From 65f7a6a9388d8462a08dd8da7a218baca099649f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 16 Apr 2020 12:16:45 -0600 Subject: changes to deal with region/note selection when changing into/out of internal edit mode Also, activate MIDI editing actions so that they are effective in internal edit mode --- gtk2_ardour/editor_selection.cc | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/editor_selection.cc') diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index fa67ea4ab1..e8326ae643 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -49,6 +49,7 @@ #include "control_point.h" #include "editor_regions.h" #include "editor_cursors.h" +#include "keyboard.h" #include "midi_region_view.h" #include "sfdb_ui.h" @@ -1618,8 +1619,8 @@ Editor::region_selection_changed () //there are a few global Editor->Select actions which select regions even if you aren't in Object mode. //if regions are selected, we must always force the mouse mode to Object... //... otherwise the user is confusingly left with selected regions that can't be manipulated. - if (!selection->regions.empty()) { - set_mouse_mode( MouseObject, false ); + if (!selection->regions.empty() && !internal_editing()) { + set_mouse_mode (MouseObject, false); } } @@ -1746,7 +1747,8 @@ Editor::invert_selection () { if (internal_editing()) { - for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) { + MidiRegionSelection ms = selection->midi_regions(); + for (MidiRegionSelection::iterator i = ms.begin(); i != ms.end(); ++i) { MidiRegionView* mrv = dynamic_cast(*i); if (mrv) { mrv->invert_selection (); @@ -2217,3 +2219,26 @@ Editor::select_range (samplepos_t s, samplepos_t e) commit_reversible_selection_op (); return ret; } + +void +Editor::catch_up_on_midi_selection () +{ + RegionSelection regions; + + for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { + if ((*iter)->hidden()) { + continue; + } + + MidiTimeAxisView* matv = dynamic_cast (*iter); + if (!matv) { + continue; + } + + matv->get_regions_with_selected_data (regions); + } + + if (!regions.empty()) { + selection->set (regions); + } +} -- cgit v1.2.3