From cd2bb63676fe52cae7f956601b576b3c13c5e37a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 4 Feb 2009 20:02:14 +0000 Subject: [PATCH] fixed bug: you can use shift+left to move notes past the beginning git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1995 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 6 ++++++ TODO | 1 - src/gui/piano_roll.cpp | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5964cfbcf..813fb6d1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-04 Andrew Kelley + + * src/gui/piano_roll.cpp: + * TODO: + fixed bug: you can use shift+left to move notes past the beginning + 2009-02-02 Andrew Kelley * include/main_window.h: diff --git a/TODO b/TODO index d328c38d0..84972e1c0 100644 --- a/TODO +++ b/TODO @@ -53,7 +53,6 @@ Andrew Kelley's todo: - pencil tool icon doesn't set right. selection arrow cursor doesn't set right -- bug: you can use shift+left to move notes past the beginning - add a Modulator class and a Humanizer tool to the piano roll - global playback buttons, like in FL Studio - when you add VSTi, have it automatically pop the find VST plugin dialog diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index fee942049..df7946c0b 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 ); } }