Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color mixer channels if they are made by a colored track #5780

Merged
merged 5 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/FxMixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ class FxChannel : public ThreadableJob
void unmuteForSolo();


// TODO C++17 and above: use std::optional insteads
void setColor (QColor newColor)
{
m_color = newColor;
m_hasColor = true;
}

// TODO C++17 and above: use std::optional instead
QColor m_color;
bool m_hasColor;

Expand Down
11 changes: 4 additions & 7 deletions src/gui/widgets/FxLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,9 @@ void FxLine::setStrokeInnerInactive( const QColor & c )
void FxLine::changeColor()
{
auto channel = Engine::fxMixer()->effectChannel( m_channelIndex );
auto new_color = ColorChooser( this ).withPalette( ColorChooser::Palette::Mixer )->getColor( channel->m_color );
if( ! new_color.isValid() )
{ return; }
channel->m_color = new_color;
channel->m_hasColor = true;
auto new_color = ColorChooser(this).withPalette(ColorChooser::Palette::Mixer)->getColor(channel->m_color);
if(!new_color.isValid()) { return; }
channel->setColor (new_color);
update();
}

Expand All @@ -439,7 +437,6 @@ void FxLine::resetColor()
void FxLine::randomColor()
{
auto channel = Engine::fxMixer()->effectChannel( m_channelIndex );
channel->m_color = ColorChooser::getPalette( ColorChooser::Palette::Mixer )[ rand() % 48 ];
channel->m_hasColor = true;
channel->setColor (ColorChooser::getPalette(ColorChooser::Palette::Mixer)[rand() % 48]);
update();
}
4 changes: 3 additions & 1 deletion src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,10 @@ InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow()
void InstrumentTrackView::createFxLine()
{
int channelIndex = gui->fxMixerView()->addNewChannel();
auto channel = Engine::fxMixer()->effectChannel(channelIndex);

Engine::fxMixer()->effectChannel( channelIndex )->m_name = getTrack()->name();
channel->m_name = getTrack()->name();
if (getTrack()->useColor()) { channel->setColor (getTrack()->color()); }

assignFxLine(channelIndex);
}
Expand Down
4 changes: 3 additions & 1 deletion src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,10 @@ void SampleTrackWindow::modelChanged()
void SampleTrackView::createFxLine()
{
int channelIndex = gui->fxMixerView()->addNewChannel();
auto channel = Engine::fxMixer()->effectChannel(channelIndex);

Engine::fxMixer()->effectChannel(channelIndex)->m_name = getTrack()->name();
channel->m_name = getTrack()->name();
if (getTrack()->useColor()) { channel->setColor (getTrack()->color()); }

assignFxLine(channelIndex);
}
Expand Down