From aa575bca83f97abb62686e62c2249d8dc8811265 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 5 Feb 2009 09:06:58 +0000 Subject: [PATCH] fixed bug: you can use shift+left to move notes past the beginning (stable backport) git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1997 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 7 ++++++- src/gui/piano_roll.cpp | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e42f35678..82d4502cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2009-02-04 Tobias Doerffel +2009-02-05 Tobias Doerffel * include/atomic_int.h: * include/audio_port.h: @@ -7,6 +7,11 @@ reworked mixer-threads (synchronization, realization of jobqueue etc.) which results in a much better performance and stability +2009-02-04 Andrew Kelley + + * src/gui/piano_roll.cpp: + fixed bug: you can use shift+left to move notes past the beginning + 2009-01-25 Paul Giblock * src/tracks/bb_track.cpp: diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 314c2cf0f..c86ad6586 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -806,13 +806,25 @@ void pianoRoll::shiftPos( int amount ) //shift notes pos by amount { bool useAllNotes = ! isSelection(); const noteVector & notes = m_pattern->notes(); + + bool first = true; for( noteVector::const_iterator it = notes.begin(); it != notes.end(); ++it ) { // if none are selected, move all notes, otherwise // only move selected notes - if( useAllNotes || ( *it )->selected() ) + if( ( *it )->selected() || (useAllNotes && ( *it )->length() > 0) ) { + // don't let notes go to out of bounds + if( first ) + { + m_moveBoundaryLeft = ( *it )->pos(); + if( m_moveBoundaryLeft + amount < 0 ) + { + amount += 0 - (amount + m_moveBoundaryLeft); + } + first = false; + } ( *it )->setPos( ( *it )->pos() + amount ); } }