summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-02-09 10:50:54 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-02-09 11:03:03 -0500
commitabcd70c1d2a48c2af9ec49dfc46b264cc07370e2 (patch)
treeae6705cbed28481ef7435a7ce3e47a3d1c5f573f /gtk2_ardour/editor_drag.cc
parentb1dafe9a3173e1c0dd437e7b895e09993f37ba9e (diff)
After dragging from multiple tracks to the dropzone, create the right number of new tracks.
This does not address the visual flattening that occurs before the drop is complete. Doing that is complex and there is no immediate solution visible. The result after the drop is complete is correct, however. Conflicts: gtk2_ardour/editor_drag.cc
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc58
1 files changed, 50 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 1161d61339..13b1e833f9 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1053,6 +1053,15 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
return;
}
+ if (_x_constrained) {
+ _editor->begin_reversible_command (Operations::fixed_time_region_copy);
+ } else {
+ _editor->begin_reversible_command (Operations::region_copy);
+ }
+
+ typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
+ PlaylistMapping playlist_mapping;
+
/* insert the regions into their new playlists */
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end();) {
@@ -1069,13 +1078,23 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
} else {
where = i->view->region()->position();
}
-
+
if (i->time_axis_view < 0) {
- if (!new_time_axis_view) {
+ /* dragged to drop zone */
+
+ PlaylistMapping::iterator pm;
+
+ if ((pm = playlist_mapping.find (i->view->region()->playlist())) == playlist_mapping.end()) {
+ /* first region from this original playlist: create a new track */
new_time_axis_view = create_destination_time_axis (i->view->region(), i->initial_time_axis_view);
+ playlist_mapping.insert (make_pair (i->view->region()->playlist(), new_time_axis_view));
+ dest_rtv = new_time_axis_view;
+ } else {
+ /* we already created a new track for regions from this playlist, use it */
+ dest_rtv = pm->second;
}
- dest_rtv = new_time_axis_view;
} else {
+ /* destination time axis view is the one we dragged to */
dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[i->time_axis_view]);
}
@@ -1129,6 +1148,18 @@ RegionMoveDrag::finished_no_copy (
return;
}
+<<<<<<< HEAD
+=======
+ if (_x_constrained) {
+ _editor->begin_reversible_command (_("fixed time region drag"));
+ } else {
+ _editor->begin_reversible_command (Operations::region_drag);
+ }
+
+ typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
+ PlaylistMapping playlist_mapping;
+
+>>>>>>> 1faf1a1... After dragging from multiple tracks to the dropzone, create the right number of new tracks.
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ) {
RegionView* rv = i->view;
@@ -1140,14 +1171,25 @@ RegionMoveDrag::finished_no_copy (
}
if (i->time_axis_view < 0) {
- if (!new_time_axis_view) {
- new_time_axis_view = create_destination_time_axis (rv->region(), i->initial_time_axis_view);
+ /* dragged to drop zone */
+
+ PlaylistMapping::iterator pm;
+
+ if ((pm = playlist_mapping.find (i->view->region()->playlist())) == playlist_mapping.end()) {
+ /* first region from this original playlist: create a new track */
+ new_time_axis_view = create_destination_time_axis (i->view->region(), i->initial_time_axis_view);
+ playlist_mapping.insert (make_pair (i->view->region()->playlist(), new_time_axis_view));
+ dest_rtv = new_time_axis_view;
+ } else {
+ /* we already created a new track for regions from this playlist, use it */
+ dest_rtv = pm->second;
}
- dest_rtv = new_time_axis_view;
+
} else {
+ /* destination time axis view is the one we dragged to */
dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[i->time_axis_view]);
- }
-
+ }
+
assert (dest_rtv);
double const dest_layer = i->layer;