From e0a26a35fcf4fdc3294a97fbd2de059cb3138aab Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 17 Apr 2009 15:07:54 +0200 Subject: [PATCH] PianoRoll: do not make notes disappear under certain circumstances When starting LMMS, loading an existing project and opening a pattern with notes inside in piano roll, moving single notes showed unexpected behaviour, i.e. the according note has been moved somewhere unreachable. I tracked this down to a missing initialization of m_moveBoundary* variables. Adding a few lines fixes the issue (closes #2632909). (cherry picked from commit efb335cea787a08fdeec290dbbc7dd5e39b2a5b8) --- src/gui/piano_roll.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index a1ed8b5fb..e1b51b3ac 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -150,6 +150,12 @@ pianoRoll::pianoRoll( void ) : m_currentNote( NULL ), m_action( ActionNone ), m_noteEditMode( NoteEditVolume ), + m_moveBoundaryLeft( 0 ), + m_moveBoundaryTop( 0 ), + m_moveBoundaryRight( 0 ), + m_moveBoundaryBottom( 0 ), + m_mouseDownKey( 0 ), + m_mouseDownTick( 0 ), m_lastMouseX( 0 ), m_lastMouseY( 0 ), m_oldNotesEditHeight( 100 ), @@ -1482,6 +1488,10 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) { clearSelectedNotes(); m_currentNote->setSelected( true ); + m_moveBoundaryLeft = m_currentNote->pos().getTicks(); + m_moveBoundaryRight = m_currentNote->pos() + m_currentNote->length(); + m_moveBoundaryBottom = m_currentNote->key(); + m_moveBoundaryTop = m_currentNote->key(); }