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
This commit is contained in:
Andrew Kelley
2009-02-04 20:02:14 +00:00
parent 879b50aaa1
commit cd2bb63676
3 changed files with 19 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2009-02-04 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:
* TODO:
fixed bug: you can use shift+left to move notes past the beginning
2009-02-02 Andrew Kelley <superjoe30/at/gmail/dot/com>
* include/main_window.h:

1
TODO
View File

@@ -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

View File

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