diff --git a/include/track.h b/include/track.h index 07ae52d6e..8139ea869 100644 --- a/include/track.h +++ b/include/track.h @@ -373,7 +373,8 @@ private slots: void cloneTrack(); void removeTrack(); void updateMenu(); - + void recordingOn(); + void recordingOff(); private: static QPixmap * s_grip; diff --git a/src/core/track.cpp b/src/core/track.cpp index d75cc91b4..0c04ff369 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -1479,6 +1479,9 @@ void trackOperationsWidget::removeTrack() * * For all track types, we have the Clone and Remove options. * For instrument-tracks we also offer the MIDI-control-menu + * For automation tracks, extra options: turn on/off recording + * on all TCOs (same should be added for sample tracks when + * sampletrack recording is implemented) */ void trackOperationsWidget::updateMenu() { @@ -1497,11 +1500,45 @@ void trackOperationsWidget::updateMenu() to_menu->addMenu( dynamic_cast( m_trackView )->midiMenu() ); } + if( dynamic_cast( m_trackView ) ) + { + to_menu->addAction( tr( "Turn all recording on" ), this, SLOT( recordingOn() ) ); + to_menu->addAction( tr( "Turn all recording off" ), this, SLOT( recordingOff() ) ); + } } +void trackOperationsWidget::recordingOn() +{ + AutomationTrackView * atv = dynamic_cast( m_trackView ); + if( atv ) + { + const track::tcoVector & tcov = atv->getTrack()->getTCOs(); + for( track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ ) + { + AutomationPattern * ap = dynamic_cast( *it ); + if( ap ) { ap->setRecording( true ); } + } + atv->update(); + } +} +void trackOperationsWidget::recordingOff() +{ + AutomationTrackView * atv = dynamic_cast( m_trackView ); + if( atv ) + { + const track::tcoVector & tcov = atv->getTrack()->getTCOs(); + for( track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ ) + { + AutomationPattern * ap = dynamic_cast( *it ); + if( ap ) { ap->setRecording( false ); } + } + atv->update(); + } +} + // =========================================================================== // track