Closing Settings now equals to clicking Cancel

This commit is contained in:
David Hrdlička
2020-11-20 18:27:25 +01:00
parent 3c679960e1
commit 3506ad90e0

View File

@@ -520,7 +520,7 @@ win_settings_changed(void)
static int static int
settings_msgbox_reset(int button) settings_msgbox_reset()
{ {
int changed, i = 0; int changed, i = 0;
HWND h; HWND h;
@@ -531,10 +531,7 @@ settings_msgbox_reset(int button)
h = hwndMain; h = hwndMain;
hwndMain = hwndParentDialog; hwndMain = hwndParentDialog;
if (button) 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_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; hwndMain = h;
@@ -4974,12 +4971,12 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_confirm(HWND hdlg, int button) win_settings_confirm(HWND hdlg)
{ {
int i; int i;
SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0);
i = settings_msgbox_reset(button); i = settings_msgbox_reset();
if (i > 0) { if (i > 0) {
if (i == 2) if (i == 2)
win_settings_save(); win_settings_save();
@@ -4988,9 +4985,9 @@ win_settings_confirm(HWND hdlg, int button)
EndDialog(hdlg, 0); EndDialog(hdlg, 0);
win_notify_dlg_closed(); win_notify_dlg_closed();
return button ? TRUE : FALSE; return TRUE;
} else } else
return button ? FALSE : TRUE; return FALSE;
} }
@@ -5065,11 +5062,14 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_CLOSE: case WM_CLOSE:
return win_settings_confirm(hdlg, 0); DestroyWindow(hwndChildDialog);
EndDialog(hdlg, 0);
win_notify_dlg_closed();
return TRUE;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
case IDOK: case IDOK:
return win_settings_confirm(hdlg, 1); return win_settings_confirm(hdlg);
case IDCANCEL: case IDCANCEL:
DestroyWindow(hwndChildDialog); DestroyWindow(hwndChildDialog);
EndDialog(hdlg, 0); EndDialog(hdlg, 0);