full (?) set of changes required to make MonitorSection an "always-there" component...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 11 Dec 2018 15:28:47 +0000 (10:28 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 11 Dec 2018 15:28:47 +0000 (10:28 -0500)
Obviously, it is not always shown, but it always exists, which means that its actions are always accessible

gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_mixer.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/monitor_section.cc
gtk2_ardour/monitor_section.h

index 8080e66b65f1bd4b9f887df52ed80d39c05637f7..d0d51fbda6d5c6286779e44224011e66a819ff47 100644 (file)
@@ -818,24 +818,3 @@ ARDOUR_UI::update_title ()
 
 }
 
-void
-ARDOUR_UI::toggle_use_monitor_section ()
-{
-       if (!_session) {
-               return;
-       }
-
-       RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
-       assert (act);  RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       assert (tact);
-
-       bool yn = tact->get_active ();
-
-       if (yn) {
-               _session->add_monitor_section ();
-       } else {
-               _session->remove_monitor_section ();
-       }
-
-       Config->set_use_monitor_bus (yn);
-}
index 467ca264cb9e702879d573e9d66ef290cc1dbd83..f15c1bed2467cf6b1948cf56f43226526a513ebe 100644 (file)
@@ -75,6 +75,13 @@ ARDOUR_UI::we_have_dependents ()
        }
 
        install_actions ();
+       /* The monitor section relies on at least 1 action defined by us. Since that
+        * action now exists, give it a chance to use it.
+        */
+       mixer->monitor_section().use_others_actions ();
+
+       /* Create "static" actions that apply to all ProcessorBoxes
+        */
        ProcessorBox::register_actions ();
 
        /* Global, editor, mixer, processor box actions are defined now. Link
index a9b041d085b8c0793ded9d0a41ea5a2def75bb3e..b80ae504282d4151a550336b781d10d75af4f7b8 100644 (file)
@@ -631,17 +631,6 @@ ARDOUR_UI::install_actions ()
        act = ActionManager::register_action (main_actions, X_("MonitorMenu"), _("Monitor Section"));
        ActionManager::session_sensitive_actions.push_back (act);
 
-       Glib::RefPtr<ActionGroup> monitor_actions = ActionManager::create_action_group (global_bindings, X_("Monitor"));
-
-       act = ActionManager::register_toggle_action (monitor_actions, X_("UseMonitorSection"), _("Use Monitor Section"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_use_monitor_section));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (monitor_actions, "monitor-mono", _("Monitor Section: Mono"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_mono));
-       act->set_sensitive(false);
-       act = ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", _("Monitor Section: Mute"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_cut_all));
-       act->set_sensitive(false);
-       act = ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", _("Monitor Section: Dim"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_dim_all));
-       act->set_sensitive(false);
-
        act = ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_time_master));
@@ -820,11 +809,9 @@ ARDOUR_UI::save_ardour_state ()
 
        XMLNode* tearoff_node = new XMLNode (X_("Tearoffs"));
 
-       if (mixer->monitor_section()) {
-               XMLNode* t = new XMLNode (X_("monitor-section"));
-               mixer->monitor_section()->tearoff().add_state (*t);
-               tearoff_node->add_child_nocopy (*t);
-       }
+       XMLNode* t = new XMLNode (X_("monitor-section"));
+       mixer->monitor_section().tearoff().add_state (*t);
+       tearoff_node->add_child_nocopy (*t);
 
        window_node->add_child_nocopy (*tearoff_node);
 
index 4f5614e32a0e278ffb9879673833eae5424103e8..93e1e6000427598e2a6fb396cfa16361c2193712 100644 (file)
@@ -27,8 +27,8 @@
 
 #include "actions.h"
 #include "ardour_ui.h"
-#include "mixer_ui.h"
 #include "meterbridge.h"
+#include "mixer_ui.h"
 
 #include "pbd/i18n.h"
 
index 6a281e001fe85bd914057fac709a1ce7fb396c98..129ad39aa50836ecf568b7e320d240eed60b90df 100644 (file)
@@ -103,7 +103,6 @@ Mixer_UI::Mixer_UI ()
        , no_track_list_redisplay (false)
        , in_group_row_change (false)
        , track_menu (0)
-       , _monitor_section (0)
        , _plugin_selector (0)
        , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
        , _spill_scroll_position (0)
@@ -348,6 +347,11 @@ Mixer_UI::Mixer_UI ()
        favorite_plugins_display.show();
        add_button.show ();
 
+       XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
+       if (mnode) {
+               _monitor_section.tearoff().set_state (*mnode);
+       }
+
        MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
        VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
 
@@ -368,10 +372,8 @@ Mixer_UI::Mixer_UI ()
 
 Mixer_UI::~Mixer_UI ()
 {
-       if (_monitor_section) {
-               monitor_section_detached ();
-               delete _monitor_section;
-       }
+       monitor_section_detached ();
+
        delete _plugin_selector;
        delete track_menu;
 }
@@ -563,25 +565,14 @@ Mixer_UI::add_stripables (StripableList& slist)
 
                                if (route->is_monitor()) {
 
-                                       if (!_monitor_section) {
-                                               _monitor_section = new MonitorSection (_session);
-
-                                               XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
-                                               if (mnode) {
-                                                       _monitor_section->tearoff().set_state (*mnode);
-                                               }
-
-                                               set_monitor_action_sensitivity(true);
-                                       }
-
-                                       out_packer.pack_end (_monitor_section->tearoff(), false, false);
-                                       _monitor_section->set_session (_session);
-                                       _monitor_section->tearoff().show_all ();
+                                       out_packer.pack_end (_monitor_section.tearoff(), false, false);
+                                       _monitor_section.set_session (_session);
+                                       _monitor_section.tearoff().show_all ();
 
-                                       _monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
-                                       _monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
+                                       _monitor_section.tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
+                                       _monitor_section.tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
 
-                                       if (_monitor_section->tearoff().torn_off()) {
+                                       if (_monitor_section.tearoff().torn_off()) {
                                                monitor_section_detached ();
                                        } else {
                                                monitor_section_attached ();
@@ -1036,6 +1027,7 @@ void
 Mixer_UI::set_session (Session* sess)
 {
        SessionHandlePtr::set_session (sess);
+       _monitor_section.set_session (sess);
 
        if (_plugin_selector) {
                _plugin_selector->set_session (_session);
@@ -1043,10 +1035,6 @@ Mixer_UI::set_session (Session* sess)
 
        _group_tabs->set_session (sess);
 
-       if (_monitor_section) {
-               _monitor_section->set_session (_session);
-       }
-
        if (!_session) {
                _selection.clear ();
                return;
@@ -1105,9 +1093,7 @@ Mixer_UI::session_going_away ()
                delete (*i);
        }
 
-       if (_monitor_section) {
-               _monitor_section->tearoff().hide_visible ();
-       }
+       _monitor_section.tearoff().hide_visible ();
 
        monitor_section_detached ();
 
@@ -1971,17 +1957,14 @@ Mixer_UI::toggle_monitor_section ()
 void
 Mixer_UI::showhide_monitor_section (bool yn)
 {
-       if (!monitor_section()) {
-               return;
-       }
-       if (monitor_section()->tearoff().torn_off()) {
+       if (monitor_section().tearoff().torn_off()) {
                return;
        }
 
        if (yn) {
-               monitor_section()->tearoff().show();
+               monitor_section().tearoff().show();
        } else {
-               monitor_section()->tearoff().hide();
+               monitor_section().tearoff().hide();
        }
 }
 
@@ -2633,58 +2616,30 @@ Mixer_UI::set_axis_targets_for_operation ()
 }
 
 void
-Mixer_UI::set_monitor_action_sensitivity (bool yn)
+Mixer_UI::monitor_section_going_away ()
 {
-       // TODO use ActionMap::find_toggle_action()->set_*();
-       Glib::RefPtr<Action> act;
-       Glib::RefPtr<ToggleAction> tact;
-
-       act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
-       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       tact->set_active (yn);
-
-       act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
-       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       tact->set_sensitive (yn);
+       XMLNode* ui_node = Config->extra_xml(X_("UI"));
 
-       act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
-       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       tact->set_sensitive (yn);
-
-       act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
-       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       tact->set_sensitive (yn);
-}
+       /* immediate state save.
+        *
+        * Tearoff settings are otherwise only stored during
+        * save_ardour_state(). The mon-section may or may not
+        * exist at that point.
+        */
 
-void
-Mixer_UI::monitor_section_going_away ()
-{
-       /* Set sensitivity based on existence of the monitor bus  */
-
-       set_monitor_action_sensitivity(false);
-
-       if (_monitor_section) {
-
-               XMLNode* ui_node = Config->extra_xml(X_("UI"));
-               /* immediate state save.
-                *
-                * Tearoff settings are otherwise only stored during
-                * save_ardour_state(). The mon-section may or may not
-                * exist at that point.
-                * */
-               if (ui_node) {
-                       XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
-                       if (tearoff_node) {
-                               tearoff_node->remove_nodes_and_delete (X_("monitor-section"));
-                               XMLNode* t = new XMLNode (X_("monitor-section"));
-                               _monitor_section->tearoff().add_state (*t);
-                               tearoff_node->add_child_nocopy (*t);
-                       }
+       if (ui_node) {
+               XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
+               if (tearoff_node) {
+                       tearoff_node->remove_nodes_and_delete (X_("monitor-section"));
+                       XMLNode* t = new XMLNode (X_("monitor-section"));
+                       _monitor_section.tearoff().add_state (*t);
+                       tearoff_node->add_child_nocopy (*t);
                }
-               monitor_section_detached ();
-               out_packer.remove (_monitor_section->tearoff());
-               _monitor_section->set_session (0);
        }
+
+       monitor_section_detached ();
+       out_packer.remove (_monitor_section.tearoff());
+       _monitor_section.set_session (0);
 }
 
 void
index 6c5107699988b1b8513beee8fb47f38eba6caf0e..1dd4b8de92cdb61954d1ddf84e91723e6da015b3 100644 (file)
@@ -52,6 +52,7 @@
 
 #include "axis_provider.h"
 #include "enums.h"
+#include "monitor_section.h"
 #include "route_processor_selection.h"
 
 namespace ARDOUR {
@@ -107,7 +108,7 @@ public:
        void maximise_mixer_space();
        void restore_mixer_space();
 
-       MonitorSection* monitor_section() const { return _monitor_section; }
+       MonitorSection& monitor_section() { return _monitor_section; }
 
        void deselect_all_strip_processors();
        void delete_processors();
@@ -287,8 +288,8 @@ private:
        void track_column_click (gint);
        void build_track_menu ();
 
-       MonitorSection* _monitor_section;
-       PluginSelector    *_plugin_selector;
+       MonitorSection   _monitor_section;
+       PluginSelector *_plugin_selector;
 
        void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
        void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
@@ -378,10 +379,7 @@ private:
 
        friend class MixerGroupTabs;
 
-       void set_monitor_action_sensitivity (bool);
-
        void monitor_section_going_away ();
-
        void monitor_section_attached ();
        void monitor_section_detached ();
 
index eb5e4eff977061f80e8ca05dfbea0e8a5c8b60b4..f1ff7fcd7eb466f8eb54febda2f5d3715d86a412 100644 (file)
@@ -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,6 @@ MonitorSection::MonitorSection (Session* s)
        , _rr_selection ()
        , _ui_initialized (false)
 {
-
        using namespace Menu_Helpers;
 
        Glib::RefPtr<Action> act;
@@ -96,7 +94,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 +103,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 +118,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 +163,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,10 +172,7 @@ 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"));
@@ -591,6 +581,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) {
@@ -606,6 +604,10 @@ MonitorSection::set_session (Session* s)
                        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,17 +615,16 @@ MonitorSection::set_session (Session* s)
                        _route.reset ();
                        delete _output_selector;
                        _output_selector = 0;
+
+                       ActionManager::set_sensitive (monitor_actions, false);
+                       ActionManager::set_sensitive (solo_actions, true);
                }
 
                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();
@@ -636,6 +637,9 @@ MonitorSection::set_session (Session* s)
                _output_selector = 0;
 
                assign_controllables ();
+
+               ActionManager::set_sensitive (monitor_actions, false);
+               ActionManager::set_sensitive (solo_actions, false);
        }
 }
 
@@ -783,12 +787,7 @@ MonitorSection::toggle_exclusive_solo ()
                return;
        }
 
-       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo");
-       if (act) {
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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,7 +797,7 @@ MonitorSection::toggle_mute_overrides_solo ()
                return;
        }
 
-       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo");
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), "toggle-mute-overrides-solo");
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
                Config->set_solo_mute_override (tact->get_active());
@@ -925,41 +924,41 @@ MonitorSection::register_actions ()
        string action_descr;
        Glib::RefPtr<Action> act;
 
-       monitor_actions = ActionManager::create_action_group (bindings, 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<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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<ToggleAction>::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));
 
        }
 
@@ -967,15 +966,16 @@ MonitorSection::register_actions ()
        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
@@ -1238,12 +1238,9 @@ MonitorSection::cancel_audition (GdkEventButton*)
 }
 
 #define SYNCHRONIZE_TOGGLE_ACTION(action, value) \
-       if (action) { \
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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 +1250,9 @@ 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 ());
        }
 }
 
@@ -1678,62 +1671,25 @@ 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;
+
+       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);
 }
index 2420888e9d69b5bc66b094622d196707b552f6af..67340e135f3ce79d1903128825e86d95c89da97c 100644 (file)
@@ -17,6 +17,9 @@
 
 */
 
+#ifndef __gtk2_ardour_monitor_section_h__
+#define __gtk2_ardour_monitor_section_h__
+
 #include <gtkmm/box.h>
 #include <gtkmm/eventbox.h>
 #include <gtkmm/sizegroup.h>
@@ -44,7 +47,7 @@ namespace ArdourWidgets {
 class MonitorSection : public RouteUI, public Gtk::EventBox
 {
 public:
-       MonitorSection (ARDOUR::Session*);
+       MonitorSection ();
        ~MonitorSection ();
 
        void set_session (ARDOUR::Session*);
@@ -55,6 +58,8 @@ public:
 
        PluginSelector* plugin_selector() { return _plugin_selector; }
 
+       void use_others_actions ();
+
 private:
        Gtk::HBox hpacker;
        Gtk::VBox vpacker;
@@ -108,32 +113,10 @@ private:
        boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
        boost::shared_ptr<ARDOUR::Route> _route;
 
-       enum MonitorActions {
-               MonitorMono,
-               MonitorCutAll,
-               MonitorDimAll,
-               ToggleExclusiveSolo,
-               ToggleMuteOverridesSolo,
-               SoloUseInPlace,
-               SoloUseAFL,
-               SoloUsePFL,
-               ToggleMonitorProcessorBox
-       };
-
-       enum ChannelActions {
-               CutChannel,
-               DimChannel,
-               SoloChannel,
-               InvertChannel
-       };
-
        Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
        Glib::RefPtr<Gtk::ActionGroup> solo_actions;
        void register_actions ();
 
-       static void action_proxy0 (enum MonitorActions);
-       static void action_proxy1 (enum ChannelActions, uint32_t);
-
        void cut_channel (uint32_t);
        void dim_channel (uint32_t);
        void solo_channel (uint32_t);
@@ -208,4 +191,8 @@ private:
        void load_bindings ();
        bool enter_handler (GdkEventCrossing*);
        bool leave_handler (GdkEventCrossing*);
+
+       void toggle_use_monitor_section ();
 };
+
+#endif /* __gtk2_ardour_monitor_section_h__ */