Prevent duplicate moves when selecting regions on shared playlists
authorRobin Gareus <robin@gareus.org>
Thu, 27 Oct 2016 01:32:59 +0000 (03:32 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 27 Oct 2016 01:33:51 +0000 (03:33 +0200)
selecting regions on multiple tracks which share playlists and
dragging them has various odd side-effects. This prevents the worst
of such edge-cases.

A cleaner solution would be to not allow selecting the same region
on multiple tracks at the same time in the first place.

Comments are welcome.

gtk2_ardour/editor_drag.cc

index 63b22bcc1457b50a9e0341bcf5c30c4023d88646..5ed00274dc194516910adbb0b377753cb79e2f80 100644 (file)
@@ -1529,6 +1529,7 @@ RegionMoveDrag::finished_no_copy (
        typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
        PlaylistMapping playlist_mapping;
 
+       std::set<boost::shared_ptr<const Region> > uniq;
        for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ) {
 
                RegionView* rv = i->view;
@@ -1539,6 +1540,13 @@ RegionMoveDrag::finished_no_copy (
                        continue;
                }
 
+               if (uniq.find (rv->region()) != uniq.end()) {
+                       /* prevent duplicate moves when selecting regions from shared playlists */
+                       ++i;
+                       continue;
+               }
+               uniq.insert(rv->region());
+
                if (i->time_axis_view < 0 || i->time_axis_view >= (int)_time_axis_views.size()) {
                        /* dragged to drop zone */