From ca11d7b776e295e4d22469817ff5b76c14935cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 20 Nov 2020 15:39:33 +0100 Subject: [PATCH 1/4] Update the Settings save confirmation dialog --- src/include/86box/language.h | 5 ++++- src/include/86box/ui.h | 1 + src/win/86Box.rc | 3 +++ src/win/win_dialog.c | 5 +++-- src/win/win_settings.c | 5 ++++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 451811964..180b39b37 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -114,6 +114,9 @@ #define IDS_2138 2138 // "Don't Reset" #define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..." #define IDS_2140 2140 // "CD-ROM images (*.ISO;*.CU.." +#define IDS_2141 2141 // "Save" +#define IDS_2142 2142 // "Don't save" +#define IDS_2143 2143 // "This will hard reset the virtual..." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -221,7 +224,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 93 +#define STR_NUM_2048 96 #define STR_NUM_3072 11 #define STR_NUM_4096 39 #define STR_NUM_4352 6 diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index 1c4c5aee1..15950c6e6 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -34,6 +34,7 @@ extern "C" { #define MBX_ERROR 2 #define MBX_QUESTION 3 #define MBX_QUESTION_YN 4 +#define MBX_QUESTION_OK 8 #define MBX_QMARK 0x10 #define MBX_WARNING 0x20 #define MBX_FATAL 0x40 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index c0bb24bc8..007d12b07 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1038,6 +1038,9 @@ BEGIN IDS_2138 "Don't reset" IDS_2139 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0" IDS_2140 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" + IDS_2141 "Save" + IDS_2142 "Don't save" + IDS_2143 "This will hard reset the virtual machine." END STRINGTABLE DISCARDABLE diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 1e48b7d40..83f19b4f1 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -100,13 +100,14 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi case MBX_QUESTION: /* question */ case MBX_QUESTION_YN: + case MBX_QUESTION_OK: if (!btn1) /* replace default "OK" button with "Yes" button */ - tdconfig.dwCommonButtons = TDCBF_YES_BUTTON; + tdconfig.dwCommonButtons = (flags & MBX_QUESTION_OK) ? TDCBF_OK_BUTTON : TDCBF_YES_BUTTON; if (btn2) /* "No" button */ tdbuttons[tdconfig.cButtons++] = tdb_no; else - tdconfig.dwCommonButtons |= TDCBF_NO_BUTTON; + tdconfig.dwCommonButtons |= (flags & MBX_QUESTION_OK) ? TDCBF_CANCEL_BUTTON : TDCBF_NO_BUTTON; if (flags & MBX_QUESTION) { if (btn3) /* "Cancel" button */ diff --git a/src/win/win_settings.c b/src/win/win_settings.c index a200adfa0..f6e0f0c8c 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -531,7 +531,10 @@ settings_msgbox_reset(int button) h = hwndMain; hwndMain = hwndParentDialog; - i = ui_msgbox_ex(MBX_QUESTION | MBX_LINKS, (wchar_t *) (button ? IDS_2051 : IDS_2123), NULL, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, NULL); + if (button) + i = ui_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING, (wchar_t *) IDS_2051, (wchar_t *) IDS_2142, (wchar_t *) IDS_2140, NULL, NULL); + else + i = ui_msgbox_ex(MBX_QUESTION | MBX_LINKS, (wchar_t *) IDS_2123, NULL, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, NULL); hwndMain = h; From 3c679960e1a043d557e121846ac53573a04693cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 20 Nov 2020 17:10:50 +0100 Subject: [PATCH 2/4] Update the device configuration dialog --- src/include/86box/language.h | 3 ++- src/win/86Box.rc | 1 + src/win/win_devconf.c | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 180b39b37..9d8634bb4 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -117,6 +117,7 @@ #define IDS_2141 2141 // "Save" #define IDS_2142 2142 // "Don't save" #define IDS_2143 2143 // "This will hard reset the virtual..." +#define IDS_2144 2144 // "%hs Device Configuration" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -224,7 +225,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 96 +#define STR_NUM_2048 97 #define STR_NUM_3072 11 #define STR_NUM_4096 39 #define STR_NUM_4352 6 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 007d12b07..9e5982464 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1041,6 +1041,7 @@ BEGIN IDS_2141 "Save" IDS_2142 "Don't save" IDS_2143 "This will hard reset the virtual machine." + IDS_2144 "%hs Device Configuration" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index 18b567d79..1ae0eddc2 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -454,7 +454,8 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) *data++ = 0; /*no menu*/ *data++ = 0; /*predefined dialog box class*/ - data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 120); + + data += wsprintf(data, plat_get_string(IDS_2144), device->name) + 1; *data++ = 9; /*Point*/ data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 120); @@ -499,7 +500,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) item->cx = 140; item->cy = 150; - item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL; + item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; @@ -514,7 +515,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -561,7 +562,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -628,7 +629,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -659,8 +660,8 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) dlg->cdit = (id - IDC_CONFIG_BASE) + 2; item = (DLGITEMTEMPLATE *)data; - item->x = 20; - item->y = y; + item->x = 100; + item->y = y + 5; item->cx = 50; item->cy = 14; item->id = IDOK; /* OK button identifier */ @@ -677,8 +678,8 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) data++; item = (DLGITEMTEMPLATE *)data; - item->x = 80; - item->y = y; + item->x = 160; + item->y = y + 5; item->cx = 50; item->cy = 14; item->id = IDCANCEL; /* OK button identifier */ @@ -691,7 +692,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50); *data++ = 0; /* no creation data */ - dlg->cy = y + 20; + dlg->cy = y + 25; device_set_context(&config_device, device, inst); From 3506ad90e00a0b5168e0297b13ee6a25565da373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 20 Nov 2020 18:27:25 +0100 Subject: [PATCH 3/4] Closing Settings now equals to clicking Cancel --- src/win/win_settings.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/win/win_settings.c b/src/win/win_settings.c index f6e0f0c8c..05ee5cec5 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -520,7 +520,7 @@ win_settings_changed(void) static int -settings_msgbox_reset(int button) +settings_msgbox_reset() { int changed, i = 0; HWND h; @@ -531,10 +531,7 @@ settings_msgbox_reset(int button) h = hwndMain; hwndMain = hwndParentDialog; - if (button) - i = ui_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING, (wchar_t *) IDS_2051, (wchar_t *) IDS_2142, (wchar_t *) IDS_2140, NULL, NULL); - else - i = ui_msgbox_ex(MBX_QUESTION | MBX_LINKS, (wchar_t *) IDS_2123, NULL, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, NULL); + i = ui_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING, (wchar_t *) IDS_2051, (wchar_t *) IDS_2143, (wchar_t *) IDS_2141, NULL, NULL); hwndMain = h; @@ -4974,12 +4971,12 @@ static LRESULT CALLBACK #else static BOOL CALLBACK #endif -win_settings_confirm(HWND hdlg, int button) +win_settings_confirm(HWND hdlg) { int i; SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); - i = settings_msgbox_reset(button); + i = settings_msgbox_reset(); if (i > 0) { if (i == 2) win_settings_save(); @@ -4988,9 +4985,9 @@ win_settings_confirm(HWND hdlg, int button) EndDialog(hdlg, 0); win_notify_dlg_closed(); - return button ? TRUE : FALSE; + return TRUE; } else - return button ? FALSE : TRUE; + return FALSE; } @@ -5065,11 +5062,14 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) } break; case WM_CLOSE: - return win_settings_confirm(hdlg, 0); + DestroyWindow(hwndChildDialog); + EndDialog(hdlg, 0); + win_notify_dlg_closed(); + return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - return win_settings_confirm(hdlg, 1); + return win_settings_confirm(hdlg); case IDCANCEL: DestroyWindow(hwndChildDialog); EndDialog(hdlg, 0); From 8aab3da7693814dca8a5625f2e754fa2ae7f7e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 20 Nov 2020 18:42:22 +0100 Subject: [PATCH 4/4] Clean up resource IDs --- src/include/86box/language.h | 27 ++++++++++++--------------- src/win/86Box.rc | 13 +++++-------- src/win/win_devconf.c | 2 +- src/win/win_settings.c | 2 +- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 9d8634bb4..5ae5bb169 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -24,7 +24,7 @@ #define IDS_STRINGS 2048 // "86Box" #define IDS_2049 2049 // "Error" #define IDS_2050 2050 // "Fatal error" -#define IDS_2051 2051 // "Are you sure you want to save..." +#define IDS_2051 2051 // "" #define IDS_2052 2052 // "Press CTRL+ALT+PAGE DOWN..." #define IDS_2053 2053 // "Speed" #define IDS_2054 2054 // "ZIP %i (%03i): %ls" @@ -94,9 +94,9 @@ #define IDS_2118 2118 // "Internal controller" #define IDS_2119 2119 // "Exit" #define IDS_2120 2120 // "No ROMs found" -#define IDS_2121 2121 // "Save changes\nThis will hard..." -#define IDS_2122 2122 // "Discard changes\nAll changes..." -#define IDS_2123 2123 // "Do you want to save the settings?" +#define IDS_2121 2121 // "Do you want to save the settings?" +#define IDS_2122 2122 // "This will hard reset the virtual..." +#define IDS_2123 2123 // "Save" #define IDS_2124 2124 // "About 86Box" #define IDS_2125 2125 // "86Box v" EMU_VERSION #define IDS_2126 2126 // "An emulator of old computers..." @@ -109,15 +109,12 @@ #define IDS_2133 2133 // LIB_NAME_FLUIDSYNTH " is required..." #define IDS_2134 2134 // "Entering fullscreen mode" #define IDS_2135 2135 // "Don't show this message again" -#define IDS_2136 2136 // "Don't Exit" +#define IDS_2136 2136 // "Don't exit" #define IDS_2137 2137 // "Reset" -#define IDS_2138 2138 // "Don't Reset" +#define IDS_2138 2138 // "Don't reset" #define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..." #define IDS_2140 2140 // "CD-ROM images (*.ISO;*.CU.." -#define IDS_2141 2141 // "Save" -#define IDS_2142 2142 // "Don't save" -#define IDS_2143 2143 // "This will hard reset the virtual..." -#define IDS_2144 2144 // "%hs Device Configuration" +#define IDS_2141 2141 // "%hs Device Configuration" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -144,7 +141,7 @@ #define IDS_4118 4118 // "The selected file will be..." #define IDS_4119 4119 // "Unsupported disk image" #define IDS_4120 4120 // "Overwrite" -#define IDS_4121 4121 // "Don't Overwrite" +#define IDS_4121 4121 // "Don't overwrite" #define IDS_4122 4122 // "Raw image (.img)" #define IDS_4123 4123 // "HDI image (.hdi)" #define IDS_4124 4124 // "HDX image (.hdx)" @@ -153,10 +150,10 @@ #define IDS_4127 4127 // "Differencing VHD (.vhd)" #define IDS_4128 4128 // "Large blocks (2 MB)" #define IDS_4129 4129 // "Small blocks (512 KB)" -#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All files (*.*)\0*.*\0" +#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All..." #define IDS_4131 4131 // "Select the parent VHD" -#define IDS_4132 4132 // "WARNING: VHD PARENT/CHILD TIMESTAMPS DO NOT MATCH..." -#define IDS_4133 4133 // "VHD Timestamp Mismatch" +#define IDS_4132 4132 // "This could mean that the parent..." +#define IDS_4133 4133 // "Parent and child disk timestamps..." #define IDS_4134 4134 // "Could not fix VHD timestamp." #define IDS_4352 4352 // "MFM/RLL" @@ -225,7 +222,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 97 +#define STR_NUM_2048 94 #define STR_NUM_3072 11 #define STR_NUM_4096 39 #define STR_NUM_4352 6 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 9e5982464..237e7f783 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -920,7 +920,7 @@ BEGIN 2048 "86Box" IDS_2049 "Error" IDS_2050 "Fatal error" - IDS_2051 "Are you sure you want to save the settings?" + IDS_2051 "" IDS_2052 "Press CTRL+ALT+PAGE DOWN to return to windowed mode." IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" @@ -998,9 +998,9 @@ BEGIN IDS_2118 "Internal controller" IDS_2119 "Exit" IDS_2120 "No ROMs found" - IDS_2121 "Save changes\nThis will hard reset the emulated machine." - IDS_2122 "Discard changes\nAll changes made to the settings will be lost." - IDS_2123 "Do you want to save the settings?" + IDS_2121 "Do you want to save the settings?" + IDS_2122 "This will hard reset the virtual machine." + IDS_2123 "Save" IDS_2124 "About 86Box" IDS_2125 "86Box v" EMU_VERSION IDS_2126 "An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information." @@ -1038,10 +1038,7 @@ BEGIN IDS_2138 "Don't reset" IDS_2139 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0" IDS_2140 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" - IDS_2141 "Save" - IDS_2142 "Don't save" - IDS_2143 "This will hard reset the virtual machine." - IDS_2144 "%hs Device Configuration" + IDS_2141 "%hs Device Configuration" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index 1ae0eddc2..d0469660c 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -455,7 +455,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst) *data++ = 0; /*no menu*/ *data++ = 0; /*predefined dialog box class*/ - data += wsprintf(data, plat_get_string(IDS_2144), device->name) + 1; + data += wsprintf(data, plat_get_string(IDS_2141), device->name) + 1; *data++ = 9; /*Point*/ data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 120); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 05ee5cec5..bd06279ae 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -531,7 +531,7 @@ settings_msgbox_reset() h = hwndMain; hwndMain = hwndParentDialog; - i = ui_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING, (wchar_t *) IDS_2051, (wchar_t *) IDS_2143, (wchar_t *) IDS_2141, NULL, NULL); + i = ui_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, (wchar_t *) IDS_2123, NULL, NULL); hwndMain = h;