From ba2fbfa2cf57a74362adafef6a41e04e79b1b2d3 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 24 Oct 2024 12:31:19 -0500 Subject: [PATCH] ArdourUI packs the tabbable visibility buttons --- gtk2_ardour/ardour_ui.h | 3 +-- gtk2_ardour/ardour_ui2.cc | 35 ++++++----------------------- gtk2_ardour/ardour_ui_dependents.cc | 2 -- gtk2_ardour/ardour_ui_dialogs.cc | 16 +++++++++++++ 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index fcb6d92f15..defaedaa1a 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -523,8 +523,7 @@ private: /* Transport Control */ - Gtk::Table transport_table; - Gtk::Frame transport_frame; + Gtk::Table tabbables_table; void toggle_follow_edits (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index f55add0ba4..030e67c562 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -231,28 +231,6 @@ ARDOUR_UI::setup_transport () /* transport control size-group */ - /* and now the layout... */ - - /* top level packing */ - transport_table.set_spacings (0); - transport_table.set_row_spacings (4); - transport_table.set_border_width (1); - - transport_frame.set_name ("TransportFrame"); - transport_frame.set_shadow_type (Gtk::SHADOW_NONE); - - /* An event box to hold the table. We use this because we want specific - control over the background color, and without this event box, - nothing inside the transport_frame actually draws a background. We - would therefore end up seeing the background of the parent widget, - which is probably some default color. Adding the EventBox adds a - widget that will draw the background, using a style based on - the parent, "TransportFrame". - */ - Gtk::EventBox* ebox = manage (new Gtk::EventBox); - transport_frame.add (*ebox); - ebox->add (transport_table); - //tab selections button_height_size_group->add_widget (trigger_page_visibility_button); button_height_size_group->add_widget (recorder_visibility_button); @@ -261,18 +239,19 @@ ARDOUR_UI::setup_transport () button_height_size_group->add_widget (prefs_visibility_button); /* and the main table layout */ - int vpadding = 1; - int hpadding = 2; + int vpadding = 3; + int hpadding = 3; int col = 0; #define TCOL col, col + 1 - transport_table.attach (recorder_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding); - transport_table.attach (trigger_page_visibility_button, TCOL, 1, 2 , FILL, SHRINK, hpadding, vpadding); + tabbables_table.attach (recorder_visibility_button, TCOL, 0, 1 , FILL, FILL, hpadding, vpadding); + tabbables_table.attach (trigger_page_visibility_button, TCOL, 1, 2 , FILL, FILL, hpadding, vpadding); ++col; - transport_table.attach (editor_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding); - transport_table.attach (mixer_visibility_button, TCOL, 1, 2 , FILL, SHRINK, hpadding, vpadding); + tabbables_table.attach (editor_visibility_button, TCOL, 0, 1 , FILL, FILL, hpadding, vpadding); + tabbables_table.attach (mixer_visibility_button, TCOL, 1, 2 , FILL, FILL, hpadding, vpadding); ++col; + tabbables_table.show_all (); } #undef PX_SCALE #undef TCOL diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 1757fa610a..e1bb46643b 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -302,7 +302,6 @@ ARDOUR_UI::setup_windows () /* now add the transport sample to the top of main window */ main_vpacker.pack_start ( *spacer, false, false); - main_vpacker.pack_start (transport_frame, false, false); main_vpacker.pack_start (_tabs, true, true); setup_transport(); @@ -320,7 +319,6 @@ ARDOUR_UI::setup_windows () */ _main_window.add (main_vpacker); - transport_frame.show_all (); apply_window_settings (true); diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 97e9196b0c..eeaef4d866 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -625,8 +625,18 @@ ARDOUR_UI::tabs_page_removed (Widget*, guint) void ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) { + if (tabbables_table.get_parent ()) { + editor->tab_btn_box ().remove (); + mixer->tab_btn_box ().remove (); + recorder->tab_btn_box ().remove (); + trigger_page->tab_btn_box ().remove (); + } + + //pack the tabbables selector in this tab, and set button sensitivity appropriately if (editor && (page == (guint) _tabs.page_num (editor->contents()))) { + editor->tab_btn_box ().add (tabbables_table); + editor_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive); if (mixer && (mixer->tabbed() || mixer->tabbed_by_default())) { @@ -649,6 +659,8 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) } else if (mixer && (page == (guint) _tabs.page_num (mixer->contents()))) { + mixer->tab_btn_box ().add (tabbables_table); + if (editor && (editor->tabbed() || editor->tabbed_by_default())) { editor_visibility_button.set_active_state (Gtkmm2ext::Off); } @@ -689,6 +701,8 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) } else if (page == (guint) _tabs.page_num (recorder->contents())) { + recorder->tab_btn_box ().add (tabbables_table); + if (editor && (editor->tabbed() || editor->tabbed_by_default())) { editor_visibility_button.set_active_state (Gtkmm2ext::Off); } @@ -709,6 +723,8 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) } else if (page == (guint) _tabs.page_num (trigger_page->contents())) { + trigger_page->tab_btn_box ().add (tabbables_table); + if (editor && (editor->tabbed() || editor->tabbed_by_default())) { editor_visibility_button.set_active_state (Gtkmm2ext::Off); }