diff --git a/include/song.h b/include/song.h index be02385b1..5c0d619e0 100644 --- a/include/song.h +++ b/include/song.h @@ -1,7 +1,7 @@ /* * song.h - class song - the root of the model-tree * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2011 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -22,7 +22,6 @@ * */ - #ifndef _SONG_H #define _SONG_H @@ -317,6 +316,7 @@ private: friend class ControllerRackView; signals: + void projectLoaded(); void lengthChanged( int _tacts ); void tempoChanged( bpm_t _new_bpm ); void timeSignatureChanged( int _old_ticks_per_tact, diff --git a/include/song_editor.h b/include/song_editor.h index c108a2b1b..1d171d187 100644 --- a/include/song_editor.h +++ b/include/song_editor.h @@ -2,7 +2,7 @@ * song_editor.h - declaration of class songEditor, a window where you can * setup your songs * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2011 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -70,6 +70,8 @@ private slots: void updatePosition( const midiTime & _t ); void zoomingChanged(); + void adjustUiAfterProjectLoad(); + private: virtual void keyPressEvent( QKeyEvent * _ke ); diff --git a/src/core/song.cpp b/src/core/song.cpp index cc4bf1885..fce3c6c64 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1,7 +1,7 @@ /* * song.cpp - root of the model tree * - * Copyright (c) 2004-2010 Tobias Doerffel + * Copyright (c) 2004-2011 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -1006,6 +1006,8 @@ void song::loadProject( const QString & _file_name ) engine::projectJournal()->setJournalling( true ); + emit projectLoaded(); + m_loadingProject = false; m_modified = false; @@ -1013,10 +1015,6 @@ void song::loadProject( const QString & _file_name ) { engine::mainWindow()->resetWindowTitle(); } - if( engine::getSongEditor() ) - { - engine::getSongEditor()->scrolled( 0 ); - } } diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index 3ef02eed8..a9eb058c5 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -1,7 +1,7 @@ /* * song_editor.cpp - basic window for song-editing * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2011 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,10 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) : m_positionLine = new positionLine( this ); + // let's get notified when loading a project + connect( m_s, SIGNAL( projectLoaded() ), + this, SLOT( adjustUiAfterProjectLoad() ) ); + // create own toolbar m_toolBar = new QWidget( this ); m_toolBar->setObjectName( "toolbar" ); @@ -479,6 +484,22 @@ void songEditor::zoomingChanged() +void songEditor::adjustUiAfterProjectLoad() +{ + //if( isMaximized() ) + { + // make sure to bring us to front as the song editor is the central + // widget in a song and when just opening a song in order to listen to + // it, it's very annyoing to manually bring up the song editor each time + engine::mainWindow()->workspace()->setActiveSubWindow( + qobject_cast( parentWidget() ) ); + } + scrolled( 0 ); +} + + + + bool songEditor::allowRubberband() const { return( m_editModeButton->isChecked() );