From 22ec15f2d738388aba55b116cbbd836bdf43fb70 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Fri, 21 Nov 2014 14:41:31 +0100 Subject: [PATCH] PianoRoll arrow key behaviour tweaks * Ctrl + Left/Right moves selected notes by one bar (Old behaviour was to move the playnote) Closes #811 * Shift + Up/Down moves selected nodes by one semitone (Old behaviour was to ignore the Shift key and move the viewport) Closes #810 --- src/gui/PianoRoll.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index 468631896..1444389b9 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -1232,6 +1232,11 @@ void PianoRoll::keyPressEvent( QKeyEvent* event ) // if nothing selected, shift _everything_ shiftSemiTone( +12 ); } + else if((event->modifiers() & Qt::ShiftModifier) && m_action == ActionNone) + { + // Move selected notes up by one semitone + shiftSemiTone( 1 ); + } else { // scroll @@ -1259,6 +1264,11 @@ void PianoRoll::keyPressEvent( QKeyEvent* event ) // if nothing selected, shift _everything_ shiftSemiTone( -12 ); } + else if((event->modifiers() & Qt::ShiftModifier) && m_action == ActionNone) + { + // Move selected notes down by one semitone + shiftSemiTone( -1 ); + } else { // scroll @@ -1282,12 +1292,8 @@ void PianoRoll::keyPressEvent( QKeyEvent* event ) case Qt::Key_Left: if( event->modifiers() & Qt::ControlModifier && m_action == ActionNone ) { - // move time ticker - if( ( m_timeLine->pos() -= 16 ) < 0 ) - { - m_timeLine->pos().setTicks( 0 ); - } - m_timeLine->updatePosition(); + // Move selected notes by one bar to the left + shiftPos( - MidiTime::ticksPerTact() ); } else if( event->modifiers() & Qt::ShiftModifier && m_action == ActionNone) { @@ -1320,9 +1326,8 @@ void PianoRoll::keyPressEvent( QKeyEvent* event ) case Qt::Key_Right: if( event->modifiers() & Qt::ControlModifier && m_action == ActionNone) { - // move time ticker - m_timeLine->pos() += 16; - m_timeLine->updatePosition(); + // Move selected notes by one bar to the right + shiftPos( MidiTime::ticksPerTact() ); } else if( event->modifiers() & Qt::ShiftModifier && m_action == ActionNone) {