X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmonitor_section.cc;h=e52b48c7c75e2bbcf244aa5a56e2bbfc1b15cdce;hb=d9fcab88f01f7ada6f52482f1ee60fc41c91235c;hp=275a60f8f3b4467b3567fde53fbada9eca30dbcd;hpb=9010262bed21611f2db652d16f63e4af4380259d;p=ardour.git diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 275a60f8f3..e52b48c7c7 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Paul Davis + Copyright (C) 2012 Paul Davis - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -23,33 +23,37 @@ #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 #include +#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; @@ -57,15 +61,18 @@ using namespace PBD; using namespace std; Glib::RefPtr MonitorSection::monitor_actions; +Gtkmm2ext::ActionMap MonitorSection::myactions (X_("monitor section")); +Gtkmm2ext::Bindings* MonitorSection::bindings = 0; #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) MonitorSection::MonitorSection (Session* s) - : AxisView (s) + : SessionHandlePtr (s) , RouteUI (s) , _tearoff (0) + , channel_table (0) , channel_table_viewport (*channel_table_scroller.get_hadjustment() - , *channel_table_scroller.get_vadjustment ()) + , *channel_table_scroller.get_vadjustment ()) , gain_control (0) , dim_control (0) , solo_boost_control (0) @@ -82,6 +89,7 @@ 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) { @@ -91,10 +99,13 @@ MonitorSection::MonitorSection (Session* s) if (!monitor_actions) { register_actions (); - } else { - connect_actions (); + load_bindings (); } + channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); + + set_data ("ardour-bindings", bindings); + _plugin_selector = new PluginSelector (PluginManager::instance()); insert_box = new ProcessorBox (_session, boost::bind (&MonitorSection::plugin_selector, this), _rr_selection, 0); insert_box->set_no_show_all (); @@ -184,9 +195,8 @@ MonitorSection::MonitorSection (Session* s) toggle_processorbox_button.set_name (X_("monitor section processors toggle")); set_tooltip (&toggle_processorbox_button, _("Allow one to add monitor effect processors")); - proctoggle = ToggleAction::create (); + proctoggle = ActionManager::get_action (X_("Monitor"), X_("toggle-monitor-processor-box")); toggle_processorbox_button.set_related_action (proctoggle); - proctoggle->signal_toggled().connect (sigc::mem_fun(*this, &MonitorSection::update_processor_box), false); /* Knobs */ Label* solo_boost_label; @@ -303,10 +313,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_(" "))); @@ -379,10 +386,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)); @@ -390,7 +393,7 @@ MonitorSection::MonitorSection (Session* s) mono_dim_box->pack_start (mono_button, true, true); mono_dim_box->pack_end (dim_all_button, true, true); - // master gain + // master gain Label* spin_label = manage (new Label (_("Monitor"))); VBox* spin_packer = manage (new VBox); spin_packer->set_spacing (PX_SCALE(2)); @@ -407,7 +410,19 @@ 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)); - // output port select + // 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)); out_packer->pack_start (*output_label, false, false); @@ -424,11 +439,19 @@ 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); + add (hpacker); + gain_control->show_all (); gain_display->show_all (); dim_control->show_all (); @@ -439,7 +462,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(); @@ -450,14 +472,17 @@ MonitorSection::MonitorSection (Session* s) vpacker.show (); hpacker.show (); - populate_buttons (); map_state (); assign_controllables (); output_button->signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::output_press), false); output_button->signal_button_release_event().connect (sigc::mem_fun(*this, &MonitorSection::output_release), false); - _tearoff = new TearOff (hpacker); + signal_enter_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::enter_handler)); + signal_leave_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::leave_handler)); + set_flags (CAN_FOCUS); + + _tearoff = new TearOff (*this); if (!UIConfiguration::instance().get_floating_monitor_section()) { /* if torn off, make this a normal window @@ -466,7 +491,7 @@ MonitorSection::MonitorSection (Session* s) _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); } _tearoff->tearoff_window().set_title (X_("Monitor")); - _tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), (Gtk::Window*) 0), false); + _tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), (Gtk::Window*) &_tearoff->tearoff_window()), false); update_output_display (); update_processor_box (); @@ -486,28 +511,58 @@ MonitorSection::~MonitorSection () } _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 +MonitorSection::enter_handler (GdkEventCrossing* ev) +{ + grab_focus (); + return false; } +bool +MonitorSection::leave_handler (GdkEventCrossing* ev) +{ + switch (ev->detail) { + case GDK_NOTIFY_INFERIOR: + return false; + default: + break; + } + + /* cancel focus if we're not torn off. With X11 WM's that do + * focus-follows-mouse, focus will be taken from us anyway. + */ + + Widget* top = get_toplevel(); + + if (top->is_toplevel() && top != &_tearoff->tearoff_window()) { + Window* win = dynamic_cast (top); + gtk_window_set_focus (win->gobj(), 0); + } + + return false; +} void MonitorSection::update_processor_box () { - bool show_processor_box = proctoggle->get_active (); + bool show_processor_box = Glib::RefPtr::cast_dynamic (proctoggle)->get_active (); if (count_processors () > 0 && !show_processor_box) { toggle_processorbox_button.set_name (X_("monitor section processors present")); @@ -537,7 +592,7 @@ 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) { @@ -548,62 +603,30 @@ MonitorSection::set_session (Session* s) /* 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 (); } } 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); - } - - 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 (); - - } 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 (); + populate_buttons (); } else { /* no session */ - _output_changed_connection.disconnect(); + output_changed_connections.drop_connections(); _monitor.reset (); _route.reset (); control_connections.drop_connections (); @@ -629,20 +652,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 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; @@ -664,16 +704,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); @@ -700,7 +740,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 @@ -852,121 +925,67 @@ MonitorSection::register_actions () string action_descr; Glib::RefPtr act; - monitor_actions = ActionGroup::create (X_("Monitor")); - ActionManager::add_action_group (monitor_actions); + monitor_actions = myactions.create_action_group (X_("Monitor")); - ActionManager::register_toggle_action (monitor_actions, "monitor-mono", "", _("Switch monitor to mono"), - sigc::mem_fun (*this, &MonitorSection::mono)); + myactions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorMono)); - ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", _("Cut monitor"), - sigc::mem_fun (*this, &MonitorSection::cut_all)); + myactions.register_toggle_action (monitor_actions, "monitor-cut-all", _("Cut monitor"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorCutAll)); - ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", _("Dim monitor"), - sigc::mem_fun (*this, &MonitorSection::dim_all)); + myactions.register_toggle_action (monitor_actions, "monitor-dim-all", _("Dim monitor"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorDimAll)); - act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", "", _("Toggle exclusive solo mode"), - sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo)); + act = myactions.register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleExclusiveSolo)); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); tact->set_active (Config->get_exclusive_solo()); - act = ActionManager::register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", "", _("Toggle mute overrides solo mode"), - sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo)); + act = myactions.register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleMuteOverridesSolo)); 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::mem_fun (*this, &MonitorSection::cut_channel), chn)); + myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + sigc::bind (sigc::ptr_fun (action_proxy1), CutChannel, 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::mem_fun (*this, &MonitorSection::dim_channel), chn)); + myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + sigc::bind (sigc::ptr_fun (action_proxy1), DimChannel, 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::mem_fun (*this, &MonitorSection::solo_channel), chn)); + myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + sigc::bind (sigc::ptr_fun (action_proxy1), SoloChannel, 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::mem_fun (*this, &MonitorSection::invert_channel), chn)); + myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + sigc::bind (sigc::ptr_fun (action_proxy1), InvertChannel, chn)); } - Glib::RefPtr solo_actions = ActionGroup::create (X_("Solo")); + Glib::RefPtr solo_actions = myactions.create_action_group (X_("Solo")); RadioAction::Group solo_group; - 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::add_action_group (solo_actions); -} + myactions.register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUseInPlace)); + myactions.register_radio_action (solo_actions, solo_group, "solo-use-afl", _("After Fade Listen (AFL) solo"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUseAFL)); + myactions.register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), SoloUsePFL)); -void -MonitorSection::connect_actions () -{ - Glib::RefPtr act; - Glib::RefPtr tact; + myactions.register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"), + sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleMonitorProcessorBox)); -#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 @@ -1161,6 +1180,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); } @@ -1208,7 +1231,7 @@ MonitorSection::cancel_isolate (GdkEventButton*) { if (_session) { boost::shared_ptr 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; @@ -1628,6 +1651,12 @@ MonitorSection::port_connected_or_disconnected (boost::weak_ptr wa, boost: } } +void +MonitorSection::load_bindings () +{ + bindings = Bindings::get_bindings (X_("Monitor Section"), myactions); +} + void MonitorSection::help_count_processors (boost::weak_ptr p, uint32_t* cnt) const { @@ -1656,3 +1685,64 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange) { update_processor_box (); } + +void +MonitorSection::action_proxy0 (enum MonitorActions action) +{ + 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; + } +} + +void +MonitorSection::action_proxy1 (enum ChannelActions action, uint32_t chn) +{ + MonitorSection* ms = Mixer_UI::instance()->monitor_section (); + if (!ms) { + 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; + } +}