X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;h=7a304d96ace37b62b72902175c81be3f32c2ecc9;hb=69777d600fe2e1e034d24551ac9faec2c2481584;hp=c401bec6020edac6135b1a382f6f7464b104e4eb;hpb=5981b7f1b8bc85444d66ab0ffac2dee412dd21ea;p=ardour.git diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index c401bec602..7a304d96ac 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -62,9 +62,8 @@ using namespace std; #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) -MonitorSection::MonitorSection (Session* s) - : SessionHandlePtr (s) - , RouteUI (s) +MonitorSection::MonitorSection () + : RouteUI ((Session*) 0) , _tearoff (0) , channel_table (0) , channel_table_viewport (*channel_table_scroller.get_hadjustment() @@ -88,7 +87,11 @@ MonitorSection::MonitorSection (Session* s) , _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; @@ -96,7 +99,6 @@ MonitorSection::MonitorSection (Session* s) load_bindings (); register_actions (); set_data ("ardour-bindings", bindings); - bindings->associate (); channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); @@ -106,8 +108,6 @@ MonitorSection::MonitorSection (Session* s) insert_box->show (); // TODO allow keyboard shortcuts in ProcessorBox - set_session (s); - /* Rude Solo & Solo Isolated */ rude_solo_button.set_text (_("Soloing")); rude_solo_button.set_name ("rude solo"); @@ -123,8 +123,6 @@ MonitorSection::MonitorSection (Session* s) Timers::blink_connect (sigc::mem_fun (*this, &MonitorSection::do_blink)); - act = ActionManager::get_action (X_("Main"), X_("cancel-solo")); - rude_solo_button.set_related_action (act); UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything")); rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false); @@ -170,7 +168,7 @@ MonitorSection::MonitorSection (Session* s) exclusive_solo_button.set_name (X_("monitor section solo option")); set_tooltip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time")); - act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo")); + act = ActionManager::get_action (X_("Solo"), X_("toggle-exclusive-solo")); if (act) { exclusive_solo_button.set_related_action (act); } @@ -179,17 +177,14 @@ MonitorSection::MonitorSection (Session* s) solo_mute_override_button.set_name (X_("monitor section solo option")); set_tooltip (&solo_mute_override_button, _("If enabled, solo will override mute\n(a soloed & muted track or bus will be audible)")); - act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo")); - if (act) { - solo_mute_override_button.set_related_action (act); - } + solo_mute_override_button.set_related_action (ActionManager::get_action (X_("Solo"), X_("toggle-mute-overrides-solo"))); /* Processor Box hide/shos */ toggle_processorbox_button.set_text (_("Processors")); toggle_processorbox_button.set_name (X_("monitor section processors toggle")); set_tooltip (&toggle_processorbox_button, _("Allow one to add monitor effect processors")); - proctoggle = ActionManager::get_action (X_("Monitor"), X_("toggle-monitor-processor-box")); + proctoggle = ActionManager::get_toggle_action (X_("Monitor"), X_("toggle-monitor-processor-box")); toggle_processorbox_button.set_related_action (proctoggle); /* Knobs */ @@ -556,7 +551,7 @@ MonitorSection::leave_handler (GdkEventCrossing* ev) void MonitorSection::update_processor_box () { - bool show_processor_box = Glib::RefPtr::cast_dynamic (proctoggle)->get_active (); + bool show_processor_box = proctoggle->get_active (); if (count_processors () > 0 && !show_processor_box) { toggle_processorbox_button.set_name (X_("monitor section processors present")); @@ -591,6 +586,14 @@ MonitorSection::set_session (Session* s) if (_session) { + /* These are not actually dependent on the Session, but they + * need to be set after construction, not during, and + * this is as good a place as any. + */ + + ActionManager::get_toggle_action (X_("Solo"), X_("toggle-exclusive-solo"))->set_active (Config->get_exclusive_solo()); + ActionManager::get_toggle_action (X_("Solo"), X_("toggle-mute-overrides-solo"))->set_active (Config->get_solo_mute_override()); + _route = _session->monitor_out (); if (_route) { @@ -603,9 +606,15 @@ 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 (); } + + ActionManager::set_sensitive (monitor_actions, true); + ActionManager::set_sensitive (solo_actions, true); + } else { /* session with no monitor section */ output_changed_connections.drop_connections(); @@ -613,32 +622,44 @@ MonitorSection::set_session (Session* s) _route.reset (); delete _output_selector; _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 (); - /* some actions may have been left in the wrong state from a - * previous monitor route that was then deleted - */ - ActionManager::set_sensitive (monitor_actions, true); - ActionManager::set_sensitive (solo_actions, true); } else { - /* 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; + /* no session */ + drop_route (); assign_controllables (); + + ActionManager::set_sensitive (monitor_actions, false); + ActionManager::set_sensitive (solo_actions, false); } } +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")); @@ -783,12 +804,7 @@ MonitorSection::toggle_exclusive_solo () return; } - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo"); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - Config->set_exclusive_solo (tact->get_active()); - } - + Config->set_exclusive_solo (ActionManager::get_toggle_action (X_("Solo"), "toggle-exclusive-solo")->get_active()); } void @@ -798,11 +814,8 @@ MonitorSection::toggle_mute_overrides_solo () return; } - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo"); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - Config->set_solo_mute_override (tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Solo"), "toggle-mute-overrides-solo"); + Config->set_solo_mute_override (tact->get_active()); } void @@ -812,12 +825,8 @@ MonitorSection::dim_all () return; } - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_dim_all (tact->get_active()); - } - + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-dim-all"); + _monitor->set_dim_all (tact->get_active()); } void @@ -827,11 +836,8 @@ MonitorSection::cut_all () return; } - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_cut_all (tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-cut-all"); + _monitor->set_cut_all (tact->get_active()); } void @@ -841,11 +847,8 @@ MonitorSection::mono () return; } - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_mono (tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-mono"); + _monitor->set_mono (tact->get_active()); } void @@ -858,11 +861,8 @@ MonitorSection::cut_channel (uint32_t chn) char buf[64]; snprintf (buf, sizeof (buf), "monitor-cut-%u", chn); - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_cut (chn, tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), buf); + _monitor->set_cut (chn, tact->get_active()); } void @@ -875,12 +875,8 @@ MonitorSection::dim_channel (uint32_t chn) char buf[64]; snprintf (buf, sizeof (buf), "monitor-dim-%u", chn); - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_dim (chn, tact->get_active()); - } - + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), buf); + _monitor->set_dim (chn, tact->get_active()); } void @@ -893,11 +889,8 @@ MonitorSection::solo_channel (uint32_t chn) char buf[64]; snprintf (buf, sizeof (buf), "monitor-solo-%u", chn); - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_solo (chn, tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), buf); + _monitor->set_solo (chn, tact->get_active()); } @@ -911,11 +904,8 @@ MonitorSection::invert_channel (uint32_t chn) char buf[64]; snprintf (buf, sizeof (buf), "monitor-invert-%u", chn); - Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - _monitor->set_polarity (chn, tact->get_active()); - } + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Monitor"), buf); + _monitor->set_polarity (chn, tact->get_active()); } void @@ -925,57 +915,58 @@ MonitorSection::register_actions () string action_descr; Glib::RefPtr act; - monitor_actions = ActionManager::create_action_group (this, X_("Monitor")); + /* ...will get sensitized if a mon-session is added */ - act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleExclusiveSolo)); + monitor_actions = ActionManager::create_action_group (bindings, X_("Monitor")); + solo_actions = ActionManager::create_action_group (bindings, X_("Monitor")); - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - tact->set_active (Config->get_exclusive_solo()); + ActionManager::register_toggle_action (monitor_actions, X_("UseMonitorSection"), _("Use Monitor Section"), sigc::mem_fun(*this, &MonitorSection::toggle_use_monitor_section)); + ActionManager::register_toggle_action (monitor_actions, "monitor-mono", _("Monitor Section: Mono"), sigc::mem_fun (*this, &MonitorSection::mono)); + ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", _("Monitor Section: Mute"), sigc::mem_fun (*this, &MonitorSection::cut_all)); + ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", _("Monitor Section: Dim"), sigc::mem_fun (*this, &MonitorSection::dim_all)); - act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleMuteOverridesSolo)); + ActionManager::register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"), + sigc::mem_fun (*this, &MonitorSection::update_processor_box)); - tact = Glib::RefPtr::cast_dynamic(act); - tact->set_active (Config->get_solo_mute_override()); for (uint32_t chn = 0; chn < 16; ++chn) { action_name = string_compose (X_("monitor-cut-%1"), chn); action_descr = string_compose (_("Cut monitor channel %1"), chn); ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), - sigc::bind (sigc::ptr_fun (action_proxy1), CutChannel, chn)); + sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn)); action_name = string_compose (X_("monitor-dim-%1"), chn); action_descr = string_compose (_("Dim monitor channel %1"), chn); ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), - sigc::bind (sigc::ptr_fun (action_proxy1), DimChannel, chn)); + sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn)); action_name = string_compose (X_("monitor-solo-%1"), chn); action_descr = string_compose (_("Solo monitor channel %1"), chn); ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), - sigc::bind (sigc::ptr_fun (action_proxy1), SoloChannel, chn)); + sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn)); action_name = string_compose (X_("monitor-invert-%1"), chn); action_descr = string_compose (_("Invert monitor channel %1"), chn); ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), - sigc::bind (sigc::ptr_fun (action_proxy1), InvertChannel, chn)); + sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn)); } - solo_actions = ActionManager::create_action_group (this, X_("Solo")); + solo_actions = ActionManager::create_action_group (bindings, X_("Solo")); RadioAction::Group solo_group; ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUseInPlace)); + sigc::mem_fun (*this, &MonitorSection::solo_use_in_place)); ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-afl", _("After Fade Listen (AFL) solo"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUseAFL)); + sigc::mem_fun (*this, &MonitorSection::solo_use_afl)); ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUsePFL)); - - ActionManager::register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"), - sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleMonitorProcessorBox)); + sigc::mem_fun (*this, &MonitorSection::solo_use_pfl)); + ActionManager::register_toggle_action (solo_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), + sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo)); + ActionManager::register_toggle_action (solo_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"), + sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo)); } void @@ -986,23 +977,17 @@ MonitorSection::solo_use_in_place () active. */ - Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place")); - - if (act) { - Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); - if (ract) { - if (!ract->get_active ()) { - /* We are turning SiP off, which means that AFL or PFL will be turned on - shortly; don't update the solo model in the mean time, as if the currently - configured listen position is not the one that is about to be turned on, - things will go wrong. - */ - _inhibit_solo_model_update = true; - } - Config->set_solo_control_is_listen_control (!ract->get_active()); - _inhibit_solo_model_update = false; - } - } + Glib::RefPtr ract = ActionManager::get_radio_action (X_("Solo"), X_("solo-use-in-place")); + if (!ract->get_active ()) { + /* We are turning SiP off, which means that AFL or PFL will be turned on + shortly; don't update the solo model in the mean time, as if the currently + configured listen position is not the one that is about to be turned on, + things will go wrong. + */ + _inhibit_solo_model_update = true; + } + Config->set_solo_control_is_listen_control (!ract->get_active()); + _inhibit_solo_model_update = false; } void @@ -1013,15 +998,10 @@ MonitorSection::solo_use_afl () active. */ - Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); - if (act) { - Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); - if (ract) { - if (ract->get_active()) { - Config->set_solo_control_is_listen_control (true); - Config->set_listen_position (AfterFaderListen); - } - } + Glib::RefPtr ract = ActionManager::get_radio_action (X_("Solo"), X_("solo-use-afl")); + if (ract->get_active()) { + Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (AfterFaderListen); } } @@ -1033,15 +1013,10 @@ MonitorSection::solo_use_pfl () active. */ - Glib::RefPtr act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl")); - if (act) { - Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); - if (ract) { - if (ract->get_active()) { - Config->set_solo_control_is_listen_control (true); - Config->set_listen_position (PreFaderListen); - } - } + Glib::RefPtr ract = ActionManager::get_radio_action (X_("Solo"), X_("solo-use-pfl")); + if (ract->get_active()) { + Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (PreFaderListen); } } @@ -1053,7 +1028,7 @@ MonitorSection::update_solo_model () } const char* action_name = 0; - Glib::RefPtr act; + Glib::RefPtr ract; if (Config->get_solo_control_is_listen_control()) { switch (Config->get_listen_position()) { @@ -1068,22 +1043,18 @@ MonitorSection::update_solo_model () action_name = X_("solo-use-in-place"); } - act = ActionManager::get_action (X_("Solo"), action_name); - if (act) { + ract = ActionManager::get_radio_action (X_("Solo"), action_name); - Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); - if (ract) { - /* because these are radio buttons, one of them will be - active no matter what. to trigger a change in the - action so that the view picks it up, toggle it. - */ - if (ract->get_active()) { - ract->set_active (false); - } - ract->set_active (true); - } + /* because these are radio buttons, one of them will be + active no matter what. to trigger a change in the + action so that the view picks it up, toggle it. + */ + if (ract->get_active()) { + ract->set_active (false); } + + ract->set_active (true); } void @@ -1098,29 +1069,14 @@ MonitorSection::map_state () Glib::RefPtr act; Glib::RefPtr tact; - act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); - if (act) { - tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->cut_all()); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-cut-all"); + tact->set_active (_monitor->cut_all()); - act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); - if (act) { - tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->dim_all()); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-dim-all"); + tact->set_active (_monitor->dim_all()); - act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); - if (act) { - tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->mono()); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-mono"); + tact->set_active (_monitor->mono()); uint32_t nchans = _monitor->output_streams().n_audio(); @@ -1131,40 +1087,20 @@ MonitorSection::map_state () char action_name[32]; snprintf (action_name, sizeof (action_name), "monitor-cut-%u", n); - act = ActionManager::get_action (X_("Monitor"), action_name); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->cut (n)); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), action_name); + tact->set_active (_monitor->cut (n)); snprintf (action_name, sizeof (action_name), "monitor-dim-%u", n); - act = ActionManager::get_action (X_("Monitor"), action_name); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->dimmed (n)); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), action_name); + tact->set_active (_monitor->dimmed (n)); snprintf (action_name, sizeof (action_name), "monitor-solo-%u", n); - act = ActionManager::get_action (X_("Monitor"), action_name); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->soloed (n)); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), action_name); + tact->set_active (_monitor->soloed (n)); snprintf (action_name, sizeof (action_name), "monitor-invert-%u", n); - act = ActionManager::get_action (X_("Monitor"), action_name); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - if (tact) { - tact->set_active (_monitor->inverted (n)); - } - } + tact = ActionManager::get_toggle_action (X_("Monitor"), action_name); + tact->set_active (_monitor->inverted (n)); } } @@ -1238,12 +1174,9 @@ MonitorSection::cancel_audition (GdkEventButton*) } #define SYNCHRONIZE_TOGGLE_ACTION(action, value) \ - if (action) { \ - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(action); \ - if (tact && tact->get_active() != value) { \ - tact->set_active(value); \ - } \ - } + if (action && action->get_active() != value) { \ + action->set_active(value); \ + } \ void MonitorSection::parameter_changed (std::string name) @@ -1253,13 +1186,11 @@ MonitorSection::parameter_changed (std::string name) } else if (name == "listen-position") { update_solo_model (); } else if (name == "solo-mute-override") { - SYNCHRONIZE_TOGGLE_ACTION( - ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo"), - Config->get_solo_mute_override ()) + 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_action (X_("Monitor"), "toggle-exclusive-solo"), - Config->get_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 ()); } } @@ -1678,62 +1609,17 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange) } void -MonitorSection::action_proxy0 (enum MonitorActions action) +MonitorSection::use_others_actions () { - MonitorSection* ms = Mixer_UI::instance()->monitor_section (); - if (!ms) { - return; - } - switch (action) { - case MonitorMono: - ms->mono (); - break; - case MonitorCutAll: - ms->cut_all (); - break; - case MonitorDimAll: - ms->dim_all (); - break; - case ToggleExclusiveSolo: - ms->toggle_exclusive_solo (); - break; - case ToggleMuteOverridesSolo: - ms->toggle_mute_overrides_solo (); - break; - case SoloUseInPlace: - ms->solo_use_in_place (); - break; - case SoloUseAFL: - ms->solo_use_afl (); - break; - case SoloUsePFL: - ms->solo_use_pfl (); - break; - case ToggleMonitorProcessorBox: - ms->update_processor_box (); - break; - } + rude_solo_button.set_related_action (ActionManager::get_action (X_("Main"), X_("cancel-solo"))); } void -MonitorSection::action_proxy1 (enum ChannelActions action, uint32_t chn) +MonitorSection::toggle_use_monitor_section () { - MonitorSection* ms = Mixer_UI::instance()->monitor_section (); - if (!ms) { + if (!_session) { return; } - switch (action) { - case CutChannel: - ms->cut_channel (chn); - break; - case DimChannel: - ms->dim_channel (chn); - break; - case SoloChannel: - ms->solo_channel (chn); - break; - case InvertChannel: - ms->invert_channel (chn); - break; - } + + Config->set_use_monitor_bus (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active()); }