From 91321272b59779546c7ca426b1c8ee94fc4f1740 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 21 Dec 2016 23:01:34 +0100 Subject: [PATCH] Add option to hide the 2ndary clock --- gtk2_ardour/ardour_ui.cc | 1 + gtk2_ardour/ardour_ui.h | 3 +++ gtk2_ardour/ardour_ui2.cc | 30 +++++++++++++++++++++++++++--- gtk2_ardour/ardour_ui_options.cc | 2 ++ gtk2_ardour/rc_option_editor.cc | 10 ++++++++++ gtk2_ardour/ui_config_vars.h | 1 + 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 7925dac7d0..5e2af4bbb4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -272,6 +272,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , _mixer_on_top (false) , _initial_verbose_plugin_scan (false) , first_time_engine_run (true) + , secondary_clock_spacer (0) , roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll)) , stop_controllable (new TransportControllable ("transport stop", *this, TransportControllable::Stop)) , goto_start_controllable (new TransportControllable ("transport goto start", *this, TransportControllable::GotoStart)) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 6d8ae8f29d..04e9208fcc 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -101,6 +101,7 @@ class About; class AddRouteDialog; class AddVideoDialog; +class ArdourVSpacer; class BigClockWindow; class BundleManager; class EngineControl; @@ -478,7 +479,9 @@ private: Gtk::Frame transport_frame; Gtk::HBox transport_hbox; + ArdourVSpacer *secondary_clock_spacer; void repack_transport_hbox (); + void update_clock_visibility (); struct TransportControllable : public PBD::Controllable { enum ToggleType { diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index e850c406a5..bb1b6fb000 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -214,6 +214,25 @@ ARDOUR_UI::repack_transport_hbox () } } +void +ARDOUR_UI::update_clock_visibility () +{ + if (ARDOUR::Profile->get_small_screen()) { + return; + } + if (UIConfiguration::instance().get_show_secondary_clock ()) { + secondary_clock->show(); + secondary_clock->left_btn()->show(); + secondary_clock->right_btn()->show(); + secondary_clock_spacer->show(); + } else { + secondary_clock->hide(); + secondary_clock->left_btn()->hide(); + secondary_clock->right_btn()->hide(); + secondary_clock_spacer->hide(); + } +} + bool ARDOUR_UI::transport_expose (GdkEventExpose* ev) { @@ -543,11 +562,15 @@ ARDOUR_UI::setup_transport () transport_table.attach (*secondary_clock, col, col + 2, 0, 1 , FILL, SHRINK, 2, 0); transport_table.attach (*secondary_clock->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, 2, 0); transport_table.attach (*secondary_clock->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, 2, 0); + secondary_clock->set_no_show_all (true); + secondary_clock->left_btn()->set_no_show_all (true); + secondary_clock->right_btn()->set_no_show_all (true); col += 2; - } - transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0); - ++col; + secondary_clock_spacer = manage (new ArdourVSpacer ()); + transport_table.attach (*secondary_clock_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0); + ++col; + } transport_table.attach (*alert_box, TCOL, 0, 2, SHRINK, EXPAND|FILL, 2, 0); ++col; @@ -569,6 +592,7 @@ ARDOUR_UI::setup_transport () ++col; repack_transport_hbox (); + update_clock_visibility (); /* desensitize */ feedback_alert_button.set_sensitive (false); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index e49cc01eaa..dc149de553 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -409,6 +409,8 @@ ARDOUR_UI::parameter_changed (std::string p) repack_transport_hbox (); } else if (p == "show-editor-meter") { repack_transport_hbox (); + } else if (p == "show-secondary-clock") { + update_clock_visibility (); } else if (p == "waveform-scale") { ArdourCanvas::WaveView::set_global_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); } else if (p == "widget-prelight") { diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index f9244c0abd..db6699e9ad 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3489,6 +3489,16 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_toolbar_selclock) )); + if (!ARDOUR::Profile->get_small_screen()) { + add_option (_("GUI/Toolbar"), + new BoolOption ( + "show-secondary-clock", + _("Display Secondary Clock in the Toolbar"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_secondary_clock), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_secondary_clock) + )); + } + add_option (_("GUI/Toolbar"), new BoolOption ( "show-mini-timeline", diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 06fadee3d3..6b90aedbf1 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -74,6 +74,7 @@ UI_CONFIG_VARIABLE (bool, meter_style_led, "meter-style-led", false) UI_CONFIG_VARIABLE (bool, show_editor_meter, "show-editor-meter", true) UI_CONFIG_VARIABLE (bool, show_toolbar_selclock, "show-toolbar-selclock", false) UI_CONFIG_VARIABLE (bool, show_mini_timeline, "show-mini-timeline", true) +UI_CONFIG_VARIABLE (bool, show_secondary_clock, "show-secondary-clock", true) UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.0933967) /* units of dB */ UI_CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)