From e9073c88bcc87f2b84977aedb2058ef747c7fd0c Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 30 Apr 2014 10:48:40 +0200 Subject: [PATCH] PianoRoll: reset last note volume/panning when clearing project In order to get a uniform behaviour when starting with a new project or opening another project, reset volume and panning of last edited note so new placed notes have default volume and panning. Closes #644. --- include/PianoRoll.h | 3 +++ src/core/song.cpp | 5 +++++ src/gui/PianoRoll.cpp | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index cdd198621..09ef9db16 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -53,6 +53,9 @@ class PianoRoll : public QWidget, public SerializingObject { Q_OBJECT public: + /*! \brief Resets settings to default when e.g. creating a new project */ + void reset(); + void setCurrentPattern( pattern * _new_pattern ); inline void stopRecording() diff --git a/src/core/song.cpp b/src/core/song.cpp index a1a27c3d6..46b51af1f 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -749,6 +749,11 @@ void song::clearProject() engine::automationEditor()->setCurrentPattern( NULL ); } + if( engine::pianoRoll() ) + { + engine::pianoRoll()->reset(); + } + m_tempoModel.reset(); m_masterVolumeModel.reset(); m_masterPitchModel.reset(); diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index c09524152..7d0b99444 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -641,6 +641,15 @@ PianoRoll::PianoRoll() : } + +void PianoRoll::reset() +{ + m_lastNoteVolume = DefaultVolume; + m_lastNotePanning = DefaultPanning; +} + + + void PianoRoll::changeNoteEditMode( int i ) { m_noteEditMode = (noteEditMode) i;