From fdbc8b2712d85cb7cafaf0298531557135cf9968 Mon Sep 17 00:00:00 2001 From: IanCaio Date: Tue, 30 Jun 2020 16:02:02 -0300 Subject: [PATCH] Adds the new solo behavior as a new LED button To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior. Changes to the code: - Added a purple LED image that will be used on the new button. - Increased the default width of the widget that holds the mute and solo buttons so the third one fits. - Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them. - Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method. - The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method. --- data/themes/classic/led_purple.png | Bin 0 -> 390 bytes data/themes/default/led_purple.png | Bin 0 -> 390 bytes include/Track.h | 5 +++- src/core/Track.cpp | 45 +++++++++++++++++++++++++---- 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 data/themes/classic/led_purple.png create mode 100644 data/themes/default/led_purple.png diff --git a/data/themes/classic/led_purple.png b/data/themes/classic/led_purple.png new file mode 100644 index 0000000000000000000000000000000000000000..7e6643527d0bc02dc9aea586dcd4e55ded913e31 GIT binary patch literal 390 zcmV;10eSw3P)Y0TW3? zK~yNu#gn~G!$1&(zx7#{v)oupI#NWUfELQ|6wvc@>GKv)k~U353YU&#DOf(AeLf0s zlp=@-kQiyTTh0E=tb`Ew4I+Mtcqp!?4-p`r!BHL%j&fM%%N{_kF75@0vUH}cE0b6m z9YTL{GLfk7ymdxrby;oQI$!!2kSv|)rrl3O)YSLw1Q?xIuP69ML={cD&$Dz^0CfzA zb)^we)0@l3=X3U6Z5DIu%C`eStc>=3I|jJD8#782CQ&5m$BF8y!`7ar_Pjjp0LHO0 z`p;AdowrUz?SP@fci45_x&wjHnQhvAzS=D2z}H8F1}K2s=*%7n%4+MfbXHhbRY0TW3? zK~yNu#gn~G!$1&(zx7#{v)oupI#NWUfELQ|6wvc@>GKv)k~U353YU&#DOf(AeLf0s zlp=@-kQiyTTh0E=tb`Ew4I+Mtcqp!?4-p`r!BHL%j&fM%%N{_kF75@0vUH}cE0b6m z9YTL{GLfk7ymdxrby;oQI$!!2kSv|)rrl3O)YSLw1Q?xIuP69ML={cD&$Dz^0CfzA zb)^we)0@l3=X3U6Z5DIu%C`eStc>=3I|jJD8#782CQ&5m$BF8y!`7ar_Pjjp0LHO0 z`p;AdowrUz?SP@fci45_x&wjHnQhvAzS=D2z}H8F1}K2s=*%7n%4+MfbXHhbRsetInactiveGraphic( embed::getIconPixmap( "led_off" ) ); m_soloBtn->setCheckable( true ); + m_soloAutomationsBtn = new PixmapButton( this, tr( "Solo with Automations" ) ); + m_soloAutomationsBtn->setActiveGraphic( embed::getIconPixmap( "led_purple" ) ); + m_soloAutomationsBtn->setInactiveGraphic( embed::getIconPixmap( "led_off" ) ); + m_soloAutomationsBtn->setCheckable( true ); + if( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() ) { m_muteBtn->move( 46, 0 ); - m_soloBtn->move( 46, 16 ); + m_soloBtn->move( 46, 9 ); + m_soloAutomationsBtn->move( 46, 18 ); } else { m_muteBtn->move( 46, 8 ); m_soloBtn->move( 62, 8 ); + m_soloAutomationsBtn->move( 78, 8 ); } m_muteBtn->show(); @@ -1889,6 +1896,14 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) : m_soloBtn->show(); ToolTip::add( m_soloBtn, tr( "Solo" ) ); + m_soloAutomationsBtn->show(); + ToolTip::add( m_soloAutomationsBtn, tr( "Solo with Automations" ) ); + // The purple LED will simply enable the regular solo (red LED). But since it will also + // change m_soloAutomationsModel to true, the behavior of the solo will be different + // keeping the automation tracks on their current state (either muted or unmuted). + connect( m_soloAutomationsBtn, SIGNAL( clicked() ), + m_soloBtn, SLOT( toggle() ) ); + connect( this, SIGNAL( trackRemovalScheduled( TrackView * ) ), m_trackView->trackContainerView(), SLOT( deleteTrackView( TrackView * ) ), @@ -2643,6 +2658,13 @@ void Track::toggleSolo() } const bool solo = m_soloModel.value(); + + // Turn off the soloAutomationsBtn LED if we are disabling the solo + if( !solo ) + { + m_soloAutomationsModel.setValue( false ); + } + for( TrackContainer::TrackList::const_iterator it = tl.begin(); it != tl.end(); ++it ) { @@ -2653,20 +2675,29 @@ void Track::toggleSolo() { ( *it )->m_mutedBeforeSolo = ( *it )->isMuted(); } - // Don't mute AutomationTracks (keep their original state) if( *it == this ){ ( *it )->setMuted( false ); - } else if( ( *it )->type() != AutomationTrack ){ - ( *it )->setMuted( true ); + } else { + // Only mutes the automation tracks if the soloAutomationsBtn LED is not + // toggled + if( ( *it )->type() == AutomationTrack ){ + if( !m_soloAutomationsModel.value() ) + { + ( *it )->setMuted( true ); + } + } else { + ( *it )->setMuted( true ); + } } if( *it != this ) { ( *it )->m_soloModel.setValue( false ); + // If the soloAutomationsBtn LED is activated on another track we disable it as well + ( *it )->m_soloAutomationsModel.setValue( false ); } } - else if( !soloBefore && (* it )->type() != AutomationTrack ) + else if( !soloBefore ) { - // Only restores the mute state if the track isn't an Automation Track ( *it )->setMuted( ( *it )->m_mutedBeforeSolo ); } } @@ -2675,6 +2706,7 @@ void Track::toggleSolo() + BoolModel *Track::getMutedModel() { return &m_mutedModel; @@ -2841,6 +2873,7 @@ void TrackView::modelChanged() connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) ); m_trackOperationsWidget.m_muteBtn->setModel( &m_track->m_mutedModel ); m_trackOperationsWidget.m_soloBtn->setModel( &m_track->m_soloModel ); + m_trackOperationsWidget.m_soloAutomationsBtn->setModel( &m_track->m_soloAutomationsModel ); ModelView::modelChanged(); setFixedHeight( m_track->getHeight() ); }