From 55c109e611cf4fb4d6493e02974b71a9d30fb03e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 15 Dec 2008 21:52:31 +0000 Subject: [PATCH] if you move a single note, it is deselected after the move to allow note editing git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1930 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 7 +++++++ TODO | 2 -- include/piano_roll.h | 1 + src/gui/piano_roll.cpp | 25 +++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bd3ee28b..9927e30db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-15 Andrew Kelley + + * include/piano_roll.h: + * src/gui/piano_roll.cpp: + if you move a single note, it is deselected after the move to allow + note editing + 2008-12-14 Andrew Kelley * include/piano_roll.h: diff --git a/TODO b/TODO index 47c67bd0b..93481481d 100644 --- a/TODO +++ b/TODO @@ -52,8 +52,6 @@ - add FLAC as export-format? Andrew Kelley's todo: -- figure out a way to not make editing note volume awkward. AKA don't select notes just by clicking on them, and don't select newly created notes - - if you press both controls at the same time, the piano roll gets stuck in selection mode - multiview button - show notes from every instrument in the current beat+bassline with different colors - undo/redo for piano roll diff --git a/include/piano_roll.h b/include/piano_roll.h index bf32ce651..7b6aea303 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -180,6 +180,7 @@ private: void shiftPos(int amount); void shiftSemiTone(int amount); bool isSelection() const; + int selectionCount() const; void testPlayNote( note * n ); void testPlayKey( int _key, int _vol, int _pan ); void pauseTestNotes( bool _pause = true ); diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 25375f4e2..93fc92077 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -829,6 +829,24 @@ bool pianoRoll::isSelection( void ) const // are any notes selected? +int pianoRoll::selectionCount( void ) const // how many notes are selected? +{ + int sum = 0; + + const noteVector & notes = m_pattern->notes(); + for( noteVector::const_iterator it = notes.begin(); it != notes.end(); + ++it ) + { + if( ( *it )->selected() ) + { + ++sum; + } + } + + return sum; +} + + void pianoRoll::keyPressEvent( QKeyEvent * _ke ) { @@ -1770,6 +1788,13 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me ) // time in the note-array of pattern m_pattern->rearrangeAllNotes(); + + // if we only moved one note, deselect it so we can + // edit the notes in the note edit area + if( selectionCount() == 1 ) + { + clearSelectedNotes(); + } } if( validPattern() == true )