ensure that track selection operations call ::set_selected() for tracks, allowing...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Feb 2014 02:53:52 +0000 (21:53 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Feb 2014 02:53:52 +0000 (21:53 -0500)
gtk2_ardour/selection.cc

index 146d9a65c50f9c2da169a66bdc44b8a7988e0aac..04c479e0d95a7391fc058c1703ad65662863ab5f 100644 (file)
@@ -125,6 +125,9 @@ void
 Selection::clear_tracks ()
 {
        if (!tracks.empty()) {
+               for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
+                       (*x)->set_selected (false);
+               }
                tracks.clear ();
                if (!_no_tracks_changed) {
                        TracksChanged();
@@ -249,8 +252,10 @@ Selection::toggle (TimeAxisView* track)
        TrackSelection::iterator i;
 
        if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
+               track->set_selected (true);
                tracks.push_back (track);
        } else {
+               track->set_selected (false);
                tracks.erase (i);
        }
 
@@ -392,6 +397,9 @@ Selection::add (const TrackViewList& track_list)
        TrackViewList added = tracks.add (track_list);
 
        if (!added.empty()) {
+               for (TrackViewList::iterator x = added.begin(); x != added.end(); ++x) {
+                       (*x)->set_selected (true);
+               }
                if (!_no_tracks_changed) {
                        TracksChanged ();
                }
@@ -402,6 +410,7 @@ void
 Selection::add (TimeAxisView* track)
 {
        TrackViewList tr;
+       track->set_selected (true);
        tr.push_back (track);
        add (tr);
 }
@@ -589,6 +598,7 @@ Selection::remove (TimeAxisView* track)
 {
        list<TimeAxisView*>::iterator i;
        if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
+               track->set_selected (false);
                tracks.erase (i);
                if (!_no_tracks_changed) {
                        TracksChanged();
@@ -596,15 +606,6 @@ Selection::remove (TimeAxisView* track)
        }
 }
 
-void
-Selection::remove (ControlPoint* p)
-{
-       PointSelection::iterator i = find (points.begin(), points.end(), p);
-       if (i != points.end ()) {
-               points.erase (i);
-       }
-}
-
 void
 Selection::remove (const TrackViewList& track_list)
 {
@@ -614,6 +615,7 @@ Selection::remove (const TrackViewList& track_list)
 
                TrackViewList::iterator x = find (tracks.begin(), tracks.end(), *i);
                if (x != tracks.end()) {
+                       (*i)->set_selected (false);
                        tracks.erase (x);
                        changed = true;
                }
@@ -626,6 +628,15 @@ Selection::remove (const TrackViewList& track_list)
        }
 }
 
+void
+Selection::remove (ControlPoint* p)
+{
+       PointSelection::iterator i = find (points.begin(), points.end(), p);
+       if (i != points.end ()) {
+               points.erase (i);
+       }
+}
+
 void
 Selection::remove (const MidiNoteSelection& midi_list)
 {
@@ -924,7 +935,7 @@ Selection::selected (Marker* m)
 bool
 Selection::selected (TimeAxisView* tv)
 {
-       return find (tracks.begin(), tracks.end(), tv) != tracks.end();
+       return tv->get_selected ();
 }
 
 bool