From d075bacf9404e8868facbafa157f1299cbfbc662 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 24 Oct 2016 10:02:44 -0700 Subject: [PATCH] fix DisplayConfig panel brkn in 7a7a72f Change the Scale control in the DisplayConfig dialog from a SpinCtrl to a TextCtrl (for a simple text field) because GenericValidator does not support using a double* with a SpinCtrl. Also force adjustment on minimum size and resize the window when necessary on panel creation, so that when the user sets the value higher, the window size automatically adjusts. --- src/wx/guiinit.cpp | 7 ++++++- src/wx/panel.cpp | 4 ++++ src/wx/xrc/DisplayConfig.xrc | 4 +--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 2b024cc0..c3f6da5f 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -2899,6 +2899,11 @@ bool MainFrame::BindControls() tc = SafeXRCCTRL(d, n); \ tc->SetValidator(wxTextValidator(wxFILTER_NONE, &o)); \ } while (0) +#define getgtc(n, o) \ + do { \ + tc = SafeXRCCTRL(d, n); \ + tc->SetValidator(wxGenericValidator(&o)); \ + } while (0) #ifndef NO_LINK { net_link_handler.dlg = d; @@ -3294,7 +3299,7 @@ bool MainFrame::BindControls() /// Zoom // this was a choice, but I'd rather not have to make an off-by-one // validator just for this, and spinctrl is good enough. - getsc("DefaultScale", gopts.video_scale); + getgtc("DefaultScale", gopts.video_scale); getsc("MaxScale", maxScale); /// Advanced getrbi("OutputSimple", gopts.render_method, RND_SIMPLE); diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index ebec1255..f70c7d18 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -1041,6 +1041,10 @@ void GameArea::OnIdle(wxIdleEvent& event) if (pointer_blanked) w->SetCursor(wxCursor(wxCURSOR_BLANK)); + + // if user changed Display/Scale config, this needs to run + AdjustMinSize(); + AdjustSize(false); } if (!paused && (!pauseWhenInactive || wxGetApp().frame->HasFocus())) { diff --git a/src/wx/xrc/DisplayConfig.xrc b/src/wx/xrc/DisplayConfig.xrc index 9a5b0a7b..2a6eaa7f 100644 --- a/src/wx/xrc/DisplayConfig.xrc +++ b/src/wx/xrc/DisplayConfig.xrc @@ -106,9 +106,7 @@ 5 - - 1 - 6 + wxALL|wxEXPAND