diff --git a/gtk2_ardour/application_bar.cc b/gtk2_ardour/application_bar.cc index 9a13f347c4..29b08b7873 100644 --- a/gtk2_ardour/application_bar.cc +++ b/gtk2_ardour/application_bar.cc @@ -117,6 +117,8 @@ ApplicationBar::ApplicationBar () , _latency_disable_button (ArdourButton::led_default_elements) , _auto_return_button (ArdourButton::led_default_elements) , _follow_edits_button (ArdourButton::led_default_elements) + , _primary_clock (X_("primary"), X_("transport"), MainClock::PrimaryClock) + , _secondary_clock (X_("secondary"), X_("secondary"), MainClock::SecondaryClock) , _secondary_clock_spacer (0) { _record_mode_strings = I18N (_record_mode_strings_); @@ -227,18 +229,18 @@ ApplicationBar::on_parent_changed (Gtk::Widget*) _table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0); ++col; - _table.attach (*(ARDOUR_UI::instance()->primary_clock), col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0); - _table.attach (*(ARDOUR_UI::instance()->primary_clock)->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0); - _table.attach (*(ARDOUR_UI::instance()->primary_clock)->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 0); + _table.attach (_primary_clock, col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0); + _table.attach (*(_primary_clock.left_btn()), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0); + _table.attach (*(_primary_clock.right_btn()), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 0); col += 2; _table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0); ++col; if (!ARDOUR::Profile->get_small_screen()) { - _table.attach (*(ARDOUR_UI::instance()->secondary_clock), col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0); - _table.attach (*(ARDOUR_UI::instance()->secondary_clock)->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0); - _table.attach (*(ARDOUR_UI::instance()->secondary_clock)->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 0); + _table.attach (_secondary_clock, col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0); + _table.attach (*(_secondary_clock.left_btn()), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0); + _table.attach (*(_secondary_clock.right_btn()), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 0); (ARDOUR_UI::instance()->secondary_clock)->set_no_show_all (true); (ARDOUR_UI::instance()->secondary_clock)->left_btn()->set_no_show_all (true); (ARDOUR_UI::instance()->secondary_clock)->right_btn()->set_no_show_all (true); @@ -267,10 +269,24 @@ ApplicationBar::on_parent_changed (Gtk::Widget*) button_height_size_group->add_widget (_follow_edits_button); button_height_size_group->add_widget (_auto_return_button); + /* clock button size groups */ + button_height_size_group->add_widget (*_primary_clock.left_btn()); + button_height_size_group->add_widget (*_primary_clock.right_btn()); + button_height_size_group->add_widget (*_secondary_clock.left_btn()); + button_height_size_group->add_widget (*_secondary_clock.right_btn()); + Glib::RefPtr punch_button_size_group = SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL); punch_button_size_group->add_widget (_punch_in_button); punch_button_size_group->add_widget (_punch_out_button); + Glib::RefPtr clock1_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); + clock1_size_group->add_widget (*_primary_clock.left_btn()); + clock1_size_group->add_widget (*_primary_clock.right_btn()); + + Glib::RefPtr clock2_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); + clock2_size_group->add_widget (*_secondary_clock.left_btn()); + clock2_size_group->add_widget (*_secondary_clock.right_btn()); + /* tooltips */ Gtkmm2ext::UI::instance()->set_tip (_punch_in_button, _("Start recording at auto-punch start")); Gtkmm2ext::UI::instance()->set_tip (_punch_out_button, _("Stop recording at auto-punch end")); @@ -278,6 +294,8 @@ ApplicationBar::on_parent_changed (Gtk::Widget*) Gtkmm2ext::UI::instance()->set_tip (_latency_disable_button, _("Disable all Plugin Delay Compensation. This results in the shortest delay from live input to output, but any paths with delay-causing plugins will sound later than those without.")); Gtkmm2ext::UI::instance()->set_tip (_auto_return_button, _("Return to last playback start when stopped")); Gtkmm2ext::UI::instance()->set_tip (_follow_edits_button, _("Playhead follows Range tool clicks, and Range selections")); + Gtkmm2ext::UI::instance()->set_tip (_primary_clock, _("Primary Clock right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite Esc: cancel; Enter: confirm; postfix the edit with '+' or '-' to enter delta times.\n")); + Gtkmm2ext::UI::instance()->set_tip (_secondary_clock, _("Secondary Clock right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite Esc: cancel; Enter: confirm; postfix the edit with '+' or '-' to enter delta times.\n")); /* theming */ _sync_button.set_name ("transport active option button"); @@ -413,8 +431,12 @@ ApplicationBar::set_session (Session *s) { SessionHandlePtr::set_session (s); - _transport_ctrl.set_session (s); - _shuttle_box.set_session (s); + if (s) { + _transport_ctrl.set_session (s); + _shuttle_box.set_session (s); + _primary_clock.set_session (s); + _secondary_clock.set_session (s); + } if (_basic_ui) { delete _basic_ui; @@ -461,21 +483,26 @@ ApplicationBar::latency_switch_changed () } } +void +ApplicationBar::focus_on_clock () +{ + _primary_clock.focus (); +} + void ApplicationBar::update_clock_visibility () { if (ARDOUR::Profile->get_small_screen()) { - _secondary_clock_spacer->hide(); return; } if (UIConfiguration::instance().get_show_secondary_clock ()) { - if (_secondary_clock_spacer) { - _secondary_clock_spacer->show(); - } + _secondary_clock.show(); + _secondary_clock.left_btn()->show(); + _secondary_clock.right_btn()->show(); } else { - if (_secondary_clock_spacer) { - _secondary_clock_spacer->hide(); - } + _secondary_clock.hide(); + _secondary_clock.left_btn()->hide(); + _secondary_clock.right_btn()->hide(); } } diff --git a/gtk2_ardour/application_bar.h b/gtk2_ardour/application_bar.h index 04184ae4b1..fda22af2a4 100644 --- a/gtk2_ardour/application_bar.h +++ b/gtk2_ardour/application_bar.h @@ -58,6 +58,8 @@ public: void set_session (ARDOUR::Session *); + void focus_on_clock (); + private: void on_parent_changed (Gtk::Widget*); @@ -104,6 +106,8 @@ private: Gtk::Label _io_latency_value; ArdourWidgets::ArdourButton _auto_return_button; ArdourWidgets::ArdourButton _follow_edits_button; + TransportClock _primary_clock; + TransportClock _secondary_clock; ArdourWidgets::ArdourVSpacer* _secondary_clock_spacer; std::vector _record_mode_strings; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index fbedef3275..71f9403643 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -522,7 +522,6 @@ private: Gtk::Frame transport_frame; Gtk::HBox transport_hbox; - void update_clock_visibility (); void toggle_follow_edits (); void set_transport_controllable_state (const XMLNode&); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 1d775f6eb6..a6b8ca8c50 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -95,8 +95,6 @@ ARDOUR_UI::setup_tooltips () set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything")); set_tip (auditioning_alert_button, _("When active, auditioning is taking place.\nClick to stop the audition")); set_tip (feedback_alert_button, _("When lit, there is a ports connection issue, leading to feedback loop or ambiguous alignment.\nThis is caused by connecting an output back to some input (feedback), or by multiple connections from a source to the same output via different paths (ambiguous latency, record alignment).")); - set_tip (primary_clock, _("Primary Clock right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite Esc: cancel; Enter: confirm; postfix the edit with '+' or '-' to enter delta times.\n")); - set_tip (secondary_clock, _("Secondary Clock right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite Esc: cancel; Enter: confirm; postfix the edit with '+' or '-' to enter delta times.\n")); set_tip (editor_meter_peak_display, _("Reset All Peak Meters")); set_tip (error_alert_button, _("Show Error Log and acknowledge warnings")); set_tip (_cue_rec_enable, _("When enabled, triggering Cues will result in Cue Markers added to the timeline")); @@ -191,23 +189,6 @@ ARDOUR_UI::cue_rec_state_changed () //Config->get_cue_behavior() } -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(); - } else { - secondary_clock->hide(); - secondary_clock->left_btn()->hide(); - secondary_clock->right_btn()->hide(); - } -} - void ARDOUR_UI::setup_transport () { @@ -376,12 +357,6 @@ ARDOUR_UI::setup_transport () monitor_box->pack_start (monitor_dim_button, true, true); monitor_box->pack_start (monitor_mute_button, true, true); - /* clock button size groups */ - button_height_size_group->add_widget (*primary_clock->left_btn()); - button_height_size_group->add_widget (*primary_clock->right_btn()); - button_height_size_group->add_widget (*secondary_clock->left_btn()); - button_height_size_group->add_widget (*secondary_clock->right_btn()); - //tab selections button_height_size_group->add_widget (trigger_page_visibility_button); button_height_size_group->add_widget (recorder_visibility_button); @@ -393,14 +368,6 @@ ARDOUR_UI::setup_transport () button_height_size_group->add_widget (action_script_call_btn[i]); } - Glib::RefPtr clock1_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); - clock1_size_group->add_widget (*primary_clock->left_btn()); - clock1_size_group->add_widget (*primary_clock->right_btn()); - - Glib::RefPtr clock2_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); - clock2_size_group->add_widget (*secondary_clock->left_btn()); - clock2_size_group->add_widget (*secondary_clock->right_btn()); - /* and the main table layout */ int vpadding = 1; int hpadding = 2; @@ -449,8 +416,6 @@ ARDOUR_UI::setup_transport () transport_table.attach (mixer_visibility_button, TCOL, 1, 2 , FILL, SHRINK, hpadding, vpadding); ++col; - /* initialize */ - update_clock_visibility (); /* desensitize */ feedback_alert_button.set_sensitive (false); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 910decc2db..6b8518eb5b 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -54,6 +54,7 @@ #include "widgets/tearoff.h" #include "widgets/tooltips.h" +#include "application_bar.h" #include "ardour_ui.h" #include "public_editor.h" #include "audio_clock.h" @@ -1053,8 +1054,8 @@ ARDOUR_UI::on_theme_changed () void ARDOUR_UI::focus_on_clock () { - if (primary_clock) { - primary_clock->focus (); + if (application_bar) { + application_bar->focus_on_clock (); } }