Improve settings messageboxes

This commit is contained in:
RichardG867
2020-06-19 00:16:05 -03:00
parent 3539c4f465
commit 9733beb542
4 changed files with 44 additions and 40 deletions

View File

@@ -118,16 +118,22 @@
#define IDS_4101 4101 // "Custom (large)..."
#define IDS_4102 4102 // "Add New Hard Disk"
#define IDS_4103 4103 // "Add Existing Hard Disk"
#define IDS_4104 4104 // "Attempting to create a HDI ima.."
#define IDS_4105 4105 // "Attempting to create a spurio.."
#define IDS_4104 4104 // "HDI disk images cannot be..."
#define IDS_4105 4105 // "Disk images cannot be larger..."
#define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.."
#define IDS_4107 4107 // "Unable to open the file for read"
#define IDS_4108 4108 // "Unable to open the file for write"
#define IDS_4109 4109 // "HDI or HDX image with a sect.."
#define IDS_4110 4110 // "USB is not yet supported"
#define IDS_4111 4111 // "This image exists and will be.."
#define IDS_4112 4112 // "Please enter a valid file name"
#define IDS_4111 4111 // "Disk image file already exists"
#define IDS_4112 4112 // "Please specify a valid file name."
#define IDS_4113 4113 // "Remember to partition and fo.."
#define IDS_4114 4114 // "Make sure the file exists and..."
#define IDS_4115 4115 // "Make sure the file is being..."
#define IDS_4116 4116 // "Disk image too large"
#define IDS_4117 4117 // "Remember to partition and format..."
#define IDS_4118 4118 // "The selected file will be..."
#define IDS_4119 4119 // "Unsupported disk image"
#define IDS_4352 4352 // "MFM/RLL"
#define IDS_4353 4353 // "XT IDE"

View File

@@ -1005,16 +1005,22 @@ BEGIN
IDS_4101 "Custom (large)..."
IDS_4102 "Add New Hard Disk"
IDS_4103 "Add Existing Hard Disk"
IDS_4104 "Attempting to create a HDI image larger than 4 GB"
IDS_4105 "Attempting to create a hard disk image beyond the 28-bit LBA limit"
IDS_4104 "HDI disk images cannot be larger than 4 GB."
IDS_4105 "Disk images cannot be larger than 127 GB."
IDS_4106 "Hard disk images (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0All files (*.*)\0*.*\0"
IDS_4107 "Unable to open the file for read"
IDS_4108 "Unable to open the file for write"
IDS_4109 "HDI or HDX images with a sector size that is not 512 are not supported"
IDS_4107 "Unable to read file"
IDS_4108 "Unable to write file"
IDS_4109 "HDI or HDX images with a sector size other than 512 are not supported."
IDS_4110 "USB is not yet supported"
IDS_4111 "This image exists and will be overwritten.\nAre you sure you want to use it?"
IDS_4112 "Please enter a valid file name"
IDS_4113 "The image has been successfully created."
IDS_4111 "Disk image file already exists"
IDS_4112 "Please specify a valid file name."
IDS_4113 "Disk image created"
IDS_4114 "Make sure the file exists and is readable."
IDS_4115 "Make sure the file is being saved to a writable directory."
IDS_4116 "Disk image too large"
IDS_4117 "Remember to partition and format the newly-created drive."
IDS_4118 "The selected file will be overwritten. Are you sure you want to use it?"
IDS_4119 "Unsupported disk image"
IDS_4352 "MFM/RLL"
IDS_4353 "XTA"

View File

@@ -429,7 +429,7 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
plat_pause(1);
ret = d86f_export(id, wopenfilestring);
if (!ret)
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4108);
ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4108, (wchar_t *) IDS_4115);
plat_pause(0);
}
break;

View File

@@ -178,7 +178,7 @@ image_list_init(HWND hwndList, const uint8_t *icon_ids)
/* Show a MessageBox dialog. This is nasty, I know. --FvK */
static int
settings_msgbox(int type, void *arg)
settings_msgbox_header(int flags, void *header, void *message)
{
HWND h;
int i;
@@ -186,7 +186,7 @@ settings_msgbox(int type, void *arg)
h = hwndMain;
hwndMain = hwndParentDialog;
i = ui_msgbox(type, arg);
i = ui_msgbox_header(flags, header, message);
hwndMain = h;
@@ -396,31 +396,23 @@ static int
settings_msgbox_reset(void)
{
int changed, i = 0;
TASKDIALOGCONFIG tdconfig = {0};
TASKDIALOG_BUTTON tdbuttons[] = {
{IDYES, MAKEINTRESOURCE(IDS_2121)},
{IDNO, MAKEINTRESOURCE(IDS_2122)},
{IDCANCEL, MAKEINTRESOURCE(IDS_2123)}
};
HWND h;
changed = win_settings_changed();
if (changed) {
tdconfig.cbSize = sizeof(tdconfig);
tdconfig.hwndParent = hwndParentDialog;
tdconfig.dwFlags = TDF_USE_COMMAND_LINKS;
tdconfig.dwCommonButtons = 0;
tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS);
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2051);
tdconfig.cButtons = ARRAYSIZE(tdbuttons);
tdconfig.pButtons = tdbuttons;
TaskDialogIndirect(&tdconfig, &i, NULL, NULL);
h = hwndMain;
hwndMain = hwndParentDialog;
if (i == IDNO) return(1); /* no */
i = ui_msgbox_ex(MBX_QUESTION | MBX_LINKS, (wchar_t *) IDS_2051, NULL, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, (wchar_t *) IDS_2123);
if (i == IDYES) return(2); /* yes */
hwndMain = h;
return(0); /* cancel */
if (i == 1) return(1); /* no */
if (i == -1) return(0); /* cancel */
return(2); /* yes */
} else
return(1);
}
@@ -2876,7 +2868,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
/* Make sure no file name is allowed with removable SCSI hard disks. */
if (wcslen(hd_file_name) == 0) {
hdd_ptr->bus = HDD_BUS_DISABLED;
settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4112);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2130, (wchar_t *) IDS_4112);
return TRUE;
}
@@ -2920,14 +2912,14 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
if (size > 0x1FFFFFFE00ll) {
fclose(f);
settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4105);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4105);
return TRUE;
}
if (image_is_hdi(hd_file_name)) {
if (size >= 0x100000000ll) {
fclose(f);
settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4104);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4104);
return TRUE;
}
@@ -3022,7 +3014,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
free(big_buf);
fclose(f);
settings_msgbox(MBX_INFO, (wchar_t *)IDS_4113);
settings_msgbox_header(MBX_INFO, (wchar_t *) IDS_4113, (wchar_t *) IDS_4117);
}
hard_disk_added = 1;
@@ -3051,7 +3043,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
f = _wfopen(wopenfilestring, L"rb");
if (f != NULL) {
fclose(f);
if (settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_4111) != 0) /* yes */
if (settings_msgbox_header(MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118) != 0) /* yes */
return FALSE;
}
}
@@ -3060,7 +3052,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
if (f == NULL) {
hdd_add_file_open_error:
fclose(f);
settings_msgbox(MBX_ERROR, (existing & 1) ? (wchar_t *)IDS_4107 : (wchar_t *)IDS_4108);
settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108);
return TRUE;
}
if (existing & 1) {
@@ -3068,7 +3060,7 @@ hdd_add_file_open_error:
fseeko64(f, 0x10, SEEK_SET);
fread(&sector_size, 1, 4, f);
if (sector_size != 512) {
settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4109);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4119, (wchar_t *) IDS_4109);
fclose(f);
return TRUE;
}