From efb335cea787a08fdeec290dbbc7dd5e39b2a5b8 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). --- 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 b6cb5081c..e74a53c87 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -151,6 +151,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 ), @@ -1490,6 +1496,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(); }