From 4d76c591efa92b58cd76c7ccb814ba56c2e9b64d Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 6 Apr 2020 23:17:52 +0200 Subject: [PATCH] Allow larger error popups (WB) The WinBoard error popup, also used for notes, is fixed size, and cannot show more than 4 lines of text without clipping. In case the message is more than 4 lines it now switches to a larger dialog. This was needed for showing the explanation of the new Edit Position method. --- winboard/resource.h | 1 + winboard/winboard.c | 4 +++- winboard/winboard.rc | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/winboard/resource.h b/winboard/resource.h index b442dc6..d22f0f9 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -207,6 +207,7 @@ #define DLG_Analysis 1017 #define OPT_AnalysisText 1018 #define DLG_Error 1019 +#define DLG_Big 2019 #define OPT_ErrorIcon 1020 #define IDD_DIALOG1 1021 #define DLG_ConsoleRich 1022 diff --git a/winboard/winboard.c b/winboard/winboard.c index d385c1d..39af55b 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -6902,8 +6902,10 @@ ErrorPopUp(char *title, char *content) if (modal) { MessageBox(NULL, errorMessage, errorTitle, MB_OK|MB_ICONEXCLAMATION); } else { + int i, n = 0; + for(i=0; errorMessage[i]; i++) n += (errorMessage[i] == '\n'); lpProc = MakeProcInstance((FARPROC)ErrorDialog, hInst); - CreateDialog(hInst, MAKEINTRESOURCE(DLG_Error), + CreateDialog(hInst, MAKEINTRESOURCE(n > 4 ? DLG_Big : DLG_Error), hwndMain, (DLGPROC)lpProc); FreeProcInstance(lpProc); } diff --git a/winboard/winboard.rc b/winboard/winboard.rc index 42feaf5..f2b0e1a 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -328,6 +328,16 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,84,48,50,14 END +DLG_Big DIALOG DISCARDABLE 0, 0, 220, 121 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Error" +FONT 8, "MS Sans Serif" +BEGIN + ICON 32515,IDC_STATIC,4,4,21,20 + LTEXT "Sorry Charlie",OPT_ErrorText,28,4,193,96 + DEFPUSHBUTTON "OK",IDOK,84,103,50,14 +END + DLG_Colorize DIALOGEX 0, 0, 174, 61 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "I C S Interaction Colors" @@ -774,10 +784,6 @@ BEGIN CONTROL "",OPT_EngineVariant+4,"Button",BS_AUTORADIOBUTTON,80,144,70,10 CONTROL "",OPT_EngineVariant+5,"Button",BS_AUTORADIOBUTTON,154,144,70,10 CONTROL "",OPT_EngineVariant+6,"Button",BS_AUTORADIOBUTTON,9,154,70,10 - - - - CONTROL "",OPT_EngineVariant+7,"Button",BS_AUTORADIOBUTTON,80,154,70,10 CONTROL "",OPT_EngineVariant+8,"Button",BS_AUTORADIOBUTTON,154,154,70,10 CONTROL "",OPT_EngineVariant+9,"Button",BS_AUTORADIOBUTTON,9,164,70,10 -- 1.7.0.4