diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-26 18:22:39 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-26 18:24:56 +0100 |
commit | 7cd70e0c916fe34a03ef65d287eb7447419d83c3 (patch) | |
tree | b771a8faa4be3a1d6035564bd1c8b06b6cc944bb /gtk2_ardour/editor_selection.cc | |
parent | f64441aa58ce5b17e2665be355b940633fde3c81 (diff) |
make sure that when extending the selection in the editor and mixer, the clicked-upon track gets set_selected() called last
This makes it be the "first" selected strip for control surfaces and the editor mixer
Diffstat (limited to 'gtk2_ardour/editor_selection.cc')
-rw-r--r-- | gtk2_ardour/editor_selection.cc | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 1c065289c6..f0ba5916d7 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -89,10 +89,6 @@ Editor::extend_selection_to_track (TimeAxisView& view) sorted.sort (cmp); - if (!selection->selected (&view)) { - to_be_added.push_back (&view); - } - /* figure out if we should go forward or backwards */ for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) { @@ -158,6 +154,10 @@ Editor::extend_selection_to_track (TimeAxisView& view) } } + if (!selection->selected (&view)) { + to_be_added.push_back (&view); + } + if (!to_be_added.empty()) { selection->add (to_be_added); return true; @@ -981,19 +981,33 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* /*ev*/, StreamView* return true; } +struct SelectionOrderSorter { + bool operator() (TimeAxisView const * const a, TimeAxisView const * const b) const { + boost::shared_ptr<Stripable> sa = a->stripable (); + boost::shared_ptr<Stripable> sb = b->stripable (); + if (!sa && !sb) { + return a < b; + } + if (!sa) { + return false; + } + if (!sb) { + return true; + } + return sa->presentation_info().selection_cnt() < sb->presentation_info().selection_cnt(); + } +}; + void Editor::track_selection_changed () { + SelectionOrderSorter cmp; + selection->tracks.sort (cmp); + switch (selection->tracks.size()) { case 0: break; default: - /* last element in selection list is the most recently - * selected, because we always append to that list. - */ - cerr << "setting selected mixer strip to " - << selection->tracks.back()->name() - << endl; set_selected_mixer_strip (*(selection->tracks.back())); if (!_track_selection_change_without_scroll) { ensure_time_axis_view_is_visible (*(selection->tracks.back()), false); |