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 ); } }