From 1228202bbefa8a8f6ad9e3b1479c1a3ba2e202f3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 3 Sep 2022 17:39:24 +0200 Subject: [PATCH] Fix save/restore window and tab sizes Window size has to be set before calling `setup_toplevel_window()`. and `set_show_tabs()` - see also acf13e9498f451c and 42cb321039fe2fe. This also unconditionally saves the current settings to global config instant.xml. This was previously only done in rare cases when first closing the session and then quitting Ardour. --- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui_dependents.cc | 9 +++++---- gtk2_ardour/ardour_ui_ed.cc | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index ee401d7fc6..408eeff9ce 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -445,7 +445,7 @@ private: void toggle_meterbridge (); int setup_windows (); - int apply_window_settings (bool); + void apply_window_settings (bool); void setup_transport (); void setup_clock (); diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 7395653bc6..fe15100064 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -344,6 +344,7 @@ ARDOUR_UI::setup_windows () _main_window.add (main_vpacker); transport_frame.show_all (); + apply_window_settings (true); setup_toplevel_window (_main_window, "", this); _main_window.show_all (); @@ -360,16 +361,16 @@ ARDOUR_UI::setup_windows () LV2Plugin::set_main_window_id (GDK_DRAWABLE_XID(_main_window.get_window()->gobj())); #endif - return apply_window_settings (true); + return 0; } -int +void ARDOUR_UI::apply_window_settings (bool with_size) { const XMLNode* mnode = main_window_settings (); if (!mnode) { - return 0; + return; } XMLProperty const* prop; @@ -428,7 +429,7 @@ ARDOUR_UI::apply_window_settings (bool with_size) } else if (editor) { _tabs.set_current_page (_tabs.page_num (editor->contents())); } - return 0; + return; } bool diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 1fa0da4ef0..45200c7ab4 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -965,7 +965,10 @@ ARDOUR_UI::save_ardour_state () vkstate.add_child_nocopy (virtual_keyboard_window.get_state ()); _session->add_instant_xml (vkstate); } - } else { + } + + /* save current Window settings and sizes for new sessions */ + { Config->add_instant_xml (main_window_node); Config->add_instant_xml (enode); Config->add_instant_xml (mnode);