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.
This commit is contained in:
Rafael Kitover 2016-10-24 10:02:44 -07:00
parent 179987f8c4
commit d075bacf94
3 changed files with 11 additions and 4 deletions

View File

@ -2899,6 +2899,11 @@ bool MainFrame::BindControls()
tc = SafeXRCCTRL<wxTextCtrl>(d, n); \ tc = SafeXRCCTRL<wxTextCtrl>(d, n); \
tc->SetValidator(wxTextValidator(wxFILTER_NONE, &o)); \ tc->SetValidator(wxTextValidator(wxFILTER_NONE, &o)); \
} while (0) } while (0)
#define getgtc(n, o) \
do { \
tc = SafeXRCCTRL<wxTextCtrl>(d, n); \
tc->SetValidator(wxGenericValidator(&o)); \
} while (0)
#ifndef NO_LINK #ifndef NO_LINK
{ {
net_link_handler.dlg = d; net_link_handler.dlg = d;
@ -3294,7 +3299,7 @@ bool MainFrame::BindControls()
/// Zoom /// Zoom
// this was a choice, but I'd rather not have to make an off-by-one // 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. // validator just for this, and spinctrl is good enough.
getsc("DefaultScale", gopts.video_scale); getgtc("DefaultScale", gopts.video_scale);
getsc("MaxScale", maxScale); getsc("MaxScale", maxScale);
/// Advanced /// Advanced
getrbi("OutputSimple", gopts.render_method, RND_SIMPLE); getrbi("OutputSimple", gopts.render_method, RND_SIMPLE);

View File

@ -1041,6 +1041,10 @@ void GameArea::OnIdle(wxIdleEvent& event)
if (pointer_blanked) if (pointer_blanked)
w->SetCursor(wxCursor(wxCURSOR_BLANK)); w->SetCursor(wxCursor(wxCURSOR_BLANK));
// if user changed Display/Scale config, this needs to run
AdjustMinSize();
AdjustSize(false);
} }
if (!paused && (!pauseWhenInactive || wxGetApp().frame->HasFocus())) { if (!paused && (!pauseWhenInactive || wxGetApp().frame->HasFocus())) {

View File

@ -106,9 +106,7 @@
<border>5</border> <border>5</border>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxSpinCtrl" name="DefaultScale"> <object class="wxTextCtrl" name="DefaultScale">
<min>1</min>
<max>6</max>
</object> </object>
<option>1</option> <option>1</option>
<flag>wxALL|wxEXPAND</flag> <flag>wxALL|wxEXPAND</flag>