From 93681760d2b4a74a36166c018d7449391eef356e Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 6 Aug 2010 22:59:43 +0200 Subject: [PATCH] InstrumentTrackView: added one-window-mode + global piano focus Added a one-window-mode which allows to have only one instrument track window open at a time. The content of this window is replaced each time you open a different track. Furthermore added global reception and forwarding of key events to the piano widget of the top-most instrument track window. This for example enables the user to play test sounds while tweaking some effects in a different subwindow. --- include/InstrumentTrack.h | 18 +++++--- include/PianoView.h | 9 ++-- include/setup_dialog.h | 4 +- src/core/engine.cpp | 2 +- src/gui/MainWindow.cpp | 24 +++++++++-- src/gui/PianoView.cpp | 4 +- src/gui/automation_editor.cpp | 55 ++++++++----------------- src/gui/piano_roll.cpp | 69 ++++++++++++------------------- src/gui/setup_dialog.cpp | 27 ++++++++++-- src/tracks/InstrumentTrack.cpp | 75 ++++++++++++++++++++++++++++------ 10 files changed, 177 insertions(+), 110 deletions(-) diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index 26e137e16..d02b12dde 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -2,7 +2,7 @@ * InstrumentTrack.h - declaration of class InstrumentTrack, a track + window * which holds an instrument-plugin * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -41,6 +41,7 @@ class QLineEdit; template class QQueue; +template class QStack; class ArpeggiatorView; class ChordCreatorView; class EffectRackView; @@ -259,6 +260,10 @@ public: return castModel(); } + static InstrumentTrackWindow * topLevelInstrumentTrackWindow() + { + return s_windowStack.isEmpty() ? NULL : s_windowStack.top(); + } QMenu * midiMenu() { @@ -267,7 +272,7 @@ public: void freeInstrumentTrackWindow(); - static void cleanupWindowPool(); + static void cleanupWindowCache(); protected: @@ -288,7 +293,8 @@ private slots: private: InstrumentTrackWindow * m_window; - static QQueue s_windows; + static QQueue s_windowCache; + static QStack s_windowStack; // widgets in track-settings-widget trackLabelButton * m_tlb; @@ -335,9 +341,11 @@ public: return castModel(); } - void setInstrumentTrackView( InstrumentTrackView * _tv ) + void setInstrumentTrackView( InstrumentTrackView * _tv ); + + PianoView * pianoView() { - m_itv = _tv; + return m_pianoView; } static void dragEnterEventGeneric( QDragEnterEvent * _dee ); diff --git a/include/PianoView.h b/include/PianoView.h index 4acc12daa..3f99fbc00 100644 --- a/include/PianoView.h +++ b/include/PianoView.h @@ -1,7 +1,7 @@ /* * PianoView.h - declaration of PianoView, an interactive piano/keyboard-widget * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,10 +43,13 @@ public: static int getKeyFromKeyEvent( QKeyEvent * _ke ); -protected: - virtual void modelChanged(); +public: virtual void keyPressEvent( QKeyEvent * ke ); virtual void keyReleaseEvent( QKeyEvent * ke ); + + +protected: + virtual void modelChanged(); virtual void contextMenuEvent( QContextMenuEvent * _me ); virtual void paintEvent( QPaintEvent * ); virtual void mousePressEvent( QMouseEvent * me ); diff --git a/include/setup_dialog.h b/include/setup_dialog.h index d0cd46b6b..db7a996c9 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -1,7 +1,7 @@ /* * setup_dialog.h - dialog for setting up LMMS * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -115,6 +115,7 @@ private slots: void toggleDisableChActInd( bool _disabled ); void toggleManualChPiano( bool _enabled ); + void toggleOneInstrumentTrackWindow( bool _enabled ); void toggleMCLEnabled( bool _enabled ); void toggleMCLControlKey( bool _enabled ); @@ -170,6 +171,7 @@ private: bool m_disableChActInd; bool m_manualChPiano; + bool m_oneInstrumentTrackWindow; typedef QMap AswMap; typedef QMap MswMap; diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 0019b1372..4f3e775cb 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -160,7 +160,7 @@ void engine::destroy() deleteHelper( &s_automationEditor ); deleteHelper( &s_fxMixerView ); - InstrumentTrackView::cleanupWindowPool(); + InstrumentTrackView::cleanupWindowCache(); s_song->clearProject(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index e0bc09661..49e4c6dc9 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1,7 +1,7 @@ /* * MainWindow.cpp - implementation of LMMS' main window * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,6 +50,8 @@ #include "embed.h" #include "engine.h" #include "FxMixerView.h" +#include "InstrumentTrack.h" +#include "PianoView.h" #include "AboutDialog.h" #include "PreferencesDialog.h" #include "ControllerRackView.h" @@ -1241,7 +1243,15 @@ void MainWindow::keyPressEvent( QKeyEvent * _ke ) case Qt::Key_Shift: m_keyMods.m_shift = true; break; case Qt::Key_Alt: m_keyMods.m_alt = true; break; default: - QMainWindow::keyPressEvent( _ke ); + if( InstrumentTrackView::topLevelInstrumentTrackWindow() ) + { + InstrumentTrackView::topLevelInstrumentTrackWindow()-> + pianoView()->keyPressEvent( _ke ); + } + if( !_ke->isAccepted() ) + { + QMainWindow::keyPressEvent( _ke ); + } } } @@ -1403,7 +1413,15 @@ void MainWindow::keyReleaseEvent( QKeyEvent * _ke ) case Qt::Key_Shift: m_keyMods.m_shift = false; break; case Qt::Key_Alt: m_keyMods.m_alt = false; break; default: - QMainWindow::keyReleaseEvent( _ke ); + if( InstrumentTrackView::topLevelInstrumentTrackWindow() ) + { + InstrumentTrackView::topLevelInstrumentTrackWindow()-> + pianoView()->keyReleaseEvent( _ke ); + } + if( !_ke->isAccepted() ) + { + QMainWindow::keyReleaseEvent( _ke ); + } } } diff --git a/src/gui/PianoView.cpp b/src/gui/PianoView.cpp index 0b781a117..343f1a4d1 100644 --- a/src/gui/PianoView.cpp +++ b/src/gui/PianoView.cpp @@ -2,7 +2,7 @@ * Piano.cpp - implementation of piano-widget used in instrument-track-window * for testing + according model class * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -644,6 +644,7 @@ void PianoView::keyPressEvent( QKeyEvent * _ke ) if( m_piano != NULL ) { m_piano->handleKeyPress( key_num ); + _ke->accept(); update(); } } @@ -671,6 +672,7 @@ void PianoView::keyReleaseEvent( QKeyEvent * _ke ) if( m_piano != NULL ) { m_piano->handleKeyRelease( key_num ); + _ke->accept(); update(); } } diff --git a/src/gui/automation_editor.cpp b/src/gui/automation_editor.cpp index 9ac296da1..5f1f448de 100644 --- a/src/gui/automation_editor.cpp +++ b/src/gui/automation_editor.cpp @@ -2,7 +2,7 @@ * automation_editor.cpp - implementation of automationEditor which is used for * actual setting of dynamic values * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2010 Tobias Doerffel * Copyright (c) 2006-2008 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -510,37 +510,35 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) case Qt::Key_Up: m_topBottomScroll->setValue( m_topBottomScroll->value() - 1 ); + _ke->accept(); break; case Qt::Key_Down: m_topBottomScroll->setValue( m_topBottomScroll->value() + 1 ); + _ke->accept(); break; case Qt::Key_Left: - { if( ( m_timeLine->pos() -= 16 ) < 0 ) { m_timeLine->pos().setTicks( 0 ); } m_timeLine->updatePosition(); + _ke->accept(); break; - } + case Qt::Key_Right: - { m_timeLine->pos() += 16; m_timeLine->updatePosition(); + _ke->accept(); break; - } case Qt::Key_C: if( _ke->modifiers() & Qt::ControlModifier ) { copySelectedValues(); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -548,10 +546,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ControlModifier ) { cutSelectedValues(); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -559,10 +554,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ControlModifier ) { pasteValues(); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -572,10 +564,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) m_selectButton->setChecked( true ); selectAll(); update(); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -583,10 +572,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ShiftModifier ) { m_drawButton->setChecked( true ); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -594,10 +580,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ShiftModifier ) { m_eraseButton->setChecked( true ); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -605,10 +588,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ShiftModifier ) { m_selectButton->setChecked( true ); - } - else - { - _ke->ignore(); + _ke->accept(); } break; @@ -616,15 +596,13 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & Qt::ShiftModifier ) { m_moveButton->setChecked( true ); - } - else - { - _ke->ignore(); + _ke->accept(); } break; case Qt::Key_Delete: deleteSelectedValues(); + _ke->accept(); break; case Qt::Key_Space: @@ -636,15 +614,16 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) { play(); } + _ke->accept(); break; case Qt::Key_Home: m_timeLine->pos().setTicks( 0 ); m_timeLine->updatePosition(); + _ke->accept(); break; default: - _ke->ignore(); break; } } diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 299280ecd..11d3b9ef3 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -2,7 +2,7 @@ * piano_roll.cpp - implementation of piano-roll which is used for actual * writing of melodies * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * Copyright (c) 2008 Andrew Kelley * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -908,6 +908,7 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) { m_pattern->instrumentTrack()-> pianoModel()->handleKeyPress( key_num ); + _ke->accept(); } } @@ -938,7 +939,9 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) Qt::AltModifier ); } } + _ke->accept(); break; + case Qt::Key_Down: if( _ke->modifiers() & Qt::ControlModifier && m_action == ActionNone ) @@ -964,10 +967,10 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) Qt::AltModifier ); } } + _ke->accept(); break; case Qt::Key_Left: - { if( _ke->modifiers() & Qt::ControlModifier && m_action == ActionNone ) { @@ -1005,10 +1008,10 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) } } + _ke->accept(); break; - } + case Qt::Key_Right: - { if( _ke->modifiers() & Qt::ControlModifier && m_action == ActionNone) { @@ -1043,103 +1046,78 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) } } - - + _ke->accept(); break; - } case Qt::Key_C: if( _ke->modifiers() & Qt::ControlModifier ) { + _ke->accept(); copySelectedNotes(); } - else - { - _ke->ignore(); - } break; case Qt::Key_X: if( _ke->modifiers() & Qt::ControlModifier ) { + _ke->accept(); cutSelectedNotes(); } - else - { - _ke->ignore(); - } break; case Qt::Key_V: if( _ke->modifiers() & Qt::ControlModifier ) { + _ke->accept(); pasteNotes(); } - else - { - _ke->ignore(); - } break; case Qt::Key_A: if( _ke->modifiers() & Qt::ControlModifier ) { + _ke->accept(); m_selectButton->setChecked( true ); selectAll(); update(); } - else - { - _ke->ignore(); - } break; case Qt::Key_D: if( _ke->modifiers() & Qt::ShiftModifier ) { + _ke->accept(); m_drawButton->setChecked( true ); } - else - { - _ke->ignore(); - } break; case Qt::Key_E: if( _ke->modifiers() & Qt::ShiftModifier ) { + _ke->accept(); m_eraseButton->setChecked( true ); } - else - { - _ke->ignore(); - } break; case Qt::Key_S: if( _ke->modifiers() & Qt::ShiftModifier ) { + _ke->accept(); m_selectButton->setChecked( true ); } - else - { - _ke->ignore(); - } break; case Qt::Key_T: if( _ke->modifiers() & Qt::ShiftModifier ) { + _ke->accept(); m_detuneButton->setChecked( true ); } - else - { - _ke->ignore(); - } break; case Qt::Key_Delete: deleteSelectedNotes(); + _ke->accept(); break; case Qt::Key_Space: @@ -1151,11 +1129,13 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) { play(); } + _ke->accept(); break; case Qt::Key_Home: m_timeLine->pos().setTicks( 0 ); m_timeLine->updatePosition(); + _ke->accept(); break; case Qt::Key_0: @@ -1175,11 +1155,13 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) if( _ke->modifiers() & ( Qt::ControlModifier | Qt::KeypadModifier ) ) { - m_noteLenModel.setValue( len ); + m_noteLenModel.setValue( len ); + _ke->accept(); } else if( _ke->modifiers() & Qt::AltModifier ) { - m_quantizeModel.setValue( len ); + m_quantizeModel.setValue( len ); + _ke->accept(); } break; } @@ -1192,10 +1174,11 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) QApplication::changeOverrideCursor( QCursor( Qt::ArrowCursor ) ); update(); + _ke->accept(); } break; + default: - _ke->ignore(); break; } } @@ -1214,6 +1197,7 @@ void pianoRoll::keyReleaseEvent( QKeyEvent * _ke ) { m_pattern->instrumentTrack()-> pianoModel()->handleKeyRelease( key_num ); + _ke->accept(); } } switch( _ke->key() ) @@ -1225,7 +1209,6 @@ void pianoRoll::keyReleaseEvent( QKeyEvent * _ke ) update(); break; } - _ke->ignore(); } diff --git a/src/gui/setup_dialog.cpp b/src/gui/setup_dialog.cpp index 05c813101..3d1b09722 100644 --- a/src/gui/setup_dialog.cpp +++ b/src/gui/setup_dialog.cpp @@ -1,7 +1,7 @@ /* * setup_dialog.cpp - dialog for setting up LMMS * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -119,6 +119,8 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) : "disablechannelactivityindicators" ).toInt() ), m_manualChPiano( configManager::inst()->value( "ui", "manualchannelpiano" ).toInt() ), + m_oneInstrumentTrackWindow( configManager::inst()->value( "ui", + "oneinstrumenttrackwindow" ).toInt() ), m_mclEnabled( engine::getMidiControlListener()->getEnabled() ), m_mclChannel( engine::getMidiControlListener()->getChannel() ), m_mclUseControlKey( engine::getMidiControlListener()->getUseControlKey() ), @@ -198,7 +200,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) : tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general ); - misc_tw->setFixedHeight( 120 ); + misc_tw->setFixedHeight( 138 ); ledCheckBox * enable_tooltips = new ledCheckBox( tr( "Enable tooltips" ), @@ -234,10 +236,18 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) : connect( mmpz, SIGNAL( toggled( bool ) ), this, SLOT( toggleMMPZ( bool ) ) ); + ledCheckBox * oneitw = new ledCheckBox( + tr( "One instrument track window mode" ), + misc_tw ); + oneitw->move( 10, 90 ); + oneitw->setChecked( m_oneInstrumentTrackWindow ); + connect( oneitw, SIGNAL( toggled( bool ) ), + this, SLOT( toggleOneInstrumentTrackWindow( bool ) ) ); + ledCheckBox * hqaudio = new ledCheckBox( tr( "HQ-mode for output audio-device" ), misc_tw ); - hqaudio->move( 10, 90 ); + hqaudio->move( 10, 108 ); hqaudio->setChecked( m_hqAudioDev ); connect( hqaudio, SIGNAL( toggled( bool ) ), this, SLOT( toggleHQAudioDev( bool ) ) ); @@ -917,6 +927,8 @@ void setupDialog::accept() QString::number( m_disableChActInd ) ); configManager::inst()->setValue( "ui", "manualchannelpiano", QString::number( m_manualChPiano ) ); + configManager::inst()->setValue( "ui", "oneinstrumenttrackwindow", + QString::number( m_oneInstrumentTrackWindow ) ); configManager::inst()->setWorkingDir( m_workingDir ); configManager::inst()->setVSTDir( m_vstDir ); @@ -1088,6 +1100,15 @@ void setupDialog::toggleManualChPiano( bool _enabled ) +void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled ) +{ + m_oneInstrumentTrackWindow = _enabled; +} + + + + + void setupDialog::openWorkingDir() { QString new_dir = QFileDialog::getExistingDirectory( this, diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 252980448..6799d7d0d 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -2,7 +2,7 @@ * InstrumentTrack.cpp - implementation of instrument-track-class * (window + data-structures) * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -874,7 +875,8 @@ Instrument * InstrumentTrack::loadInstrument( const QString & _plugin_name ) // #### ITV: -QQueue InstrumentTrackView::s_windows; +QQueue InstrumentTrackView::s_windowCache; +QStack InstrumentTrackView::s_windowStack; @@ -992,16 +994,26 @@ void InstrumentTrackView::freeInstrumentTrackWindow() { if( m_window != NULL ) { + if( qFind( s_windowStack.begin(), s_windowStack.end(), m_window ) != + s_windowStack.end() ) + { + s_windowStack.erase( + qFind( s_windowStack.begin(), s_windowStack.end(), m_window ) ); + } m_lastPos = m_window->parentWidget()->pos(); - if( s_windows.count() < INSTRUMENT_WINDOW_CACHE_SIZE ) + + if( configManager::inst()->value( "ui", + "oneinstrumenttrackwindow" ).toInt() || + s_windowCache.count() < INSTRUMENT_WINDOW_CACHE_SIZE ) { model()->setHook( NULL ); + m_window->setInstrumentTrackView( NULL ); m_window->parentWidget()->hide(); m_window->setModel( engine::dummyTrackContainer()-> dummyInstrumentTrack() ); m_window->updateInstrumentView(); - s_windows.enqueue( m_window ); + s_windowCache << m_window; } else { @@ -1015,11 +1027,11 @@ void InstrumentTrackView::freeInstrumentTrackWindow() -void InstrumentTrackView::cleanupWindowPool() +void InstrumentTrackView::cleanupWindowCache() { - while( s_windows.count() ) + while( !s_windowCache.isEmpty() ) { - delete s_windows.dequeue(); + delete s_windowCache.dequeue(); } } @@ -1031,16 +1043,21 @@ InstrumentTrackWindow * InstrumentTrackView::getInstrumentTrackWindow() if( m_window != NULL ) { } - else if( !s_windows.isEmpty() ) + else if( !s_windowCache.isEmpty() ) { - m_window = s_windows.dequeue(); + m_window = s_windowCache.dequeue(); m_window->setInstrumentTrackView( this ); m_window->setModel( model() ); m_window->updateInstrumentView(); model()->setHook( m_window ); - if( m_lastPos.x() > 0 || m_lastPos.y() > 0 ) + if( configManager::inst()->value( "ui", + "oneinstrumenttrackwindow" ).toInt() ) + { + s_windowCache << m_window; + } + else if( m_lastPos.x() > 0 || m_lastPos.y() > 0 ) { m_window->parentWidget()->move( m_lastPos ); } @@ -1048,6 +1065,12 @@ InstrumentTrackWindow * InstrumentTrackView::getInstrumentTrackWindow() else { m_window = new InstrumentTrackWindow( this ); + if( configManager::inst()->value( "ui", + "oneinstrumenttrackwindow" ).toInt() ) + { + // first time, an InstrumentTrackWindow is opened + s_windowCache << m_window; + } } return m_window; @@ -1079,12 +1102,23 @@ void InstrumentTrackView::dropEvent( QDropEvent * _de ) void InstrumentTrackView::toggleInstrumentWindow( bool _on ) { - getInstrumentTrackWindow()->toggleVisibility( _on ); + InstrumentTrackWindow * w = getInstrumentTrackWindow(); + w->toggleVisibility( _on ); if( !_on ) { freeInstrumentTrackWindow(); } + else + { + if( qFind( s_windowStack.begin(), s_windowStack.end(), w ) != + s_windowStack.end() ) + { + s_windowStack.erase( + qFind( s_windowStack.begin(), s_windowStack.end(), w ) ); + } + s_windowStack.push( w ); + } } @@ -1166,6 +1200,8 @@ protected: + + // #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), @@ -1270,7 +1306,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); // setup piano-widget - m_pianoView= new PianoView( this ); + m_pianoView = new PianoView( this ); vlayout->addWidget( m_generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); @@ -1300,7 +1336,10 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : InstrumentTrackWindow::~InstrumentTrackWindow() { + InstrumentTrackView::s_windowCache.removeAll( this ); + delete m_instrumentView; + if( engine::mainWindow()->workspace() ) { parentWidget()->hide(); @@ -1311,6 +1350,18 @@ InstrumentTrackWindow::~InstrumentTrackWindow() +void InstrumentTrackWindow::setInstrumentTrackView( InstrumentTrackView * _tv ) +{ + if( m_itv && _tv ) + { + m_itv->m_tlb->setChecked( false ); + } + m_itv = _tv; +} + + + + void InstrumentTrackWindow::modelChanged() { m_track = castModel();