do NOT remove tracks from selection during drag selection on the basis of geometry alone.

Membership of select-enabled route groups matters too.
This commit is contained in:
Paul Davis 2017-02-08 17:40:27 +01:00
parent 62995bd38d
commit 234ea15499
1 changed files with 29 additions and 0 deletions

View File

@ -5226,11 +5226,17 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
//( NOTE: most mouse moves don't change the selection so we can't just SET it for every mouse move; it gets clunky )
TrackViewList tracks_to_add;
TrackViewList tracks_to_remove;
vector<RouteGroup*> selected_route_groups;
if (!first_move) {
for (TrackViewList::const_iterator i = _editor->selection->tracks.begin(); i != _editor->selection->tracks.end(); ++i) {
if (!new_selection.contains (*i) && !_track_selection_at_start.contains (*i)) {
tracks_to_remove.push_back (*i);
} else {
RouteGroup* rg = (*i)->route_group();
if (rg && rg->is_active() && rg->is_select()) {
selected_route_groups.push_back (rg);
}
}
}
}
@ -5238,12 +5244,35 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
for (TrackViewList::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
if (!_editor->selection->tracks.contains (*i)) {
tracks_to_add.push_back (*i);
RouteGroup* rg = (*i)->route_group();
if (rg && rg->is_active() && rg->is_select()) {
selected_route_groups.push_back (rg);
}
}
}
_editor->selection->add (tracks_to_add);
if (!tracks_to_remove.empty()) {
/* check all these to-be-removed tracks against the
* possibility that they are selected by being
* in the same group as an approved track.
*/
for (TrackViewList::iterator i = tracks_to_remove.begin(); i != tracks_to_remove.end(); ) {
RouteGroup* rg = (*i)->route_group();
if (rg && find (selected_route_groups.begin(), selected_route_groups.end(), rg) != selected_route_groups.end()) {
i = tracks_to_remove.erase (i);
} else {
++i;
}
}
/* remove whatever is left */
_editor->selection->remove (tracks_to_remove);
}
}