Report an error to stderr if creation of jack command line fails.
[ardour.git] / gtk2_ardour / mixer_ui.cc
index 8126a81e85837c1abbd96b510ec14f74fd8b0c22..12cf87d7931a7f31341b7ea8296bf895e3e74b2f 100644 (file)
@@ -313,6 +313,22 @@ Mixer_UI::hide_window (GdkEventAny *ev)
 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();
+
+       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];
+
+               if (r->order_key() == (routes.front()->order_key() + routes.size())) {
+                       insert_iter = it;
+                       break;
+               }
+       }
+
+       if(!from_scratch) {
+               _selection.clear_routes ();
+       }
+
        MixerStrip* strip;
 
        try {
@@ -359,11 +375,15 @@ Mixer_UI::add_strips (RouteList& routes)
                        
                        show_strip (strip);
                        
-                       TreeModel::Row row = *(track_model->append());
+                       TreeModel::Row row = *(track_model->insert(insert_iter));
                        row[track_columns.text] = route->name();
                        row[track_columns.visible] = strip->route()->is_master() ? true : strip->marked_for_display();
                        row[track_columns.route] = route;
                        row[track_columns.strip] = strip;
+
+                       if (!from_scratch) {
+                               _selection.add (strip);
+                       }
                        
                        route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context());