summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2014-11-18 13:58:37 +0000
committerColin Fletcher <colin.m.fletcher@googlemail.com>2014-12-19 17:12:04 +0000
commit182312640875719981999a7ed08e2d5b7506e0a0 (patch)
treec75dc9b500e1dbe013cae2ca42db12b4a73f9511 /gtk2_ardour/editor_ops.cc
parentd4a31419273d55a5de8845308076c61d2a612cf7 (diff)
Implement configurable region selection after split
Implement the configured behaviour of region selection after split.
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index c09bbcceb8..221a1f7254 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -241,12 +241,35 @@ Editor::split_regions_at (framepos_t where, RegionSelection& regions)
EditorThaw(); /* Emit Signal */
}
- if (ARDOUR::Profile->get_mixbus()) {
- //IFF we were working on selected regions, try to reinstate the other region selections that existed before the freeze/thaw.
- _ignore_follow_edits = true; //a split will change the region selection in mysterious ways; its not practical or wanted to follow this edit
- if( working_on_selection ) {
+ if (working_on_selection) {
+ // IFF we were working on selected regions, try to reinstate the other region selections that existed before the freeze/thaw.
+
+ _ignore_follow_edits = true; // a split will change the region selection in mysterious ways; it's not practical or wanted to follow this edit
+ RegionSelectionAfterSplit rsas = Config->get_region_selection_after_split();
+ /* There are three classes of regions that we might want selected after
+ splitting selected regions:
+ - regions selected before the split operation, and unaffected by it
+ - newly-created regions before the split
+ - newly-created regions after the split
+ */
+
+ if (rsas & Existing) {
+ // region selections that existed before the split.
selection->add ( pre_selected_regions );
- selection->add (latest_regionviews); //these are the new regions created after the split
+ }
+
+ for (RegionSelection::iterator ri = latest_regionviews.begin(); ri != latest_regionviews.end(); ri++) {
+ if ((*ri)->region()->position() < where) {
+ // new regions created before the split
+ if (rsas & NewlyCreatedLeft) {
+ selection->add (*ri);
+ }
+ } else {
+ // new regions created after the split
+ if (rsas & NewlyCreatedRight) {
+ selection->add (*ri);
+ }
+ }
}
_ignore_follow_edits = false;
} else {