Revert "Convert existing MessageBox calls to TaskDialog"

This reverts commit af6cead246.
This commit is contained in:
RichardG867
2020-03-24 19:13:58 -03:00
parent 0b5d648a49
commit 2b6258139e
2 changed files with 35 additions and 61 deletions

View File

@@ -43,36 +43,34 @@ int
ui_msgbox(int flags, void *arg) ui_msgbox(int flags, void *arg)
{ {
WCHAR temp[512]; WCHAR temp[512];
WCHAR *icon = NULL; DWORD fl = 0;
TASKDIALOG_COMMON_BUTTON_FLAGS buttons = TDCBF_OK_BUTTON;
WCHAR *str = NULL; WCHAR *str = NULL;
WCHAR *instr = NULL; WCHAR *cap = NULL;
int res = 0;
switch(flags & 0x1f) { switch(flags & 0x1f) {
case MBX_INFO: /* just an informational message */ case MBX_INFO: /* just an informational message */
icon = TD_INFORMATION_ICON; fl = (MB_OK | MB_ICONINFORMATION);
instr = plat_get_string(IDS_STRINGS); /* "86Box" */ cap = plat_get_string(IDS_STRINGS); /* "86Box" */
break; break;
case MBX_ERROR: /* error message */ case MBX_ERROR: /* error message */
if (flags & MBX_FATAL) { if (flags & MBX_FATAL) {
icon = TD_ERROR_ICON; fl = (MB_OK | MB_ICONERROR);
instr = plat_get_string(IDS_2050); /* "Fatal Error"*/ cap = plat_get_string(IDS_2050); /* "Fatal Error"*/
} else { } else {
icon = TD_WARNING_ICON; fl = (MB_OK | MB_ICONWARNING);
instr = plat_get_string(IDS_2049); /* "Error" */ cap = plat_get_string(IDS_2049); /* "Error" */
} }
break; break;
case MBX_QUESTION: /* question */ case MBX_QUESTION: /* question */
buttons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON; fl = (MB_YESNOCANCEL | MB_ICONQUESTION);
instr = plat_get_string(IDS_STRINGS); /* "86Box" */ cap = plat_get_string(IDS_STRINGS); /* "86Box" */
break; break;
case MBX_QUESTION_YN: /* question */ case MBX_QUESTION_YN: /* question */
buttons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON; fl = (MB_YESNO | MB_ICONQUESTION);
instr = plat_get_string(IDS_STRINGS); /* "86Box" */ cap = plat_get_string(IDS_STRINGS); /* "86Box" */
break; break;
} }
@@ -101,21 +99,17 @@ ui_msgbox(int flags, void *arg)
} }
/* At any rate, we do have a valid (wide) string now. */ /* At any rate, we do have a valid (wide) string now. */
TaskDialog(hwndMain, /* our main window */ fl = MessageBox(hwndMain, /* our main window */
NULL, /* no icon resource */ str, /* error message etc */
plat_get_string(IDS_STRINGS), /* window caption */ cap, /* window caption */
instr, /* main instruction */ fl);
str, /* error message */
buttons,
icon,
&res); /* pointer to result */
/* Convert return values to generic ones. */ /* Convert return values to generic ones. */
if (res == IDNO) res = 1; if (fl == IDNO) fl = 1;
else if (res == IDCANCEL) res = -1; else if (fl == IDCANCEL) fl = -1;
else res = 0; else fl = 0;
return(res); return(fl);
} }

View File

@@ -843,14 +843,10 @@ ui_init(int nCmdShow)
if (settings_only) { if (settings_only) {
if (! pc_init_modules()) { if (! pc_init_modules()) {
/* Dang, no ROMs found at all! */ /* Dang, no ROMs found at all! */
TaskDialog(hwnd, MessageBox(hwnd,
NULL,
plat_get_string(IDS_STRINGS),
plat_get_string(IDS_2050),
plat_get_string(IDS_2056), plat_get_string(IDS_2056),
TDCBF_OK_BUTTON, plat_get_string(IDS_2050),
TD_ERROR_ICON, MB_OK | MB_ICONERROR);
NULL);
return(6); return(6);
} }
@@ -937,14 +933,10 @@ ui_init(int nCmdShow)
ridev.dwFlags = RIDEV_NOHOTKEYS; ridev.dwFlags = RIDEV_NOHOTKEYS;
ridev.hwndTarget = NULL; /* current focus window */ ridev.hwndTarget = NULL; /* current focus window */
if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) { if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
TaskDialog(hwnd, MessageBox(hwndMain,
NULL,
plat_get_string(IDS_STRINGS),
plat_get_string(IDS_2050),
plat_get_string(IDS_2114), plat_get_string(IDS_2114),
TDCBF_OK_BUTTON, plat_get_string(IDS_2050),
TD_ERROR_ICON, MB_OK | MB_ICONERROR);
NULL);
return(4); return(4);
} }
keyboard_getkeymap(); keyboard_getkeymap();
@@ -955,14 +947,10 @@ ui_init(int nCmdShow)
/* Load the accelerator table */ /* Load the accelerator table */
haccel = LoadAccelerators(hinstance, ACCEL_NAME); haccel = LoadAccelerators(hinstance, ACCEL_NAME);
if (haccel == NULL) { if (haccel == NULL) {
TaskDialog(hwnd, MessageBox(hwndMain,
NULL,
plat_get_string(IDS_STRINGS),
plat_get_string(IDS_2050),
plat_get_string(IDS_2113), plat_get_string(IDS_2113),
TDCBF_OK_BUTTON, plat_get_string(IDS_2050),
TD_ERROR_ICON, MB_OK | MB_ICONERROR);
NULL);
return(3); return(3);
} }
@@ -992,27 +980,19 @@ ui_init(int nCmdShow)
/* All done, fire up the actual emulated machine. */ /* All done, fire up the actual emulated machine. */
if (! pc_init_modules()) { if (! pc_init_modules()) {
/* Dang, no ROMs found at all! */ /* Dang, no ROMs found at all! */
TaskDialog(hwnd, MessageBox(hwnd,
NULL,
plat_get_string(IDS_STRINGS),
plat_get_string(IDS_2050),
plat_get_string(IDS_2056), plat_get_string(IDS_2056),
TDCBF_OK_BUTTON, plat_get_string(IDS_2050),
TD_ERROR_ICON, MB_OK | MB_ICONERROR);
NULL);
return(6); return(6);
} }
/* Initialize the configured Video API. */ /* Initialize the configured Video API. */
if (! plat_setvid(vid_api)) { if (! plat_setvid(vid_api)) {
TaskDialog(hwnd, MessageBox(hwnd,
NULL,
plat_get_string(IDS_STRINGS),
plat_get_string(IDS_2050),
plat_get_string(IDS_2095), plat_get_string(IDS_2095),
TDCBF_OK_BUTTON, plat_get_string(IDS_2050),
TD_ERROR_ICON, MB_OK | MB_ICONERROR);
NULL);
return(5); return(5);
} }