Enable track-wide color coding (#5573)
* Enable track-wide color coding * Add support for automation tracks * Allow saving & loading track colors * Allow track color to be reset to default * Partially migrate common settings to Track.cpp, fix bug * Completely migrate local TCO color functions to TCO class, fix bug * Set QColorDialog colors to better colors * Color the side of the track according to TCO colors * Disable color gradient when muted * Change selection color to depend on TCO color * Fix breaking builds * Bug fix * Fix another bug where BB track colors wouldn't load * Restore changed demo to original state * Fix BB Editor bug * Fix breaking builds * Allow random color picking * Fix copy-paste bug * Change how color is painted on a track * Cleanup, and implement per-pattern colors * Cleanup comments * Migrate some functions * Remove redundant function * Rename some functions * Migrate duplicates to superclass * Use ColorChooser and reorder some includes * Change how colors are saved * Fix some formatting * Fix some code * Change how clip colors work * Fix some unexpected behaviors * Fix note border coloring being green on colored tracks * Change name of an option * Remove redundant code * Fix ghost changes * Remove colorRgb * Rename backgroundColor, remove some variables we don't use * Remove a redundant variable * Migrate some duplicates to superclass * Check for nullpointer * Remove redundant variable * Update some logic * Change how muted colors are displayed * Change how dark muted tracks become * Place setModified() in appropriate places * Make getColorForDisplay() function * Change how colors are organised and saved * Remove m_useStyleColor * Remove a comment * Quick changes * Change how colors are saved * Remove redundant stuff * Remove redundant stuff pt. 2 * Change how colors are copied * Fixes pt. 3 * Fixes pt. 4 * Change spaces to tabs * Fix pseudochanges * Remove s_lastTCOColor * Fix pseudochanges pt. 2 * Fix breaking builds * Add files via upload * Add comments (again)
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
|
||||
#include <QStaticText>
|
||||
|
||||
#include "AutomationPattern.h"
|
||||
#include "Song.h"
|
||||
#include "SongEditor.h"
|
||||
#include "Track.h"
|
||||
|
||||
class AutomationPattern;
|
||||
|
||||
|
||||
class AutomationPatternView : public TrackContentObjectView
|
||||
{
|
||||
|
||||
@@ -50,33 +50,11 @@ public:
|
||||
return( "bbtco" );
|
||||
}
|
||||
|
||||
unsigned int color() const
|
||||
{
|
||||
return( m_color.rgb() );
|
||||
}
|
||||
|
||||
QColor colorObj() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
void setColor( const QColor & c )
|
||||
{
|
||||
m_color = QColor( c );
|
||||
}
|
||||
|
||||
void setUseStyleColor( bool b )
|
||||
{
|
||||
m_useStyleColor = b;
|
||||
}
|
||||
|
||||
int bbTrackIndex();
|
||||
|
||||
TrackContentObjectView * createView( TrackView * _tv ) override;
|
||||
|
||||
private:
|
||||
QColor m_color;
|
||||
bool m_useStyleColor;
|
||||
|
||||
|
||||
friend class BBTCOView;
|
||||
@@ -92,11 +70,6 @@ public:
|
||||
BBTCOView( TrackContentObject * _tco, TrackView * _tv );
|
||||
virtual ~BBTCOView() = default;
|
||||
|
||||
QColor color() const
|
||||
{
|
||||
return( m_bbTCO->m_color );
|
||||
}
|
||||
void setColor( QColor _new_color );
|
||||
|
||||
public slots:
|
||||
void update() override;
|
||||
@@ -105,8 +78,6 @@ protected slots:
|
||||
void openInBBEditor();
|
||||
void resetName();
|
||||
void changeName();
|
||||
void changeColor();
|
||||
void resetColor();
|
||||
|
||||
|
||||
protected:
|
||||
@@ -162,27 +133,6 @@ public:
|
||||
m_disabledTracks.removeAll( _track );
|
||||
}
|
||||
|
||||
static void setLastTCOColor( const QColor & c )
|
||||
{
|
||||
if( ! s_lastTCOColor )
|
||||
{
|
||||
s_lastTCOColor = new QColor( c );
|
||||
}
|
||||
else
|
||||
{
|
||||
*s_lastTCOColor = QColor( c );
|
||||
}
|
||||
}
|
||||
|
||||
static void clearLastTCOColor()
|
||||
{
|
||||
if( s_lastTCOColor )
|
||||
{
|
||||
delete s_lastTCOColor;
|
||||
}
|
||||
s_lastTCOColor = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline QString nodeName() const override
|
||||
{
|
||||
@@ -196,8 +146,6 @@ private:
|
||||
typedef QMap<BBTrack *, int> infoMap;
|
||||
static infoMap s_infoMap;
|
||||
|
||||
static QColor * s_lastTCOColor;
|
||||
|
||||
friend class BBTrackView;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -133,6 +133,25 @@ public:
|
||||
{
|
||||
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 MidiTime & pos );
|
||||
virtual void changeLength( const MidiTime & length );
|
||||
@@ -154,6 +173,8 @@ public:
|
||||
|
||||
MidiTime startTimeOffset() const;
|
||||
void setStartTimeOffset( const MidiTime &startTimeOffset );
|
||||
|
||||
void updateColor();
|
||||
|
||||
// Will copy the state of a TCO to another TCO
|
||||
static void copyStateTo( TrackContentObject *src, TrackContentObject *dst );
|
||||
@@ -166,6 +187,7 @@ signals:
|
||||
void lengthChanged();
|
||||
void positionChanged();
|
||||
void destroyedTCO();
|
||||
void trackColorChanged();
|
||||
|
||||
|
||||
private:
|
||||
@@ -189,6 +211,9 @@ private:
|
||||
|
||||
bool m_selectViewOnCreate;
|
||||
|
||||
QColor m_color;
|
||||
bool m_useCustomClipColor;
|
||||
|
||||
friend class TrackContentObjectView;
|
||||
|
||||
} ;
|
||||
@@ -264,11 +289,16 @@ public:
|
||||
// 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
|
||||
@@ -486,6 +516,10 @@ private slots:
|
||||
void cloneTrack();
|
||||
void removeTrack();
|
||||
void updateMenu();
|
||||
void changeTrackColor();
|
||||
void randomTrackColor();
|
||||
void resetTrackColor();
|
||||
void useTrackColor();
|
||||
void toggleRecording(bool on);
|
||||
void recordingOn();
|
||||
void recordingOff();
|
||||
@@ -503,6 +537,9 @@ private:
|
||||
|
||||
signals:
|
||||
void trackRemovalScheduled( TrackView * t );
|
||||
void colorChanged( QColor & c );
|
||||
void colorParented();
|
||||
void colorReset();
|
||||
|
||||
} ;
|
||||
|
||||
@@ -635,7 +672,16 @@ public:
|
||||
{
|
||||
return m_processingLock.tryLock();
|
||||
}
|
||||
|
||||
|
||||
QColor color()
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
bool useColor()
|
||||
{
|
||||
return m_hasColor;
|
||||
}
|
||||
|
||||
BoolModel* getMutedModel();
|
||||
|
||||
public slots:
|
||||
@@ -647,6 +693,8 @@ public slots:
|
||||
|
||||
void toggleSolo();
|
||||
|
||||
void trackColorChanged( QColor & c );
|
||||
void trackColorReset();
|
||||
|
||||
private:
|
||||
TrackContainer* m_trackContainer;
|
||||
@@ -665,6 +713,9 @@ private:
|
||||
tcoVector m_trackContentObjects;
|
||||
|
||||
QMutex m_processingLock;
|
||||
|
||||
QColor m_color;
|
||||
bool m_hasColor;
|
||||
|
||||
friend class TrackView;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user