summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-05-27 19:36:27 +0000
committerCarl Hetherington <carl@carlh.net>2012-05-27 19:36:27 +0000
commitd33c0d96fb1a44fe25115ab668495be8c712395e (patch)
tree0a8b98b66816931cda06f4e055ea93c31a3d4d29 /gtk2_ardour
parentbdfd71602f7fb6b19985b457e9cd8e8ae5307ad7 (diff)
Patch from colinf to avoid splitting unselected regions
on the same track as a selected region; also make no selection = all tracks button work (#4831). git-svn-id: svn://localhost/ardour2/branches/3.0@12459 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc53
1 files changed, 35 insertions, 18 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index d19359a0f3..573303825b 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -4526,16 +4526,15 @@ Editor::get_regions_from_selection ()
* the edit point is `mouse' and the mouse is over an unselected
* region. In this case, start with just that region.
*
- * Then, make an initial track list of the tracks that these
- * regions are on, and if the edit point is not `mouse', add the
- * selected tracks.
+ * Then, add equivalent regions in active edit groups to the region list.
*
- * Look at this track list and add any other tracks that are on the
- * same active edit-enabled route group as one of the initial tracks.
+ * Then, search the list of selected tracks to find any selected tracks which
+ * do not contain regions already in the region list. If there are no selected
+ * tracks and 'No Selection = All Tracks' is active, search all tracks rather
+ * than just the selected.
*
- * Finally take the initial region list and add any regions that are
- * under the edit point on one of the tracks on the track list to get
- * the returned region list.
+ * Add any regions that are under the edit point on these tracks to get the
+ * returned region list.
*
* The rationale here is that the mouse edit point is special in that
* its position describes both a time and a track; the other edit
@@ -4563,22 +4562,40 @@ Editor::get_regions_from_selection_and_edit_point ()
tracks = selection->tracks;
}
- /* Add any other tracks that have regions that are in the same
+ /* Add any other regions that are in the same
edit-activated route group as one of our regions.
*/
- for (RegionSelection::iterator i = regions.begin (); i != regions.end(); ++i) {
+ regions = get_equivalent_regions (regions, ARDOUR::Properties::edit.property_id);
+ framepos_t const where = get_preferred_edit_position ();
- RouteGroup* g = (*i)->get_time_axis_view().route_group ();
-
- if (g && g->is_active() && g->is_edit()) {
- tracks.add (axis_views_from_routes (g->route_list()));
- }
+ if (_route_groups->all_group_active_button().get_active() && tracks.empty()) {
+ /* tracks is empty (no track selected), and 'No Selection = All Tracks'
+ * is enabled, so consider all tracks
+ */
+ tracks = track_views;
}
if (!tracks.empty()) {
- /* now find regions that are at the edit position on those tracks */
- framepos_t const where = get_preferred_edit_position ();
- get_regions_at (regions, where, tracks);
+ /* now search the selected tracks for tracks which don't
+ already contain regions to be acted upon, and get regions at
+ the edit point on those tracks too.
+ */
+ TrackViewList tracks_without_relevant_regions;
+
+ for (TrackViewList::iterator t = tracks.begin (); t != tracks.end (); ++t) {
+ if (!regions.involves (**t)) {
+ /* there are no equivalent regions on this track */
+ tracks_without_relevant_regions.push_back (*t);
+ }
+ }
+
+ if (!tracks_without_relevant_regions.empty()) {
+ /* there are some selected tracks with neither selected
+ * regions or their equivalents: act upon all regions in
+ * those tracks
+ */
+ get_regions_at (regions, where, tracks_without_relevant_regions);
+ }
}
return regions;