mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- -norun works without -stdout now.
SVN r1487 (trunk)
This commit is contained in:
parent
c2aab5dd46
commit
cfbf55acab
1 changed files with 53 additions and 54 deletions
|
@ -697,69 +697,78 @@ void ShowErrorPane(const char *text)
|
||||||
{
|
{
|
||||||
if (Window == NULL || ConWindow == NULL)
|
if (Window == NULL || ConWindow == NULL)
|
||||||
{
|
{
|
||||||
MessageBox (Window, text,
|
if (text != NULL)
|
||||||
GAMESIG " Fatal Error", MB_OK|MB_ICONSTOP|MB_TASKMODAL);
|
{
|
||||||
|
MessageBox (Window, text,
|
||||||
|
GAMESIG " Fatal Error", MB_OK|MB_ICONSTOP|MB_TASKMODAL);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowText (Window, "Fatal Error - " WINDOW_TITLE);
|
|
||||||
if (StartScreen != NULL) // Ensure that the network pane is hidden.
|
if (StartScreen != NULL) // Ensure that the network pane is hidden.
|
||||||
{
|
{
|
||||||
StartScreen->NetDone();
|
StartScreen->NetDone();
|
||||||
}
|
}
|
||||||
ErrorIcon = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, Window, NULL, g_hInst, NULL);
|
if (text != NULL)
|
||||||
if (ErrorIcon != NULL)
|
|
||||||
{
|
{
|
||||||
SetWindowLong (ErrorIcon, GWL_ID, IDC_ICONPIC);
|
SetWindowText (Window, "Fatal Error - " WINDOW_TITLE);
|
||||||
|
ErrorIcon = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, Window, NULL, g_hInst, NULL);
|
||||||
|
if (ErrorIcon != NULL)
|
||||||
|
{
|
||||||
|
SetWindowLong (ErrorIcon, GWL_ID, IDC_ICONPIC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ErrorPane = CreateDialogParam (g_hInst, MAKEINTRESOURCE(IDD_ERRORPANE), Window, ErrorPaneProc, (LONG_PTR)NULL);
|
ErrorPane = CreateDialogParam (g_hInst, MAKEINTRESOURCE(IDD_ERRORPANE), Window, ErrorPaneProc, (LONG_PTR)NULL);
|
||||||
|
|
||||||
CHARRANGE end;
|
if (text != NULL)
|
||||||
CHARFORMAT2 oldformat, newformat;
|
{
|
||||||
PARAFORMAT2 paraformat;
|
CHARRANGE end;
|
||||||
|
CHARFORMAT2 oldformat, newformat;
|
||||||
|
PARAFORMAT2 paraformat;
|
||||||
|
|
||||||
// Append the error message to the log.
|
// Append the error message to the log.
|
||||||
end.cpMax = end.cpMin = GetWindowTextLength (ConWindow);
|
end.cpMax = end.cpMin = GetWindowTextLength (ConWindow);
|
||||||
SendMessage (ConWindow, EM_EXSETSEL, 0, (LPARAM)&end);
|
SendMessage (ConWindow, EM_EXSETSEL, 0, (LPARAM)&end);
|
||||||
|
|
||||||
// Remember current charformat.
|
// Remember current charformat.
|
||||||
oldformat.cbSize = sizeof(oldformat);
|
oldformat.cbSize = sizeof(oldformat);
|
||||||
SendMessage (ConWindow, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&oldformat);
|
SendMessage (ConWindow, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&oldformat);
|
||||||
|
|
||||||
// Use bigger font and standout colors.
|
// Use bigger font and standout colors.
|
||||||
newformat.cbSize = sizeof(newformat);
|
newformat.cbSize = sizeof(newformat);
|
||||||
newformat.dwMask = CFM_BOLD | CFM_COLOR | CFM_SIZE;
|
newformat.dwMask = CFM_BOLD | CFM_COLOR | CFM_SIZE;
|
||||||
newformat.dwEffects = CFE_BOLD;
|
newformat.dwEffects = CFE_BOLD;
|
||||||
newformat.yHeight = oldformat.yHeight * 5 / 4;
|
newformat.yHeight = oldformat.yHeight * 5 / 4;
|
||||||
newformat.crTextColor = RGB(255,170,170);
|
newformat.crTextColor = RGB(255,170,170);
|
||||||
SendMessage (ConWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&newformat);
|
SendMessage (ConWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&newformat);
|
||||||
|
|
||||||
// Indent the rest of the text to make the error message stand out a little more.
|
// Indent the rest of the text to make the error message stand out a little more.
|
||||||
paraformat.cbSize = sizeof(paraformat);
|
paraformat.cbSize = sizeof(paraformat);
|
||||||
paraformat.dwMask = PFM_STARTINDENT | PFM_OFFSETINDENT | PFM_RIGHTINDENT;
|
paraformat.dwMask = PFM_STARTINDENT | PFM_OFFSETINDENT | PFM_RIGHTINDENT;
|
||||||
paraformat.dxStartIndent = paraformat.dxOffset = paraformat.dxRightIndent = 120;
|
paraformat.dxStartIndent = paraformat.dxOffset = paraformat.dxRightIndent = 120;
|
||||||
SendMessage (ConWindow, EM_SETPARAFORMAT, 0, (LPARAM)¶format);
|
SendMessage (ConWindow, EM_SETPARAFORMAT, 0, (LPARAM)¶format);
|
||||||
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)"\n");
|
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)"\n");
|
||||||
|
|
||||||
// Find out where the error lines start for the error icon display control.
|
// Find out where the error lines start for the error icon display control.
|
||||||
SendMessage (ConWindow, EM_EXGETSEL, 0, (LPARAM)&end);
|
SendMessage (ConWindow, EM_EXGETSEL, 0, (LPARAM)&end);
|
||||||
ErrorIconChar = end.cpMax;
|
ErrorIconChar = end.cpMax;
|
||||||
|
|
||||||
// Now start adding the actual error message.
|
// Now start adding the actual error message.
|
||||||
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)"Execution could not continue.\n\n");
|
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)"Execution could not continue.\n\n");
|
||||||
|
|
||||||
// Restore old charformat but with light yellow text.
|
// Restore old charformat but with light yellow text.
|
||||||
oldformat.crTextColor = RGB(255,255,170);
|
oldformat.crTextColor = RGB(255,255,170);
|
||||||
SendMessage (ConWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&oldformat);
|
SendMessage (ConWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&oldformat);
|
||||||
|
|
||||||
// Add the error text.
|
// Add the error text.
|
||||||
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)text);
|
SendMessage (ConWindow, EM_REPLACESEL, FALSE, (LPARAM)text);
|
||||||
|
|
||||||
// Make sure the error text is not scrolled below the window.
|
// Make sure the error text is not scrolled below the window.
|
||||||
SendMessage (ConWindow, EM_LINESCROLL, 0, SendMessage (ConWindow, EM_GETLINECOUNT, 0, 0));
|
SendMessage (ConWindow, EM_LINESCROLL, 0, SendMessage (ConWindow, EM_GETLINECOUNT, 0, 0));
|
||||||
// The above line scrolled everything off the screen, so pretend to move the scroll
|
// The above line scrolled everything off the screen, so pretend to move the scroll
|
||||||
// bar thumb, which clamps to not show any extra lines if it doesn't need to.
|
// bar thumb, which clamps to not show any extra lines if it doesn't need to.
|
||||||
SendMessage (ConWindow, EM_SCROLL, SB_PAGEDOWN, 0);
|
SendMessage (ConWindow, EM_SCROLL, SB_PAGEDOWN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL bRet;
|
BOOL bRet;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
@ -1007,17 +1016,7 @@ void DoMain (HINSTANCE hInstance)
|
||||||
}
|
}
|
||||||
else if (StdOut == NULL)
|
else if (StdOut == NULL)
|
||||||
{
|
{
|
||||||
BOOL bRet;
|
ShowErrorPane(NULL);
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
RestoreConView();
|
|
||||||
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
|
|
||||||
{
|
|
||||||
if (bRet == -1)
|
|
||||||
{
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue