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

Color mixer channels if they are made by a coloured track using the “Assign to new FX channel option.”
This commit is contained in:
Kumar
2020-11-16 23:02:57 +05:30
committed by GitHub
parent 060d0dc5dc
commit a42d2d2d70
4 changed files with 17 additions and 10 deletions

View File

@@ -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;

View File

@@ -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();
}
@@ -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();
}

View File

@@ -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);
}

View File

@@ -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);
}