From 875c66458d7e809c7e96dfd6031214343264b318 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 12 Aug 2019 04:49:31 +0200 Subject: [PATCH] Fix middle-click note selection --- gtk2_ardour/midi_time_axis.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 1ea54f2a18..9ddcb5422a 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1360,13 +1360,19 @@ MidiTimeAxisView::set_note_selection (uint8_t note) _editor.begin_reversible_selection_op (X_("Set Note Selection")); + /* set_note_selection_region_view() will not work with multiple regions, + * as each individual `foreach` call will clear prior selection. + * Use clear_midi_notes() and add_note_selection_region_view() instead. */ + + _editor.get_selection().clear_midi_notes(); + if (_view->num_selected_regionviews() == 0) { _view->foreach_regionview ( - sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_selection_region_view), + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::add_note_selection_region_view), note, chn_mask)); } else { _view->foreach_selected_regionview ( - sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_selection_region_view), + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::add_note_selection_region_view), note, chn_mask)); }