diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 211ed83f9e..6a57df7886 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -405,6 +405,14 @@ public: void gui_idle_handler (); + enum LiveTraxVisibility { + LiveTraxEditorVisible = 0x1, + LiveTraxMixerVisible = 0x2, + LiveTraxMeterVisible = 0x4, + }; + + void livetrax_toggle_visibility (LiveTraxVisibility); + protected: friend class PublicEditor; @@ -980,6 +988,9 @@ private: bool nsm_first_session_opened; PBD::ScopedConnectionList clock_state_connection; + + LiveTraxVisibility _livetrax_visibility; + void livetrax_visibility_change (); }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 7e41373f79..deee5b4475 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -400,6 +400,7 @@ ARDOUR_UI::livetrax_setup_windows () Gtk::HBox* hb; ArdourButton::Element elements (ArdourButton::Element (ArdourButton::Text|ArdourButton::VectorIcon)); Gtkmm2ext::Bindings* bindings; + Glib::RefPtr act; livetrax_top_bar.set_spacing (12); livetrax_top_bar.set_border_width (12); @@ -440,9 +441,17 @@ ARDOUR_UI::livetrax_setup_windows () /* transport bar */ - livetrax_meter_view_button = manage (new ArdourButton (_("METER"), ArdourButton::Element (elements|ArdourButton::Edge|ArdourButton::Body), true));; - livetrax_mixer_view_button = manage (new ArdourButton (_("MIXER"), ArdourButton::Element (elements|ArdourButton::Edge|ArdourButton::Body), true)); - livetrax_editor_view_button = manage (new ArdourButton (_("TRACKS"), ArdourButton::Element (elements|ArdourButton::Edge|ArdourButton::Body), true)); + livetrax_meter_view_button = manage (new ArdourButton (_("METERS"), ArdourButton::Element (ArdourButton::Text|ArdourButton::Edge|ArdourButton::Body), true));; + act = ActionManager::get_action (X_("Common"), X_("livetrax-toggle-meter")); + livetrax_meter_view_button->set_related_action (act); + + livetrax_mixer_view_button = manage (new ArdourButton (_("MIXER"), ArdourButton::Element (ArdourButton::Text|ArdourButton::Edge|ArdourButton::Body), true)); + act = ActionManager::get_action (X_("Common"), X_("livetrax-toggle-mixer")); + livetrax_mixer_view_button->set_related_action (act); + + livetrax_editor_view_button = manage (new ArdourButton (_("TRACKS"), ArdourButton::Element (ArdourButton::Text|ArdourButton::Edge|ArdourButton::Body), true)); + act = ActionManager::get_action (X_("Common"), X_("livetrax-toggle-editor")); + livetrax_editor_view_button->set_related_action (act); livetrax_transport_bar.pack_start (*livetrax_editor_view_button, false, false); livetrax_transport_bar.pack_start (*livetrax_mixer_view_button, false, false); @@ -475,7 +484,7 @@ ARDOUR_UI::livetrax_setup_windows () livetrax_edit_vscrollbar->show (); hb->pack_start (editor->contents(), true, true); hb->pack_start (*livetrax_edit_vscrollbar, false, false); - + vb = manage (new Gtk::VBox); livetrax_edit_hscrollbar = manage (new Gtk::HScrollbar (editor->horizontal_adjustment)); livetrax_edit_hscrollbar->show (); @@ -505,6 +514,9 @@ ARDOUR_UI::livetrax_setup_windows () bindings = Bindings::get_bindings (X_("Mixer")); livetrax_mixer_bar.set_data ("ardour-bindings", bindings); + _livetrax_visibility = LiveTraxVisibility (LiveTraxMeterVisible|LiveTraxMixerVisible|LiveTraxEditorVisible); + livetrax_visibility_change (); + // setup_tooltips (); _main_window.signal_delete_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::main_window_delete_event)); @@ -649,3 +661,43 @@ ARDOUR_UI::action_script_changed (int i, const std::string& n) } KeyEditor::UpdateBindings (); } + +void +ARDOUR_UI::livetrax_visibility_change () +{ + if (_livetrax_visibility & LiveTraxMeterVisible) { + livetrax_meter_bar.show (); + livetrax_meter_view_button->set_active_state (Gtkmm2ext::ExplicitActive); + } else { + livetrax_meter_bar.hide (); + livetrax_meter_view_button->set_active_state (Gtkmm2ext::Off); + } + + if (_livetrax_visibility & LiveTraxEditorVisible) { + livetrax_editor_bar.show (); + livetrax_editor_view_button->set_active_state (Gtkmm2ext::ExplicitActive); + } else { + livetrax_editor_bar.hide (); + livetrax_editor_view_button->set_active_state (Gtkmm2ext::Off); + } + + if (_livetrax_visibility & LiveTraxMixerVisible) { + livetrax_mixer_bar.show (); + livetrax_mixer_view_button->set_active_state (Gtkmm2ext::ExplicitActive); + } else { + livetrax_mixer_bar.hide (); + livetrax_mixer_view_button->set_active_state (Gtkmm2ext::Off); + } +} + +void +ARDOUR_UI::livetrax_toggle_visibility (LiveTraxVisibility v) +{ + if (_livetrax_visibility & v) { + _livetrax_visibility = LiveTraxVisibility (_livetrax_visibility & ~v); + } else { + _livetrax_visibility = LiveTraxVisibility (_livetrax_visibility | v); + } + + livetrax_visibility_change (); +} diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index df4eaef001..bb655b515c 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -286,6 +286,13 @@ ARDOUR_UI::install_actions () ActionManager::register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs)); } + if (Profile->get_livetrax()) { + /* XXX should these be toggles? */ + ActionManager::register_action (common_actions, X_("livetrax-toggle-meter"), _("Hide/Show Meters"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::livetrax_toggle_visibility), LiveTraxMeterVisible)); + ActionManager::register_action (common_actions, X_("livetrax-toggle-mixer"), _("Hide/Show Mixer"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::livetrax_toggle_visibility), LiveTraxMixerVisible)); + ActionManager::register_action (common_actions, X_("livetrax-toggle-editor"), _("Hide/Show Editor"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::livetrax_toggle_visibility), LiveTraxEditorVisible)); + } + ActionManager::register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge)); act = ActionManager::register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window));