full (?) set of changes required to make MonitorSection an "always-there" component...
[ardour.git] / gtk2_ardour / monitor_section.cc
index 31378401e78b1335c6157f4dd5c24de3ed21d1b0..f1ff7fcd7eb466f8eb54febda2f5d3715d86a412 100644 (file)
 #include "pbd/error.h"
 #include "pbd/replace_all.h"
 
-#include "gtkmm2ext/bindable_button.h"
-#include "gtkmm2ext/tearoff.h"
 #include "gtkmm2ext/actions.h"
 #include "gtkmm2ext/utils.h"
 
 #include <gtkmm/menu.h>
 #include <gtkmm/menuitem.h>
 
+#include "widgets/tearoff.h"
+#include "widgets/tooltips.h"
+
 #include "ardour/amp.h"
 #include "ardour/audioengine.h"
 #include "ardour/monitor_processor.h"
 #include "ardour/port.h"
 #include "ardour/route.h"
+#include "ardour/solo_isolate_control.h"
 #include "ardour/user_bundle.h"
 #include "ardour/plugin_manager.h"
 
 #include "ardour_ui.h"
 #include "gui_thread.h"
+#include "mixer_ui.h"
 #include "monitor_section.h"
 #include "public_editor.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace PBD;
 using namespace std;
 
-Glib::RefPtr<ActionGroup> MonitorSection::monitor_actions;
-
 #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
 
-MonitorSection::MonitorSection (Session* s)
-       : AxisView (s)
-       , RouteUI (s)
+MonitorSection::MonitorSection ()
+       : RouteUI ((Session*) 0)
        , _tearoff (0)
+       , channel_table (0)
        , channel_table_viewport (*channel_table_scroller.get_hadjustment()
                                  , *channel_table_scroller.get_vadjustment ())
        , gain_control (0)
@@ -83,23 +84,18 @@ MonitorSection::MonitorSection (Session* s)
        , solo_mute_override_button (ArdourButton::led_default_elements)
        , toggle_processorbox_button (ArdourButton::default_elements)
        , _inhibit_solo_model_update (false)
+       , _rr_selection ()
        , _ui_initialized (false)
-       , myactions (X_("monitor section"))
-       , bindings (0)
 {
-
        using namespace Menu_Helpers;
 
        Glib::RefPtr<Action> act;
 
-       if (!monitor_actions) {
-               register_actions ();
-               load_bindings ();
-               if (bindings) {
-                       set_data ("ardour-bindings", bindings);
-                       ARDOUR_UI::instance()->add_keyboard_binding_tab (_("Monitor Section"), *bindings);
-               }
-       }
+       load_bindings ();
+       register_actions ();
+       set_data ("ardour-bindings", bindings);
+
+       channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
 
        _plugin_selector = new PluginSelector (PluginManager::instance());
        insert_box = new ProcessorBox (_session, boost::bind (&MonitorSection::plugin_selector, this), _rr_selection, 0);
@@ -107,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");
@@ -124,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);
@@ -171,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);
        }
@@ -180,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"));
@@ -308,10 +297,7 @@ MonitorSection::MonitorSection (Session* s)
        channel_table_scroller.show ();
        channel_table_scroller.add (channel_table_viewport);
 
-       channel_size_group  = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
        channel_size_group->add_widget (channel_table_header);
-       channel_size_group->add_widget (channel_table);
-
        channel_table_header.resize (1, 5);
 
        Label* l1 = manage (new Label (X_("  ")));
@@ -384,10 +370,6 @@ MonitorSection::MonitorSection (Session* s)
        level_tbl->attach (*dim_control,         1, 3, 4, 5, EXPAND|FILL, SHRINK, 1, 2);
        level_tbl->attach (*dim_display,         1, 3, 5, 6, EXPAND     , SHRINK, 1, 2);
 
-       /* note that we don't pack the table_hpacker till later
-        * -> top level channel_table_packer */
-       table_hpacker.pack_start (channel_table, true, true);
-
        // mono, dim
        HBox* mono_dim_box = manage (new HBox);
        mono_dim_box->set_spacing (PX_SCALE(4));
@@ -412,6 +394,18 @@ MonitorSection::MonitorSection (Session* s)
        lower_packer->pack_start (*mono_dim_box,        false, false, PX_SCALE(2));
        lower_packer->pack_start (cut_all_button,       false, false, PX_SCALE(2));
 
+       // calc height of mixer scrollbar
+       int scrollbar_height = 0;
+       {
+               Gtk::Window window (WINDOW_TOPLEVEL);
+               HScrollbar scrollbar;
+               window.add (scrollbar);
+               scrollbar.set_name ("MixerWindow");
+               scrollbar.ensure_style();
+               Gtk::Requisition requisition(scrollbar.size_request ());
+               scrollbar_height = requisition.height;
+       }
+
        // output port select
        VBox* out_packer = manage (new VBox);
        out_packer->set_spacing (PX_SCALE(2));
@@ -429,7 +423,13 @@ MonitorSection::MonitorSection (Session* s)
        vpacker.pack_start (*level_tbl,           false, false, PX_SCALE(8));
        vpacker.pack_start (*lower_packer,        false, false, PX_SCALE(8));
        vpacker.pack_start (master_packer,        false, false, PX_SCALE(10));
-       vpacker.pack_end   (*out_packer,          false, false, PX_SCALE(3));
+       vpacker.pack_end   (*out_packer,          false, false,
+#ifdef MIXBUS
+                       scrollbar_height - 2 /* no outer sample */
+#else
+                       scrollbar_height + 2 /* sample borders */
+#endif
+                       );
 
        hpacker.set_spacing (0);
        hpacker.pack_start (vpacker, true, true);
@@ -446,7 +446,6 @@ MonitorSection::MonitorSection (Session* s)
        mono_dim_box->show ();
        spin_packer->show ();
        master_packer.show ();
-       channel_table.show ();
 
        rude_box->show();
        solo_tbl->show_all();
@@ -457,7 +456,6 @@ MonitorSection::MonitorSection (Session* s)
        vpacker.show ();
        hpacker.show ();
 
-       populate_buttons ();
        map_state ();
        assign_controllables ();
 
@@ -492,28 +490,26 @@ MonitorSection::MonitorSection (Session* s)
 
 MonitorSection::~MonitorSection ()
 {
-       ARDOUR_UI::instance()->remove_keyboard_binding_tab (_("Monitor Section"));
-
        for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
                delete *i;
        }
 
        _channel_buttons.clear ();
-       _output_changed_connection.disconnect ();
-
-       delete insert_box;
-       delete output_button;
-       delete gain_control;
-       delete gain_display;
-       delete dim_control;
-       delete dim_display;
-       delete solo_boost_control;
-       delete solo_boost_display;
-       delete solo_cut_control;
-       delete solo_cut_display;
-       delete _tearoff;
-       delete _output_selector;
-       _output_selector = 0;
+       output_changed_connections.drop_connections ();
+
+       delete insert_box; insert_box = 0;
+       delete output_button; output_button = 0;
+       delete gain_control; gain_control = 0;
+       delete gain_display; gain_display = 0;
+       delete dim_control; dim_control = 0;
+       delete dim_display; dim_display = 0;
+       delete solo_boost_control; solo_boost_control = 0;
+       delete solo_boost_display; solo_boost_display = 0;
+       delete solo_cut_control; solo_cut_control = 0;
+       delete solo_cut_display; solo_cut_display = 0;
+       delete _tearoff; _tearoff = 0;
+       delete _output_selector; _output_selector = 0;
+       delete channel_table; channel_table = 0;
 }
 
 bool
@@ -580,73 +576,58 @@ MonitorSection::update_processor_box ()
 void
 MonitorSection::set_session (Session* s)
 {
-       AxisView::set_session (s);
+       RouteUI::set_session (s);
        _plugin_selector->set_session (_session);
 
        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) {
                        /* session with monitor section */
                        _monitor = _route->monitor_control ();
                        assign_controllables ();
-                       _route->output()->changed.connect (_output_changed_connection, invalidator (*this),
+                       _route->output()->changed.connect (output_changed_connections, invalidator (*this),
                                                                                        boost::bind (&MonitorSection::update_output_display, this),
                                                                                        gui_context());
                        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());
                        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_connection.disconnect();
+                       output_changed_connections.drop_connections();
                        _monitor.reset ();
                        _route.reset ();
                        delete _output_selector;
                        _output_selector = 0;
-               }
 
-               if (channel_table_scroller.get_parent()) {
-                       /* scroller is packed, so remove it */
-                       channel_table_packer.remove (channel_table_scroller);
+                       ActionManager::set_sensitive (monitor_actions, false);
+                       ActionManager::set_sensitive (solo_actions, true);
                }
 
-               if (table_hpacker.get_parent () == &channel_table_packer) {
-                       /* this occurs when the table hpacker is directly
-                                packed, so remove it.
-                                */
-                       channel_table_packer.remove (table_hpacker);
-               } else if (table_hpacker.get_parent()) {
-                       channel_table_viewport.remove ();
-               }
-
-               if (_monitor->output_streams().n_audio() > 7) {
-                       /* put the table into a scrolled window, and then put
-                        * that into the channel vpacker, after the table header
-                        */
-                       channel_table_viewport.add (table_hpacker);
-                       channel_table_packer.pack_start (channel_table_scroller, true, true);
-                       channel_table_viewport.show ();
-                       channel_table_scroller.show ();
+               populate_buttons ();
 
-               } else {
-                       /* just put the channel table itself into the channel
-                        * vpacker, after the table header
-                        */
-
-                       channel_table_packer.pack_start (table_hpacker, true, true);
-                       channel_table_scroller.hide ();
-               }
-
-               table_hpacker.show ();
-               channel_table.show ();
 
        } else {
+
                /* no session */
 
-               _output_changed_connection.disconnect();
+               output_changed_connections.drop_connections();
                _monitor.reset ();
                _route.reset ();
                control_connections.drop_connections ();
@@ -656,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);
        }
 }
 
@@ -672,20 +656,37 @@ MonitorSection::ChannelButtonSet::ChannelButtonSet ()
        invert.unset_flags (Gtk::CAN_FOCUS);
 }
 
-       void
+void
 MonitorSection::populate_buttons ()
 {
        if (!_monitor) {
                return;
        }
 
+       if (channel_table) {
+               channel_size_group->remove_widget (*channel_table);
+               delete channel_table;
+       }
+
+       channel_table = new Gtk::Table();
+
+       channel_table->set_col_spacings (6);
+       channel_table->set_row_spacings (6);
+       channel_table->set_homogeneous (true);
+
+       channel_size_group->add_widget (*channel_table);
+       channel_table->show ();
+       table_hpacker.pack_start (*channel_table, true, true);
+
+       for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
+               delete *i;
+       }
+       _channel_buttons.clear ();
+
        Glib::RefPtr<Action> act;
        uint32_t nchans = _monitor->output_streams().n_audio();
 
-       channel_table.resize (nchans, 5);
-       channel_table.set_col_spacings (6);
-       channel_table.set_row_spacings (6);
-       channel_table.set_homogeneous (true);
+       channel_table->resize (nchans, 5);
 
        const uint32_t row_offset = 0;
 
@@ -707,16 +708,16 @@ MonitorSection::populate_buttons ()
                }
 
                Label* label = manage (new Label (l));
-               channel_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL);
+               channel_table->attach (*label, 0, 1, i+row_offset, i+row_offset+1, EXPAND|FILL);
 
                ChannelButtonSet* cbs = new ChannelButtonSet;
 
                _channel_buttons.push_back (cbs);
 
-               channel_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL);
-               channel_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL);
-               channel_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL);
-               channel_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL);
+               channel_table->attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, EXPAND|FILL);
+               channel_table->attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, EXPAND|FILL);
+               channel_table->attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, EXPAND|FILL);
+               channel_table->attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, EXPAND|FILL);
 
                snprintf (buf, sizeof (buf), "monitor-cut-%u", i);
                act = ActionManager::get_action (X_("Monitor"), buf);
@@ -743,7 +744,40 @@ MonitorSection::populate_buttons ()
                }
        }
 
-       channel_table.show_all ();
+       channel_table->show_all ();
+
+       if (channel_table_scroller.get_parent()) {
+               /* scroller is packed, so remove it */
+               channel_table_packer.remove (channel_table_scroller);
+       }
+
+       if (table_hpacker.get_parent () == &channel_table_packer) {
+               /* this occurs when the table hpacker is directly
+                        packed, so remove it.
+                        */
+               channel_table_packer.remove (table_hpacker);
+       } else if (table_hpacker.get_parent()) {
+               channel_table_viewport.remove ();
+       }
+
+       if (nchans > 7) {
+               /* put the table into a scrolled window, and then put
+                * that into the channel vpacker, after the table header
+                */
+               channel_table_viewport.add (table_hpacker);
+               channel_table_packer.pack_start (channel_table_scroller, true, true);
+               channel_table_viewport.show ();
+               channel_table_scroller.show ();
+
+       } else {
+               /* just put the channel table itself into the channel
+                * vpacker, after the table header
+                */
+               channel_table_packer.pack_start (table_hpacker, true, true);
+               channel_table_scroller.hide ();
+       }
+       table_hpacker.show ();
+       channel_table->show ();
 }
 
 void
@@ -753,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
@@ -768,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());
@@ -895,120 +924,58 @@ MonitorSection::register_actions ()
        string action_descr;
        Glib::RefPtr<Action> act;
 
-       monitor_actions = myactions.create_action_group (X_("Monitor"));
-
-       myactions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"),
-                       sigc::mem_fun (*this, &MonitorSection::mono));
-
-       myactions.register_toggle_action (monitor_actions, "monitor-cut-all", _("Cut monitor"),
-                       sigc::mem_fun (*this, &MonitorSection::cut_all));
+       /* ...will get sensitized if a mon-session is added */
 
-       myactions.register_toggle_action (monitor_actions, "monitor-dim-all", _("Dim monitor"),
-                       sigc::mem_fun (*this, &MonitorSection::dim_all));
+       monitor_actions = ActionManager::create_action_group (bindings, X_("Monitor"));
+       solo_actions = ActionManager::create_action_group (bindings, X_("Monitor"));
 
-       act = myactions.register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"),
-                       sigc::mem_fun (*this, &MonitorSection::toggle_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));
 
-       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-       tact->set_active (Config->get_exclusive_solo());
+       ActionManager::register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"),
+                                              sigc::mem_fun (*this, &MonitorSection::update_processor_box));
 
-       act = myactions.register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"),
-                       sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo));
-
-       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);
-               myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
-                               sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn));
+               ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
+                                                      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);
-               myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
-                               sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn));
+               ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
+                                                      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);
-               myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
-                               sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn));
+               ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
+                                                      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);
-               myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
-                               sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
+               ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(),
+                                                      sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn));
 
        }
 
-
-       Glib::RefPtr<ActionGroup> solo_actions = myactions.create_action_group (X_("Solo"));
+       solo_actions = ActionManager::create_action_group (bindings, X_("Solo"));
        RadioAction::Group solo_group;
 
-       myactions.register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"),
-                       sigc::mem_fun (*this, &MonitorSection::solo_use_in_place));
-       myactions.register_radio_action (solo_actions, solo_group, "solo-use-afl", _("After Fade Listen (AFL) solo"),
-                       sigc::mem_fun (*this, &MonitorSection::solo_use_afl));
-       myactions.register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"),
-                       sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
-
-       myactions.register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"),
-                       sigc::mem_fun(*this, &MonitorSection::update_processor_box));
-}
-
-void
-MonitorSection::connect_actions ()
-{
-       Glib::RefPtr<Action> act;
-       Glib::RefPtr<ToggleAction> tact;
-
-#define MON_TOG(NAME, FUNC) \
-       act = ActionManager::get_action (X_("Monitor"), NAME); \
-       tact = Glib::RefPtr<ToggleAction>::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<ToggleAction>::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<RadioAction>::cast_dynamic (act); \
-       assert (ract); \
-       ract->signal_toggled().connect (sigc::mem_fun (*this, &MonitorSection::FUNC)); \
-
-       Glib::RefPtr<RadioAction> 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
+       ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"),
+                                             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::mem_fun (*this, &MonitorSection::solo_use_afl));
+       ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"),
+                                             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
@@ -1126,13 +1093,14 @@ MonitorSection::map_state ()
                return;
        }
 
-       Glib::RefPtr<Action> act;
-
        update_solo_model ();
 
+       Glib::RefPtr<Action> act;
+       Glib::RefPtr<ToggleAction> tact;
+
        act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
        if (act) {
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+               tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
                if (tact) {
                        tact->set_active (_monitor->cut_all());
                }
@@ -1140,7 +1108,7 @@ MonitorSection::map_state ()
 
        act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
        if (act) {
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+               tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
                if (tact) {
                        tact->set_active (_monitor->dim_all());
                }
@@ -1148,7 +1116,7 @@ MonitorSection::map_state ()
 
        act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
        if (act) {
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+               tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
                if (tact) {
                        tact->set_active (_monitor->mono());
                }
@@ -1203,6 +1171,10 @@ MonitorSection::map_state ()
 void
 MonitorSection::do_blink (bool onoff)
 {
+       if (!UIConfiguration::instance().get_blink_alert_indicators ()) {
+               onoff = true;
+       }
+
        solo_blink (onoff);
        audition_blink (onoff);
 }
@@ -1250,7 +1222,7 @@ MonitorSection::cancel_isolate (GdkEventButton*)
 {
        if (_session) {
                boost::shared_ptr<RouteList> rl (_session->get_routes ());
-               _session->set_solo_isolated (rl, false, Session::rt_cleanup, Controllable::NoGroup);
+               _session->set_controls (route_list_to_control_list (rl, &Stripable::solo_isolate_control), 0.0, Controllable::NoGroup);
        }
 
        return true;
@@ -1266,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)
@@ -1281,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 ());
        }
 }
 
@@ -1673,7 +1638,7 @@ MonitorSection::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost:
 void
 MonitorSection::load_bindings ()
 {
-       bindings = Bindings::get_bindings (X_("monitor section"), myactions);
+       bindings = Bindings::get_bindings (X_("Monitor Section"));
 }
 
 void
@@ -1704,3 +1669,27 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange)
 {
        update_processor_box ();
 }
+
+void
+MonitorSection::use_others_actions ()
+{
+       rude_solo_button.set_related_action (ActionManager::get_action (X_("Main"), X_("cancel-solo")));
+}
+
+void
+MonitorSection::toggle_use_monitor_section ()
+{
+       if (!_session) {
+               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);
+}