From c59c9d86267fd5fa3799d8e73dd23e9589d9f119 Mon Sep 17 00:00:00 2001 From: rheiny Date: Sun, 11 Feb 2007 16:26:23 +0000 Subject: [PATCH] Cleaned up Timing Configuration dialog. --- src/drivers/win/res.rc | Bin 138262 -> 138368 bytes src/drivers/win/resource.h | 2 + src/drivers/win/timing.cpp | 105 +++++++++++++++++++++++-------------- 3 files changed, 67 insertions(+), 40 deletions(-) diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 0b95d93a19a4371a8e681239f44d47073529dffd..31596cc4aabb0e3a3d3508952c4b39398119582d 100644 GIT binary patch delta 127 zcmbQXgQH<5$A$w>rypoxWZQh?X%OS&1!ZZI)1GgdyrES>Hh{qu2wfQB8A2F57=jr5 zfpiFi4}&LzAA|d3$M@BfXS}FVcV=(`st5+E3<1&}Kv{Pn8P5;^)Zq!#10q8hA}2fE V_MiT4IU`4N-plQIFBw-D0RZp~D8K*! delta 59 zcmV-B0L1@*xd@iH2(ZBAl9>dv#^q80lQ3IOlYHm21u+0H05Ow~Q+t!(=z0M$m$AG7 RCzH^~EQ8SLx6tVUurfth9D@J= diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 2255f0f7..466b5fd6 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -12,12 +12,14 @@ #define EDIT_CHEATS 100 #define MENU_CLOSE_FILE 101 #define IDI_ICON1 101 +#define CB_DISABLE_SPEED_THROTTLING 101 #define IDI_ICON2 102 #define MENU_RECENT_FILES 102 #define CB_LOAD_FILE_OPEN 102 #define CB_AUTO_HIDE_MENU 104 #define COMBO_PAD1 104 #define COMBO_PAD2 105 +#define CB_SET_HIGH_PRIORITY 105 #define BTN_PORT1 106 #define BTN_PORT2 107 #define MENU_SAVE_STATE 110 diff --git a/src/drivers/win/timing.cpp b/src/drivers/win/timing.cpp index e874ac81..502a4dfd 100644 --- a/src/drivers/win/timing.cpp +++ b/src/drivers/win/timing.cpp @@ -1,54 +1,79 @@ #include "common.h" #include "main.h" +#include "gui.h" +#include "resource.h" + +/** +* This function is called when the dialog closes. +* +* @param hwndDlg Handle of the timing dialog. +**/ +void CloseTimingDialog(HWND hwndDlg) +{ + if(IsDlgButtonChecked(hwndDlg, CB_SET_HIGH_PRIORITY) == BST_CHECKED) + { + eoptions |= EO_HIGHPRIO; + } + else + { + eoptions &= ~EO_HIGHPRIO; + } + + if(IsDlgButtonChecked(hwndDlg, CB_DISABLE_SPEED_THROTTLING)==BST_CHECKED) + { + eoptions |= EO_NOTHROTTLE; + } + else + { + eoptions &= ~EO_NOTHROTTLE; + } + + EndDialog(hwndDlg, 0); +} /** * Callback function of the Timing configuration dialog. **/ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - int x; + switch(uMsg) + { + case WM_INITDIALOG: - switch(uMsg) { - case WM_INITDIALOG: - if(eoptions&EO_HIGHPRIO) - CheckDlgButton(hwndDlg,105,BST_CHECKED); - if(eoptions&EO_NOTHROTTLE) - CheckDlgButton(hwndDlg,101,BST_CHECKED); - for(x=0;x<10;x++) - { - char buf[8]; - sprintf(buf,"%d",x); - SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - SendDlgItemMessage(hwndDlg,111,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - } - SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,maxconbskip,(LPARAM)(LPSTR)0); - SendDlgItemMessage(hwndDlg,111,CB_SETCURSEL,ffbskip,(LPARAM)(LPSTR)0); - break; - case WM_CLOSE: - case WM_QUIT: goto gornk; - case WM_COMMAND: - if(!(wParam>>16)) - switch(wParam&0xFFFF) - { - case 1: - gornk: - if(IsDlgButtonChecked(hwndDlg,105)==BST_CHECKED) - eoptions|=EO_HIGHPRIO; - else - eoptions&=~EO_HIGHPRIO; + // Update controls to the current settings. + if(eoptions & EO_HIGHPRIO) + { + CheckDlgButton(hwndDlg, CB_SET_HIGH_PRIORITY, BST_CHECKED); + } - if(IsDlgButtonChecked(hwndDlg,101)==BST_CHECKED) - eoptions|=EO_NOTHROTTLE; - else - eoptions&=~EO_NOTHROTTLE; + if(eoptions & EO_NOTHROTTLE) + { + CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED); + } - maxconbskip=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - ffbskip=SendDlgItemMessage(hwndDlg,111,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EndDialog(hwndDlg,0); - break; - } - } - return 0; + CenterWindowOnScreen(hwndDlg); + + break; + + case WM_CLOSE: + case WM_QUIT: + CloseTimingDialog(hwndDlg); + break; + + case WM_COMMAND: + + if(!(wParam >> 16)) + { + switch(wParam & 0xFFFF) + { + case 1: + CloseTimingDialog(hwndDlg); + break; + } + } + } + + return 0; } void DoTimingConfigFix()