Automation recording: add option to trackops to switch on/off recording in all TCOs on the track

I still had time to implement this convenient little thing, so here you go...
The same code can be reused in the future for sampletracks as well.
This commit is contained in:
Vesa
2014-05-05 00:37:39 +03:00
parent 62068684c2
commit 6b7a3c0041
2 changed files with 39 additions and 1 deletions

View File

@@ -373,7 +373,8 @@ private slots:
void cloneTrack();
void removeTrack();
void updateMenu();
void recordingOn();
void recordingOff();
private:
static QPixmap * s_grip;

View File

@@ -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<InstrumentTrackView *>(
m_trackView )->midiMenu() );
}
if( dynamic_cast<AutomationTrackView *>( 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<AutomationTrackView *>( 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<AutomationPattern *>( *it );
if( ap ) { ap->setRecording( true ); }
}
atv->update();
}
}
void trackOperationsWidget::recordingOff()
{
AutomationTrackView * atv = dynamic_cast<AutomationTrackView *>( 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<AutomationPattern *>( *it );
if( ap ) { ap->setRecording( false ); }
}
atv->update();
}
}
// ===========================================================================
// track