From 027ffb1b371e94183e21700dae7e09dc07b4c7ac Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 8 Jan 2016 01:31:20 +0100 Subject: monitor-section: re-connect to static actions --- gtk2_ardour/monitor_section.cc | 60 +++++++++++++++++++++++++++++++++++++++--- gtk2_ardour/monitor_section.h | 1 + 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index e4abbc18bc..0741bffa5d 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -92,11 +92,9 @@ MonitorSection::MonitorSection (Session* s) Glib::RefPtr act; if (!monitor_actions) { - - /* do some static stuff */ - register_actions (); - + } else { + connect_actions (); } _plugin_selector = new PluginSelector (PluginManager::instance()); @@ -919,6 +917,60 @@ MonitorSection::register_actions () ActionManager::add_action_group (solo_actions); } +void +MonitorSection::connect_actions () +{ + Glib::RefPtr act; + Glib::RefPtr tact; + +#define MON_TOG(NAME, FUNC) \ + act = ActionManager::get_action (X_("Monitor"), NAME); \ + tact = Glib::RefPtr::cast_dynamic (act); \ + assert (tact); \ + tact->signal_toggled().connect (sigc::mem_fun (*this, &MonitorSection::FUNC)); \ + + MON_TOG("monitor-mono", mono); + MON_TOG("monitor-cut-all", cut_all); + MON_TOG("monitor-dim-all", dim_all); + + MON_TOG("toggle-exclusive-solo", toggle_exclusive_solo); + tact->set_active (Config->get_exclusive_solo()); + + MON_TOG("toggle-mute-overrides-solo", toggle_mute_overrides_solo); + tact->set_active (Config->get_solo_mute_override()); +#undef MON_TOG + +#define MON_BIND(NAME, FUNC, ARG) \ + act = ActionManager::get_action (X_("Monitor"), NAME); \ + tact = Glib::RefPtr::cast_dynamic (act); \ + assert (tact); \ + tact->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::FUNC), ARG)); + + for (uint32_t chn = 0; chn < 16; ++chn) { + std::string action_name = string_compose (X_("monitor-cut-%1"), chn); + MON_BIND(action_name.c_str(), cut_channel, chn); + action_name = string_compose (X_("monitor-dim-%1"), chn); + MON_BIND(action_name.c_str(), dim_channel, chn); + action_name = string_compose (X_("monitor-solo-%1"), chn); + MON_BIND(action_name.c_str(), solo_channel, chn); + action_name = string_compose (X_("monitor-invert-%1"), chn); + MON_BIND(action_name.c_str(), invert_channel, chn); + } +#undef MON_BIND + +#define SOLO_RADIO(NAME, FUNC) \ + act = ActionManager::get_action (X_("Solo"), NAME); \ + ract = Glib::RefPtr::cast_dynamic (act); \ + assert (ract); \ + ract->signal_toggled().connect (sigc::mem_fun (*this, &MonitorSection::FUNC)); \ + + Glib::RefPtr ract; + SOLO_RADIO ("solo-use-in-place", solo_use_in_place); + SOLO_RADIO ("solo-use-afl", solo_use_afl); + SOLO_RADIO ("solo-use-pfl", solo_use_pfl); +#undef SOLO_RADIO +} + void MonitorSection::solo_use_in_place () { diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h index c8aed68dcb..67d22d0af0 100644 --- a/gtk2_ardour/monitor_section.h +++ b/gtk2_ardour/monitor_section.h @@ -110,6 +110,7 @@ class MonitorSection : public RouteUI static Glib::RefPtr monitor_actions; void register_actions (); + void connect_actions (); void cut_channel (uint32_t); void dim_channel (uint32_t); -- cgit v1.2.3