From 31ffc2aa85dd2fda2daa9981e8fb84626e0554a1 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 8 Jul 2014 14:16:13 -0500 Subject: [PATCH] fix thinko with split selections. also ignore follow_edits when we are splitting, because the playlist freeze and the newly added regions cause the playhead to jump to unexpected locations --- gtk2_ardour/editor.cc | 2 ++ gtk2_ardour/editor.h | 2 ++ gtk2_ardour/editor_ops.cc | 15 +++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 1a13a4e5bf..595d49afb9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -752,6 +752,8 @@ Editor::Editor () _last_region_menu_was_main = false; _popup_region_menu_item = 0; + _ignore_follow_edits = false; + _show_marker_lines = false; /* Button bindings */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e81d7cec3f..06c39307ae 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1730,6 +1730,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void point_selection_changed (); void marker_selection_changed (); + bool _ignore_follow_edits; + void cancel_selection (); void cancel_time_selection (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 62d39bfed4..7778087ea4 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -135,7 +135,8 @@ Editor::split_regions_at (framepos_t where, RegionSelection& regions) bool frozen = false; RegionSelection pre_selected_regions = selection->regions; - + bool working_on_selection = !pre_selected_regions.empty(); + list > used_playlists; list used_trackviews; @@ -235,11 +236,13 @@ Editor::split_regions_at (framepos_t where, RegionSelection& regions) EditorThaw(); /* Emit Signal */ } - //IFF we were working on selected regions, then we should select both sides of the new region after the split. - if( !pre_selected_regions.empty() ) { - selection->add (latest_regionviews); //these are the new regions, created after the split - selection->add (pre_selected_regions); //these were the old selected regions, they got lost in the freeze/thaw + //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 ) { + selection->add ( pre_selected_regions ); + selection->add (latest_regionviews); //these are the new regions created after the split } + _ignore_follow_edits = false; } @@ -2295,7 +2298,7 @@ Editor::get_preroll () void Editor::maybe_locate_with_edit_preroll ( framepos_t location ) { - if ( _session->transport_rolling() || !Config->get_follow_edits() ) + if ( _session->transport_rolling() || !Config->get_follow_edits() || _ignore_follow_edits ) return; location -= get_preroll();