diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-26 14:08:58 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-26 14:08:58 +0100 |
commit | 7ef09f98ffefb8ac3b8b835d7d0fe64dfa9a0f13 (patch) | |
tree | 921a5c26568d63c31b63e673ad7c1052f09e5d9e | |
parent | 6de15a79cfc9f9156700e2fe84287a5abe4f9893 (diff) |
Fix mixer continuous multi-selection
Shift+select needs to iterate over strips as they are visually ordered.
(Previously the order of adding/loading strips was used)
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 1 |
2 files changed, 27 insertions, 3 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 766f39ddf3..00a351d60e 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -874,6 +874,18 @@ Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) const return 0; } +MixerStrip* +Mixer_UI::strip_by_stripable (boost::shared_ptr<Stripable> s) const +{ + for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->stripable() == s) { + return (*i); + } + } + + return 0; +} + AxisView* Mixer_UI::axis_by_stripable (boost::shared_ptr<Stripable> s) const { @@ -911,8 +923,19 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) tmp.push_back (strip); + OrderingKeys sorted; + const size_t cmp_max = strips.size (); for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) { - if ((*i) == strip) { + sorted.push_back (OrderKeys (-1, (*i)->stripable(), cmp_max)); + } + SortByNewDisplayOrder cmp; + sort (sorted.begin(), sorted.end(), cmp); + + for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr) { + MixerStrip* ms = strip_by_stripable (sr->stripable); + assert (ms); + + if (ms == strip) { /* hit clicked strip, start accumulating till we hit the first selected strip */ @@ -922,7 +945,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) } else { accumulate = true; } - } else if (_selection.selected (*i)) { + } else if (_selection.selected (ms)) { /* hit selected strip. if currently accumulating others, we're done. if not accumulating others, start doing so. */ @@ -935,7 +958,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) } } else { if (accumulate) { - tmp.push_back (*i); + tmp.push_back (ms); } } } diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 27a5575f77..8e5bbddfd0 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -187,6 +187,7 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p void remove_master (VCAMasterStrip*); MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const; + MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const; AxisView* axis_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const; void hide_all_strips (bool with_select); |