summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-01-27 23:18:06 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-01-28 12:25:16 +1000
commit45e8bda65f691b0ea876eb9f186b95a381d628ef (patch)
treeb9e6884102aee800089c2db79a617f34dbd49998
parente6a33b818fcce16d40e4eea96641591f19f60488 (diff)
Change duplicate range to use time range/s rather than a single region
This should fix bugs #4980, #4984, #4986 and #6579
-rw-r--r--gtk2_ardour/editor_ops.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 55d38f3a88..df87b3de69 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -4811,18 +4811,9 @@ Editor::duplicate_selection (float times)
}
boost::shared_ptr<Playlist> playlist;
- vector<boost::shared_ptr<Region> > new_regions;
- vector<boost::shared_ptr<Region> >::iterator ri;
-
- create_region_from_selection (new_regions);
-
- if (new_regions.empty()) {
- return;
- }
-
- ri = new_regions.begin();
TrackViewList ts = selection->tracks.filter_to_unique_playlists ();
+
bool in_command = false;
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
@@ -4830,27 +4821,34 @@ Editor::duplicate_selection (float times)
continue;
}
playlist->clear_changes ();
- framepos_t end;
+
if (clicked_selection) {
- end = selection->time[clicked_selection].end;
+ playlist->duplicate_range (selection->time[clicked_selection], times);
} else {
- end = selection->time.end_frame();
+ playlist->duplicate_ranges (selection->time, times);
}
- playlist->duplicate (*ri, end + 1, times);
if (!in_command) {
- begin_reversible_command (_("duplicate selection"));
+ begin_reversible_command (_("duplicate range selection"));
in_command = true;
}
_session->add_command (new StatefulDiffCommand (playlist));
- ++ri;
- if (ri == new_regions.end()) {
- --ri;
- }
}
if (in_command) {
+ // now "move" range selection to after the current range selection
+ framecnt_t distance = 0;
+
+ if (clicked_selection) {
+ distance = selection->time[clicked_selection].end -
+ selection->time[clicked_selection].start;
+ } else {
+ distance = selection->time.end_frame() - selection->time.start();
+ }
+
+ selection->move_time (distance);
+
commit_reversible_command ();
}
}