fix incorrect selection of all strips/tracks at opening.
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 4 Mar 2016 20:40:44 +0000 (15:40 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:39 +0000 (15:30 -0400)
Old code was counting how many child nodes where in the MixerUI, assuming they
were all routes, and using that to decide if this was a from_scratch setup.
The addition of VCAs to the track_model changes that, so now we have to actually
check there are no existing Routes before doing the from_scratch setup

gtk2_ardour/mixer_ui.cc

index 5313bb2ac46953252d0fc0e9a356a8e934400857..c7e827ef3e341894154a171191ee578dcbf55984 100644 (file)
@@ -398,8 +398,8 @@ Mixer_UI::remove_master (VCAMasterStrip* vms)
 void
 Mixer_UI::add_strips (RouteList& routes)
 {
-       bool from_scratch = track_model->children().size() == 0;
        Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
+       uint32_t nroutes = 0;
 
        for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
                boost::shared_ptr<Route> r = (*it)[track_columns.route];
@@ -408,13 +408,15 @@ Mixer_UI::add_strips (RouteList& routes)
                        continue;
                }
 
+               nroutes++;
+
                if (r->order_key() == (routes.front()->order_key() + routes.size())) {
                        insert_iter = it;
                        break;
                }
        }
 
-       if(!from_scratch) {
+       if (nroutes) {
                _selection.clear_routes ();
        }
 
@@ -476,7 +478,7 @@ Mixer_UI::add_strips (RouteList& routes)
                        row[track_columns.strip] = strip;
                        row[track_columns.vca] = 0;
 
-                       if (!from_scratch) {
+                       if (nroutes != 0) {
                                _selection.add (strip);
                        }