From ffde3968ec3a597939aa5896f6917e5711bae739 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 19 Dec 2015 17:42:36 +0100 Subject: allow to show/hide Monitor Section --- gtk2_ardour/ardour.menus.in | 1 + gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/ardour_ui_dialogs.cc | 11 +++++++++ gtk2_ardour/ardour_ui_ed.cc | 3 +++ gtk2_ardour/dark.colors | 1 + gtk2_ardour/mixer_strip.cc | 39 +++++++++++++++++++++++++++++- gtk2_ardour/mixer_strip.h | 2 ++ gtk2_ardour/mixer_ui.cc | 51 +++++++++++++++++++++++++++++++++++++--- gtk2_ardour/mixer_ui.h | 4 ++++ 9 files changed, 109 insertions(+), 4 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 2197ed93f8..411b262e4d 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -505,6 +505,7 @@ + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 8583d73d48..cc800a2e2f 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -203,6 +203,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void toggle_editing_space(); void toggle_mixer_space(); void toggle_mixer_list(); + void toggle_monitor_section_visibility (); void toggle_keep_tearoffs(); static PublicEditor* _instance; diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 8640d7a2f5..859a167832 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -597,3 +597,14 @@ ARDOUR_UI::toggle_mixer_list() mixer->show_mixer_list (tact->get_active()); } } + +void +ARDOUR_UI::toggle_monitor_section_visibility () +{ + Glib::RefPtr act = ActionManager::get_action ("Common", "ToggleMonitorSection"); + + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + mixer->show_monitor_section (tact->get_active()); + } +} diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 2fc5a17c33..cbf2c04192 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -218,6 +218,9 @@ ARDOUR_UI::install_actions () act = ActionManager::register_toggle_action (common_actions, X_("ToggleMixerList"), _("Toggle Mixer List"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_list)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_toggle_action (common_actions, X_("ToggleMonitorSection"), _("Toggle Monitor Section Visibility"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_monitor_section_visibility)); + act->set_sensitive (false); + if (Profile->get_mixbus()) ActionManager::register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs)); diff --git a/gtk2_ardour/dark.colors b/gtk2_ardour/dark.colors index 3e3adae078..38137bb26d 100644 --- a/gtk2_ardour/dark.colors +++ b/gtk2_ardour/dark.colors @@ -257,6 +257,7 @@ + diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index ad28c6cd88..99bd730b9f 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -96,6 +96,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer) , mute_solo_table (1, 2) , bottom_button_table (1, 3) , meter_point_button (_("pre")) + , monitor_section_button (0) , midi_input_enable_button (0) , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) @@ -126,6 +127,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr rt , mute_solo_table (1, 2) , bottom_button_table (1, 3) , meter_point_button (_("pre")) + , monitor_section_button (0) , midi_input_enable_button (0) , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) @@ -491,13 +493,23 @@ MixerStrip::set_route (boost::shared_ptr rt) } if (route()->is_master()) { - mute_solo_table.attach (*mute_button, 0, 2, 0, 1); solo_button->hide (); mute_button->show (); rec_mon_table.hide (); if (solo_iso_table.get_parent()) { solo_iso_table.get_parent()->remove(solo_iso_table); } + if (monitor_section_button == 0) { + Glib::RefPtr act = ActionManager::get_action ("Common", "ToggleMonitorSection"); + monitor_section_button = manage (new ArdourButton); + monitor_section_button->set_name ("monitor section button"); + monitor_section_button->set_related_action (act); + set_tooltip (monitor_section_button, _("Show/Hide Monitoring Section")); + mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1); + monitor_section_button->show(); + monitor_section_button->unset_flags (Gtk::CAN_FOCUS); + } + 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); @@ -2076,6 +2088,9 @@ MixerStrip::set_button_names () mute_button->set_text (_("Mute")); monitor_input_button->set_text (_("In")); monitor_disk_button->set_text (_("Disk")); + if (monitor_section_button) { + monitor_section_button->set_text (_("Mon")); + } if (_route && _route->solo_safe()) { solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); @@ -2102,6 +2117,9 @@ MixerStrip::set_button_names () mute_button->set_text (S_("Mute|M")); monitor_input_button->set_text (S_("MonitorInput|I")); monitor_disk_button->set_text (S_("MonitorDisk|D")); + if (monitor_section_button) { + monitor_section_button->set_text (S_("Mon|O")); + } if (_route && _route->solo_safe()) { solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); @@ -2199,6 +2217,25 @@ MixerStrip::parameter_changed (string p) else if (p == "track-name-number") { name_changed (); } + 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 (_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 to decide whether the solo isolate / solo lock button visibility should diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 9133d2981f..6f63acf224 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -184,6 +184,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox ArdourButton input_button; ArdourButton output_button; + ArdourButton* monitor_section_button; + void input_button_resized (Gtk::Allocation&); void output_button_resized (Gtk::Allocation&); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 0eb3f77cfe..69887fd606 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -259,6 +259,7 @@ Mixer_UI::Mixer_UI () Mixer_UI::~Mixer_UI () { if (_monitor_section) { + monitor_section_detached (); delete _monitor_section; } delete _plugin_selector; @@ -364,6 +365,11 @@ Mixer_UI::add_strips (RouteList& routes) _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)); + + monitor_section_attached (); + route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context()); /* no regular strip shown for control out */ @@ -803,9 +809,11 @@ Mixer_UI::session_going_away () delete (*i); } - if (_monitor_section) { - _monitor_section->tearoff().hide_visible (); - } + if (_monitor_section) { + _monitor_section->tearoff().hide_visible (); + } + + monitor_section_detached (); strips.clear (); @@ -1447,6 +1455,22 @@ Mixer_UI::show_mixer_list (bool yn) _show_mixer_list = yn; } +void +Mixer_UI::show_monitor_section (bool yn) +{ + if (!monitor_section()) { + return; + } + if (monitor_section()->tearoff().torn_off()) { + return; + } + + if (yn) { + monitor_section()->tearoff().show(); + } else { + monitor_section()->tearoff().hide(); + } +} void Mixer_UI::route_group_name_edit (const std::string& path, const std::string& new_text) @@ -1881,6 +1905,10 @@ Mixer_UI::parameter_changed (string const & p) } } else if (p == "remote-model") { reset_remote_control_ids (); + } else if (p == "use-monitor-bus") { + if (!_session->monitor_out()) { + monitor_section_detached (); + } } } @@ -2026,6 +2054,7 @@ void Mixer_UI::monitor_section_going_away () { if (_monitor_section) { + monitor_section_detached (); out_packer.remove (_monitor_section->tearoff()); _monitor_section->set_session (0); } @@ -2074,3 +2103,19 @@ Mixer_UI::restore_mixer_space () _maximised = false; } + +void +Mixer_UI::monitor_section_attached () +{ + Glib::RefPtr act = ActionManager::get_action ("Common", "ToggleMonitorSection"); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + act->set_sensitive (true); + tact->set_active (); +} + +void +Mixer_UI::monitor_section_detached () +{ + Glib::RefPtr act = ActionManager::get_action ("Common", "ToggleMonitorSection"); + act->set_sensitive (false); +} diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 8352ce76a2..68ea0ca2d9 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -76,6 +76,7 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR int set_state (const XMLNode& ); void show_mixer_list (bool yn); + void show_monitor_section (bool); void show_window (); bool hide_window (GdkEventAny *ev); @@ -293,6 +294,9 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR void monitor_section_going_away (); + void monitor_section_attached (); + void monitor_section_detached (); + /// true if we are in fullscreen mode bool _maximised; -- cgit v1.2.3