13
0

GUI updates to handle monitor-section changes

This fixes various MS related action sensitivity issues, as well
as action-states.

Also manually adding a monitor-section to a session now always
immediately shows it, regardless of prior ToggleMonitorSection
visibility.
This commit is contained in:
Robin Gareus 2019-03-01 16:51:08 +01:00
parent 9836304e3e
commit 94d3da7e09
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 59 additions and 39 deletions

View File

@ -583,6 +583,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
if (monitor_section_button == 0) {
Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
_session->MonitorChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::monitor_changed, this), gui_context());
_session->MonitorBusAddedOrRemoved.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::monitor_section_added_or_removed, this), gui_context());
monitor_section_button = manage (new ArdourButton);
monitor_changed ();
@ -591,8 +592,8 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1);
monitor_section_button->show();
monitor_section_button->unset_flags (Gtk::CAN_FOCUS);
monitor_section_added_or_removed ();
}
parameter_changed ("use-monitor-bus");
} else {
bottom_button_table.attach (group_button, 1, 2, 0, 1);
mute_solo_table.attach (*mute_button, 0, 1, 0, 1);
@ -2115,6 +2116,27 @@ MixerStrip::monitor_changed ()
}
}
void
MixerStrip::monitor_section_added_or_removed ()
{
assert (monitor_section_button);
if (mute_button->get_parent()) {
mute_button->get_parent()->remove(*mute_button);
}
if (monitor_section_button->get_parent()) {
monitor_section_button->get_parent()->remove(*monitor_section_button);
}
if (_session && _session->monitor_out ()) {
mute_solo_table.attach (*mute_button, 0, 1, 0, 1);
mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1);
mute_button->show();
monitor_section_button->show();
} else {
mute_solo_table.attach (*mute_button, 0, 2, 0, 1);
mute_button->show();
}
}
/** Called when the metering point has changed */
void
MixerStrip::meter_changed ()
@ -2394,24 +2416,6 @@ MixerStrip::parameter_changed (string p)
} else if (p == "track-name-number") {
name_changed ();
update_track_number_visibility();
} else if (p == "use-monitor-bus") {
if (monitor_section_button) {
if (mute_button->get_parent()) {
mute_button->get_parent()->remove(*mute_button);
}
if (monitor_section_button->get_parent()) {
monitor_section_button->get_parent()->remove(*monitor_section_button);
}
if (Config->get_use_monitor_bus ()) {
mute_solo_table.attach (*mute_button, 0, 1, 0, 1);
mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1);
mute_button->show();
monitor_section_button->show();
} else {
mute_solo_table.attach (*mute_button, 0, 2, 0, 1);
mute_button->show();
}
}
}
}

View File

@ -187,6 +187,7 @@ private:
void meter_changed ();
void monitor_changed ();
void monitor_section_added_or_removed ();
ArdourWidgets::ArdourButton input_button;
ArdourWidgets::ArdourButton output_button;

View File

@ -63,6 +63,11 @@ using namespace std;
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
#define SYNCHRONIZE_TOGGLE_ACTION(action, value) \
if (action && action->get_active() != value) { \
action->set_active(value); \
}
MonitorSection::MonitorSection ()
: RouteUI ((Session*) 0)
, _tearoff (0)
@ -585,6 +590,8 @@ MonitorSection::set_session (Session* s)
_plugin_selector->set_session (_session);
insert_box->set_session (_session);
Glib::RefPtr<ActionGroup> global_monitor_actions = ActionManager::get_action_group (X_("Monitor Section"));
if (_session) {
/* These are not actually dependent on the Session, but they
@ -613,6 +620,8 @@ MonitorSection::set_session (Session* s)
update_processor_box ();
}
SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection"), true);
ActionManager::set_sensitive (global_monitor_actions, true);
ActionManager::set_sensitive (monitor_actions, true);
ActionManager::set_sensitive (solo_actions, true);
@ -624,18 +633,16 @@ MonitorSection::set_session (Session* s)
delete _output_selector;
_output_selector = 0;
SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection"), false);
ActionManager::set_sensitive (global_monitor_actions, false);
ActionManager::set_sensitive (monitor_actions, false);
/* this action needs to always be true in this * scenaro, so that we can turn it back on*/
ActionManager::get_toggle_action (X_("Monitor"), X_("UseMonitorSection"))->set_sensitive (true);
ActionManager::set_sensitive (solo_actions, true);
/* this action needs to always be true in this, so that we can turn it back on */
ActionManager::get_toggle_action (X_("Monitor"), X_("UseMonitorSection"))->set_sensitive (true);
}
/* make sure the state of this action reflects reality */
ActionManager::get_toggle_action (X_("Monitor"), X_("UseMonitorSection"))->set_active (_route != 0);
populate_buttons ();
} else {
/* no session */
@ -647,6 +654,7 @@ MonitorSection::set_session (Session* s)
ActionManager::set_sensitive (monitor_actions, false);
ActionManager::set_sensitive (solo_actions, false);
ActionManager::set_sensitive (global_monitor_actions, false);
}
}
@ -1186,11 +1194,6 @@ MonitorSection::cancel_audition (GdkEventButton*)
return true;
}
#define SYNCHRONIZE_TOGGLE_ACTION(action, value) \
if (action && action->get_active() != value) { \
action->set_active(value); \
} \
void
MonitorSection::parameter_changed (std::string name)
{
@ -1202,8 +1205,6 @@ MonitorSection::parameter_changed (std::string name)
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_toggle_action (X_("Solo"), "toggle-exclusive-solo"), Config->get_exclusive_solo ());
} else if (name == "use-monitor-bus") {
SYNCHRONIZE_TOGGLE_ACTION (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection"), Config->get_use_monitor_bus ());
}
}
@ -1623,6 +1624,17 @@ MonitorSection::toggle_use_monitor_section ()
if (!_session) {
return;
}
bool want_ms = ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active();
bool have_ms = Config->get_use_monitor_bus ();
Config->set_use_monitor_bus (ActionManager::get_toggle_action (X_("Monitor"), "UseMonitorSection")->get_active());
if (want_ms == have_ms) {
return;
}
if (want_ms) {
Config->set_use_monitor_bus (true);
ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMonitorSection"))->set_active (true);
} else {
Config->set_use_monitor_bus (false);
}
}

View File

@ -3999,7 +3999,6 @@ These settings will only take effect after %1 is restarted.\n\
//trigger some parameter-changed messages which affect widget-visibility or -sensitivity
parameter_changed ("send-ltc");
parameter_changed ("sync-source");
parameter_changed ("use-monitor-bus");
parameter_changed ("open-gui-after-adding-plugin");
XMLNode* node = ARDOUR_UI::instance()->preferences_settings();
@ -4029,7 +4028,7 @@ RCOptionEditor::parameter_changed (string const & p)
bool const s = Config->get_use_monitor_bus ();
if (!s) {
/* we can't use this if we don't have a monitor bus */
Config->set_solo_control_is_listen_control (false);
Config->set_solo_control_is_listen_control (false); // XXX
}
_solo_control_is_listen_control->set_sensitive (s);
_listen_position->set_sensitive (s);

View File

@ -210,6 +210,7 @@ RouteUI::init ()
_session->SoloChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::solo_changed_so_update_mute, this), gui_context());
_session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context());
_session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
_session->MonitorBusAddedOrRemoved.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::set_button_names, this), gui_context());
_session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteUI::parameter_changed, this, _1), gui_context());
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteUI::parameter_changed, this, _1), gui_context());
@ -1995,7 +1996,7 @@ RouteUI::parameter_changed (string const & p)
if (p == "disable-disarm-during-roll") {
check_rec_enable_sensitivity ();
} else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
} else if (p == "solo-control-is-listen-control" || p == "listen-position") {
set_button_names ();
} else if (p == "session-monitoring") {
update_monitoring_display ();

View File

@ -275,7 +275,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
));
add_option (_("Monitoring"), new CheckOption (
"have-monitor-section",
"unused",
_("Use monitor section in this session"),
ActionManager::get_action(X_("Monitor"), "UseMonitorSection")
));

View File

@ -159,6 +159,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
_vca->solo_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::solo_changed, this), gui_context());
_vca->mute_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::mute_changed, this), gui_context());
_session->MonitorBusAddedOrRemoved.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::set_button_names, this), gui_context());
s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
@ -197,7 +198,7 @@ VCAMasterStrip::self_delete ()
void
VCAMasterStrip::parameter_changed (std::string const & p)
{
if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
if (p == "solo-control-is-listen-control" || p == "listen-position") {
set_button_names ();
} else if (p == "mixer-element-visibility") {
update_bottom_padding ();

View File

@ -113,6 +113,8 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
controls_ebox.set_name (controls_base_unselected_name);
time_axis_frame.set_name (controls_base_unselected_name);
s->MonitorBusAddedOrRemoved.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::set_button_names, this), gui_context());
s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VCATimeAxisView::parameter_changed));
@ -135,7 +137,7 @@ VCATimeAxisView::parameter_changed (std::string const & p)
{
if (p == "track-name-number") {
update_track_number_visibility();
} else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
} else if (p == "solo-control-is-listen-control" || p == "listen-position") {
set_button_names ();
}
}