Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation for my preferred behavior, since code might be easier to interpret than my explanation 😅

Suggested change
newLength = qMax(alt ? 1 : quantization(), newLength);
if (newLength <= 0) { newLength = quantization(); }

Or if you prefer

Suggested change
newLength = qMax(alt ? 1 : quantization(), newLength);
newLength = (newLength > 0) ? newLength : quantization();

Copy link
Contributor Author

@zonkmachine zonkmachine May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's elegant! I prefer the <Alt> key in there somewhere. You can skip quantization when changing the length of the note with the <Alt> key so I would prefer:

if (newLength <= 0){ newLength = alt ? 1 : quantization(); }

If you change that I'll commit it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like so? :)

Suggested change
newLength = qMax(alt ? 1 : quantization(), newLength);
if (newLength <= 0) { newLength = alt ? 1 : quantization(); }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder that newLength = alt is not a boolean operation, but an assignment one. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We're assigning either the quantized value or if overriding with Alt key, 1. Then you can still set the note to any length if you want.

Copy link
Contributor

@Veratil Veratil May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay! Wanted to make sure since tertiary operator can be confusing sometimes.
EDIT: To quick glance that is. 😁 Looked like newLength == alt ? ... when I saw it.

note->setLength(MidiTime(newLength));

m_lenOfNewNotes = note->length();
}
Expand Down