From 8556560eca218c58d9de29b562e1f82065b2acad Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 1 May 2020 22:27:50 -0600 Subject: [PATCH] change design of MidiRegionView::add_to_selection() so that the rubber-band select works again Adding the first note trigged Editor::set_selected_midi_region_view() which cleared the (newly added to) selection --- gtk2_ardour/midi_region_view.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 63a3fd6b87..ec0dd6a76d 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2440,14 +2440,14 @@ MidiRegionView::remove_from_selection (NoteBase* ev) void MidiRegionView::add_to_selection (NoteBase* ev) { - const bool selection_was_empty = _selection.empty(); + Selection::iterator n = _selection.find (ev); - if (_selection.insert (ev).second) { - ev->set_selected (true); - start_playing_midi_note ((ev)->note()); + if (n != _selection.end()) { + /* already selected */ + return; } - if (selection_was_empty) { + if (_selection.empty()) { /* first note selected in this region, force Editor region * selection to this region. @@ -2455,6 +2455,10 @@ MidiRegionView::add_to_selection (NoteBase* ev) trackview.editor().set_selected_midi_region_view (*this); } + + _selection.insert (n, ev); + ev->set_selected (true); + start_playing_midi_note ((ev)->note()); } Temporal::Beats