X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;fp=gtk2_ardour%2Fmonitor_section.cc;h=5c8190a093b9cb2fe049e150f7f5a75073cc4fdf;hp=f1ff7fcd7eb466f8eb54febda2f5d3715d86a412;hb=20c55065abcbaf877780706bb33f5f69d73d90f0;hpb=fbab611a735e70522e457161e1f1f6834f803752 diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index f1ff7fcd7e..5c8190a093 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -87,6 +87,11 @@ MonitorSection::MonitorSection () , _rr_selection () , _ui_initialized (false) { + /* note that although this a RouteUI, we never called ::set_route() so + * we do not need to worry about self-destructing when the Route (the + * monitor out) is destroyed. + */ + using namespace Menu_Helpers; Glib::RefPtr act; @@ -601,6 +606,8 @@ MonitorSection::set_session (Session* s) insert_box->set_route (_route); _route->processors_changed.connect (*this, invalidator (*this), boost::bind (&MonitorSection::processors_changed, this, _1), gui_context()); _route->output()->PortCountChanged.connect (output_changed_connections, invalidator (*this), boost::bind (&MonitorSection::populate_buttons, this), gui_context()); + _route->DropReferences.connect (*this, invalidator (*this), boost::bind (&MonitorSection::drop_route, this), gui_context()); + if (_ui_initialized) { update_processor_box (); } @@ -617,9 +624,14 @@ MonitorSection::set_session (Session* s) _output_selector = 0; ActionManager::set_sensitive (monitor_actions, false); + /* this action needs to always be true in this * scenaro, so that we can turn it back on*/ + ActionManager::get_toggle_action (X_("Monitor"), X_("UseMonitorSection"))->set_sensitive (true); ActionManager::set_sensitive (solo_actions, true); } + /* make sure the state of this action reflects reality */ + ActionManager::get_toggle_action (X_("Monitor"), X_("UseMonitorSection"))->set_active (_route != 0); + populate_buttons (); @@ -627,15 +639,7 @@ MonitorSection::set_session (Session* s) /* no session */ - output_changed_connections.drop_connections(); - _monitor.reset (); - _route.reset (); - control_connections.drop_connections (); - rude_iso_button.unset_active_state (); - rude_solo_button.unset_active_state (); - delete _output_selector; - _output_selector = 0; - + drop_route (); assign_controllables (); ActionManager::set_sensitive (monitor_actions, false); @@ -643,6 +647,19 @@ MonitorSection::set_session (Session* s) } } +void +MonitorSection::drop_route () +{ + output_changed_connections.drop_connections(); + _monitor.reset (); + _route.reset (); + control_connections.drop_connections (); + rude_iso_button.unset_active_state (); + rude_solo_button.unset_active_state (); + delete _output_selector; + _output_selector = 0; +} + MonitorSection::ChannelButtonSet::ChannelButtonSet () { cut.set_name (X_("mute button")); @@ -1253,6 +1270,8 @@ MonitorSection::parameter_changed (std::string name) SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Solo"), "toggle-mute-overrides-solo"), Config->get_solo_mute_override ()); } else if (name == "exclusive-solo") { SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Solo"), "toggle-exclusive-solo"), Config->get_exclusive_solo ()); + } else if (name == "use-monitor-bus") { + SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection"), Config->get_use_monitor_bus ()); } } @@ -1683,13 +1702,5 @@ MonitorSection::toggle_use_monitor_section () return; } - bool yn = ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active(); - - if (yn) { - _session->add_monitor_section (); - } else { - _session->remove_monitor_section (); - } - - Config->set_use_monitor_bus (yn); + Config->set_use_monitor_bus (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active()); }