From aa08c52a321f682697b9b0ac55346aa32c36c253 Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Wed, 22 Nov 2017 02:16:12 +0100 Subject: [PATCH 1/3] Limit note length to quantization value Draging a note to it's minimum value of 1 will add this new length to the note if you later choose to stretch it which will not be clearly visible in the Piano Roll unless you zoom in a bit. Limit the note length to the quantization value and use key to override and set a smaller value. --- src/gui/editors/PianoRoll.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 0eb5df16343..d9c14256cdf 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -2811,8 +2811,8 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) if (note->selected()) { int newLength = note->oldLength() + off_ticks; - newLength = qMax(1, newLength); - note->setLength( MidiTime(newLength) ); + newLength = qMax(alt ? 1 : quantization(), newLength); + note->setLength(MidiTime(newLength)); m_lenOfNewNotes = note->length(); } From 54e4bc53cb75f9516aaed4c1e76c48eef817a53c Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Mon, 11 May 2020 21:40:55 +0200 Subject: [PATCH 2/3] Update src/gui/editors/PianoRoll.cpp Co-authored-by: Spekular --- src/gui/editors/PianoRoll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index d9c14256cdf..6d6c4ba3696 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -2811,7 +2811,7 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) if (note->selected()) { int newLength = note->oldLength() + off_ticks; - newLength = qMax(alt ? 1 : quantization(), newLength); + if (newLength <= 0) { newLength = alt ? 1 : quantization(); } note->setLength(MidiTime(newLength)); m_lenOfNewNotes = note->length(); From cb01991211606db8780eed53f14d61d0136b51ad Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Wed, 13 May 2020 23:25:20 +0200 Subject: [PATCH 3/3] Remember min note length if shorter than quantization() --- src/gui/editors/PianoRoll.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 6d6c4ba3696..33f9dae74ff 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -2810,8 +2810,10 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) { if (note->selected()) { - int newLength = note->oldLength() + off_ticks; - if (newLength <= 0) { newLength = alt ? 1 : quantization(); } + int oldLength = note->oldLength(); + int newLength = oldLength + off_ticks; + int minLength = qMin(oldLength,quantization()); + newLength = qMax(alt ? 1 : minLength, newLength); note->setLength(MidiTime(newLength)); m_lenOfNewNotes = note->length();