do NOT remove tracks from selection during drag selection on the basis of geometry...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 8 Feb 2017 16:40:27 +0000 (17:40 +0100)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 8 Feb 2017 16:40:27 +0000 (17:40 +0100)
Membership of select-enabled route groups matters too.

gtk2_ardour/editor_drag.cc

index c62151fc280eff01fd9ba04f3406c30ed1d166e7..a54896f6fe2c1cb23a7d9d2191acc5fba3dac6bb 100644 (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);
                        }
                }