committed by
GitHub
parent
ddf69feebc
commit
b701e82e3b
@@ -30,7 +30,7 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#include "Track.h"
|
||||
#include "TrackContentObject.h"
|
||||
|
||||
|
||||
class AutomationTrack;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "AutomationPattern.h"
|
||||
#include "Song.h"
|
||||
#include "SongEditor.h"
|
||||
#include "Track.h"
|
||||
#include "TrackContentObjectView.h"
|
||||
|
||||
|
||||
class AutomationPatternView : public TrackContentObjectView
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#define AUTOMATION_TRACK_H
|
||||
|
||||
#include "Track.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
class AutomationTrack : public Track
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef BB_EDITOR_H
|
||||
#define BB_EDITOR_H
|
||||
|
||||
|
||||
#include "Editor.h"
|
||||
#include "TrackContainerView.h"
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QStaticText>
|
||||
|
||||
#include "TrackContentObjectView.h"
|
||||
#include "Track.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
class TrackLabelButton;
|
||||
class TrackContainer;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "Pitch.h"
|
||||
#include "Plugin.h"
|
||||
#include "Track.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,16 +34,10 @@
|
||||
|
||||
|
||||
#include "Note.h"
|
||||
#include "Track.h"
|
||||
#include "TrackContentObjectView.h"
|
||||
|
||||
|
||||
class QAction;
|
||||
class QProgressBar;
|
||||
class QPushButton;
|
||||
|
||||
class InstrumentTrack;
|
||||
class SampleBuffer;
|
||||
|
||||
|
||||
|
||||
class LMMS_EXPORT Pattern : public TrackContentObject
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "NotePlayHandle.h"
|
||||
|
||||
|
||||
class DataFile;
|
||||
class InstrumentTrack;
|
||||
class PreviewTrackContainer;
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "FxMixer.h"
|
||||
#include "FxLineLcdSpinBox.h"
|
||||
#include "Track.h"
|
||||
#include "TrackContentObjectView.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
class EffectRackView;
|
||||
class Knob;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <QtCore/QSharedMemory>
|
||||
#include <QtCore/QVector>
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
#include "TrackContainer.h"
|
||||
#include "Controller.h"
|
||||
|
||||
627
include/Track.h
627
include/Track.h
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Track.h - declaration of classes concerning tracks -> necessary for all
|
||||
* track-like objects (beat/bassline, sample-track...)
|
||||
* Track.h - declaration of Track class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
@@ -26,43 +25,22 @@
|
||||
#ifndef TRACK_H
|
||||
#define TRACK_H
|
||||
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QList>
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QColor>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "TimePos.h"
|
||||
#include "Rubberband.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "ModelView.h"
|
||||
#include "DataFile.h"
|
||||
#include "FadeButton.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
class QPushButton;
|
||||
|
||||
class PixmapButton;
|
||||
class TextFloat;
|
||||
class Track;
|
||||
class TrackContentObjectView;
|
||||
class TimePos;
|
||||
class TrackContainer;
|
||||
class TrackContainerView;
|
||||
class TrackContentWidget;
|
||||
class TrackContentObject;
|
||||
class TrackView;
|
||||
|
||||
|
||||
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
|
||||
const int TRACK_OP_WIDTH = 78;
|
||||
// This shaves 150-ish pixels off track buttons,
|
||||
// ruled from config: ui.compacttrackbuttons
|
||||
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
|
||||
const int TRACK_OP_WIDTH_COMPACT = 62;
|
||||
|
||||
/*! The minimum track height in pixels
|
||||
*
|
||||
* Tracks can be resized by shift-dragging anywhere inside the track
|
||||
@@ -71,483 +49,10 @@ const int TRACK_OP_WIDTH_COMPACT = 62;
|
||||
const int MINIMAL_TRACK_HEIGHT = 32;
|
||||
const int DEFAULT_TRACK_HEIGHT = 32;
|
||||
|
||||
const int TCO_BORDER_WIDTH = 2;
|
||||
|
||||
char const *const FILENAME_FILTER = "[\\0000-\x1f\"*/:<>?\\\\|\x7f]";
|
||||
|
||||
|
||||
class LMMS_EXPORT TrackContentObject : public Model, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
MM_OPERATORS
|
||||
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
|
||||
mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel);
|
||||
public:
|
||||
TrackContentObject( Track * track );
|
||||
virtual ~TrackContentObject();
|
||||
|
||||
inline Track * getTrack() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline const QString & name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
inline void setName( const QString & name )
|
||||
{
|
||||
m_name = name;
|
||||
emit dataChanged();
|
||||
}
|
||||
|
||||
QString displayName() const override
|
||||
{
|
||||
return name();
|
||||
}
|
||||
|
||||
|
||||
inline const TimePos & startPosition() const
|
||||
{
|
||||
return m_startPosition;
|
||||
}
|
||||
|
||||
inline TimePos endPosition() const
|
||||
{
|
||||
const int sp = m_startPosition;
|
||||
return sp + m_length;
|
||||
}
|
||||
|
||||
inline const TimePos & length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
inline void setAutoResize( const bool r )
|
||||
{
|
||||
m_autoResize = r;
|
||||
}
|
||||
|
||||
inline const bool getAutoResize() const
|
||||
{
|
||||
return m_autoResize;
|
||||
}
|
||||
|
||||
QColor color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
void setColor( const QColor & c )
|
||||
{
|
||||
m_color = c;
|
||||
}
|
||||
|
||||
bool hasColor();
|
||||
|
||||
void useCustomClipColor( bool b );
|
||||
|
||||
bool usesCustomClipColor()
|
||||
{
|
||||
return m_useCustomClipColor;
|
||||
}
|
||||
|
||||
virtual void movePosition( const TimePos & pos );
|
||||
virtual void changeLength( const TimePos & length );
|
||||
|
||||
virtual TrackContentObjectView * createView( TrackView * tv ) = 0;
|
||||
|
||||
inline void selectViewOnCreate( bool select )
|
||||
{
|
||||
m_selectViewOnCreate = select;
|
||||
}
|
||||
|
||||
inline bool getSelectViewOnCreate()
|
||||
{
|
||||
return m_selectViewOnCreate;
|
||||
}
|
||||
|
||||
/// Returns true if and only if a->startPosition() < b->startPosition()
|
||||
static bool comparePosition(const TrackContentObject* a, const TrackContentObject* b);
|
||||
|
||||
TimePos startTimeOffset() const;
|
||||
void setStartTimeOffset( const TimePos &startTimeOffset );
|
||||
|
||||
void updateColor();
|
||||
|
||||
// Will copy the state of a TCO to another TCO
|
||||
static void copyStateTo( TrackContentObject *src, TrackContentObject *dst );
|
||||
|
||||
public slots:
|
||||
void toggleMute();
|
||||
|
||||
|
||||
signals:
|
||||
void lengthChanged();
|
||||
void positionChanged();
|
||||
void destroyedTCO();
|
||||
void trackColorChanged();
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
Move,
|
||||
Resize
|
||||
} ;
|
||||
|
||||
Track * m_track;
|
||||
QString m_name;
|
||||
|
||||
TimePos m_startPosition;
|
||||
TimePos m_length;
|
||||
TimePos m_startTimeOffset;
|
||||
|
||||
BoolModel m_mutedModel;
|
||||
BoolModel m_soloModel;
|
||||
bool m_autoResize;
|
||||
|
||||
bool m_selectViewOnCreate;
|
||||
|
||||
QColor m_color;
|
||||
bool m_useCustomClipColor;
|
||||
|
||||
friend class TrackContentObjectView;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class TrackContentObjectView : public selectableObject, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor mutedColor READ mutedColor WRITE setMutedColor )
|
||||
Q_PROPERTY( QColor mutedBackgroundColor READ mutedBackgroundColor WRITE setMutedBackgroundColor )
|
||||
Q_PROPERTY( QColor selectedColor READ selectedColor WRITE setSelectedColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
Q_PROPERTY( QColor textBackgroundColor READ textBackgroundColor WRITE setTextBackgroundColor )
|
||||
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
|
||||
Q_PROPERTY( QColor BBPatternBackground READ BBPatternBackground WRITE setBBPatternBackground )
|
||||
Q_PROPERTY( bool gradient READ gradient WRITE setGradient )
|
||||
// We have to use a QSize here because using QPoint isn't supported.
|
||||
// width -> x, height -> y
|
||||
Q_PROPERTY( QSize mouseHotspotHand WRITE setMouseHotspotHand )
|
||||
|
||||
public:
|
||||
TrackContentObjectView( TrackContentObject * tco, TrackView * tv );
|
||||
virtual ~TrackContentObjectView();
|
||||
|
||||
bool fixedTCOs();
|
||||
|
||||
inline TrackContentObject * getTrackContentObject()
|
||||
{
|
||||
return m_tco;
|
||||
}
|
||||
|
||||
inline TrackView * getTrackView()
|
||||
{
|
||||
return m_trackView;
|
||||
}
|
||||
|
||||
// qproperty access func
|
||||
QColor mutedColor() const;
|
||||
QColor mutedBackgroundColor() const;
|
||||
QColor selectedColor() const;
|
||||
QColor textColor() const;
|
||||
QColor textBackgroundColor() const;
|
||||
QColor textShadowColor() const;
|
||||
QColor BBPatternBackground() const;
|
||||
bool gradient() const;
|
||||
void setMutedColor( const QColor & c );
|
||||
void setMutedBackgroundColor( const QColor & c );
|
||||
void setSelectedColor( const QColor & c );
|
||||
void setTextColor( const QColor & c );
|
||||
void setTextBackgroundColor( const QColor & c );
|
||||
void setTextShadowColor( const QColor & c );
|
||||
void setBBPatternBackground( const QColor & c );
|
||||
void setGradient( const bool & b );
|
||||
void setMouseHotspotHand(const QSize & s);
|
||||
|
||||
// access needsUpdate member variable
|
||||
bool needsUpdate();
|
||||
void setNeedsUpdate( bool b );
|
||||
|
||||
// Method to get a QVector of TCOs to be affected by a context menu action
|
||||
QVector<TrackContentObjectView *> getClickedTCOs();
|
||||
|
||||
// Methods to remove, copy, cut, paste and mute a QVector of TCO views
|
||||
void copy( QVector<TrackContentObjectView *> tcovs );
|
||||
void cut( QVector<TrackContentObjectView *> tcovs );
|
||||
void paste();
|
||||
// remove and toggleMute are static because they don't depend
|
||||
// being called from a particular TCO view, but can be called anywhere as long
|
||||
// as a valid TCO view list is given, while copy/cut require an instance for
|
||||
// some metadata to be written to the clipboard.
|
||||
static void remove( QVector<TrackContentObjectView *> tcovs );
|
||||
static void toggleMute( QVector<TrackContentObjectView *> tcovs );
|
||||
|
||||
QColor getColorForDisplay( QColor );
|
||||
|
||||
public slots:
|
||||
virtual bool close();
|
||||
void remove();
|
||||
void update() override;
|
||||
|
||||
void changeClipColor();
|
||||
void useTrackColor();
|
||||
|
||||
protected:
|
||||
enum ContextMenuAction
|
||||
{
|
||||
Remove,
|
||||
Cut,
|
||||
Copy,
|
||||
Paste,
|
||||
Mute
|
||||
};
|
||||
|
||||
virtual void constructContextMenu( QMenu * )
|
||||
{
|
||||
}
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent * cme ) override;
|
||||
void contextMenuAction( ContextMenuAction action );
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void leaveEvent( QEvent * e ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void mouseMoveEvent( QMouseEvent * me ) override;
|
||||
void mouseReleaseEvent( QMouseEvent * me ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override
|
||||
{
|
||||
m_needsUpdate = true;
|
||||
selectableObject::resizeEvent( re );
|
||||
}
|
||||
|
||||
float pixelsPerBar();
|
||||
|
||||
|
||||
DataFile createTCODataFiles(const QVector<TrackContentObjectView *> & tcos) const;
|
||||
|
||||
virtual void paintTextLabel(QString const & text, QPainter & painter);
|
||||
|
||||
|
||||
protected slots:
|
||||
void updateLength();
|
||||
void updatePosition();
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
Move,
|
||||
MoveSelection,
|
||||
Resize,
|
||||
ResizeLeft,
|
||||
CopySelection,
|
||||
ToggleSelected
|
||||
} ;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
|
||||
TrackContentObject * m_tco;
|
||||
TrackView * m_trackView;
|
||||
Actions m_action;
|
||||
QPoint m_initialMousePos;
|
||||
QPoint m_initialMouseGlobalPos;
|
||||
TimePos m_initialTCOPos;
|
||||
TimePos m_initialTCOEnd;
|
||||
QVector<TimePos> m_initialOffsets;
|
||||
|
||||
TextFloat * m_hint;
|
||||
|
||||
// qproperty fields
|
||||
QColor m_mutedColor;
|
||||
QColor m_mutedBackgroundColor;
|
||||
QColor m_selectedColor;
|
||||
QColor m_textColor;
|
||||
QColor m_textBackgroundColor;
|
||||
QColor m_textShadowColor;
|
||||
QColor m_BBPatternBackground;
|
||||
bool m_gradient;
|
||||
QSize m_mouseHotspotHand; // QSize must be used because QPoint isn't supported by property system
|
||||
bool m_cursorSetYet;
|
||||
|
||||
bool m_needsUpdate;
|
||||
inline void setInitialPos( QPoint pos )
|
||||
{
|
||||
m_initialMousePos = pos;
|
||||
m_initialMouseGlobalPos = mapToGlobal( pos );
|
||||
m_initialTCOPos = m_tco->startPosition();
|
||||
m_initialTCOEnd = m_initialTCOPos + m_tco->length();
|
||||
}
|
||||
void setInitialOffsets();
|
||||
|
||||
bool mouseMovedDistance( QMouseEvent * me, int distance );
|
||||
TimePos draggedTCOPos( QMouseEvent * me );
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class TrackContentWidget : public QWidget, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// qproperties for track background gradients
|
||||
Q_PROPERTY( QBrush darkerColor READ darkerColor WRITE setDarkerColor )
|
||||
Q_PROPERTY( QBrush lighterColor READ lighterColor WRITE setLighterColor )
|
||||
Q_PROPERTY( QBrush gridColor READ gridColor WRITE setGridColor )
|
||||
Q_PROPERTY( QBrush embossColor READ embossColor WRITE setEmbossColor )
|
||||
|
||||
public:
|
||||
TrackContentWidget( TrackView * parent );
|
||||
virtual ~TrackContentWidget();
|
||||
|
||||
/*! \brief Updates the background tile pixmap. */
|
||||
void updateBackground();
|
||||
|
||||
void addTCOView( TrackContentObjectView * tcov );
|
||||
void removeTCOView( TrackContentObjectView * tcov );
|
||||
void removeTCOView( int tcoNum )
|
||||
{
|
||||
if( tcoNum >= 0 && tcoNum < m_tcoViews.size() )
|
||||
{
|
||||
removeTCOView( m_tcoViews[tcoNum] );
|
||||
}
|
||||
}
|
||||
|
||||
bool canPasteSelection( TimePos tcoPos, const QDropEvent *de );
|
||||
bool canPasteSelection( TimePos tcoPos, const QMimeData *md, bool allowSameBar = false );
|
||||
bool pasteSelection( TimePos tcoPos, QDropEvent * de );
|
||||
bool pasteSelection( TimePos tcoPos, const QMimeData * md, bool skipSafetyCheck = false );
|
||||
|
||||
TimePos endPosition( const TimePos & posStart );
|
||||
|
||||
// qproperty access methods
|
||||
|
||||
QBrush darkerColor() const;
|
||||
QBrush lighterColor() const;
|
||||
QBrush gridColor() const;
|
||||
QBrush embossColor() const;
|
||||
|
||||
void setDarkerColor( const QBrush & c );
|
||||
void setLighterColor( const QBrush & c );
|
||||
void setGridColor( const QBrush & c );
|
||||
void setEmbossColor( const QBrush & c);
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
void changePosition( const TimePos & newPos = TimePos( -1 ) );
|
||||
|
||||
protected:
|
||||
enum ContextMenuAction
|
||||
{
|
||||
Paste
|
||||
};
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent * cme ) override;
|
||||
void contextMenuAction( QContextMenuEvent * cme, ContextMenuAction action );
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override;
|
||||
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "trackcontentwidget";
|
||||
}
|
||||
|
||||
void saveSettings( QDomDocument& doc, QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(doc)
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
void loadSettings( const QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Track * getTrack();
|
||||
TimePos getPosition( int mouseX );
|
||||
|
||||
TrackView * m_trackView;
|
||||
|
||||
typedef QVector<TrackContentObjectView *> tcoViewVector;
|
||||
tcoViewVector m_tcoViews;
|
||||
|
||||
QPixmap m_background;
|
||||
|
||||
// qproperty fields
|
||||
QBrush m_darkerColor;
|
||||
QBrush m_lighterColor;
|
||||
QBrush m_gridColor;
|
||||
QBrush m_embossColor;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class TrackOperationsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackOperationsWidget( TrackView * parent );
|
||||
~TrackOperationsWidget();
|
||||
|
||||
|
||||
protected:
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
|
||||
|
||||
private slots:
|
||||
void cloneTrack();
|
||||
void removeTrack();
|
||||
void updateMenu();
|
||||
void changeTrackColor();
|
||||
void randomTrackColor();
|
||||
void resetTrackColor();
|
||||
void useTrackColor();
|
||||
void toggleRecording(bool on);
|
||||
void recordingOn();
|
||||
void recordingOff();
|
||||
void clearTrack();
|
||||
|
||||
private:
|
||||
TrackView * m_trackView;
|
||||
|
||||
QPushButton * m_trackOps;
|
||||
PixmapButton * m_muteBtn;
|
||||
PixmapButton * m_soloBtn;
|
||||
|
||||
|
||||
friend class TrackView;
|
||||
|
||||
signals:
|
||||
void trackRemovalScheduled( TrackView * t );
|
||||
void colorChanged( QColor & c );
|
||||
void colorParented();
|
||||
void colorReset();
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// base-class for all tracks
|
||||
//! Base-class for all tracks
|
||||
class LMMS_EXPORT Track : public Model, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -729,122 +234,4 @@ signals:
|
||||
|
||||
|
||||
|
||||
|
||||
class TrackView : public QWidget, public ModelView, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackView( Track * _track, TrackContainerView* tcv );
|
||||
virtual ~TrackView();
|
||||
|
||||
inline const Track * getTrack() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline Track * getTrack()
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline TrackContainerView* trackContainerView()
|
||||
{
|
||||
return m_trackContainerView;
|
||||
}
|
||||
|
||||
inline TrackOperationsWidget * getTrackOperationsWidget()
|
||||
{
|
||||
return &m_trackOperationsWidget;
|
||||
}
|
||||
|
||||
inline QWidget * getTrackSettingsWidget()
|
||||
{
|
||||
return &m_trackSettingsWidget;
|
||||
}
|
||||
|
||||
inline TrackContentWidget * getTrackContentWidget()
|
||||
{
|
||||
return &m_trackContentWidget;
|
||||
}
|
||||
|
||||
bool isMovingTrack() const
|
||||
{
|
||||
return m_action == MoveTrack;
|
||||
}
|
||||
|
||||
virtual void update();
|
||||
|
||||
// Create a menu for assigning/creating channels for this track
|
||||
// Currently instrument track and sample track supports it
|
||||
virtual QMenu * createFxMenu(QString title, QString newFxLabel);
|
||||
|
||||
|
||||
public slots:
|
||||
virtual bool close();
|
||||
|
||||
|
||||
protected:
|
||||
void modelChanged() override;
|
||||
|
||||
void saveSettings( QDomDocument& doc, QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(doc)
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
void loadSettings( const QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "trackview";
|
||||
}
|
||||
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void mouseMoveEvent( QMouseEvent * me ) override;
|
||||
void mouseReleaseEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override;
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
MoveTrack,
|
||||
ResizeTrack
|
||||
} ;
|
||||
|
||||
Track * m_track;
|
||||
TrackContainerView * m_trackContainerView;
|
||||
|
||||
TrackOperationsWidget m_trackOperationsWidget;
|
||||
QWidget m_trackSettingsWidget;
|
||||
TrackContentWidget m_trackContentWidget;
|
||||
|
||||
Actions m_action;
|
||||
|
||||
virtual FadeButton * getActivityIndicator()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void setIndicatorMute(FadeButton* indicator, bool muted);
|
||||
|
||||
friend class TrackLabelButton;
|
||||
|
||||
|
||||
private slots:
|
||||
void createTCOView( TrackContentObject * tco );
|
||||
void muteChanged();
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,12 +31,15 @@
|
||||
#include <QWidget>
|
||||
#include <QThread>
|
||||
|
||||
#include "Track.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "ModelView.h"
|
||||
#include "Rubberband.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
class QVBoxLayout;
|
||||
|
||||
class InstrumentTrack;
|
||||
class TrackContainer;
|
||||
|
||||
|
||||
|
||||
183
include/TrackContentObject.h
Normal file
183
include/TrackContentObject.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* TrackConteintObject.h - declaration of TrackContentObject class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRACK_CONTENT_OBJECT_H
|
||||
#define TRACK_CONTENT_OBJECT_H
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
|
||||
class Track;
|
||||
class TrackContentObjectView;
|
||||
class TrackContainer;
|
||||
class TrackView;
|
||||
|
||||
|
||||
class LMMS_EXPORT TrackContentObject : public Model, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
MM_OPERATORS
|
||||
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
|
||||
mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel);
|
||||
public:
|
||||
TrackContentObject( Track * track );
|
||||
virtual ~TrackContentObject();
|
||||
|
||||
inline Track * getTrack() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline const QString & name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
inline void setName( const QString & name )
|
||||
{
|
||||
m_name = name;
|
||||
emit dataChanged();
|
||||
}
|
||||
|
||||
QString displayName() const override
|
||||
{
|
||||
return name();
|
||||
}
|
||||
|
||||
|
||||
inline const TimePos & startPosition() const
|
||||
{
|
||||
return m_startPosition;
|
||||
}
|
||||
|
||||
inline TimePos endPosition() const
|
||||
{
|
||||
const int sp = m_startPosition;
|
||||
return sp + m_length;
|
||||
}
|
||||
|
||||
inline const TimePos & length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
inline void setAutoResize( const bool r )
|
||||
{
|
||||
m_autoResize = r;
|
||||
}
|
||||
|
||||
inline const bool getAutoResize() const
|
||||
{
|
||||
return m_autoResize;
|
||||
}
|
||||
|
||||
QColor color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
void setColor( const QColor & c )
|
||||
{
|
||||
m_color = c;
|
||||
}
|
||||
|
||||
bool hasColor();
|
||||
|
||||
void useCustomClipColor( bool b );
|
||||
|
||||
bool usesCustomClipColor()
|
||||
{
|
||||
return m_useCustomClipColor;
|
||||
}
|
||||
|
||||
virtual void movePosition( const TimePos & pos );
|
||||
virtual void changeLength( const TimePos & length );
|
||||
|
||||
virtual TrackContentObjectView * createView( TrackView * tv ) = 0;
|
||||
|
||||
inline void selectViewOnCreate( bool select )
|
||||
{
|
||||
m_selectViewOnCreate = select;
|
||||
}
|
||||
|
||||
inline bool getSelectViewOnCreate()
|
||||
{
|
||||
return m_selectViewOnCreate;
|
||||
}
|
||||
|
||||
/// Returns true if and only if a->startPosition() < b->startPosition()
|
||||
static bool comparePosition(const TrackContentObject* a, const TrackContentObject* b);
|
||||
|
||||
TimePos startTimeOffset() const;
|
||||
void setStartTimeOffset( const TimePos &startTimeOffset );
|
||||
|
||||
void updateColor();
|
||||
|
||||
// Will copy the state of a TCO to another TCO
|
||||
static void copyStateTo( TrackContentObject *src, TrackContentObject *dst );
|
||||
|
||||
public slots:
|
||||
void toggleMute();
|
||||
|
||||
|
||||
signals:
|
||||
void lengthChanged();
|
||||
void positionChanged();
|
||||
void destroyedTCO();
|
||||
void trackColorChanged();
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
Move,
|
||||
Resize
|
||||
} ;
|
||||
|
||||
Track * m_track;
|
||||
QString m_name;
|
||||
|
||||
TimePos m_startPosition;
|
||||
TimePos m_length;
|
||||
TimePos m_startTimeOffset;
|
||||
|
||||
BoolModel m_mutedModel;
|
||||
BoolModel m_soloModel;
|
||||
bool m_autoResize;
|
||||
|
||||
bool m_selectViewOnCreate;
|
||||
|
||||
QColor m_color;
|
||||
bool m_useCustomClipColor;
|
||||
|
||||
friend class TrackContentObjectView;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
218
include/TrackContentObjectView.h
Normal file
218
include/TrackContentObjectView.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* TrackContentObjectView.h - declaration of TrackContentObjectView class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRACK_CONTENT_OBJECT_VIEW_H
|
||||
#define TRACK_CONTENT_OBJECT_VIEW_H
|
||||
|
||||
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include "ModelView.h"
|
||||
#include "Rubberband.h"
|
||||
#include "TrackContentObject.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
class QContextMenuEvent;
|
||||
|
||||
class DataFile;
|
||||
class TextFloat;
|
||||
class TrackContentObject;
|
||||
class TrackView;
|
||||
|
||||
|
||||
class TrackContentObjectView : public selectableObject, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor mutedColor READ mutedColor WRITE setMutedColor )
|
||||
Q_PROPERTY( QColor mutedBackgroundColor READ mutedBackgroundColor WRITE setMutedBackgroundColor )
|
||||
Q_PROPERTY( QColor selectedColor READ selectedColor WRITE setSelectedColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
Q_PROPERTY( QColor textBackgroundColor READ textBackgroundColor WRITE setTextBackgroundColor )
|
||||
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
|
||||
Q_PROPERTY( QColor BBPatternBackground READ BBPatternBackground WRITE setBBPatternBackground )
|
||||
Q_PROPERTY( bool gradient READ gradient WRITE setGradient )
|
||||
// We have to use a QSize here because using QPoint isn't supported.
|
||||
// width -> x, height -> y
|
||||
Q_PROPERTY( QSize mouseHotspotHand WRITE setMouseHotspotHand )
|
||||
|
||||
public:
|
||||
TrackContentObjectView( TrackContentObject * tco, TrackView * tv );
|
||||
virtual ~TrackContentObjectView();
|
||||
|
||||
bool fixedTCOs();
|
||||
|
||||
inline TrackContentObject * getTrackContentObject()
|
||||
{
|
||||
return m_tco;
|
||||
}
|
||||
|
||||
inline TrackView * getTrackView()
|
||||
{
|
||||
return m_trackView;
|
||||
}
|
||||
|
||||
// qproperty access func
|
||||
QColor mutedColor() const;
|
||||
QColor mutedBackgroundColor() const;
|
||||
QColor selectedColor() const;
|
||||
QColor textColor() const;
|
||||
QColor textBackgroundColor() const;
|
||||
QColor textShadowColor() const;
|
||||
QColor BBPatternBackground() const;
|
||||
bool gradient() const;
|
||||
void setMutedColor( const QColor & c );
|
||||
void setMutedBackgroundColor( const QColor & c );
|
||||
void setSelectedColor( const QColor & c );
|
||||
void setTextColor( const QColor & c );
|
||||
void setTextBackgroundColor( const QColor & c );
|
||||
void setTextShadowColor( const QColor & c );
|
||||
void setBBPatternBackground( const QColor & c );
|
||||
void setGradient( const bool & b );
|
||||
void setMouseHotspotHand(const QSize & s);
|
||||
|
||||
// access needsUpdate member variable
|
||||
bool needsUpdate();
|
||||
void setNeedsUpdate( bool b );
|
||||
|
||||
// Method to get a QVector of TCOs to be affected by a context menu action
|
||||
QVector<TrackContentObjectView *> getClickedTCOs();
|
||||
|
||||
// Methods to remove, copy, cut, paste and mute a QVector of TCO views
|
||||
void copy( QVector<TrackContentObjectView *> tcovs );
|
||||
void cut( QVector<TrackContentObjectView *> tcovs );
|
||||
void paste();
|
||||
// remove and toggleMute are static because they don't depend
|
||||
// being called from a particular TCO view, but can be called anywhere as long
|
||||
// as a valid TCO view list is given, while copy/cut require an instance for
|
||||
// some metadata to be written to the clipboard.
|
||||
static void remove( QVector<TrackContentObjectView *> tcovs );
|
||||
static void toggleMute( QVector<TrackContentObjectView *> tcovs );
|
||||
|
||||
QColor getColorForDisplay( QColor );
|
||||
|
||||
public slots:
|
||||
virtual bool close();
|
||||
void remove();
|
||||
void update() override;
|
||||
|
||||
void changeClipColor();
|
||||
void useTrackColor();
|
||||
|
||||
protected:
|
||||
enum ContextMenuAction
|
||||
{
|
||||
Remove,
|
||||
Cut,
|
||||
Copy,
|
||||
Paste,
|
||||
Mute
|
||||
};
|
||||
|
||||
virtual void constructContextMenu( QMenu * )
|
||||
{
|
||||
}
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent * cme ) override;
|
||||
void contextMenuAction( ContextMenuAction action );
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void leaveEvent( QEvent * e ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void mouseMoveEvent( QMouseEvent * me ) override;
|
||||
void mouseReleaseEvent( QMouseEvent * me ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override
|
||||
{
|
||||
m_needsUpdate = true;
|
||||
selectableObject::resizeEvent( re );
|
||||
}
|
||||
|
||||
float pixelsPerBar();
|
||||
|
||||
|
||||
DataFile createTCODataFiles(const QVector<TrackContentObjectView *> & tcos) const;
|
||||
|
||||
virtual void paintTextLabel(QString const & text, QPainter & painter);
|
||||
|
||||
|
||||
protected slots:
|
||||
void updateLength();
|
||||
void updatePosition();
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
Move,
|
||||
MoveSelection,
|
||||
Resize,
|
||||
ResizeLeft,
|
||||
CopySelection,
|
||||
ToggleSelected
|
||||
} ;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
|
||||
TrackContentObject * m_tco;
|
||||
TrackView * m_trackView;
|
||||
Actions m_action;
|
||||
QPoint m_initialMousePos;
|
||||
QPoint m_initialMouseGlobalPos;
|
||||
TimePos m_initialTCOPos;
|
||||
TimePos m_initialTCOEnd;
|
||||
QVector<TimePos> m_initialOffsets;
|
||||
|
||||
TextFloat * m_hint;
|
||||
|
||||
// qproperty fields
|
||||
QColor m_mutedColor;
|
||||
QColor m_mutedBackgroundColor;
|
||||
QColor m_selectedColor;
|
||||
QColor m_textColor;
|
||||
QColor m_textBackgroundColor;
|
||||
QColor m_textShadowColor;
|
||||
QColor m_BBPatternBackground;
|
||||
bool m_gradient;
|
||||
QSize m_mouseHotspotHand; // QSize must be used because QPoint isn't supported by property system
|
||||
bool m_cursorSetYet;
|
||||
|
||||
bool m_needsUpdate;
|
||||
inline void setInitialPos( QPoint pos )
|
||||
{
|
||||
m_initialMousePos = pos;
|
||||
m_initialMouseGlobalPos = mapToGlobal( pos );
|
||||
m_initialTCOPos = m_tco->startPosition();
|
||||
m_initialTCOEnd = m_initialTCOPos + m_tco->length();
|
||||
}
|
||||
void setInitialOffsets();
|
||||
|
||||
bool mouseMovedDistance( QMouseEvent * me, int distance );
|
||||
TimePos draggedTCOPos( QMouseEvent * me );
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
142
include/TrackContentWidget.h
Normal file
142
include/TrackContentWidget.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* TrackContentWidget.h - declaration of TrackContentWidget class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRACK_CONTENT_WIDGET_H
|
||||
#define TRACK_CONTENT_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "JournallingObject.h"
|
||||
#include "TimePos.h"
|
||||
|
||||
|
||||
class QMimeData;
|
||||
|
||||
class Track;
|
||||
class TrackContentObjectView;
|
||||
class TrackView;
|
||||
|
||||
|
||||
class TrackContentWidget : public QWidget, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// qproperties for track background gradients
|
||||
Q_PROPERTY( QBrush darkerColor READ darkerColor WRITE setDarkerColor )
|
||||
Q_PROPERTY( QBrush lighterColor READ lighterColor WRITE setLighterColor )
|
||||
Q_PROPERTY( QBrush gridColor READ gridColor WRITE setGridColor )
|
||||
Q_PROPERTY( QBrush embossColor READ embossColor WRITE setEmbossColor )
|
||||
|
||||
public:
|
||||
TrackContentWidget( TrackView * parent );
|
||||
virtual ~TrackContentWidget();
|
||||
|
||||
/*! \brief Updates the background tile pixmap. */
|
||||
void updateBackground();
|
||||
|
||||
void addTCOView( TrackContentObjectView * tcov );
|
||||
void removeTCOView( TrackContentObjectView * tcov );
|
||||
void removeTCOView( int tcoNum )
|
||||
{
|
||||
if( tcoNum >= 0 && tcoNum < m_tcoViews.size() )
|
||||
{
|
||||
removeTCOView( m_tcoViews[tcoNum] );
|
||||
}
|
||||
}
|
||||
|
||||
bool canPasteSelection( TimePos tcoPos, const QDropEvent *de );
|
||||
bool canPasteSelection( TimePos tcoPos, const QMimeData *md, bool allowSameBar = false );
|
||||
bool pasteSelection( TimePos tcoPos, QDropEvent * de );
|
||||
bool pasteSelection( TimePos tcoPos, const QMimeData * md, bool skipSafetyCheck = false );
|
||||
|
||||
TimePos endPosition( const TimePos & posStart );
|
||||
|
||||
// qproperty access methods
|
||||
|
||||
QBrush darkerColor() const;
|
||||
QBrush lighterColor() const;
|
||||
QBrush gridColor() const;
|
||||
QBrush embossColor() const;
|
||||
|
||||
void setDarkerColor( const QBrush & c );
|
||||
void setLighterColor( const QBrush & c );
|
||||
void setGridColor( const QBrush & c );
|
||||
void setEmbossColor( const QBrush & c);
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
void changePosition( const TimePos & newPos = TimePos( -1 ) );
|
||||
|
||||
protected:
|
||||
enum ContextMenuAction
|
||||
{
|
||||
Paste
|
||||
};
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent * cme ) override;
|
||||
void contextMenuAction( QContextMenuEvent * cme, ContextMenuAction action );
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override;
|
||||
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "trackcontentwidget";
|
||||
}
|
||||
|
||||
void saveSettings( QDomDocument& doc, QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(doc)
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
void loadSettings( const QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Track * getTrack();
|
||||
TimePos getPosition( int mouseX );
|
||||
|
||||
TrackView * m_trackView;
|
||||
|
||||
typedef QVector<TrackContentObjectView *> tcoViewVector;
|
||||
tcoViewVector m_tcoViews;
|
||||
|
||||
QPixmap m_background;
|
||||
|
||||
// qproperty fields
|
||||
QBrush m_darkerColor;
|
||||
QBrush m_lighterColor;
|
||||
QBrush m_gridColor;
|
||||
QBrush m_embossColor;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
79
include/TrackOperationsWidget.h
Normal file
79
include/TrackOperationsWidget.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* TrackOperationsWidget.h - declaration of TrackOperationsWidget class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRACK_OPERATIONS_WIDGET_H
|
||||
#define TRACK_OPERATIONS_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class PixmapButton;
|
||||
class TrackView;
|
||||
|
||||
class TrackOperationsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackOperationsWidget( TrackView * parent );
|
||||
~TrackOperationsWidget();
|
||||
|
||||
|
||||
protected:
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
|
||||
|
||||
private slots:
|
||||
void cloneTrack();
|
||||
void removeTrack();
|
||||
void updateMenu();
|
||||
void changeTrackColor();
|
||||
void randomTrackColor();
|
||||
void resetTrackColor();
|
||||
void useTrackColor();
|
||||
void toggleRecording(bool on);
|
||||
void recordingOn();
|
||||
void recordingOff();
|
||||
void clearTrack();
|
||||
|
||||
private:
|
||||
TrackView * m_trackView;
|
||||
|
||||
QPushButton * m_trackOps;
|
||||
PixmapButton * m_muteBtn;
|
||||
PixmapButton * m_soloBtn;
|
||||
|
||||
|
||||
friend class TrackView;
|
||||
|
||||
signals:
|
||||
void trackRemovalScheduled( TrackView * t );
|
||||
void colorChanged( QColor & c );
|
||||
void colorParented();
|
||||
void colorReset();
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
173
include/TrackView.h
Normal file
173
include/TrackView.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* TrackView.h - declaration of TrackView class
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef TRACK_VIEW_H
|
||||
#define TRACK_VIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "JournallingObject.h"
|
||||
#include "ModelView.h"
|
||||
#include "TrackContentWidget.h"
|
||||
#include "TrackOperationsWidget.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
|
||||
class FadeButton;
|
||||
class Track;
|
||||
class TrackContainerView;
|
||||
class TrackContentObject;
|
||||
|
||||
|
||||
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
|
||||
const int TRACK_OP_WIDTH = 78;
|
||||
// This shaves 150-ish pixels off track buttons,
|
||||
// ruled from config: ui.compacttrackbuttons
|
||||
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
|
||||
const int TRACK_OP_WIDTH_COMPACT = 62;
|
||||
|
||||
const int TCO_BORDER_WIDTH = 2;
|
||||
|
||||
|
||||
class TrackView : public QWidget, public ModelView, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackView( Track * _track, TrackContainerView* tcv );
|
||||
virtual ~TrackView();
|
||||
|
||||
inline const Track * getTrack() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline Track * getTrack()
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
inline TrackContainerView* trackContainerView()
|
||||
{
|
||||
return m_trackContainerView;
|
||||
}
|
||||
|
||||
inline TrackOperationsWidget * getTrackOperationsWidget()
|
||||
{
|
||||
return &m_trackOperationsWidget;
|
||||
}
|
||||
|
||||
inline QWidget * getTrackSettingsWidget()
|
||||
{
|
||||
return &m_trackSettingsWidget;
|
||||
}
|
||||
|
||||
inline TrackContentWidget * getTrackContentWidget()
|
||||
{
|
||||
return &m_trackContentWidget;
|
||||
}
|
||||
|
||||
bool isMovingTrack() const
|
||||
{
|
||||
return m_action == MoveTrack;
|
||||
}
|
||||
|
||||
virtual void update();
|
||||
|
||||
// Create a menu for assigning/creating channels for this track
|
||||
// Currently instrument track and sample track supports it
|
||||
virtual QMenu * createFxMenu(QString title, QString newFxLabel);
|
||||
|
||||
|
||||
public slots:
|
||||
virtual bool close();
|
||||
|
||||
|
||||
protected:
|
||||
void modelChanged() override;
|
||||
|
||||
void saveSettings( QDomDocument& doc, QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(doc)
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
void loadSettings( const QDomElement& element ) override
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "trackview";
|
||||
}
|
||||
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
||||
void dropEvent( QDropEvent * de ) override;
|
||||
void mousePressEvent( QMouseEvent * me ) override;
|
||||
void mouseMoveEvent( QMouseEvent * me ) override;
|
||||
void mouseReleaseEvent( QMouseEvent * me ) override;
|
||||
void paintEvent( QPaintEvent * pe ) override;
|
||||
void resizeEvent( QResizeEvent * re ) override;
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
NoAction,
|
||||
MoveTrack,
|
||||
ResizeTrack
|
||||
} ;
|
||||
|
||||
Track * m_track;
|
||||
TrackContainerView * m_trackContainerView;
|
||||
|
||||
TrackOperationsWidget m_trackOperationsWidget;
|
||||
QWidget m_trackSettingsWidget;
|
||||
TrackContentWidget m_trackContentWidget;
|
||||
|
||||
Actions m_action;
|
||||
|
||||
virtual FadeButton * getActivityIndicator()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void setIndicatorMute(FadeButton* indicator, bool muted);
|
||||
|
||||
friend class TrackLabelButton;
|
||||
|
||||
|
||||
private slots:
|
||||
void createTCOView( TrackContentObject * tco );
|
||||
void muteChanged();
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user