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 r) const return 0; } +MixerStrip* +Mixer_UI::strip_by_stripable (boost::shared_ptr s) const +{ + for (list::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 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::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) const; + MixerStrip* strip_by_stripable (boost::shared_ptr) const; AxisView* axis_by_stripable (boost::shared_ptr) const; void hide_all_strips (bool with_select);