- add "restart" button to error pane in Windows

- add keyboard accelerator shortcuts to many Windows-specific dialogs
This commit is contained in:
Rachael Alexanderson 2020-06-14 14:27:53 -04:00
parent 97d515005b
commit b441d8c399
2 changed files with 34 additions and 16 deletions

View file

@ -41,6 +41,9 @@
#include <commctrl.h>
#include <richedit.h>
#include <processenv.h>
#include <shellapi.h>
#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif
@ -189,14 +192,21 @@ static void UnWTS (void)
static int LayoutErrorPane (HWND pane, int w)
{
HWND ctl;
RECT rectc;
HWND ctl, ctl_two;
RECT rectc, rectc_two;
// Right-align the Quit button.
ctl = GetDlgItem (pane, IDOK);
GetClientRect (ctl, &rectc); // Find out how big it is.
MoveWindow (ctl, w - rectc.right - 1, 1, rectc.right, rectc.bottom, TRUE);
// Second-right-align the Restart button
ctl_two = GetDlgItem (pane, IDC_BUTTON1);
GetClientRect (ctl_two, &rectc_two); // Find out how big it is.
MoveWindow (ctl_two, w - rectc.right - rectc_two.right - 2, 1, rectc.right, rectc.bottom, TRUE);
InvalidateRect (ctl, NULL, TRUE);
InvalidateRect (ctl_two, NULL, TRUE);
// Return the needed height for this layout
return rectc.bottom + 2;
@ -545,9 +555,16 @@ INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
return TRUE;
case WM_COMMAND:
// There is only one button, and it's "Ok" and makes us quit.
if (HIWORD(wParam) == BN_CLICKED)
{
if (LOWORD(wParam) == IDC_BUTTON1) // we pressed the restart button, so run GZDoom again
{
HMODULE hModule = GetModuleHandleW(NULL);
WCHAR path[MAX_PATH];
GetModuleFileNameW(hModule, path, MAX_PATH);
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
}
PostQuitMessage (0);
return TRUE;
}

View file

@ -215,17 +215,17 @@ BEGIN
LTEXT "Select which game file (IWAD) to run.",IDC_STATIC,12,44,190,8
LISTBOX IDC_IWADLIST,12,56,200,87,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Video settings",IDC_STATIC,8,155,109,52
CONTROL "Fullscreen",IDC_WELCOME_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,167,48,10
CONTROL "&Fullscreen",IDC_WELCOME_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,167,48,10
GROUPBOX "Resource settings",IDC_STATIC,123,155,95,52
CONTROL "Disable autoload",IDC_WELCOME_NOAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,170,65,10
CONTROL "Load lights",IDC_WELCOME_LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,180,51,10
CONTROL "Load brightmaps",IDC_WELCOME_BRIGHTMAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,190,65,10
CONTROL "Don't ask me this again",IDC_DONTASKIWAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,211,87,10
DEFPUSHBUTTON "Play GZDoom",IDOK,8,228,90,14
PUSHBUTTON "Exit",IDCANCEL,166,228,50,14
CONTROL "OpenGL",IDC_WELCOME_VULKAN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,167,41,10
CONTROL "Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON,13,177,37,10
CONTROL "SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10
CONTROL "Disable &autoload",IDC_WELCOME_NOAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,170,65,10
CONTROL "Load &lights",IDC_WELCOME_LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,180,51,10
CONTROL "Load &brightmaps",IDC_WELCOME_BRIGHTMAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,190,65,10
CONTROL "&Don't ask me this again",IDC_DONTASKIWAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,211,87,10
DEFPUSHBUTTON "&Play GZDoom",IDOK,8,228,90,14
PUSHBUTTON "E&xit",IDCANCEL,166,228,50,14
CONTROL "&OpenGL",IDC_WELCOME_VULKAN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,167,41,10
CONTROL "&Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON,13,177,37,10
CONTROL "&SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10
END
@ -236,7 +236,7 @@ CAPTION "GZDoom Very Fatal Error"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
CONTROL "",IDC_CRASHTAB,"SysTabControl32",WS_TABSTOP,4,4,404,280
PUSHBUTTON "Save Report to Disk...",IDC_SAVEREPORT,242,289,91,14
PUSHBUTTON "&Save Report to Disk...",IDC_SAVEREPORT,242,289,91,14
PUSHBUTTON "&Discard Report",IDNO,338,289,70,14
END
@ -270,14 +270,15 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CL
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Quit",IDOK,133,7,50,14
DEFPUSHBUTTON "E&xit",IDOK,133,7,50,14
PUSHBUTTON "&Restart",IDC_BUTTON1,79,7,50,14
END
IDD_NETSTARTPANE DIALOGEX 0, 0, 189, 55
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Abort Network Game",IDCANCEL,45,34,89,14
PUSHBUTTON "&Abort Network Game",IDCANCEL,45,34,89,14
CONTROL "",IDC_NETSTARTMESSAGE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,7,7,116,8
CONTROL "",IDC_NETSTARTCOUNT,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,153,7,29,8,WS_EX_RIGHT
CONTROL "",IDC_NETSTARTPROGRESS,"msctls_progress32",WS_BORDER,7,18,175,10