13
0

Consolidate Mixer-strip sensitivity

* Use a single method to set mixer-strip widget sensitivity
* Update context-menu to only allow show actions that can
  currently be performed, depending on active/inactive state.
* Mark all control elements of in-active strips as insenstive
  except those required to re-enable the route.
* Also update processor-box and solo-button when showing Aux

Special case Mixbus. Mixbus already shows a "Insensitive" label,
and Mixbus-channelstrip element sensitivity remains to be
implemented before using this mechanism.
This commit is contained in:
Robin Gareus 2020-01-28 22:22:57 +01:00
parent cb01a910d7
commit 87af9fb820
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 104 additions and 98 deletions

View File

@ -579,8 +579,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
solo_button->hide (); solo_button->hide ();
mute_button->show (); mute_button->show ();
rec_mon_table.hide (); rec_mon_table.hide ();
solo_iso_table.set_sensitive(false);
control_slave_ui.set_sensitive(false);
if (monitor_section_button == 0) { if (monitor_section_button == 0) {
Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection"); 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->MonitorChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::monitor_changed, this), gui_context());
@ -602,8 +600,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
mute_button->show (); mute_button->show ();
solo_button->show (); solo_button->show ();
rec_mon_table.show (); rec_mon_table.show ();
solo_iso_table.set_sensitive(true);
control_slave_ui.set_sensitive(true);
} }
hide_master_spacer (false); hide_master_spacer (false);
@ -747,6 +743,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
map_frozen(); map_frozen();
show (); show ();
update_sensitivity ();
} }
void void
@ -1678,8 +1675,12 @@ MixerStrip::build_route_ops_menu ()
route_ops_menu = new Menu; route_ops_menu = new Menu;
route_ops_menu->set_name ("ArdourContextMenu"); route_ops_menu->set_name ("ArdourContextMenu");
bool active = _route->active () || ARDOUR::Profile->get_mixbus();
MenuList& items = route_ops_menu->items(); MenuList& items = route_ops_menu->items();
if (active) {
items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &RouteUI::choose_color))); items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &RouteUI::choose_color)));
items.push_back (MenuElem (_("Comments..."), sigc::mem_fun (*this, &RouteUI::open_comment_editor))); items.push_back (MenuElem (_("Comments..."), sigc::mem_fun (*this, &RouteUI::open_comment_editor)));
@ -1710,13 +1711,15 @@ MixerStrip::build_route_ops_menu ()
} }
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
}
items.push_back (CheckMenuElem (_("Active"))); items.push_back (CheckMenuElem (_("Active")));
Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back()); Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
i->set_active (_route->active()); i->set_active (active);
i->set_sensitive(! _session->transport_rolling()); i->set_sensitive(! _session->transport_rolling());
i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false)); i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
if (!Profile->get_mixbus ()) { if (active && !Profile->get_mixbus ()) {
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
items.push_back (CheckMenuElem (_("Strict I/O"))); items.push_back (CheckMenuElem (_("Strict I/O")));
i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back()); i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
@ -1724,7 +1727,7 @@ MixerStrip::build_route_ops_menu ()
i->signal_activate().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*_route, &Route::set_strict_io), !_route->strict_io()))); i->signal_activate().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*_route, &Route::set_strict_io), !_route->strict_io())));
} }
if (is_track()) { if (active && is_track()) {
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
Gtk::Menu* dio_menu = new Menu; Gtk::Menu* dio_menu = new Menu;
@ -1738,17 +1741,17 @@ MixerStrip::build_route_ops_menu ()
_plugin_insert_cnt = 0; _plugin_insert_cnt = 0;
_route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::help_count_plugins)); _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::help_count_plugins));
if (_plugin_insert_cnt > 0) { if (active && _plugin_insert_cnt > 0) {
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins))); items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins)));
} }
if (boost::dynamic_pointer_cast<MidiTrack>(_route) || _route->the_instrument ()) { if (active && (boost::dynamic_pointer_cast<MidiTrack>(_route) || _route->the_instrument ())) {
items.push_back (MenuElem (_("Patch Selector..."), items.push_back (MenuElem (_("Patch Selector..."),
sigc::mem_fun(*this, &RouteUI::select_midi_patch))); sigc::mem_fun(*this, &RouteUI::select_midi_patch)));
} }
if (_route->the_instrument () && _route->the_instrument ()->output_streams().n_audio() > 2) { if (active && _route->the_instrument () && _route->the_instrument ()->output_streams().n_audio() > 2) {
// TODO ..->n_audio() > 1 && separate_output_groups) hard to check here every time. // TODO ..->n_audio() > 1 && separate_output_groups) hard to check here every time.
items.push_back (MenuElem (_("Fan out to Busses"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), true, true))); items.push_back (MenuElem (_("Fan out to Busses"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), true, true)));
items.push_back (MenuElem (_("Fan out to Tracks"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), false, true))); items.push_back (MenuElem (_("Fan out to Tracks"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), false, true)));
@ -1759,14 +1762,12 @@ MixerStrip::build_route_ops_menu ()
denormal_menu_item = dynamic_cast<Gtk::CheckMenuItem *> (&items.back()); denormal_menu_item = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
denormal_menu_item->set_active (_route->denormal_protection()); denormal_menu_item->set_active (_route->denormal_protection());
if (_route) {
/* note that this relies on selection being shared across editor and /* note that this relies on selection being shared across editor and
mixer (or global to the backend, in the future), which is the only * mixer (or global to the backend, in the future), which is the only
sane thing for users anyway. * sane thing for users anyway.
*/ */
StripableTimeAxisView* stav = PublicEditor::instance().get_stripable_time_axis_by_id (_route->id()); StripableTimeAxisView* stav = PublicEditor::instance().get_stripable_time_axis_by_id (_route->id());
if (stav) { if (active && stav) {
Selection& selection (PublicEditor::instance().get_selection()); Selection& selection (PublicEditor::instance().get_selection());
if (!selection.selected (stav)) { if (!selection.selected (stav)) {
selection.set (stav); selection.set (stav);
@ -1776,11 +1777,12 @@ MixerStrip::build_route_ops_menu ()
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes))); items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes)));
} }
}
if (active) {
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks))); items.push_back (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
} }
}
} }
gboolean gboolean
@ -1960,6 +1962,9 @@ MixerStrip::map_frozen ()
boost::shared_ptr<AudioTrack> at = audio_track(); boost::shared_ptr<AudioTrack> at = audio_track();
bool en = _route->active () || ARDOUR::Profile->get_mixbus();
bool send = _current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery) != 0;
if (at) { if (at) {
switch (at->freeze_state()) { switch (at->freeze_state()) {
case AudioTrack::Frozen: case AudioTrack::Frozen:
@ -1967,12 +1972,11 @@ MixerStrip::map_frozen ()
hide_redirect_editors (); hide_redirect_editors ();
break; break;
default: default:
processor_box.set_sensitive (true); processor_box.set_sensitive (en && !send);
// XXX need some way, maybe, to retoggle redirect editors
break; break;
} }
} else { } else {
processor_box.set_sensitive (true); processor_box.set_sensitive (en && !send);
} }
RouteUI::map_frozen (); RouteUI::map_frozen ();
} }
@ -2166,25 +2170,7 @@ MixerStrip::drop_send ()
} }
send_gone_connection.disconnect (); send_gone_connection.disconnect ();
input_button.set_sensitive (true);
output_button.set_sensitive (true);
group_button.set_sensitive (true);
set_invert_sensitive (true);
gpm.meter_point_button.set_sensitive (true);
mute_button->set_sensitive (true);
solo_button->set_sensitive (true);
solo_isolated_led->set_sensitive (true);
solo_safe_led->set_sensitive (true);
monitor_input_button->set_sensitive (true);
monitor_disk_button->set_sensitive (true);
_comment_button.set_sensitive (true);
trim_control.set_sensitive (true);
if (midi_input_enable_button) {
midi_input_enable_button->set_sensitive (true);
}
control_slave_ui.set_sensitive (true);
RouteUI::check_rec_enable_sensitivity (); RouteUI::check_rec_enable_sensitivity ();
set_button_names (); // update solo button visual state
} }
void void
@ -2192,6 +2178,7 @@ MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
{ {
_current_delivery = d; _current_delivery = d;
DeliveryChanged (_current_delivery); DeliveryChanged (_current_delivery);
update_sensitivity ();
} }
void void
@ -2219,28 +2206,6 @@ MixerStrip::show_send (boost::shared_ptr<Send> send)
panner_ui().set_send_drawing_mode (true); panner_ui().set_send_drawing_mode (true);
panner_ui().show_all (); panner_ui().show_all ();
input_button.set_sensitive (false);
group_button.set_sensitive (false);
set_invert_sensitive (false);
gpm.meter_point_button.set_sensitive (false);
mute_button->set_sensitive (false);
solo_button->set_sensitive (false);
rec_enable_button->set_sensitive (false);
solo_isolated_led->set_sensitive (false);
solo_safe_led->set_sensitive (false);
monitor_input_button->set_sensitive (false);
monitor_disk_button->set_sensitive (false);
_comment_button.set_sensitive (false);
trim_control.set_sensitive (false);
if (midi_input_enable_button) {
midi_input_enable_button->set_sensitive (false);
}
control_slave_ui.set_sensitive (false);
if (boost::dynamic_pointer_cast<InternalSend>(send)) {
output_button.set_sensitive (false);
}
reset_strip_style (); reset_strip_style ();
} }
@ -2280,7 +2245,7 @@ MixerStrip::set_button_names ()
monitor_section_button->set_text (_("Mon")); monitor_section_button->set_text (_("Mon"));
} }
if (_route && _route->solo_safe_control()->solo_safe()) { if ((_route && _route->solo_safe_control()->solo_safe()) || !solo_button->get_sensitive()) {
solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive));
} else { } else {
solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive)); solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive));
@ -2309,7 +2274,7 @@ MixerStrip::set_button_names ()
monitor_section_button->set_text (S_("Mon|O")); monitor_section_button->set_text (S_("Mon|O"));
} }
if (_route && _route->solo_safe_control()->solo_safe()) { if ((_route && _route->solo_safe_control()->solo_safe()) || !solo_button->get_sensitive()) {
solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive));
} else { } else {
solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive)); solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive));
@ -2439,6 +2404,46 @@ MixerStrip::route_active_changed ()
{ {
RouteUI::route_active_changed (); RouteUI::route_active_changed ();
reset_strip_style (); reset_strip_style ();
update_sensitivity ();
}
void
MixerStrip::update_sensitivity ()
{
bool en = _route->active () || ARDOUR::Profile->get_mixbus();
bool send = _current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery) != 0;
bool aux = _current_delivery && boost::dynamic_pointer_cast<InternalSend>(_current_delivery) != 0;
if (route()->is_master()) {
solo_iso_table.set_sensitive (false);
control_slave_ui.set_sensitive (false);
} else {
solo_iso_table.set_sensitive (en && !send);
control_slave_ui.set_sensitive (en && !send);
}
input_button.set_sensitive (en && !send);
group_button.set_sensitive (en && !send);
set_invert_sensitive (en && !send);
gpm.meter_point_button.set_sensitive (en && !send);
mute_button->set_sensitive (en && !send);
solo_button->set_sensitive (en && !send);
solo_isolated_led->set_sensitive (en && !send);
solo_safe_led->set_sensitive (en && !send);
monitor_input_button->set_sensitive (en && !send);
monitor_disk_button->set_sensitive (en && !send);
_comment_button.set_sensitive (en && !send);
trim_control.set_sensitive (en && !send);
control_slave_ui.set_sensitive (en && !send);
if (midi_input_enable_button) {
midi_input_enable_button->set_sensitive (en && !send);
}
output_button.set_sensitive (en && !aux);
map_frozen ();
set_button_names (); // update solo button visual state
} }
void void

View File

@ -305,6 +305,7 @@ private:
PBD::ScopedConnection send_gone_connection; PBD::ScopedConnection send_gone_connection;
void reset_strip_style (); void reset_strip_style ();
void update_sensitivity ();
ARDOUR::DataType guess_main_type(bool for_input, bool favor_connected = true) const; ARDOUR::DataType guess_main_type(bool for_input, bool favor_connected = true) const;