Make the Unsaved Changes Dialog Header Span the Full Table Width

The grey header strip carrying the Settings/Old Value/New Value titles was
added to the tab panel without wxEXPAND, so it stayed at the width its own
sizer fitted it to. The panel, the scrolled window and every category and
value row below it are added with wxEXPAND and do follow the dialog width,
so as soon as the dialog came out wider than the table, the header stopped
short and left a bare strip of panel to the right of New Value.

The dialog takes its width from the widest child of the main sizer, which
includes the button row. In the Transfer/Discard/Save variant three Choice
buttons, each with a hard FromDIP(100) minimum, plus the gaps, the checkbox
and the margins come within a few pixels of the table width, and at higher
display scaling they overrun it.

Give the header the panel width and send the surplus to a stretch spacer
after the last column, so the columns stay put: they are hard minimum sizes
on both sides, and the rows below leave that same area empty, so header and
values remain aligned. The Settings column drops to proportion 0 so it does
not absorb the surplus and slide the other two titles out of alignment.

The header is unchanged when the dialog is not wider than its table.

Verified on Linux with a release build: with the dialog widened, the header
goes from ending at x=511 to spanning the full 749, and the pixel difference
between the two builds is confined to the strip that was previously bare. At
normal width the two builds render identically. Not verified on Windows.
This commit is contained in:
Hanif Koh
2026-09-18 18:35:24 +08:00
parent db91d4b630
commit 87f5aa298e
+3 -2
View File
@@ -891,7 +891,7 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_
top_title_temp_v->Add(top_title_temp_h, 1, wxALIGN_CENTER, 0);
m_panel_temp->SetSizer(top_title_temp_v);
m_panel_temp->Layout();
m_sizer_top->Add(m_panel_temp, 1, wxALIGN_CENTER, 0);
m_sizer_top->Add(m_panel_temp, 0, wxALIGN_CENTER, 0);
title_block_middle = new wxPanel(m_table_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
title_block_middle->SetBackgroundColour(wxColour(172, 172, 172));
@@ -935,11 +935,12 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_
m_panel_newv->Layout();
m_sizer_top->Add(m_panel_newv, 0, wxALIGN_CENTER, 0);
//m_sizer_top->Add(top_title_newv, 1, wxALIGN_CENTER, 0);
m_sizer_top->AddStretchSpacer();
m_table_top->SetSizer(m_sizer_top);
m_table_top->Layout();
m_sizer_top->Fit(m_table_top);
m_sizer_tab->Add(m_table_top, 1, 0, 0);
m_sizer_tab->Add(m_table_top, 0, wxEXPAND, 0);
m_scrolledWindow = new wxScrolledWindow(m_panel_tab, wxID_ANY, wxDefaultPosition, UNSAVE_CHANGE_DIALOG_SCROLL_WINDOW_SIZE, wxNO_BORDER|wxVSCROLL);
m_scrolledWindow->SetScrollRate(0, 5);