try that one on for size (VST build fu)
[ardour.git] / gtk2_ardour / route_params_ui.cc
index 86ac1e035ed997c9975bec4b3fa1f79367238079..033537f8424675a84a48261a3521fdc7899e40a7 100644 (file)
@@ -159,22 +159,26 @@ RouteParams_UI::~RouteParams_UI ()
 }
 
 void
-RouteParams_UI::add_route (boost::shared_ptr<Route> route)
+RouteParams_UI::add_routes (Session::RouteList& routes)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::add_route), route));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::add_routes), routes));
        
-       if (route->hidden()) {
-               return;
-       }
-
-       TreeModel::Row row = *(route_display_model->append());
-       row[route_display_columns.text] = route->name();
-       row[route_display_columns.route] = route;
+       for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
+               boost::shared_ptr<Route> route = (*x);
 
-       //route_select_list.rows().back().select ();
-       
-       route->name_changed.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route));
-       route->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::route_removed), route));
+               if (route->hidden()) {
+                       return;
+               }
+               
+               TreeModel::Row row = *(route_display_model->append());
+               row[route_display_columns.text] = route->name();
+               row[route_display_columns.route] = route;
+               
+               //route_select_list.rows().back().select ();
+               
+               route->name_changed.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route));
+               route->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::route_removed), route));
+       }
 }
 
 
@@ -355,9 +359,10 @@ RouteParams_UI::set_session (Session *sess)
        route_display_model->clear();
 
        if (session) {
-               session->foreach_route (this, &RouteParams_UI::add_route);
-               session->going_away.connect (mem_fun(*this, &ArdourDialog::session_gone));
-               session->RouteAdded.connect (mem_fun(*this, &RouteParams_UI::add_route));
+               boost::shared_ptr<Session::RouteList> r = session->get_routes();
+               add_routes (*r);
+               session->GoingAway.connect (mem_fun(*this, &ArdourDialog::session_gone));
+               session->RouteAdded.connect (mem_fun(*this, &RouteParams_UI::add_routes));
                start_updating ();
        } else {
                stop_updating ();
@@ -505,7 +510,7 @@ RouteParams_UI::show_track_menu()
                                (MenuElem (_("Add Track/Bus"), 
                                           mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route)));
        }
-       track_menu->popup (1, 0);
+       track_menu->popup (1, gtk_get_current_event_time());
 }
 
 
@@ -532,7 +537,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
 
                        if (place == PreFader) {
                                cleanup_pre_view();
-                               _pre_plugin_conn = send->GoingAway.connect (mem_fun(*this, &RouteParams_UI::redirect_going_away));
+                               _pre_plugin_conn = send->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), redirect));
                                _active_pre_view = send_ui;
                                
                                pre_redir_hpane.add2 (*_active_pre_view);
@@ -540,7 +545,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
                        }
                        else {
                                cleanup_post_view();
-                               _post_plugin_conn = send->GoingAway.connect (mem_fun(*this, &RouteParams_UI::redirect_going_away));
+                               _post_plugin_conn = send->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), redirect));
                                _active_post_view = send_ui;
                                
                                post_redir_hpane.add2 (*_active_post_view);
@@ -556,7 +561,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
                                
                if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) {                                
 
-                       LadspaPluginUI *plugin_ui = new LadspaPluginUI (session->engine(), plugin_insert, true);
+                       LadspaPluginUI *plugin_ui = new LadspaPluginUI (plugin_insert, true);
 
                        if (place == PreFader) {
                                cleanup_pre_view();
@@ -581,7 +586,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
                                        
                        if (place == PreFader) {
                                cleanup_pre_view();
-                               _pre_plugin_conn = port_insert->GoingAway.connect (mem_fun(*this, &RouteParams_UI::redirect_going_away));
+                               _pre_plugin_conn = port_insert->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), redirect));
                                _active_pre_view = portinsert_ui;
                                pre_redir_hpane.pack2 (*_active_pre_view);
                                portinsert_ui->redisplay();
@@ -589,7 +594,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
                        }
                        else {
                                cleanup_post_view();
-                               _post_plugin_conn = port_insert->GoingAway.connect (mem_fun(*this, &RouteParams_UI::redirect_going_away));
+                               _post_plugin_conn = port_insert->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), redirect));
                                _active_post_view = portinsert_ui;
                                post_redir_hpane.pack2 (*_active_post_view);
                                portinsert_ui->redisplay();
@@ -610,9 +615,9 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect,
 }
 
 void
-RouteParams_UI::plugin_going_away (Plugin *plugin, Placement place)
+RouteParams_UI::plugin_going_away (Placement place)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), plugin, place));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), place));
        
        // delete the current view without calling finish
 
@@ -627,18 +632,17 @@ RouteParams_UI::plugin_going_away (Plugin *plugin, Placement place)
 }
 
 void
-RouteParams_UI::redirect_going_away (ARDOUR::Redirect *plugin)
+RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Redirect> redirect)
 
 {
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), plugin));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), redirect));
        
        printf ("redirect going away\n");
        // delete the current view without calling finish
-       if (plugin == _pre_redirect.get()) {
+       if (redirect == _pre_redirect) {
                cleanup_pre_view (false);
                _pre_redirect.reset ((Redirect*) 0);
-       }
-       else if (plugin == _post_redirect.get()) {
+       } else if (redirect == _post_redirect) {
                cleanup_post_view (false);
                _post_redirect.reset ((Redirect*) 0);
        }