Fix mixer continuous multi-selection
authorRobin Gareus <robin@gareus.org>
Thu, 26 Jan 2017 13:08:58 +0000 (14:08 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 26 Jan 2017 13:08:58 +0000 (14:08 +0100)
Shift+select needs to iterate over strips as they are visually ordered.
(Previously the order of adding/loading strips was used)

gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index 766f39ddf3b4010bd2c6cc68c1c7e4703aef40b7..00a351d60e1d03ab4045d97a1f1d4b1d9a05b447 100644 (file)
@@ -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);
                                                }
                                        }
                                }
index 27a5575f77f9ad7c01287b622e8d6e2e52a8f3cd..8e5bbddfd0eb67e09a1db1657b9fcab02799cbbb 100644 (file)
@@ -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);