From 45e8bda65f691b0ea876eb9f186b95a381d628ef Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Wed, 27 Jan 2016 23:18:06 +1000 Subject: Change duplicate range to use time range/s rather than a single region This should fix bugs #4980, #4984, #4986 and #6579 --- gtk2_ardour/editor_ops.cc | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'gtk2_ardour') 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; - vector > new_regions; - vector >::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 (); } } -- cgit v1.2.3