Modify get_regions_for_action to fix #2960. Rationale is in the comment for that method. This method is used a lot, so this commit may have unwanted side-effects.
git-svn-id: svn://localhost/ardour2/branches/3.0@7908 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
326d227323
commit
ec52182f30
@ -4930,46 +4930,64 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
|
||||
}
|
||||
}
|
||||
|
||||
/** Find all regions which are either:
|
||||
* - selected or
|
||||
* - the entered_regionview (if allow_entered == true) or
|
||||
* - under the preferred edit position AND on a selected track, or on a track
|
||||
* which is in the same active edit-enable route group as a selected region (if allow_edit_position == true)
|
||||
/** Get regions using the following conditions:
|
||||
* If check_edit_position == false, then return the selected regions.
|
||||
* Otherwise:
|
||||
* 1. If the edit point is `mouse':
|
||||
* if the mouse is over a selected region, or no region, return all selected regions.
|
||||
* if the mouse is over an unselected region, return just that region.
|
||||
* 2. For all other edit points:
|
||||
* return the selected regions AND those that are both under the edit position
|
||||
* AND on a selected track, or on a track which is in the same active edit-enabled route group
|
||||
* as a selected region.
|
||||
*
|
||||
* 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 modes only describe a time.
|
||||
*
|
||||
* @param rs Returned region list.
|
||||
* @param allow_entered true to include the entered_regionview in the list.
|
||||
*/
|
||||
void
|
||||
Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered, bool allow_edit_position)
|
||||
Editor::get_regions_for_action (RegionSelection& rs, bool check_edit_point)
|
||||
{
|
||||
if (!check_edit_point) {
|
||||
rs = selection->regions;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_edit_point == EditAtMouse) {
|
||||
if (entered_regionview == 0 || selection->regions.contains (entered_regionview)) {
|
||||
rs = selection->regions;
|
||||
return;
|
||||
} else {
|
||||
rs.add (entered_regionview);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* We're using the edit point, but its not EditAtMouse */
|
||||
|
||||
/* Start with selected regions */
|
||||
rs = selection->regions;
|
||||
|
||||
/* Add the entered_regionview, if requested */
|
||||
if (allow_entered && entered_regionview) {
|
||||
rs.add (entered_regionview);
|
||||
TrackViewList tracks = selection->tracks;
|
||||
|
||||
/* Tracks is currently the set of selected tracks; add any other tracks that
|
||||
have regions that are in the same edit-activated route group as one of
|
||||
our regions.
|
||||
*/
|
||||
for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) {
|
||||
|
||||
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 (allow_edit_position) {
|
||||
|
||||
TrackViewList tracks = selection->tracks;
|
||||
|
||||
/* tracks is currently the set of selected tracks; add any other tracks that
|
||||
* have regions that are in the same edit-activated route group as one of
|
||||
* our regions */
|
||||
for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) {
|
||||
|
||||
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 (!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 (rs, where, tracks);
|
||||
}
|
||||
|
||||
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 (rs, where, tracks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1993,8 +1993,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
|
||||
void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
|
||||
|
||||
void get_regions_for_action (RegionSelection&, bool allow_entered = false, bool allow_edit_position = true);
|
||||
|
||||
void get_regions_for_action (RegionSelection&, bool check_edit_point = true);
|
||||
|
||||
void start_updating_meters ();
|
||||
void stop_updating_meters ();
|
||||
bool meters_running;
|
||||
|
@ -3881,7 +3881,7 @@ Editor::cut_copy (CutCopyOp op)
|
||||
/* we only want to cut regions if some are selected */
|
||||
|
||||
if (!selection->regions.empty()) {
|
||||
get_regions_for_action (rs, false, false);
|
||||
get_regions_for_action (rs, false);
|
||||
}
|
||||
|
||||
switch (current_mouse_mode()) {
|
||||
|
Loading…
Reference in New Issue
Block a user