diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 5875fffbfa..6e37868aa3 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1231,8 +1231,6 @@ Editor::select_all_in_track (Selection::Operation op) void Editor::select_all_internal_edit (Selection::Operation) { - /* currently limited to MIDI only */ - for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { MidiRegionView* mrv = dynamic_cast(*i); if (mrv) { @@ -1274,6 +1272,7 @@ Editor::select_all (Selection::Operation op) } commit_reversible_command (); } + void Editor::invert_selection_in_track () { @@ -1292,6 +1291,16 @@ Editor::invert_selection () { list touched; + if (_internal_editing) { + for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { + MidiRegionView* mrv = dynamic_cast(*i); + if (mrv) { + mrv->invert_selection (); + } + } + return; + } + for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { if ((*iter)->hidden()) { continue; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index b79d97d746..50eda1023b 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2027,6 +2027,18 @@ MidiRegionView::select_all_notes () } } +void +MidiRegionView::invert_selection () +{ + for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { + if ((*i)->selected()) { + remove_from_selection(*i); + } else { + add_to_selection (*i); + } + } +} + void MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend) { diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index a878aa13dd..38cd703a98 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -192,6 +192,7 @@ public: void delete_note (boost::shared_ptr); size_t selection_size() { return _selection.size(); } void select_all_notes (); + void invert_selection (); void move_selection(double dx, double dy, double cumulative_dy); void note_dropped (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::frameoffset_t, int8_t d_note);