From 1d8548306be536e6c82a179bc38c8f8dbd12a700 Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 21 Jun 2017 23:02:52 +1000 Subject: Cropping a single region to time selection works for multiple ranges Should fix 7285. --- gtk2_ardour/editor_ops.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 512648993c..c8a778f5ad 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3369,15 +3369,22 @@ Editor::crop_region_to_selection () { if (!selection->time.empty()) { - crop_region_to (selection->time.start(), selection->time.end_frame()); - + begin_reversible_command (_("Crop Regions to Time Selection")); + for (std::list::iterator i = selection->time.begin(); i != selection->time.end(); ++i) { + crop_region_to ((*i).start, (*i).end); + } + commit_reversible_command(); } else { framepos_t start; framepos_t end; if (get_edit_op_range (start, end)) { + begin_reversible_command (_("Crop Regions to Edit Range")); + crop_region_to (start, end); + + commit_reversible_command(); } } @@ -3424,7 +3431,6 @@ Editor::crop_region_to (framepos_t start, framepos_t end) framepos_t new_start; framepos_t new_end; framecnt_t new_length; - bool in_command = false; for (vector >::iterator i = playlists.begin(); i != playlists.end(); ++i) { @@ -3454,19 +3460,11 @@ Editor::crop_region_to (framepos_t start, framepos_t end) new_end = min (end, new_end); new_length = new_end - new_start + 1; - if(!in_command) { - begin_reversible_command (_("trim to selection")); - in_command = true; - } (*i)->clear_changes (); (*i)->trim_to (new_start, new_length); _session->add_command (new StatefulDiffCommand (*i)); } } - - if (in_command) { - commit_reversible_command (); - } } void -- cgit v1.2.3