fix dropzone region ordering
authorRobin Gareus <robin@gareus.org>
Wed, 25 Mar 2015 21:05:23 +0000 (22:05 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 25 Mar 2015 21:06:05 +0000 (22:06 +0100)
gtk2_ardour/editor_drag.cc

index 470a57ade2d2ed6421dbbac9e590ec5746903ef9..f2bb65b69569a21db3316293dabc7fae5c275b80 100644 (file)
@@ -756,6 +756,12 @@ RegionMotionDrag::y_movement_allowed (int delta_track, double delta_layer, int s
        return true;
 }
 
+struct DraggingViewSorter {
+       bool operator() (const DraggingView& a, const DraggingView& b) {
+               return a.time_axis_view < b.time_axis_view;
+       }
+};
+
 void
 RegionMotionDrag::motion (GdkEvent* event, bool first_move)
 {
@@ -940,6 +946,14 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
                }
        }
 
+       if (first_move) {
+               /* sort views by time_axis.
+                * This retains track order in the dropzone, regardless
+                * of actual selection order
+                */
+               _views.sort (DraggingViewSorter());
+       }
+
        for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
 
                RegionView* rv = i->view;