Cleaned up Timing Configuration dialog.

This commit is contained in:
rheiny 2007-02-11 16:26:23 +00:00
parent 1c539a66a4
commit c59c9d8626
3 changed files with 67 additions and 40 deletions

Binary file not shown.

View File

@ -12,12 +12,14 @@
#define EDIT_CHEATS 100 #define EDIT_CHEATS 100
#define MENU_CLOSE_FILE 101 #define MENU_CLOSE_FILE 101
#define IDI_ICON1 101 #define IDI_ICON1 101
#define CB_DISABLE_SPEED_THROTTLING 101
#define IDI_ICON2 102 #define IDI_ICON2 102
#define MENU_RECENT_FILES 102 #define MENU_RECENT_FILES 102
#define CB_LOAD_FILE_OPEN 102 #define CB_LOAD_FILE_OPEN 102
#define CB_AUTO_HIDE_MENU 104 #define CB_AUTO_HIDE_MENU 104
#define COMBO_PAD1 104 #define COMBO_PAD1 104
#define COMBO_PAD2 105 #define COMBO_PAD2 105
#define CB_SET_HIGH_PRIORITY 105
#define BTN_PORT1 106 #define BTN_PORT1 106
#define BTN_PORT2 107 #define BTN_PORT2 107
#define MENU_SAVE_STATE 110 #define MENU_SAVE_STATE 110

View File

@ -1,53 +1,78 @@
#include "common.h" #include "common.h"
#include "main.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. * Callback function of the Timing configuration dialog.
**/ **/
BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
int x; switch(uMsg)
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]; case WM_INITDIALOG:
sprintf(buf,"%d",x);
SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); // Update controls to the current settings.
SendDlgItemMessage(hwndDlg,111,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); if(eoptions & EO_HIGHPRIO)
{
CheckDlgButton(hwndDlg, CB_SET_HIGH_PRIORITY, BST_CHECKED);
} }
SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,maxconbskip,(LPARAM)(LPSTR)0);
SendDlgItemMessage(hwndDlg,111,CB_SETCURSEL,ffbskip,(LPARAM)(LPSTR)0); if(eoptions & EO_NOTHROTTLE)
{
CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED);
}
CenterWindowOnScreen(hwndDlg);
break; break;
case WM_CLOSE: case WM_CLOSE:
case WM_QUIT: goto gornk; case WM_QUIT:
CloseTimingDialog(hwndDlg);
break;
case WM_COMMAND: case WM_COMMAND:
if(!(wParam >> 16)) if(!(wParam >> 16))
{
switch(wParam & 0xFFFF) switch(wParam & 0xFFFF)
{ {
case 1: case 1:
gornk: CloseTimingDialog(hwndDlg);
if(IsDlgButtonChecked(hwndDlg,105)==BST_CHECKED)
eoptions|=EO_HIGHPRIO;
else
eoptions&=~EO_HIGHPRIO;
if(IsDlgButtonChecked(hwndDlg,101)==BST_CHECKED)
eoptions|=EO_NOTHROTTLE;
else
eoptions&=~EO_NOTHROTTLE;
maxconbskip=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
ffbskip=SendDlgItemMessage(hwndDlg,111,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
EndDialog(hwndDlg,0);
break; break;
} }
} }
}
return 0; return 0;
} }