13
0

Transfer from ardour_ui (pack ARDOUR_UIs clocks)

This commit is contained in:
Robin Gareus 2024-11-08 01:55:42 +01:00
parent efbb222277
commit 1641be9f7a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 46 additions and 31 deletions

View File

@ -117,6 +117,7 @@ ApplicationBar::ApplicationBar ()
, _latency_disable_button (ArdourButton::led_default_elements)
, _auto_return_button (ArdourButton::led_default_elements)
, _follow_edits_button (ArdourButton::led_default_elements)
, _secondary_clock_spacer (0)
{
_record_mode_strings = I18N (_record_mode_strings_);
}
@ -226,6 +227,28 @@ 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);
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);
(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);
col += 2;
_secondary_clock_spacer = manage (new ArdourVSpacer ());
_table.attach (*_secondary_clock_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
++col;
}
_table.set_spacings (0);
_table.set_row_spacings (4);
_table.set_border_width (1);
@ -269,6 +292,7 @@ ApplicationBar::on_parent_changed (Gtk::Widget*)
ARDOUR::Latent::DisableSwitchChanged.connect (_forever_connections, MISSING_INVALIDATOR, std::bind (&ApplicationBar::latency_switch_changed, this), gui_context ());
/* initialize */
update_clock_visibility ();
set_transport_sensitivity (false);
latency_switch_changed ();
session_latency_updated (true);
@ -437,6 +461,24 @@ ApplicationBar::latency_switch_changed ()
}
}
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();
}
} else {
if (_secondary_clock_spacer) {
_secondary_clock_spacer->hide();
}
}
}
void
ApplicationBar::session_latency_updated (bool for_playback)
{
@ -536,7 +578,7 @@ ApplicationBar::parameter_changed (std::string p)
} else if (p == "show-editor-meter") {
repack_transport_hbox ();
} else if (p == "show-secondary-clock") {
// update_clock_visibility ();
update_clock_visibility ();
} else if (p == "action-table-columns") {
/* const uint32_t cols = UIConfiguration::instance().get_action_table_columns ();
for (int i = 0; i < MAX_LUA_ACTION_BUTTONS; ++i) {

View File

@ -78,6 +78,8 @@ private:
void latency_switch_changed ();
void session_latency_updated (bool);
void update_clock_visibility ();
/* blinking alerts */
void sync_blink (bool);
void blink_handler (bool);
@ -102,6 +104,7 @@ private:
Gtk::Label _io_latency_value;
ArdourWidgets::ArdourButton _auto_return_button;
ArdourWidgets::ArdourButton _follow_edits_button;
ArdourWidgets::ArdourVSpacer* _secondary_clock_spacer;
std::vector<std::string> _record_mode_strings;

View File

@ -298,7 +298,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, _shared_popup_menu (0)
, _basic_ui (0)
, startup_fsm (0)
, secondary_clock_spacer (0)
, _cue_rec_enable (_("Rec Cues"), ArdourButton::led_default_elements)
, _cue_play_enable (_("Play Cues"), ArdourButton::led_default_elements)
, time_info_box (0)

View File

@ -521,7 +521,6 @@ private:
Gtk::Frame transport_frame;
Gtk::HBox transport_hbox;
ArdourWidgets::ArdourVSpacer* secondary_clock_spacer;
void update_clock_visibility ();
void toggle_follow_edits ();

View File

@ -201,16 +201,10 @@ ARDOUR_UI::update_clock_visibility ()
secondary_clock->show();
secondary_clock->left_btn()->show();
secondary_clock->right_btn()->show();
if (secondary_clock_spacer) {
secondary_clock_spacer->show();
}
} else {
secondary_clock->hide();
secondary_clock->left_btn()->hide();
secondary_clock->right_btn()->hide();
if (secondary_clock_spacer) {
secondary_clock_spacer->hide();
}
}
}
@ -422,28 +416,6 @@ ARDOUR_UI::setup_transport ()
transport_table.attach (*application_bar, TCOL, 0, 2 , EXPAND|FILL, EXPAND|FILL, 3, 0);
++col;
transport_table.attach (*primary_clock, col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0);
transport_table.attach (*primary_clock->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0);
transport_table.attach (*primary_clock->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 0);
col += 2;
transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
++col;
if (!ARDOUR::Profile->get_small_screen()) {
transport_table.attach (*secondary_clock, col, col + 2, 0, 1 , FILL, SHRINK, hpadding, 0);
transport_table.attach (*secondary_clock->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, hpadding, 0);
transport_table.attach (*secondary_clock->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, hpadding, 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;
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, hpadding, 0);
++col;