static HMODULE hHtmlHelp;
pathtype path_type;
+static int stringboxdialogactive;
+static int customdialogactive;
+
static void darkmode_initdialog(HWND hDlg)
{
if (g_darkModeSupported)
return 0;
}
-static int stringboxdialogactive;
static INT_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (dialog_inhibit)
void gui_infotextbox(HWND hDlg, const TCHAR *text)
{
stringboxdialogactive = 1;
- HWND hwnd = CustomCreateDialog (IDD_DISKINFO, hDlg ? hDlg : hGUIWnd, StringBoxDialogProc);
+ HWND hwnd = CustomCreateDialog(IDD_DISKINFO, hDlg ? hDlg : hGUIWnd, StringBoxDialogProc);
if (hwnd == NULL)
return;
}
stringboxdialogactive = 1;
- HWND hwnd = CustomCreateDialog (IDD_DISKINFO, hDlg, StringBoxDialogProc);
+ HWND hwnd = CustomCreateDialog(IDD_DISKINFO, hDlg, StringBoxDialogProc);
if (hwnd == NULL)
return;
}
static struct ConfigStruct *InfoSettingsProcConfig;
-static INT_PTR CALLBACK InfoSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK InfoSettingsProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int recursive = 0;
switch (msg)
{
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_INITDIALOG:
{
recursive++;
DiskSelection(hDlg, IDC_PATH_NAME, 8, &workprefs, NULL, NULL);
break;
case IDOK:
- EndDialog(hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog(hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDC_CONFIGAUTO:
if (configtypepanel > 0) {
int ct = ischecked(hDlg, IDC_CONFIGAUTO) ? 1 : 0;
break;
case IDC_SETINFO:
InfoSettingsProcConfig = config;
- if (CustomCreateDialog(IDD_SETINFO, hDlg, InfoSettingsProc))
+ if (CustomCreateDialogBox(IDD_SETINFO, hDlg, InfoSettingsProc))
EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
break;
}
switch (msg) {
case WM_COMMAND:
if (wParam == IDOK) {
- EndDialog (hDlg, 1);
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
return TRUE;
} else if (wParam == IDC_ERRORLOGCLEAR) {
error_log (NULL);
- EndDialog (hDlg, 1);
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
return TRUE;
}
break;
}
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_COMMAND:
if (wParam == ID_OK) {
- EndDialog (hDlg, 1);
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
return TRUE;
}
break;
static void DisplayContributors (HWND hDlg)
{
- CustomCreateDialog(IDD_CONTRIBUTORS, hDlg, ContributorsProc);
+ CustomCreateDialogBox(IDD_CONTRIBUTORS, hDlg, ContributorsProc);
}
typedef struct url_info
}
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_INITDIALOG:
{
archivehd = -1;
volumeselectdir (hDlg, 0, 1);
break;
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
}
}
current_fsvdlg.ci.readonly = !ischecked (hDlg, IDC_FS_RW);
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_INITDIALOG:
recursive++;
inithdcontroller(hDlg, current_tapedlg.ci.controller_type, current_tapedlg.ci.controller_type_unit, UAEDEV_TAPE, current_tapedlg.ci.rootdir[0] != 0);
break;
}
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
}
current_tapedlg.ci.readonly = !ischecked (hDlg, IDC_TAPE_RW);
recursive--;
}
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_INITDIALOG:
recursive++;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->idFrom == IDC_CDLIST) {
NM_LISTVIEW *nmlistview = (NM_LISTVIEW *)lParam;
- if (nmlistview->hdr.code == NM_DBLCLK)
- EndDialog (hDlg, 1);
+ if (nmlistview->hdr.code == NM_DBLCLK) {
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
+ }
}
break;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDC_HDF_CONTROLLER:
posn = gui_get_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER);
if (posn != CB_ERR) {
}
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_DROPFILES:
dragdrop (hDlg, (HDROP)wParam, &changed_prefs, -2);
return FALSE;
DISK_history_add(current_hfdlg.ci.filesys, -1, HISTORY_FS, 1);
break;
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDC_HDF_PHYSGEOMETRY:
current_hfdlg.ci.physical_geometry = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
updatehdfinfo(hDlg, true, false, false);
}
switch (msg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
+ case WM_CLOSE:
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case WM_INITDIALOG:
{
int index;
if (HIWORD (wParam) == BN_CLICKED) {
switch (LOWORD (wParam)) {
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDC_HDF_PHYSGEOMETRY:
current_hfdlg.ci.physical_geometry = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
updatehdfinfo(hDlg, true, false, true);
if (uci->ci.type == UAEDEV_CD) {
memcpy (¤t_cddlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomCreateDialog(IDD_CDDRIVE, hDlg, CDDriveSettingsProc)) {
+ if (CustomCreateDialogBox(IDD_CDDRIVE, hDlg, CDDriveSettingsProc)) {
new_cddrive (hDlg, entry);
}
} else if (uci->ci.type == UAEDEV_TAPE) {
memcpy (¤t_tapedlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomCreateDialog(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc)) {
+ if (CustomCreateDialogBox(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc)) {
new_tapedrive (hDlg, entry);
}
}
{
current_hfdlg.forcedcylinders = uci->ci.highcyl;
memcpy (¤t_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomCreateDialog(IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
+ if (CustomCreateDialogBox(IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
new_hardfile (hDlg, entry);
}
}
else if (type == FILESYS_HARDDRIVE) /* harddisk */
{
memcpy (¤t_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
- if (CustomCreateDialog(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
+ if (CustomCreateDialogBox(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
new_harddrive (hDlg, entry);
}
}
{
memcpy (¤t_fsvdlg.ci, uci, sizeof (struct uaedev_config_info));
archivehd = -1;
- if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc)) {
+ if (CustomCreateDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc)) {
new_filesys (hDlg, entry);
}
}
case IDC_NEW_FS:
default_fsvdlg (¤t_fsvdlg);
archivehd = 0;
- if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc))
+ if (CustomCreateDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc))
new_filesys (hDlg, -1);
return 1;
case IDC_NEW_FSARCH:
archivehd = 1;
default_fsvdlg (¤t_fsvdlg);
- if (CustomCreateDialog(IDD_FILESYS, hDlg, VolumeSettingsProc))
+ if (CustomCreateDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc))
new_filesys (hDlg, -1);
return 1;
case IDC_NEW_HF:
default_hfdlg (¤t_hfdlg, false);
- if (CustomCreateDialog(IDD_HARDFILE, hDlg, HardfileSettingsProc))
+ if (CustomCreateDialogBox(IDD_HARDFILE, hDlg, HardfileSettingsProc))
new_hardfile (hDlg, -1);
return 1;
case IDC_NEW_CD:
- if (CustomCreateDialog(IDD_CDDRIVE, hDlg, CDDriveSettingsProc))
+ if (CustomCreateDialogBox(IDD_CDDRIVE, hDlg, CDDriveSettingsProc))
new_cddrive (hDlg, -1);
return 1;
case IDC_NEW_TAPE:
default_tapedlg (¤t_tapedlg);
- if (CustomCreateDialog(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc))
+ if (CustomCreateDialogBox(IDD_TAPEDRIVE, hDlg, TapeDriveSettingsProc))
new_tapedrive (hDlg, -1);
return 1;
WIN32GUI_LoadUIString (IDS_NOHARDDRIVES, tmp, sizeof (tmp) / sizeof (TCHAR));
gui_message (tmp);
} else {
- if (CustomCreateDialog(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
+ if (CustomCreateDialogBox(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
new_harddrive (hDlg, -1);
}
return 1;
if (inputmap_handle(NULL, -1, -1, NULL, NULL, -1, NULL, inputmap_selected,
remapcustoms[entry].flags, IDEV_MAPPED_AUTOFIRE_SET | IDEV_MAPPED_TOGGLE | IDEV_MAPPED_INVERTTOGGLE | IDEV_MAPPED_INVERT, NULL)) {
inputdevice_generate_jport_custom(&workprefs, inputmap_port);
- EndDialog(hDlg, 1);
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
}
}
}
break;
}
case IDOK:
- EndDialog(hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog(hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
}
recursive--;
break;
case IDC_INPUTMAP_EXIT:
pages[INPUTMAP_ID] = NULL;
DestroyWindow (hDlg);
- break;
+ return TRUE;
case IDC_INPUTMAP_TEST:
inputmap_port_remap = -1;
inputmap_remap_counter = -1;
break;
}
case IDOK:
- EndDialog (hDlg, 1);
- break;
+ customdialogactive = -1;
+ DestroyWindow(hDlg);
+ return TRUE;
case IDCANCEL:
- EndDialog (hDlg, 0);
- break;
+ customdialogactive = 0;
+ DestroyWindow(hDlg);
+ return TRUE;
}
recursive--;
break;
{
case IDC_ERRORLOG:
{
- CustomCreateDialog(IDD_ERRORLOG, hDlg, ErrorLogProc);
+ CustomCreateDialogBox(IDD_ERRORLOG, hDlg, ErrorLogProc);
ShowWindow (GetDlgItem (guiDlg, IDC_ERRORLOG), is_error_log () ? SW_SHOW : SW_HIDE);
}
break;
return h;
}
+int CustomCreateDialogBox(int templ, HWND hDlg, DLGPROC proc)
+{
+ customdialogactive = 1;
+ HWND hwnd = CustomCreateDialog(templ, hDlg, proc);
+ if (!hwnd) {
+ return 0;
+ }
+ while (customdialogactive == 1) {
+ MSG msg;
+ int ret;
+ WaitMessage();
+ while ((ret = GetMessage(&msg, NULL, 0, 0))) {
+ if (ret == -1)
+ break;
+ if (!IsWindow(hwnd) || !IsDialogMessage(hwnd, &msg)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ if (customdialogactive == -1)
+ break;
+ }
+ return 1;
+}
+
static int init_page (int tmpl, int icon, int title,
INT_PTR (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam), ACCEL *accels, const TCHAR *help, int focusid)
{