full (?) set of changes required to make MonitorSection an "always-there" component of the MixerUI

Obviously, it is not always shown, but it always exists, which means that its actions are always accessible
This commit is contained in:
Paul Davis 2018-12-11 10:28:47 -05:00
parent 685c4f8955
commit 098b0f8a8b
8 changed files with 124 additions and 255 deletions

View 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);
}

View File

@ -75,6 +75,13 @@ ARDOUR_UI::we_have_dependents ()
} }
install_actions (); 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 (); ProcessorBox::register_actions ();
/* Global, editor, mixer, processor box actions are defined now. Link /* Global, editor, mixer, processor box actions are defined now. Link

View File

@ -631,17 +631,6 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (main_actions, X_("MonitorMenu"), _("Monitor Section")); act = ActionManager::register_action (main_actions, X_("MonitorMenu"), _("Monitor Section"));
ActionManager::session_sensitive_actions.push_back (act); 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)); 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); 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)); 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")); XMLNode* tearoff_node = new XMLNode (X_("Tearoffs"));
if (mixer->monitor_section()) { XMLNode* t = new XMLNode (X_("monitor-section"));
XMLNode* t = new XMLNode (X_("monitor-section")); mixer->monitor_section().tearoff().add_state (*t);
mixer->monitor_section()->tearoff().add_state (*t); tearoff_node->add_child_nocopy (*t);
tearoff_node->add_child_nocopy (*t);
}
window_node->add_child_nocopy (*tearoff_node); window_node->add_child_nocopy (*tearoff_node);

View File

@ -27,8 +27,8 @@
#include "actions.h" #include "actions.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "mixer_ui.h"
#include "meterbridge.h" #include "meterbridge.h"
#include "mixer_ui.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"

View File

@ -103,7 +103,6 @@ Mixer_UI::Mixer_UI ()
, no_track_list_redisplay (false) , no_track_list_redisplay (false)
, in_group_row_change (false) , in_group_row_change (false)
, track_menu (0) , track_menu (0)
, _monitor_section (0)
, _plugin_selector (0) , _plugin_selector (0)
, _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide) , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
, _spill_scroll_position (0) , _spill_scroll_position (0)
@ -348,6 +347,11 @@ Mixer_UI::Mixer_UI ()
favorite_plugins_display.show(); favorite_plugins_display.show();
add_button.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()); 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()); 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 () Mixer_UI::~Mixer_UI ()
{ {
if (_monitor_section) { monitor_section_detached ();
monitor_section_detached ();
delete _monitor_section;
}
delete _plugin_selector; delete _plugin_selector;
delete track_menu; delete track_menu;
} }
@ -563,25 +565,14 @@ Mixer_UI::add_stripables (StripableList& slist)
if (route->is_monitor()) { if (route->is_monitor()) {
if (!_monitor_section) { out_packer.pack_end (_monitor_section.tearoff(), false, false);
_monitor_section = new MonitorSection (_session); _monitor_section.set_session (_session);
_monitor_section.tearoff().show_all ();
XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section")); _monitor_section.tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
if (mnode) { _monitor_section.tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
_monitor_section->tearoff().set_state (*mnode);
}
set_monitor_action_sensitivity(true); if (_monitor_section.tearoff().torn_off()) {
}
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));
if (_monitor_section->tearoff().torn_off()) {
monitor_section_detached (); monitor_section_detached ();
} else { } else {
monitor_section_attached (); monitor_section_attached ();
@ -1036,6 +1027,7 @@ void
Mixer_UI::set_session (Session* sess) Mixer_UI::set_session (Session* sess)
{ {
SessionHandlePtr::set_session (sess); SessionHandlePtr::set_session (sess);
_monitor_section.set_session (sess);
if (_plugin_selector) { if (_plugin_selector) {
_plugin_selector->set_session (_session); _plugin_selector->set_session (_session);
@ -1043,10 +1035,6 @@ Mixer_UI::set_session (Session* sess)
_group_tabs->set_session (sess); _group_tabs->set_session (sess);
if (_monitor_section) {
_monitor_section->set_session (_session);
}
if (!_session) { if (!_session) {
_selection.clear (); _selection.clear ();
return; return;
@ -1105,9 +1093,7 @@ Mixer_UI::session_going_away ()
delete (*i); delete (*i);
} }
if (_monitor_section) { _monitor_section.tearoff().hide_visible ();
_monitor_section->tearoff().hide_visible ();
}
monitor_section_detached (); monitor_section_detached ();
@ -1971,17 +1957,14 @@ Mixer_UI::toggle_monitor_section ()
void void
Mixer_UI::showhide_monitor_section (bool yn) Mixer_UI::showhide_monitor_section (bool yn)
{ {
if (!monitor_section()) { if (monitor_section().tearoff().torn_off()) {
return;
}
if (monitor_section()->tearoff().torn_off()) {
return; return;
} }
if (yn) { if (yn) {
monitor_section()->tearoff().show(); monitor_section().tearoff().show();
} else { } else {
monitor_section()->tearoff().hide(); monitor_section().tearoff().hide();
} }
} }
@ -2632,59 +2615,31 @@ Mixer_UI::set_axis_targets_for_operation ()
} }
void
Mixer_UI::set_monitor_action_sensitivity (bool yn)
{
// 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);
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);
}
void void
Mixer_UI::monitor_section_going_away () Mixer_UI::monitor_section_going_away ()
{ {
/* Set sensitivity based on existence of the monitor bus */ XMLNode* ui_node = Config->extra_xml(X_("UI"));
set_monitor_action_sensitivity(false); /* 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 (_monitor_section) { if (ui_node) {
XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
XMLNode* ui_node = Config->extra_xml(X_("UI")); if (tearoff_node) {
/* immediate state save. tearoff_node->remove_nodes_and_delete (X_("monitor-section"));
* XMLNode* t = new XMLNode (X_("monitor-section"));
* Tearoff settings are otherwise only stored during _monitor_section.tearoff().add_state (*t);
* save_ardour_state(). The mon-section may or may not tearoff_node->add_child_nocopy (*t);
* 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);
}
} }
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 void

View File

@ -52,6 +52,7 @@
#include "axis_provider.h" #include "axis_provider.h"
#include "enums.h" #include "enums.h"
#include "monitor_section.h"
#include "route_processor_selection.h" #include "route_processor_selection.h"
namespace ARDOUR { namespace ARDOUR {
@ -107,7 +108,7 @@ public:
void maximise_mixer_space(); void maximise_mixer_space();
void restore_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 deselect_all_strip_processors();
void delete_processors(); void delete_processors();
@ -287,8 +288,8 @@ private:
void track_column_click (gint); void track_column_click (gint);
void build_track_menu (); void build_track_menu ();
MonitorSection* _monitor_section; MonitorSection _monitor_section;
PluginSelector *_plugin_selector; PluginSelector *_plugin_selector;
void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws); 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 &); void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
@ -378,10 +379,7 @@ private:
friend class MixerGroupTabs; friend class MixerGroupTabs;
void set_monitor_action_sensitivity (bool);
void monitor_section_going_away (); void monitor_section_going_away ();
void monitor_section_attached (); void monitor_section_attached ();
void monitor_section_detached (); void monitor_section_detached ();

View File

@ -62,9 +62,8 @@ using namespace std;
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
MonitorSection::MonitorSection (Session* s) MonitorSection::MonitorSection ()
: SessionHandlePtr (s) : RouteUI ((Session*) 0)
, RouteUI (s)
, _tearoff (0) , _tearoff (0)
, channel_table (0) , channel_table (0)
, channel_table_viewport (*channel_table_scroller.get_hadjustment() , channel_table_viewport (*channel_table_scroller.get_hadjustment()
@ -88,7 +87,6 @@ MonitorSection::MonitorSection (Session* s)
, _rr_selection () , _rr_selection ()
, _ui_initialized (false) , _ui_initialized (false)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
Glib::RefPtr<Action> act; Glib::RefPtr<Action> act;
@ -96,7 +94,6 @@ MonitorSection::MonitorSection (Session* s)
load_bindings (); load_bindings ();
register_actions (); register_actions ();
set_data ("ardour-bindings", bindings); set_data ("ardour-bindings", bindings);
bindings->associate ();
channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
@ -106,8 +103,6 @@ MonitorSection::MonitorSection (Session* s)
insert_box->show (); insert_box->show ();
// TODO allow keyboard shortcuts in ProcessorBox // TODO allow keyboard shortcuts in ProcessorBox
set_session (s);
/* Rude Solo & Solo Isolated */ /* Rude Solo & Solo Isolated */
rude_solo_button.set_text (_("Soloing")); rude_solo_button.set_text (_("Soloing"));
rude_solo_button.set_name ("rude solo"); 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)); 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")); 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); 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")); 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")); 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) { if (act) {
exclusive_solo_button.set_related_action (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")); 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)")); 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")); solo_mute_override_button.set_related_action (ActionManager::get_action (X_("Solo"), X_("toggle-mute-overrides-solo")));
if (act) {
solo_mute_override_button.set_related_action (act);
}
/* Processor Box hide/shos */ /* Processor Box hide/shos */
toggle_processorbox_button.set_text (_("Processors")); toggle_processorbox_button.set_text (_("Processors"));
@ -591,6 +581,14 @@ MonitorSection::set_session (Session* s)
if (_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 (); _route = _session->monitor_out ();
if (_route) { if (_route) {
@ -606,6 +604,10 @@ MonitorSection::set_session (Session* s)
if (_ui_initialized) { if (_ui_initialized) {
update_processor_box (); update_processor_box ();
} }
ActionManager::set_sensitive (monitor_actions, true);
ActionManager::set_sensitive (solo_actions, true);
} else { } else {
/* session with no monitor section */ /* session with no monitor section */
output_changed_connections.drop_connections(); output_changed_connections.drop_connections();
@ -613,17 +615,16 @@ MonitorSection::set_session (Session* s)
_route.reset (); _route.reset ();
delete _output_selector; delete _output_selector;
_output_selector = 0; _output_selector = 0;
ActionManager::set_sensitive (monitor_actions, false);
ActionManager::set_sensitive (solo_actions, true);
} }
populate_buttons (); 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 { } else {
/* no session */ /* no session */
output_changed_connections.drop_connections(); output_changed_connections.drop_connections();
@ -636,6 +637,9 @@ MonitorSection::set_session (Session* s)
_output_selector = 0; _output_selector = 0;
assign_controllables (); assign_controllables ();
ActionManager::set_sensitive (monitor_actions, false);
ActionManager::set_sensitive (solo_actions, false);
} }
} }
@ -783,12 +787,7 @@ MonitorSection::toggle_exclusive_solo ()
return; return;
} }
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo"); Config->set_exclusive_solo (ActionManager::get_toggle_action (X_("Solo"), "toggle-exclusive-solo")->get_active());
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
Config->set_exclusive_solo (tact->get_active());
}
} }
void void
@ -798,7 +797,7 @@ MonitorSection::toggle_mute_overrides_solo ()
return; 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) { if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
Config->set_solo_mute_override (tact->get_active()); Config->set_solo_mute_override (tact->get_active());
@ -925,41 +924,41 @@ MonitorSection::register_actions ()
string action_descr; string action_descr;
Glib::RefPtr<Action> act; Glib::RefPtr<Action> act;
/* ...will get sensitized if a mon-session is added */
monitor_actions = ActionManager::create_action_group (bindings, X_("Monitor")); monitor_actions = ActionManager::create_action_group (bindings, X_("Monitor"));
solo_actions = ActionManager::create_action_group (bindings, X_("Monitor"));
act = ActionManager::register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), ActionManager::register_toggle_action (monitor_actions, X_("UseMonitorSection"), _("Use Monitor Section"), sigc::mem_fun(*this, &MonitorSection::toggle_use_monitor_section));
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleExclusiveSolo)); 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); ActionManager::register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"),
tact->set_active (Config->get_exclusive_solo()); sigc::mem_fun (*this, &MonitorSection::update_processor_box));
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));
tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
tact->set_active (Config->get_solo_mute_override());
for (uint32_t chn = 0; chn < 16; ++chn) { for (uint32_t chn = 0; chn < 16; ++chn) {
action_name = string_compose (X_("monitor-cut-%1"), chn); action_name = string_compose (X_("monitor-cut-%1"), chn);
action_descr = string_compose (_("Cut monitor channel %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(), 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_name = string_compose (X_("monitor-dim-%1"), chn);
action_descr = string_compose (_("Dim monitor channel %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(), 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_name = string_compose (X_("monitor-solo-%1"), chn);
action_descr = string_compose (_("Solo monitor channel %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(), 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_name = string_compose (X_("monitor-invert-%1"), chn);
action_descr = string_compose (_("Invert monitor channel %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(), 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; RadioAction::Group solo_group;
ActionManager::register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"), 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"), 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"), 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)); sigc::mem_fun (*this, &MonitorSection::solo_use_pfl));
ActionManager::register_toggle_action (monitor_actions, "toggle-monitor-processor-box", _("Toggle Monitor Section Processor Box"),
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleMonitorProcessorBox));
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 void
@ -1238,12 +1238,9 @@ MonitorSection::cancel_audition (GdkEventButton*)
} }
#define SYNCHRONIZE_TOGGLE_ACTION(action, value) \ #define SYNCHRONIZE_TOGGLE_ACTION(action, value) \
if (action) { \ if (action && action->get_active() != value) { \
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(action); \ action->set_active(value); \
if (tact && tact->get_active() != value) { \ } \
tact->set_active(value); \
} \
}
void void
MonitorSection::parameter_changed (std::string name) MonitorSection::parameter_changed (std::string name)
@ -1253,13 +1250,9 @@ MonitorSection::parameter_changed (std::string name)
} else if (name == "listen-position") { } else if (name == "listen-position") {
update_solo_model (); update_solo_model ();
} else if (name == "solo-mute-override") { } else if (name == "solo-mute-override") {
SYNCHRONIZE_TOGGLE_ACTION( SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Solo"), "toggle-mute-overrides-solo"), Config->get_solo_mute_override ());
ActionManager::get_action (X_("Monitor"), "toggle-mute-overrides-solo"),
Config->get_solo_mute_override ())
} else if (name == "exclusive-solo") { } else if (name == "exclusive-solo") {
SYNCHRONIZE_TOGGLE_ACTION( SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Solo"), "toggle-exclusive-solo"), Config->get_exclusive_solo ());
ActionManager::get_action (X_("Monitor"), "toggle-exclusive-solo"),
Config->get_exclusive_solo ())
} }
} }
@ -1678,62 +1671,25 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange)
} }
void void
MonitorSection::action_proxy0 (enum MonitorActions action) MonitorSection::use_others_actions ()
{ {
MonitorSection* ms = Mixer_UI::instance()->monitor_section (); rude_solo_button.set_related_action (ActionManager::get_action (X_("Main"), X_("cancel-solo")));
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 void
MonitorSection::action_proxy1 (enum ChannelActions action, uint32_t chn) MonitorSection::toggle_use_monitor_section ()
{ {
MonitorSection* ms = Mixer_UI::instance()->monitor_section (); if (!_session) {
if (!ms) {
return; return;
} }
switch (action) {
case CutChannel: bool yn = ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active();
ms->cut_channel (chn);
break; if (yn) {
case DimChannel: _session->add_monitor_section ();
ms->dim_channel (chn); } else {
break; _session->remove_monitor_section ();
case SoloChannel:
ms->solo_channel (chn);
break;
case InvertChannel:
ms->invert_channel (chn);
break;
} }
Config->set_use_monitor_bus (yn);
} }

View File

@ -17,6 +17,9 @@
*/ */
#ifndef __gtk2_ardour_monitor_section_h__
#define __gtk2_ardour_monitor_section_h__
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/eventbox.h> #include <gtkmm/eventbox.h>
#include <gtkmm/sizegroup.h> #include <gtkmm/sizegroup.h>
@ -44,7 +47,7 @@ namespace ArdourWidgets {
class MonitorSection : public RouteUI, public Gtk::EventBox class MonitorSection : public RouteUI, public Gtk::EventBox
{ {
public: public:
MonitorSection (ARDOUR::Session*); MonitorSection ();
~MonitorSection (); ~MonitorSection ();
void set_session (ARDOUR::Session*); void set_session (ARDOUR::Session*);
@ -55,6 +58,8 @@ public:
PluginSelector* plugin_selector() { return _plugin_selector; } PluginSelector* plugin_selector() { return _plugin_selector; }
void use_others_actions ();
private: private:
Gtk::HBox hpacker; Gtk::HBox hpacker;
Gtk::VBox vpacker; Gtk::VBox vpacker;
@ -108,32 +113,10 @@ private:
boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor; boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
boost::shared_ptr<ARDOUR::Route> _route; 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> monitor_actions;
Glib::RefPtr<Gtk::ActionGroup> solo_actions; Glib::RefPtr<Gtk::ActionGroup> solo_actions;
void register_actions (); void register_actions ();
static void action_proxy0 (enum MonitorActions);
static void action_proxy1 (enum ChannelActions, uint32_t);
void cut_channel (uint32_t); void cut_channel (uint32_t);
void dim_channel (uint32_t); void dim_channel (uint32_t);
void solo_channel (uint32_t); void solo_channel (uint32_t);
@ -208,4 +191,8 @@ private:
void load_bindings (); void load_bindings ();
bool enter_handler (GdkEventCrossing*); bool enter_handler (GdkEventCrossing*);
bool leave_handler (GdkEventCrossing*); bool leave_handler (GdkEventCrossing*);
void toggle_use_monitor_section ();
}; };
#endif /* __gtk2_ardour_monitor_section_h__ */