don't bother doing port stuff if session is being deleted
[ardour.git] / gtk2_ardour / route_ui.cc
index 703857bc6b41131263d339b3f35ae49733e58e0a..fe2adff44985e572ba6b77783679dd7214d94c97 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2002-2006 Paul Davis 
+    Copyright (C) 2002-2006 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
 #include "pbd/stacktrace.h"
 #include "pbd/shiva.h"
 #include "pbd/controllable.h"
+#include "pbd/enumwriter.h"
 
 #include "ardour_ui.h"
 #include "editor.h"
 #include "latency_gui.h"
 #include "mixer_strip.h"
 #include "automation_time_axis.h"
+#include "route_time_axis.h"
 
 #include "ardour/route.h"
+#include "ardour/event_type_map.h"
 #include "ardour/session.h"
 #include "ardour/audioengine.h"
 #include "ardour/audio_track.h"
@@ -81,7 +84,7 @@ RouteUI::~RouteUI()
        /* derived classes should emit GoingAway so that they receive the signal
           when the object is still a legal derived instance.
        */
-       
+
        delete solo_menu;
        delete mute_menu;
        delete sends_menu;
@@ -95,6 +98,10 @@ RouteUI::init ()
        mute_menu = 0;
        solo_menu = 0;
        sends_menu = 0;
+       pre_fader_mute_check = 0;
+       post_fader_mute_check = 0;
+       listen_mute_check = 0;
+       main_mute_check = 0;
        ignore_toggle = false;
        wait_for_release = false;
        route_active_menu_item = 0;
@@ -151,7 +158,7 @@ RouteUI::reset ()
 
        delete mute_menu;
        mute_menu = 0;
-       
+
        if (xml_node) {
                /* do not delete the node - its owned by the route */
                xml_node = 0;
@@ -183,13 +190,13 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
 
        mute_button->set_controllable (_route->mute_control());
        solo_button->set_controllable (_route->solo_control());
-  
+
        connections.push_back (_route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed)));
        connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
        connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
        connections.push_back (_route->listen_changed.connect (mem_fun(*this, &RouteUI::listen_changed)));
        connections.push_back (_route->solo_isolated_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
-  
+
        if (_session.writable() && is_track()) {
                boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
 
@@ -200,11 +207,11 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
                rec_enable_button->set_controllable (t->rec_enable_control());
 
                update_rec_display ();
-       } 
+       }
 
        mute_button->unset_flags (Gtk::CAN_FOCUS);
        solo_button->unset_flags (Gtk::CAN_FOCUS);
-       
+
        mute_button->show();
 
        if (_route->is_control()) {
@@ -243,7 +250,7 @@ RouteUI::mute_press(GdkEventButton* ev)
                        if (Keyboard::is_button2_event (ev)) {
                                // Primary-button2 click is the midi binding click
                                // button2-click is "momentary"
-                               
+
                                if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) {
                                        wait_for_release = true;
                                } else {
@@ -274,7 +281,7 @@ RouteUI::mute_press(GdkEventButton* ev)
                                        if (ev->button == 1) {
                                                set_route_group_mute (_route, !_route->muted());
                                        }
-                                       
+
                                } else {
 
                                        /* plain click applies change to this route */
@@ -328,41 +335,41 @@ RouteUI::solo_press(GdkEventButton* ev)
 
                multiple_solo_change = false;
                if (!ignore_toggle) {
-                       
+
                        if (Keyboard::is_context_menu_event (ev)) {
-                               
+
                                if (solo_menu == 0) {
                                        build_solo_menu ();
                                }
-                               
+
                                solo_menu->popup (1, ev->time);
-                               
+
                        } else {
-                               
+
                                if (Keyboard::is_button2_event (ev)) {
-                                       
+
                                        // Primary-button2 click is the midi binding click
                                        // button2-click is "momentary"
-                                       
+
                                        if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) {
                                                wait_for_release = true;
                                        } else {
                                                return false;
                                        }
                                }
-                               
+
                                if (ev->button == 1 || Keyboard::is_button2_event (ev)) {
-                                       
+
                                        if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
-                                               
+
                                                /* Primary-Tertiary-click applies change to all routes */
                                                bool was_not_latched = false;
                                                if (!Config->get_solo_latched ()) {
                                                        was_not_latched = true;
                                                        /*
-                                                         XXX it makes no sense to solo all tracks if we're 
-                                                         not in latched mode, but doing nothing feels like a bug, 
-                                                         so do it anyway 
+                                                         XXX it makes no sense to solo all tracks if we're
+                                                         not in latched mode, but doing nothing feels like a bug,
+                                                         so do it anyway
                                                        */
                                                        Config->set_solo_latched (true);
                                                }
@@ -376,9 +383,9 @@ RouteUI::solo_press(GdkEventButton* ev)
                                                if (was_not_latched) {
                                                        Config->set_solo_latched (false);
                                                }
-                                               
+
                                        } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
-                                               
+
                                                // Primary-Secondary-click: exclusively solo this track, not a toggle */
 
                                                _session.begin_reversible_command (_("solo change"));
@@ -391,19 +398,10 @@ RouteUI::solo_press(GdkEventButton* ev)
 
                                        } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
 
-                                               // shift-click: set this route to solo safe
+                                               // shift-click: toggle solo isolated status
 
-                                               if (Profile->get_sae() && ev->button == 1) {
-                                                       // button 1 and shift-click: disables solo_latched for this click
-                                                       if (!Config->get_solo_latched ()) {
-                                                               Config->set_solo_latched (true);
-                                                               reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this);
-                                                               Config->set_solo_latched (false);
-                                                       }
-                                               } else {
-                                                       _route->set_solo_isolated (!_route->solo_isolated(), this);
-                                                       wait_for_release = false;
-                                               }
+                                               _route->set_solo_isolated (!_route->solo_isolated(), this);
+                                               wait_for_release = false;
 
                                        } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
 
@@ -499,7 +497,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
                        set_route_group_rec_enable (_route, !_route->record_enabled());
 
                } else if (Keyboard::is_context_menu_event (ev)) {
-                       
+
                        /* do this on release */
 
                } else {
@@ -521,13 +519,15 @@ void
 RouteUI::build_sends_menu ()
 {
        using namespace Menu_Helpers;
-       
+
        sends_menu = new Menu;
        sends_menu->set_name ("ArdourContextMenu");
        MenuList& items = sends_menu->items();
-       
+
        items.push_back (MenuElem(_("Assign all tracks (prefader)"), bind (mem_fun (*this, &RouteUI::create_sends), PreFader)));
        items.push_back (MenuElem(_("Assign all tracks (postfader)"), bind (mem_fun (*this, &RouteUI::create_sends), PostFader)));
+       items.push_back (MenuElem(_("Assign selected tracks (prefader)"), bind (mem_fun (*this, &RouteUI::create_selected_sends), PreFader)));
+       items.push_back (MenuElem(_("Assign selected tracks (postfader)"), bind (mem_fun (*this, &RouteUI::create_selected_sends), PostFader)));
        items.push_back (MenuElem(_("Copy track gains to sends"), mem_fun (*this, &RouteUI::set_sends_gain_from_track)));
        items.push_back (MenuElem(_("Set sends gain to -inf"), mem_fun (*this, &RouteUI::set_sends_gain_to_zero)));
        items.push_back (MenuElem(_("Set sends gain to 0dB"), mem_fun (*this, &RouteUI::set_sends_gain_to_unity)));
@@ -540,6 +540,27 @@ RouteUI::create_sends (Placement p)
        _session.globally_add_internal_sends (_route, p);
 }
 
+void
+RouteUI::create_selected_sends (Placement p)
+{
+       boost::shared_ptr<RouteList> rlist (new RouteList);
+       TrackSelection& selected_tracks (ARDOUR_UI::instance()->the_editor().get_selection().tracks);
+
+       for (TrackSelection::iterator i = selected_tracks.begin(); i != selected_tracks.end(); ++i) {
+               RouteTimeAxisView* rtv;
+               RouteUI* rui;
+               if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
+                       if ((rui = dynamic_cast<RouteUI*>(rtv)) != 0) {
+                               if (boost::dynamic_pointer_cast<AudioTrack>(rui->route())) {
+                                       rlist->push_back (rui->route());
+                               }
+                       }
+               }
+       }
+       
+       _session.add_internal_sends (_route, p, rlist);
+}
+
 void
 RouteUI::set_sends_gain_from_track ()
 {
@@ -616,7 +637,7 @@ RouteUI::send_blink (bool onoff)
        if (!show_sends_button) {
                return;
        }
-               
+
        if (onoff) {
                show_sends_button->set_state (STATE_ACTIVE);
        } else {
@@ -637,11 +658,36 @@ RouteUI::listen_changed(void* /*src*/)
        Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_solo_display));
 }
 
+int
+RouteUI::solo_visual_state (boost::shared_ptr<Route> r)
+{
+       if (Config->get_solo_control_is_listen_control()) {
+
+               if (r->listening()) {
+                       return 1;
+               } else {
+                       return 0;
+               }
+
+       } else {
+
+               if (r->solo_isolated()) {
+                       return 2;
+               } else if (r->soloed()) {
+                       return 1;
+               } else {
+                       return 0;
+               }
+       }
+
+       return 0;
+}
+
 void
 RouteUI::update_solo_display ()
 {
        bool x;
-
+       
        if (Config->get_solo_control_is_listen_control()) {
 
                if (solo_button->get_active() != (x = _route->listening())) {
@@ -650,29 +696,17 @@ RouteUI::update_solo_display ()
                        ignore_toggle = false;
                }
 
-               if (x) {
-                       solo_button->set_visual_state (1);
-               } else {
-                       solo_button->set_visual_state (0);
-               }
-
-
        } else {
 
-               if (solo_button->get_active() != (x = _route->soloed())){
+               if (solo_button->get_active() != (x = _route->soloed())) {
                        ignore_toggle = true;
                        solo_button->set_active (x);
                        ignore_toggle = false;
-               } 
-               
-               if (_route->solo_isolated()) {
-                       solo_button->set_visual_state (2);
-               } else if (x) {
-                       solo_button->set_visual_state (1);
-               } else {
-                       solo_button->set_visual_state (0);
                }
+
        }
+
+       solo_button->set_visual_state (solo_visual_state (_route));
 }
 
 void
@@ -687,6 +721,36 @@ RouteUI::mute_changed(void* /*src*/)
        Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_mute_display));
 }
 
+int
+RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
+{
+       if (Config->get_show_solo_mutes()) {
+               
+               if (r->muted ()) {
+                       /* full mute */
+                       return 2;
+               } else if (s.soloing() && !r->soloed() && !r->solo_isolated()) {
+                       /* mute-because-not-soloed */
+                       return 1;
+               } else {
+                       /* no mute at all */
+                       return 0;
+               }
+
+       } else {
+
+               if (r->muted()) {
+                       /* full mute */
+                       return 2;
+               } else {
+                       /* no mute at all */
+                       return 0;
+               }
+       }
+
+       return 0;
+}
+
 void
 RouteUI::update_mute_display ()
 {
@@ -703,24 +767,7 @@ RouteUI::update_mute_display ()
                ignore_toggle = false;
        }
 
-       /* now attend to visual state */
-       
-       if (Config->get_show_solo_mutes()) {
-               if (_route->muted()) {
-                       mute_button->set_visual_state (2);
-               } else if (!_route->soloed() && _session.soloing()) {
-                       mute_button->set_visual_state (1);
-               } else {
-                       mute_button->set_visual_state (0);
-               }
-       } else {
-               if (_route->muted()) {
-                       mute_button->set_visual_state (2);
-               } else {
-                       mute_button->set_visual_state (0);
-               }
-       }
-
+       mute_button->set_visual_state (mute_visual_state (_session, _route));
 }
 
 void
@@ -750,10 +797,7 @@ RouteUI::update_rec_display ()
                rec_enable_button->set_active (model);
                ignore_toggle = false;
        }
-       else {
-               return;
-       }
-       
+
        /* now make sure its color state is correct */
 
        if (model) {
@@ -779,7 +823,7 @@ void
 RouteUI::build_solo_menu (void)
 {
        using namespace Menu_Helpers;
-       
+
        solo_menu = new Menu;
        solo_menu->set_name ("ArdourContextMenu");
        MenuList& items = solo_menu->items();
@@ -792,65 +836,105 @@ RouteUI::build_solo_menu (void)
        items.push_back (CheckMenuElem(*check));
        check->show_all();
 
+       check = new CheckMenuItem(_("Solo Safe"));
+       check->set_active (_route->solo_safe());
+       check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check));
+       _route->solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check));
+       items.push_back (CheckMenuElem(*check));
+       check->show_all();
+
        //items.push_back (SeparatorElem());
        // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
-       
+
 }
 
 void
 RouteUI::build_mute_menu(void)
 {
        using namespace Menu_Helpers;
-       
+
        mute_menu = new Menu;
        mute_menu->set_name ("ArdourContextMenu");
 
-#if FIX_ME_IN_3_0      
        MenuList& items = mute_menu->items();
-       CheckMenuItem* check;
 
-       check = new CheckMenuItem(_("Pre Fader"));
-       init_mute_menu(PRE_FADER, check);
-       check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), PRE_FADER, check));
-       _route->pre_fader_changed.connect(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), check));
-       items.push_back (CheckMenuElem(*check));
-       check->show_all();
+       pre_fader_mute_check = manage (new CheckMenuItem(_("Pre Fader")));
+       init_mute_menu(MuteMaster::PreFader, pre_fader_mute_check);
+       pre_fader_mute_check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::PreFader, pre_fader_mute_check));
+       items.push_back (CheckMenuElem(*pre_fader_mute_check));
+       pre_fader_mute_check->show_all();
+
+       post_fader_mute_check = manage (new CheckMenuItem(_("Post Fader")));
+       init_mute_menu(MuteMaster::PostFader, post_fader_mute_check);
+       post_fader_mute_check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::PostFader, post_fader_mute_check));
+       items.push_back (CheckMenuElem(*post_fader_mute_check));
+       post_fader_mute_check->show_all();
+
+       listen_mute_check = manage (new CheckMenuItem(_("Control Outs")));
+       init_mute_menu(MuteMaster::Listen, listen_mute_check);
+       listen_mute_check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::Listen, listen_mute_check));
+       items.push_back (CheckMenuElem(*listen_mute_check));
+       listen_mute_check->show_all();
+
+       main_mute_check = manage (new CheckMenuItem(_("Main Outs")));
+       init_mute_menu(MuteMaster::Main, main_mute_check);
+       main_mute_check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::Main, main_mute_check));
+       items.push_back (CheckMenuElem(*main_mute_check));
+       main_mute_check->show_all();
 
-       check = new CheckMenuItem(_("Post Fader"));
-       init_mute_menu(POST_FADER, check);
-       check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), POST_FADER, check));
-       _route->post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check));
-       items.push_back (CheckMenuElem(*check));
-       check->show_all();
-       
-       check = new CheckMenuItem(_("Control Outs"));
-       init_mute_menu(CONTROL_OUTS, check);
-       check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), CONTROL_OUTS, check));
-       _route->control_outs_changed.connect(bind (mem_fun (*this, &RouteUI::control_outs_toggle), check));
-       items.push_back (CheckMenuElem(*check));
-       check->show_all();
-
-       check = new CheckMenuItem(_("Main Outs"));
-       init_mute_menu(MAIN_OUTS, check);
-       check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MAIN_OUTS, check));
-       _route->main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check));
-       items.push_back (CheckMenuElem(*check));
-       check->show_all();
-#endif
        //items.push_back (SeparatorElem());
        // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
+
+       _route->mute_points_changed.connect (mem_fun (*this, &RouteUI::muting_change));
 }
 
 void
 RouteUI::init_mute_menu(MuteMaster::MutePoint mp, CheckMenuItem* check)
 {
-       check->set_active (_route->mute_master()->muted_at (mp));
+       check->set_active (_route->mute_points() & mp);
 }
 
 void
-RouteUI::toggle_mute_menu(MuteMaster::MutePoint /*mp*/, Gtk::CheckMenuItem* /*check*/)
+RouteUI::toggle_mute_menu(MuteMaster::MutePoint mp, Gtk::CheckMenuItem* check)
 {
-       // _route->set_mute_config(type, check->get_active(), this);
+       if (check->get_active()) {
+               _route->set_mute_points (MuteMaster::MutePoint (_route->mute_points() | mp));
+       } else {
+               _route->set_mute_points (MuteMaster::MutePoint (_route->mute_points() & ~mp));
+       }
+}
+
+void
+RouteUI::muting_change ()
+{
+       ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::muting_change));
+
+       bool yn;
+       MuteMaster::MutePoint current = _route->mute_points ();
+
+       yn = (current & MuteMaster::PreFader);
+
+       if (pre_fader_mute_check->get_active() != yn) {
+               pre_fader_mute_check->set_active (yn);
+       }
+
+       yn = (current & MuteMaster::PostFader);
+
+       if (post_fader_mute_check->get_active() != yn) {
+               post_fader_mute_check->set_active (yn);
+       }
+
+       yn = (current & MuteMaster::Listen);
+
+       if (listen_mute_check->get_active() != yn) {
+               listen_mute_check->set_active (yn);
+       }
+
+       yn = (current & MuteMaster::Main);
+
+       if (main_mute_check->get_active() != yn) {
+               main_mute_check->set_active (yn);
+       }
 }
 
 void
@@ -859,6 +943,12 @@ RouteUI::toggle_solo_isolated (Gtk::CheckMenuItem* check)
        _route->set_solo_isolated (check->get_active(), this);
 }
 
+void
+RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check)
+{
+       _route->set_solo_safe (check->get_active(), this);
+}
+
 void
 RouteUI::set_route_group_solo(boost::shared_ptr<Route> route, bool yn)
 {
@@ -952,9 +1042,9 @@ void
 RouteUI::set_color (const Gdk::Color & c)
 {
        char buf[64];
-       
+
        _color = c;
-       
+
        ensure_xml_node ();
        snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue());
        xml_node->add_property ("color", buf);
@@ -978,7 +1068,7 @@ XMLNode*
 RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
 {
        ensure_xml_node ();
-       
+
        XMLNodeList kids = xml_node->children();
        XMLNodeConstIterator iter;
 
@@ -1004,7 +1094,7 @@ int
 RouteUI::set_color_from_route ()
 {
        XMLProperty *prop;
-       
+
        RouteUI::ensure_xml_node ();
 
        if ((prop = xml_node->property ("color")) != 0) {
@@ -1014,7 +1104,7 @@ RouteUI::set_color_from_route ()
                _color.set_green(g);
                _color.set_blue(b);
                return 0;
-       } 
+       }
        return 1;
 }
 
@@ -1064,12 +1154,12 @@ RouteUI::route_rename ()
         name_prompter.get_result (result);
         if (result.length()) {
                        _route->set_name (result);
-               }       
+               }
                break;
        }
 
        return;
-  
+
 }
 
 void
@@ -1108,7 +1198,7 @@ RouteUI::toggle_polarity ()
                bool x;
 
                ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_polarity));
-               
+
                if ((x = polarity_menu_item->get_active()) != _route->phase_invert()) {
                        _route->set_phase_invert (x);
                        if (x) {
@@ -1138,7 +1228,7 @@ RouteUI::toggle_denormal_protection ()
                bool x;
 
                ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_denormal_protection));
-               
+
                if ((x = denormal_menu_item->get_active()) != _route->denormal_protection()) {
                        _route->set_denormal_protection (x);
                }
@@ -1163,51 +1253,16 @@ RouteUI::solo_isolated_toggle(void* /*src*/, Gtk::CheckMenuItem* check)
        }
 }
 
-#ifdef FIX_THIS_FOR_3_0
-void
-RouteUI::pre_fader_toggle(void* src, Gtk::CheckMenuItem* check)
-{
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), src, check));
-       
-       bool yn = _route->get_mute_config(PRE_FADER);
-       if (check->get_active() != yn) {
-               check->set_active (yn);
-       }
-}
-
-void
-RouteUI::post_fader_toggle(void* src, Gtk::CheckMenuItem* check)
-{
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::post_fader_toggle), src, check));
-       
-       bool yn = _route->get_mute_config(POST_FADER);
-       if (check->get_active() != yn) {
-               check->set_active (yn);
-       }
-}
 
 void
-RouteUI::control_outs_toggle(void* src, Gtk::CheckMenuItem* check)
+RouteUI::solo_safe_toggle(void* /*src*/, Gtk::CheckMenuItem* check)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::control_outs_toggle), src, check));
-       
-       bool yn = _route->get_mute_config(CONTROL_OUTS);
-       if (check->get_active() != yn) {
-               check->set_active (yn);
-       }
-}
+       bool yn = _route->solo_safe ();
 
-void
-RouteUI::main_outs_toggle(void* src, Gtk::CheckMenuItem* check)
-{
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::main_outs_toggle), src, check));
-       
-       bool yn = _route->get_mute_config(MAIN_OUTS);
        if (check->get_active() != yn) {
                check->set_active (yn);
        }
 }
-#endif
 
 void
 RouteUI::disconnect_input ()
@@ -1306,16 +1361,16 @@ RouteUI::save_as_template ()
        sys::path path;
        Glib::ustring safe_name;
        string name;
-       
+
        path = ARDOUR::user_route_template_directory ();
-       
+
        if (g_mkdir_with_parents (path.to_string().c_str(), 0755)) {
                error << string_compose (_("Cannot create route template directory %1"), path.to_string()) << endmsg;
                return;
        }
-       
+
        Prompter p (true); // modal
-       
+
        p.set_prompt (_("Template name:"));
        switch (p.run()) {
        case RESPONSE_ACCEPT:
@@ -1323,15 +1378,15 @@ RouteUI::save_as_template ()
        default:
                return;
        }
-       
+
        p.hide ();
        p.get_result (name, true);
-       
+
        safe_name = legalize_for_path (name);
        safe_name += template_suffix;
-       
+
        path /= safe_name;
-       
+
        _route->save_as_template (path.to_string(), name);
 }
 
@@ -1349,7 +1404,7 @@ void
 RouteUI::parameter_changed (string const & p)
 {
        ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::parameter_changed), p));
-       
+
        if (p == "disable-disarm-during-roll") {
                check_rec_enable_sensitivity ();
        } else if (p == "solo-control-is-listen-control") {