From 1edbb679f045126162f6cfdf39b3418e32974a65 Mon Sep 17 00:00:00 2001 From: SarahW Date: Mon, 11 Dec 2017 09:06:19 +0000 Subject: [PATCH] Emulate memory spinner granularity on systems that don't implement wxSpinCtrl->SetIncrement(). --- src/wx-config.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/wx-config.c b/src/wx-config.c index 942c02c..d917449 100644 --- a/src/wx-config.c +++ b/src/wx-config.c @@ -1085,6 +1085,38 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam) temp_joystick_type = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0); joystickconfig_open(hdlg, 3, temp_joystick_type); } +#ifndef __WXGTK__ + /*Emulate spinner granularity on systems that don't implement wxSpinCtrl->SetIncrement()*/ + else if (wParam == WX_ID("IDC_MEMSPIN")) + { + int mem; + int granularity; + int granularity_mask; + + h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO1")); + temp_model = listtomodel[wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0)]; + + granularity = models[temp_model].ram_granularity; + granularity_mask = granularity - 1; + + h = wx_getdlgitem(hdlg, WX_ID("IDC_MEMSPIN")); + mem = wx_sendmessage(h, WX_UDM_GETPOS, 0, 0); + if (mem & granularity_mask) + { + if ((mem & granularity_mask) < (granularity / 2)) + { + /*Assume increase*/ + mem = (mem + granularity_mask) & ~granularity_mask; + } + else + { + /*Assumg decrease*/ + mem &= ~granularity_mask; + } + mem = wx_sendmessage(h, WX_UDM_SETPOS, 0, mem); + } + } +#endif return 0; } }