MIDI editing: clean up logic for ::note_selected()

The behavior should be the same but the logical intent of the code is now more
obvious.
This commit is contained in:
Paul Davis 2022-04-17 22:17:09 -06:00
parent 948fc52c5c
commit e01452c6a6

View File

@ -2440,17 +2440,15 @@ MidiRegionView::toggle_matching_notes (uint8_t notenum, uint16_t channel_mask)
void
MidiRegionView::note_selected (NoteBase* ev, bool add, bool extend)
{
if (!add) {
clear_selection_internal ();
add_to_selection (ev);
}
if (!extend) {
if (!ev->selected()) {
add_to_selection (ev);
if (!add) {
clear_selection_internal ();
}
add_to_selection (ev);
return;
} else {
/* find end of latest note selected, select all between that and the start of "ev" */