From ca18ad46ddd8592e44a0f7dda54a99f35f420f30 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 18 Nov 2007 13:15:13 +0000 Subject: [PATCH] QMdiArea, first attempt git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@597 0778d3d1-df1d-0410-868b-ea421aaaa00d --- AUTHORS | 4 ++ acinclude.m4 | 15 ++++--- include/instrument_track.h | 3 +- include/main_window.h | 6 +-- include/rack_plugin.h | 2 + include/track_container.h | 21 +++++++--- plugins/bass_booster/bass_booster.h | 2 +- plugins/ladspa_effect/ladspa_effect.h | 2 +- .../stereoenhancer_control_dialog.cpp | 3 +- .../stereoenhancer_control_dialog.h | 3 +- src/core/automation_editor.cpp | 20 ++++----- src/core/automation_pattern.cpp | 2 +- src/core/bb_editor.cpp | 32 +++++++++------ src/core/file_browser.cpp | 11 ++--- src/core/main.cpp | 1 + src/core/main_window.cpp | 41 ++++++++++--------- src/core/piano_roll.cpp | 22 +++++----- src/core/song_editor.cpp | 35 +++++++++------- src/core/tool.cpp | 2 +- src/core/track_container.cpp | 9 +--- src/tracks/instrument_track.cpp | 29 +++++++------ src/tracks/pattern.cpp | 2 +- src/widgets/effect_label.cpp | 4 +- src/widgets/project_notes.cpp | 14 +++---- src/widgets/rack_plugin.cpp | 16 ++++---- src/widgets/tempo_sync_knob.cpp | 2 +- 26 files changed, 170 insertions(+), 133 deletions(-) diff --git a/AUTHORS b/AUTHORS index b2582c0cd..0df34e704 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,6 +10,10 @@ Javier Serrano Polo development +Paul Giblock + + development + Zolo theme "Blue Scene" diff --git a/acinclude.m4 b/acinclude.m4 index 7ed31f99f..d7582b8a1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -7,13 +7,13 @@ AC_REQUIRE([AC_PATH_X]) AC_MSG_CHECKING([QTDIR]) AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval) # Check that QTDIR is defined or that --with-qtdir given -if test x"$QTDIR" = x ; then +#if test x"$QTDIR" = x ; then # some usual Qt-locations - QT_SEARCH="/usr /usr/lib/qt4 /usr/share/qt4 /usr/local/Trolltech/Qt-4.3.0 /usr/local/Trolltech/Qt-4.3.1 /usr/local/Trolltech/Qt-4.1.0" -else - QT_SEARCH=$QTDIR - QTDIR="" -fi + QT_SEARCH="/home/llama/projects/lmms/lmms/qtdir /usr/local/Trolltech/Qt-4.3.0 /usr/local/Trolltech/Qt-4.3.1 /usr/local/Trolltech/Qt-4.1.0" +#else +# QT_SEARCH=$QTDIR +# QTDIR="" +#fi for i in $QT_SEARCH ; do QT_INCLUDE_SEARCH="include/qt4 include" for j in $QT_INCLUDE_SEARCH ; do @@ -23,6 +23,9 @@ for i in $QT_SEARCH ; do fi done done + +QTDIR="/home/llama/projects/lmms/qtdir" +QT_INCLUDES="/home/llama/projects/lmms/qtdir/include" if test x"$QTDIR" = x ; then AC_MSG_ERROR([*** QTDIR must be defined, or --with-qtdir option given]) fi diff --git a/include/instrument_track.h b/include/instrument_track.h index 3a7447587..ccd822e4b 100644 --- a/include/instrument_track.h +++ b/include/instrument_track.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "midi_event_processor.h" #include "mixer.h" @@ -54,7 +55,7 @@ class surroundArea; class volumeKnob; -class instrumentTrack : public QWidget, public track, public midiEventProcessor +class instrumentTrack : public QMdiSubWindow, public track, public midiEventProcessor { Q_OBJECT public: diff --git a/include/main_window.h b/include/main_window.h index b3fb89da6..ba73aacb3 100644 --- a/include/main_window.h +++ b/include/main_window.h @@ -34,7 +34,7 @@ class QAction; class QDomElement; class QGridLayout; class QSplashScreen; -class QWorkspace; +class QMdiArea; class configManager; class tool; @@ -45,7 +45,7 @@ class mainWindow : public QMainWindow { Q_OBJECT public: - inline QWorkspace * workspace( void ) + inline QMdiArea * workspace( void ) { return( m_workspace ); } @@ -124,7 +124,7 @@ private: void finalize( void ); - QWorkspace * m_workspace; + QMdiArea * m_workspace; QWidget * m_toolBar; QGridLayout * m_toolBarLayout; diff --git a/include/rack_plugin.h b/include/rack_plugin.h index bc21e94a4..5d29809d3 100644 --- a/include/rack_plugin.h +++ b/include/rack_plugin.h @@ -33,6 +33,7 @@ class QGroupBox; class QLabel; class QPushButton; +class QMdiSubWindow; class audioPort; class effect; @@ -94,6 +95,7 @@ private: QGroupBox * m_controls; QLabel * m_label; QPushButton * m_editButton; + QMdiSubWindow *m_subWindow; effect * m_effect; effectControlDialog * m_controlView; track * m_track; diff --git a/include/track_container.h b/include/track_container.h index 3541affda..a1276c06b 100644 --- a/include/track_container.h +++ b/include/track_container.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include "track.h" @@ -42,7 +42,7 @@ const Uint16 DEFAULT_SCROLLBAR_SIZE = 16; -class trackContainer : public QMainWindow, public journallingObject +class trackContainer : public QWidget, public journallingObject { Q_OBJECT public: @@ -54,6 +54,15 @@ public: return( m_scrollArea ); } +#warning centralWidget is obsolete + QWidget * centralWidget() const { + return (QWidget*)this; + } + + void setCentralWidget( QWidget *cw ) { + //m_centralWidget = cw; + } + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); @@ -98,7 +107,6 @@ public: const trackWidget * trackWidgetAt( const int _y ) const; - virtual bool allowRubberband( void ) const; inline bool rubberBandActive( void ) const @@ -131,11 +139,15 @@ protected: virtual void dragEnterEvent( QDragEnterEvent * _dee ); virtual void dropEvent( QDropEvent * _de ); - virtual void mousePressEvent( QMouseEvent * _me ); + + virtual void mousePressEvent( QMouseEvent * _me ); virtual void mouseMoveEvent( QMouseEvent * _me ); virtual void mouseReleaseEvent( QMouseEvent * _me ); + virtual void resizeEvent( QResizeEvent * ); + void addToWorkspace(); + constTrackVector tracks( void ) const; virtual QRect scrollAreaRect( void ) const @@ -145,7 +157,6 @@ protected: midiTime m_currentPosition; - protected slots: void updateScrollArea( void ); diff --git a/plugins/bass_booster/bass_booster.h b/plugins/bass_booster/bass_booster.h index f5205e3c8..e520cccc1 100644 --- a/plugins/bass_booster/bass_booster.h +++ b/plugins/bass_booster/bass_booster.h @@ -52,7 +52,7 @@ public: virtual inline effectControlDialog * createControlDialog( track * ) { return( new bassBoosterControlDialog( - engine::getMainWindow()->workspace(), + NULL /*engine::getMainWindow()->workspace()*/, this ) ); } diff --git a/plugins/ladspa_effect/ladspa_effect.h b/plugins/ladspa_effect/ladspa_effect.h index 020995a59..be843ba6a 100644 --- a/plugins/ladspa_effect/ladspa_effect.h +++ b/plugins/ladspa_effect/ladspa_effect.h @@ -69,7 +69,7 @@ public: track * _track ) { return( new ladspaControlDialog( - engine::getMainWindow()->workspace(), + NULL /*engine::getMainWindow()->workspace()*/, this, _track ) ); } diff --git a/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp b/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp index 14d7302e3..bb1b3d006 100644 --- a/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp +++ b/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp @@ -26,6 +26,7 @@ #ifndef QT3 #include +#include #else @@ -38,7 +39,7 @@ -stereoEnhancerControlDialog::stereoEnhancerControlDialog( QWidget * _parent, +stereoEnhancerControlDialog::stereoEnhancerControlDialog( QMdiArea * _parent, stereoEnhancerEffect * _eff ) : effectControlDialog( _parent, _eff ), m_effect( _eff ) diff --git a/plugins/stereo_enhancer/stereoenhancer_control_dialog.h b/plugins/stereo_enhancer/stereoenhancer_control_dialog.h index e56949ff6..c3b7eed5e 100644 --- a/plugins/stereo_enhancer/stereoenhancer_control_dialog.h +++ b/plugins/stereo_enhancer/stereoenhancer_control_dialog.h @@ -29,13 +29,14 @@ class knob; class stereoEnhancerEffect; +class QMdiArea; class stereoEnhancerControlDialog : public effectControlDialog { Q_OBJECT public: - stereoEnhancerControlDialog( QWidget * _parent, stereoEnhancerEffect * _eff ); + stereoEnhancerControlDialog( QMdiArea * _parent, stereoEnhancerEffect * _eff ); virtual ~stereoEnhancerControlDialog() { } diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index 14fe81ced..99e07ede1 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #ifndef __USE_XOPEN @@ -74,7 +74,7 @@ QPixmap * automationEditor::s_toolMove = NULL; automationEditor::automationEditor( void ) : - QWidget( engine::getMainWindow()->workspace() ), + QWidget( ), m_pattern( NULL ), m_min_level( 0 ), m_max_level( 0 ), @@ -113,12 +113,6 @@ automationEditor::automationEditor( void ) : "edit_move" ) ); } - // add us to workspace - if( engine::getMainWindow()->workspace() ) - { - engine::getMainWindow()->workspace()->addWindow( this ); - } - // add time-line m_timeLine = new timeLine( VALUES_WIDTH, 32, m_ppt, engine::getSongEditor()->getPlayPos( @@ -333,12 +327,18 @@ automationEditor::automationEditor( void ) : // setup our actual window setWindowIcon( embed::getIconPixmap( "automation" ) ); - resize( INITIAL_WIDTH, INITIAL_HEIGHT ); setCurrentPattern( NULL ); setMouseTracking( TRUE ); - hide(); + // add us to workspace + if( engine::getMainWindow()->workspace() ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + + parentWidget()->resize( INITIAL_WIDTH, INITIAL_HEIGHT ); + parentWidget()->hide(); } diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index ffc355549..2b54997ba 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -250,7 +250,7 @@ void automationPattern::loadSettings( const QDomElement & _this ) void automationPattern::openInAutomationEditor( void ) { engine::getAutomationEditor()->setCurrentPattern( this ); - engine::getAutomationEditor()->show(); + engine::getAutomationEditor()->parentWidget()->show(); engine::getAutomationEditor()->setFocus(); } diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 185ae4c8f..59ff2f418 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "bb_editor.h" @@ -73,18 +74,6 @@ bbEditor::bbEditor( void ) BBE_PPT + 2 * TCO_BORDER_WIDTH + DEFAULT_SCROLLBAR_SIZE ); - QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; - if( engine::getMainWindow()->workspace() != NULL ) - { - resize( minimumWidth(), 300 ); - w->move( 10, 340 ); - } - else - { - resize( minimumWidth(), 300 ); - w->move( 210, 340 ); - } - containerWidget()->move( 0, 32 ); setPixelsPerTact( BBE_PPT ); @@ -131,7 +120,24 @@ bbEditor::bbEditor( void ) tb_layout->addWidget( l ); tb_layout->addSpacing( 15 ); - show(); + if( engine::getMainWindow()->workspace() != NULL ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + + QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; + if( engine::getMainWindow()->workspace() != NULL ) + { + w->resize( minimumWidth(), 300 ); + w->move( 10, 340 ); + } + else + { + resize( minimumWidth(), 300 ); + w->move( 210, 340 ); + } + + w->show(); } diff --git a/src/core/file_browser.cpp b/src/core/file_browser.cpp index 4d1ed4e47..8f6737aa1 100644 --- a/src/core/file_browser.cpp +++ b/src/core/file_browser.cpp @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include #include "bb_editor.h" @@ -317,16 +318,16 @@ void listView::sendToActiveInstrumentTrack( void ) } // get all windows opened in the workspace - QWidgetList pl = engine::getMainWindow()->workspace()->windowList( - QWorkspace::StackingOrder ); - QListIterator w( pl ); + QList pl = engine::getMainWindow()->workspace()->subWindowList( + QMdiArea::StackingOrder ); + QListIterator w( pl ); w.toBack(); // now we travel through the window-list until we find an // instrument-track while( w.hasPrevious() ) { instrumentTrack * ct = dynamic_cast( - w.previous() ); + w.previous()->widget() ); if( ct != NULL && ct->isHidden() == FALSE ) { // ok, it's an instrument-track, so we can apply the diff --git a/src/core/main.cpp b/src/core/main.cpp index 91ed3a3af..474456728 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -169,6 +169,7 @@ int main( int argc, char * * argv ) return( EXIT_FAILURE ); } + // set palette QPalette pal = app.palette(); pal.setColor( QPalette::Background, QColor( 128, 128, 128 ) ); pal.setColor( QPalette::Foreground, QColor( 240, 240, 240 ) ); diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index 4d139787a..a8f879ed8 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -37,7 +37,8 @@ #include #include #include -#include +#include +#include #ifdef HAVE_CONFIG_H @@ -142,10 +143,10 @@ mainWindow::mainWindow( void ) : if( no_mdi == FALSE ) { - m_workspace = new QWorkspace( splitter ); - m_workspace->setScrollBarsEnabled( TRUE ); + m_workspace = new QMdiArea( splitter ); m_workspace->setBackground( embed::getIconPixmap( "background_artwork" ) ); + // m_workspace->setBackgroundMode (QWidget::NoBackground); } hbox->addWidget( side_bar ); @@ -730,16 +731,16 @@ void mainWindow::help( void ) void mainWindow::toggleBBEditorWin( void ) { - if( engine::getBBEditor()->isHidden() == TRUE || + if( engine::getBBEditor()->parentWidget()->isHidden() == TRUE || ( m_workspace != NULL && - m_workspace->activeWindow() != engine::getBBEditor() ) ) + m_workspace->activeSubWindow()->widget() != engine::getBBEditor() ) ) { - engine::getBBEditor()->show(); + engine::getBBEditor()->parentWidget()->show(); engine::getBBEditor()->setFocus(); } else { - engine::getBBEditor()->hide(); + engine::getBBEditor()->parentWidget()->hide(); } } @@ -748,16 +749,16 @@ void mainWindow::toggleBBEditorWin( void ) void mainWindow::toggleSongEditorWin( void ) { - if( engine::getSongEditor()->isHidden() == TRUE || - ( m_workspace != NULL && m_workspace->activeWindow() + if( engine::getSongEditor()->parentWidget()->isHidden() == TRUE || + ( m_workspace != NULL && m_workspace->activeSubWindow()->widget() != engine::getSongEditor() ) ) { - engine::getSongEditor()->show(); + engine::getSongEditor()->parentWidget()->show(); engine::getSongEditor()->setFocus(); } else { - engine::getSongEditor()->hide(); + engine::getSongEditor()->parentWidget()->hide(); } } @@ -767,7 +768,7 @@ void mainWindow::toggleSongEditorWin( void ) void mainWindow::toggleProjectNotesWin( void ) { if( engine::getProjectNotes()->isHidden() == TRUE || - ( m_workspace != NULL && m_workspace->activeWindow() != + ( m_workspace != NULL && m_workspace->activeSubWindow()->widget() != engine::getProjectNotes() ) ) { engine::getProjectNotes()->show(); @@ -784,16 +785,16 @@ void mainWindow::toggleProjectNotesWin( void ) void mainWindow::togglePianoRollWin( void ) { - if( engine::getPianoRoll()->isHidden() == TRUE || - ( m_workspace != NULL && m_workspace->activeWindow() + if( engine::getPianoRoll()->parentWidget()->isHidden() == TRUE || + ( m_workspace != NULL && m_workspace->activeSubWindow()->widget() != engine::getPianoRoll() ) ) { - engine::getPianoRoll()->show(); + engine::getPianoRoll()->parentWidget()->show(); engine::getPianoRoll()->setFocus(); } else { - engine::getPianoRoll()->hide(); + engine::getPianoRoll()->parentWidget()->hide(); } } @@ -802,16 +803,16 @@ void mainWindow::togglePianoRollWin( void ) void mainWindow::toggleAutomationEditorWin( void ) { - if( engine::getAutomationEditor()->isHidden() == TRUE || - ( m_workspace != NULL && m_workspace->activeWindow() + if( engine::getAutomationEditor()->parentWidget()->isHidden() == TRUE || + ( m_workspace != NULL && m_workspace->activeSubWindow()->widget() != engine::getAutomationEditor() ) ) { - engine::getAutomationEditor()->show(); + engine::getAutomationEditor()->parentWidget()->show(); engine::getAutomationEditor()->setFocus(); } else { - engine::getAutomationEditor()->hide(); + engine::getAutomationEditor()->parentWidget()->hide(); } } diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index 82dd53d9a..d7ccbfea3 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #ifndef __USE_XOPEN @@ -127,7 +127,7 @@ const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DEFAULT_STEPS_PER_TACT; pianoRoll::pianoRoll( void ) : - QWidget( engine::getMainWindow()->workspace() ), + QWidget( ), m_pattern( NULL ), m_currentPosition(), m_recording( FALSE ), @@ -185,11 +185,6 @@ pianoRoll::pianoRoll( void ) : "automation" ) ); } - // add us to workspace - if( engine::getMainWindow()->workspace() ) - { - engine::getMainWindow()->workspace()->addWindow( this ); - } // add time-line m_timeLine = new timeLine( WHITE_KEY_WIDTH, 32, m_ppt, @@ -422,12 +417,17 @@ pianoRoll::pianoRoll( void ) : // setup our actual window setWindowIcon( embed::getIconPixmap( "piano" ) ); - resize( INITIAL_PIANOROLL_WIDTH, INITIAL_PIANOROLL_HEIGHT ); setCurrentPattern( NULL ); setMouseTracking( TRUE ); - hide(); + // add us to workspace + if( engine::getMainWindow()->workspace() ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + parentWidget()->resize( INITIAL_PIANOROLL_WIDTH, INITIAL_PIANOROLL_HEIGHT ); + parentWidget()->hide(); } @@ -970,7 +970,7 @@ void pianoRoll::removeSelection( void ) void pianoRoll::closeEvent( QCloseEvent * _ce ) { QApplication::restoreOverrideCursor(); - hide(); + parentWidget()->hide(); _ce->ignore (); } @@ -1906,7 +1906,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) -void pianoRoll::paintEvent( QPaintEvent * ) +void pianoRoll::paintEvent( QPaintEvent * _pe) { QPixmap paintPixmap( size() ); updatePaintPixmap( paintPixmap ); diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index e7839a071..956ebb547 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "song_editor.h" @@ -97,23 +98,10 @@ songEditor::songEditor( void ) : setWindowTitle( tr( "Song-Editor" ) ); setWindowIcon( embed::getIconPixmap( "songeditor" ) ); - QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; - if( engine::getMainWindow()->workspace() != NULL ) - { - resize( 680, 300 ); - w->move( 10, 10 ); - } - else - { - resize( 580, 300 ); - w->move( 210, 10 ); - } - setFocusPolicy( Qt::StrongFocus ); setFocus(); - QWidget * cw = new QWidget( this ); - setCentralWidget( cw ); + QWidget * cw = this; // create time-line @@ -388,7 +376,24 @@ songEditor::songEditor( void ) : this, SLOT( scrolled( int ) ) ); - show(); + if( engine::getMainWindow()->workspace() != NULL ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + + QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; + if( engine::getMainWindow()->workspace() != NULL ) + { + w->resize( 680, 300 ); + w->move( 10, 10 ); + } + else + { + resize( 580, 300 ); + w->move( 210, 10 ); + } + + w->show(); } diff --git a/src/core/tool.cpp b/src/core/tool.cpp index c046a8df1..e87a9f77a 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -28,7 +28,7 @@ #include "tool.h" #include -#include +#include #include "main_window.h" diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index 7179840ab..08200714b 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "bb_track.h" @@ -56,18 +56,13 @@ trackContainer::trackContainer( void ) : - QMainWindow( engine::getMainWindow()->workspace() ), + QWidget( ), m_currentPosition( 0, 0 ), m_scrollArea( new scrollArea( this ) ), m_ppt( DEFAULT_PIXELS_PER_TACT ), m_rubberBand( new rubberBand( m_scrollArea ) ), m_origin() { - if( engine::getMainWindow()->workspace() != NULL ) - { - engine::getMainWindow()->workspace()->addWindow( this ); - } - m_scrollArea->show(); m_rubberBand->hide(); diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 958ebe2bd..800284ad1 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -40,7 +40,8 @@ #include #include #include -#include +#include +#include #include "arp_and_chords_tab_widget.h" @@ -97,8 +98,8 @@ const int PIANO_HEIGHT = 84; instrumentTrack::instrumentTrack( trackContainer * _tc ) : - QWidget( engine::getMainWindow()->workspace() ), - track( _tc ), + QMdiSubWindow( engine::getMainWindow()->workspace() ), + track( _tc ), midiEventProcessor(), m_trackType( INSTRUMENT_TRACK ), m_midiPort( engine::getMixer()->getMIDIClient()->addPort( this, @@ -111,21 +112,17 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : m_midiInputAction( NULL ), m_midiOutputAction( NULL ) { + + QWidget * widget = new QWidget(); + for( int i = 0; i < NOTES; ++i ) { m_notes[i] = NULL; } - if( engine::getMainWindow()->workspace() ) - { - engine::getMainWindow()->workspace()->addWindow( this ); - } - setAcceptDrops( TRUE ); - hide(); - getTrackWidget()->setFixedHeight( 32 ); @@ -174,12 +171,12 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); - QVBoxLayout * vlayout = new QVBoxLayout( this ); + QVBoxLayout * vlayout = new QVBoxLayout( widget ); vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); m_generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), - this ); + widget ); m_generalSettingsWidget->setFixedHeight( 90 ); // setup line-edit for changing channel-name @@ -317,9 +314,17 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : _tc->updateAfterTrackAdd(); + setWidget( widget ); + setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); + if( engine::getMainWindow()->workspace() ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + + hide(); } diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index c4bd2657f..6c49d63c0 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -457,7 +457,7 @@ void pattern::openInPianoRoll( void ) void pattern::openInPianoRoll( bool ) { engine::getPianoRoll()->setCurrentPattern( this ); - engine::getPianoRoll()->show(); + engine::getPianoRoll()->parentWidget()->show(); engine::getPianoRoll()->setFocus(); } diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index 41d4f696a..ce4013fb0 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -29,7 +29,7 @@ #include "effect_label.h" #include -#include +#include #include #include "effect_tab_widget.h" @@ -67,7 +67,7 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent, if( engine::getMainWindow()->workspace() ) { - engine::getMainWindow()->workspace()->addWindow( m_effWidget ); + engine::getMainWindow()->workspace()->addSubWindow( m_effWidget ); } m_effWidget->setWindowTitle( _initial_name ); diff --git a/src/widgets/project_notes.cpp b/src/widgets/project_notes.cpp index 716bd3667..dc9edef51 100644 --- a/src/widgets/project_notes.cpp +++ b/src/widgets/project_notes.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "embed.h" #include "engine.h" @@ -49,11 +49,6 @@ projectNotes::projectNotes( void ) : QMainWindow( engine::getMainWindow()->workspace() ) { - if( engine::getMainWindow()->workspace() ) - { - engine::getMainWindow()->workspace()->addWindow( this ); - } - m_edit = new QTextEdit( this ); m_edit->setAutoFillBackground( TRUE ); QPalette pal; @@ -78,6 +73,11 @@ projectNotes::projectNotes( void ) : resize( 300, 200 ); + if( engine::getMainWindow()->workspace() ) + { + engine::getMainWindow()->workspace()->addSubWindow( this ); + } + QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; if( engine::getMainWindow()->workspace() != NULL ) { @@ -88,8 +88,6 @@ projectNotes::projectNotes( void ) : w->move( 800, 10 ); } - //show(); - } diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index 8030048f6..315c54fbb 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -30,7 +30,8 @@ #include #include -#include +#include +#include #include "audio_port.h" #include "caption_menu.h" @@ -132,10 +133,11 @@ rackPlugin::rackPlugin( QWidget * _parent, m_label->setPalette( pal ); m_controlView = m_effect->createControlDialog( m_track ); - engine::getMainWindow()->workspace()->addWindow( m_controlView ); + m_subWindow = engine::getMainWindow()->workspace()->addSubWindow( m_controlView ); connect( m_controlView, SIGNAL( closed() ), this, SLOT( closeEffects() ) ); - m_controlView->hide(); + + m_subWindow->hide(); if( m_controlView->getControlCount() == 0 ) { @@ -189,13 +191,13 @@ void rackPlugin::editControls( void ) { if( m_show ) { - m_controlView->show(); - m_controlView->raise(); + m_subWindow->show(); + m_subWindow->raise(); m_show = FALSE; } else { - m_controlView->hide(); + m_subWindow->hide(); m_show = TRUE; } } @@ -333,7 +335,7 @@ void FASTCALL rackPlugin::loadSettings( const QDomElement & _this ) void rackPlugin::closeEffects( void ) { - m_controlView->hide(); + m_subWindow->hide(); m_show = TRUE; } diff --git a/src/widgets/tempo_sync_knob.cpp b/src/widgets/tempo_sync_knob.cpp index 233fd4e70..2c3ab665d 100644 --- a/src/widgets/tempo_sync_knob.cpp +++ b/src/widgets/tempo_sync_knob.cpp @@ -29,7 +29,7 @@ #include "tempo_sync_knob.h" #include -#include +#include #include "automatable_object_templates.h" #include "caption_menu.h"