diff --git a/src/lang/language.h b/src/lang/language.h index 8f8bee8ce..bbbffdb2c 100644 --- a/src/lang/language.h +++ b/src/lang/language.h @@ -24,7 +24,7 @@ #define IDS_STRINGS 2048 // "86Box" #define IDS_2049 2049 // "86Box Error" #define IDS_2050 2050 // "86Box Fatal Error" -#define IDS_2051 2051 // "This will reset 86Box.." +#define IDS_2051 2051 // "This will hard reset the.." #define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.." #define IDS_2053 2053 // "Speed" #define IDS_2054 2054 // "ZIP %i (%03i): %ls" @@ -92,9 +92,10 @@ #define IDS_2116 2116 // "%u MB (CHS: %i, %i, %i)" #define IDS_2117 2117 // "Floppy %i (%s): %ls" #define IDS_2118 2118 // "All floppy images (*.0??;*.." -#define IDS_2119 2119 // "You must save the settings.." -#define IDS_2120 2120 // "Unable to initialize Free.." -#define IDS_2121 2121 // "Unable to initialize SDL..." +#define IDS_2119 2119 // "Unable to initialize Free.." +#define IDS_2120 2120 // "Unable to initialize SDL..." +#define IDS_2121 2121 // "Are you sure you want to..." +#define IDS_2122 2122 // "Are you sure you want to..." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -173,7 +174,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 74 +#define STR_NUM_2048 75 #define STR_NUM_3072 11 #define STR_NUM_4096 18 #define STR_NUM_4352 7 diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index febad8307..5d6b3fa31 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2033,7 +2033,7 @@ escp_init(void *lpt) if (ft_handle == NULL) { ft_handle = dynld_module(fn, ft_imports); if (ft_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2120); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2119); return(NULL); } } @@ -2041,7 +2041,7 @@ escp_init(void *lpt) /* Initialize FreeType. */ if (ft_lib == NULL) { if (ft_Init_FreeType(&ft_lib)) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2120); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2119); dynld_close(ft_lib); ft_lib = NULL; return(NULL); diff --git a/src/ui.h b/src/ui.h index efe64800f..4c66d218b 100644 --- a/src/ui.h +++ b/src/ui.h @@ -8,13 +8,13 @@ * * Define the various UI functions. * - * Version: @(#)ui.h 1.0.15 2018/10/19 + * Version: @(#)ui.h 1.0.16 2019/09/22 * * Authors: Miran Grca, * Fred N. van Kempen, * - * Copyright 2016-2018 Miran Grca. - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2016-2019 Miran Grca. + * Copyright 2017-2019 Fred N. van Kempen. */ #ifndef EMU_UI_H # define EMU_UI_H @@ -33,6 +33,7 @@ extern "C" { #define MBX_INFO 1 #define MBX_ERROR 2 #define MBX_QUESTION 3 +#define MBX_QUESTION_YN 4 #define MBX_FATAL 0x20 #define MBX_ANSI 0x80 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index f595ec879..291da17c0 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -815,7 +815,7 @@ BEGIN 2048 "86Box" IDS_2049 "86Box Error" IDS_2050 "86Box Fatal Error" - IDS_2051 "This will reset 86Box.\nAre you sure you want to save the settings?" + IDS_2051 "This will hard reset the emulated machine.\nAre you sure you want to save the settings?" IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" @@ -891,9 +891,10 @@ BEGIN IDS_2116 "%u MB (CHS: %i, %i, %i)" IDS_2117 "Floppy %i (%s): %ls" IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F;*.MFM)\0*.86F;*.MFM\0All files (*.*)\0*.*\0" - IDS_2119 "You must save the settings first before attempting to configure the memory boards" - IDS_2120 "Unable to initialize FreeType, freetype.dll is required" - IDS_2121 "Unable to initialize SDL, SDL2.dll is required" + IDS_2119 "Unable to initialize FreeType, freetype.dll is required" + IDS_2120 "Unable to initialize SDL, SDL2.dll is required" + IDS_2121 "Are you sure you want to hard reset the emulated machine?" + IDS_2122 "Are you sure you want to quit 86Box?" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index b5c0167b4..729be881e 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -8,13 +8,13 @@ * * Several dialogs for the application. * - * Version: @(#)win_dialog.c 1.0.10 2018/04/29 + * Version: @(#)win_dialog.c 1.0.11 2019/09/22 * * Author: Miran Grca, * Fred N. van Kempen, * - * Copyright 2016-2018 Miran Grca. - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2016-2019 Miran Grca. + * Copyright 2017-2019 Fred N. van Kempen. */ #define UNICODE #include @@ -67,6 +67,11 @@ ui_msgbox(int flags, void *arg) fl = (MB_YESNOCANCEL | MB_ICONQUESTION); cap = plat_get_string(IDS_STRINGS); /* "86Box" */ break; + + case MBX_QUESTION_YN: /* question */ + fl = (MB_YESNO | MB_ICONQUESTION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + break; } /* If ANSI string, convert it. */ diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index e0ebf7382..22a67731c 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -379,7 +379,7 @@ sdl_init_common(int fs) /* Try loading the DLL. */ sdl_handle = dynld_module(PATH_SDL_DLL, sdl_imports); if (sdl_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2121); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2120); return(0); } diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 910865b7c..99c579903 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -275,7 +275,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HMENU hmenu; - int sb_borders[3]; + int i, sb_borders[3]; RECT rect; int temp_x, temp_y; @@ -297,7 +297,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_ACTION_HRESET: - pc_reset(1); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2121); + if (i == 0) + pc_reset(1); break; case IDM_ACTION_RESET_CAD: @@ -305,7 +307,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_ACTION_EXIT: - PostQuitMessage(0); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); + if (i == 0) { + UnhookWindowsHookEx(hKeyboardHook); + KillTimer(hwnd, TIMER_1SEC); + PostQuitMessage(0); + } break; case IDM_ACTION_CTRL_ALT_ESC: @@ -661,6 +668,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SYSKEYUP: return(0); + case WM_CLOSE: + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); + if (i == 0) { + UnhookWindowsHookEx(hKeyboardHook); + KillTimer(hwnd, TIMER_1SEC); + PostQuitMessage(0); + } + break; + case WM_DESTROY: UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -681,6 +697,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_SHUTDOWN: + UnhookWindowsHookEx(hKeyboardHook); + KillTimer(hwnd, TIMER_1SEC); PostQuitMessage(0); break;