mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
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
3 changed files with 53 additions and 35 deletions
|
|
@ -4930,32 +4930,51 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find all regions which are either:
|
/** Get regions using the following conditions:
|
||||||
* - selected or
|
* If check_edit_position == false, then return the selected regions.
|
||||||
* - the entered_regionview (if allow_entered == true) or
|
* Otherwise:
|
||||||
* - under the preferred edit position AND on a selected track, or on a track
|
* 1. If the edit point is `mouse':
|
||||||
* which is in the same active edit-enable route group as a selected region (if allow_edit_position == true)
|
* 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 rs Returned region list.
|
||||||
* @param allow_entered true to include the entered_regionview in the list.
|
|
||||||
*/
|
*/
|
||||||
void
|
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 */
|
/* Start with selected regions */
|
||||||
rs = selection->regions;
|
rs = selection->regions;
|
||||||
|
|
||||||
/* Add the entered_regionview, if requested */
|
|
||||||
if (allow_entered && entered_regionview) {
|
|
||||||
rs.add (entered_regionview);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allow_edit_position) {
|
|
||||||
|
|
||||||
TrackViewList tracks = selection->tracks;
|
TrackViewList tracks = selection->tracks;
|
||||||
|
|
||||||
/* tracks is currently the set of selected tracks; add any other tracks that
|
/* 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
|
have regions that are in the same edit-activated route group as one of
|
||||||
* our regions */
|
our regions.
|
||||||
|
*/
|
||||||
for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) {
|
for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) {
|
||||||
|
|
||||||
RouteGroup* g = (*i)->get_time_axis_view().route_group ();
|
RouteGroup* g = (*i)->get_time_axis_view().route_group ();
|
||||||
|
|
@ -4971,7 +4990,6 @@ Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered, bool al
|
||||||
get_regions_at (rs, where, tracks);
|
get_regions_at (rs, where, tracks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<RegionView*>& regions)
|
Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<RegionView*>& regions)
|
||||||
|
|
|
||||||
|
|
@ -1993,7 +1993,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
|
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_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 start_updating_meters ();
|
||||||
void stop_updating_meters ();
|
void stop_updating_meters ();
|
||||||
|
|
|
||||||
|
|
@ -3881,7 +3881,7 @@ Editor::cut_copy (CutCopyOp op)
|
||||||
/* we only want to cut regions if some are selected */
|
/* we only want to cut regions if some are selected */
|
||||||
|
|
||||||
if (!selection->regions.empty()) {
|
if (!selection->regions.empty()) {
|
||||||
get_regions_for_action (rs, false, false);
|
get_regions_for_action (rs, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (current_mouse_mode()) {
|
switch (current_mouse_mode()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue