monitor section: make sip/afl/pfl buttons work, add rude solo, mono function, rearrange
[ardour.git] / gtk2_ardour / route_ui.cc
index f78885deb4f52c4f6e53719afe9931f0c26c2d62..befed977436c402e53f2ed9c0b0e1016cc3d7643 100644 (file)
@@ -79,6 +79,9 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session* sess)
 
 RouteUI::~RouteUI()
 {
+       _route.reset (); /* drop reference to route, so that it can be cleaned up */
+       route_connections.drop_connections ();
+
        delete solo_menu;
        delete mute_menu;
        delete sends_menu;
@@ -137,6 +140,17 @@ RouteUI::init ()
        _session->RecordStateChanged.connect (_session_connections, boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
 
        Config->ParameterChanged.connect (*this, ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
+
+       rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false);
+       rec_enable_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_release), false);
+
+       show_sends_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::show_sends_press), false);
+       show_sends_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::show_sends_release));
+
+       solo_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::solo_press), false);
+       solo_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::solo_release), false);
+       mute_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::mute_press), false);
+       mute_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::mute_release), false);
 }
 
 void
@@ -165,9 +179,6 @@ RouteUI::self_delete ()
 {
        /* This may be called from a non-GUI thread. Keep it safe */
 
-       cerr << "\n\nExpect to see route " << _route->name() << " be deleted\n";
-       _route.reset (); /* drop reference to route, so that it can be cleaned up */
-       route_connections.drop_connections ();
        delete_when_idle (this);
 }
 
@@ -194,6 +205,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
        _route->solo_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
        _route->listen_changed.connect (route_connections, ui_bind (&RouteUI::listen_changed, this, _1), gui_context());
        _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
+       _route->PropertyChanged.connect (route_connections, ui_bind (&RouteUI::property_changed, this, _1), gui_context());
 
        if (_session->writable() && is_track()) {
                boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
@@ -754,13 +766,13 @@ RouteUI::update_solo_display ()
 void
 RouteUI::solo_changed_so_update_mute ()
 {
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_mute_display, this));
+       update_mute_display ();
 }
 
 void
 RouteUI::mute_changed(void* /*src*/)
 {
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_mute_display, this));
+       update_mute_display ();
 }
 
 int
@@ -800,6 +812,10 @@ RouteUI::mute_visual_state (Session* s, boost::shared_ptr<Route> r)
 void
 RouteUI::update_mute_display ()
 {
+        if (!_route) {
+                return;
+        }
+
        bool model = _route->muted();
        bool view = mute_button->get_active();
 
@@ -825,17 +841,13 @@ RouteUI::route_rec_enable_changed ()
 void
 RouteUI::session_rec_enable_changed ()
 {
-       if (!rec_enable_button) {
-               return;
-       }
-
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_rec_display, this));
+        update_rec_display ();
 }
 
 void
 RouteUI::update_rec_display ()
 {
-       if (!rec_enable_button) {
+       if (!rec_enable_button || !_route) {
                return;
        }
                        
@@ -1152,11 +1164,11 @@ RouteUI::route_rename ()
 }
 
 void
-RouteUI::name_changed ()
+RouteUI::property_changed (const PropertyChange& what_changed)
 {
-       ENSURE_GUI_THREAD (*this, &RouteUI::name_changed);
-
-       name_label.set_text (_route->name());
+       if (what_changed.contains (ARDOUR::Properties::name)) {
+               name_label.set_text (_route->name());
+       }
 }
 
 void
@@ -1392,8 +1404,6 @@ RouteUI::check_rec_enable_sensitivity ()
 void
 RouteUI::parameter_changed (string const & p)
 {
-       ENSURE_GUI_THREAD (*this, &RouteUI::parameter_changed, p)
-
        if (p == "disable-disarm-during-roll") {
                check_rec_enable_sensitivity ();
        } else if (p == "solo-control-is-listen-control") {