From 08acf426768649f05e22d9f959c1b9b3bd128164 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 29 Mar 2022 00:28:12 +0200 Subject: [PATCH] Correctly restore mixer-ui pane sizes Pane::set_divider() constrains the divider so that widget minimum sizes are honored. Initially the mixer is empty and the tab has width of ~110px (just scroll window). Pane::on_size_allocate() calls set_divider() before actual mixer-strips are added and before the mixer window size was restored. This incorrectly constrained pane sizes. --- gtk2_ardour/mixer_ui.cc | 47 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 51df6b74b6..2b2fbcdb30 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -313,28 +313,10 @@ Mixer_UI::Mixer_UI () list_hpane.add (global_hpacker); list_hpane.set_child_minsize (list_vpacker, 30); - XMLNode const * settings = ARDOUR_UI::instance()->mixer_settings(); - float fract; - - if (!settings || !settings->get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) { - fract = 0.6f; - } - rhs_pane1.set_divider (0, fract); - - if (!settings || !settings->get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) { - fract = 0.7f; - } - rhs_pane2.set_divider (0, fract); - - if (!settings || !settings->get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) { - fract = 0.2f; - } - list_hpane.set_divider (0, fract); - - if (!settings || !settings->get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) { - fract = 0.8f; - } - inner_pane.set_divider (0, fract); + rhs_pane1.set_divider (0, .6); + rhs_pane2.set_divider (0, .7); + list_hpane.set_divider (0, .2); + inner_pane.set_divider (0, .8); rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down); rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down); @@ -2528,6 +2510,27 @@ Mixer_UI::set_state (const XMLNode& node, int version) sync_treeview_from_favorite_order (); } + float fract; + if (!node.get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) { + fract = 0.6f; + } + rhs_pane1.set_divider (0, fract); + + if (!node.get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) { + fract = 0.7f; + } + rhs_pane2.set_divider (0, fract); + + if (!node.get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) { + fract = 0.2f; + } + list_hpane.set_divider (0, fract); + + if (!node.get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) { + fract = 0.8f; + } + inner_pane.set_divider (0, fract); + return 0; }