Allow larger error popups (WB)
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Apr 2020 21:17:52 +0000 (23:17 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Apr 2020 21:17:52 +0000 (23:17 +0200)
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
winboard/winboard.c
winboard/winboard.rc

index b442dc6..d22f0f9 100644 (file)
 #define DLG_Analysis                    1017\r
 #define OPT_AnalysisText                1018\r
 #define DLG_Error                       1019\r
+#define DLG_Big                         2019\r
 #define OPT_ErrorIcon                   1020\r
 #define IDD_DIALOG1                     1021\r
 #define DLG_ConsoleRich                 1022\r
index d385c1d..39af55b 100644 (file)
@@ -6902,8 +6902,10 @@ ErrorPopUp(char *title, char *content)
   if (modal) {\r
     MessageBox(NULL, errorMessage, errorTitle, MB_OK|MB_ICONEXCLAMATION);\r
   } else {\r
+    int i, n = 0;\r
+    for(i=0; errorMessage[i]; i++) n += (errorMessage[i] == '\n');\r
     lpProc = MakeProcInstance((FARPROC)ErrorDialog, hInst);\r
-    CreateDialog(hInst, MAKEINTRESOURCE(DLG_Error),\r
+    CreateDialog(hInst, MAKEINTRESOURCE(n > 4 ? DLG_Big : DLG_Error),\r
                 hwndMain, (DLGPROC)lpProc);\r
     FreeProcInstance(lpProc);\r
   }\r
index 42feaf5..f2b0e1a 100644 (file)
@@ -328,6 +328,16 @@ BEGIN
     DEFPUSHBUTTON   "OK",IDOK,84,48,50,14\r
 END\r
 \r
+DLG_Big DIALOG DISCARDABLE  0, 0, 220, 121\r
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
+CAPTION "Error"\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    ICON            32515,IDC_STATIC,4,4,21,20\r
+    LTEXT           "Sorry Charlie",OPT_ErrorText,28,4,193,96\r
+    DEFPUSHBUTTON   "OK",IDOK,84,103,50,14\r
+END\r
+\r
 DLG_Colorize DIALOGEX 0, 0, 174, 61\r
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "I C S Interaction Colors"\r
@@ -774,10 +784,6 @@ BEGIN
     CONTROL         "",OPT_EngineVariant+4,"Button",BS_AUTORADIOBUTTON,80,144,70,10\r
     CONTROL         "",OPT_EngineVariant+5,"Button",BS_AUTORADIOBUTTON,154,144,70,10\r
     CONTROL         "",OPT_EngineVariant+6,"Button",BS_AUTORADIOBUTTON,9,154,70,10\r
-\r
-\r
-\r
-\r
     CONTROL         "",OPT_EngineVariant+7,"Button",BS_AUTORADIOBUTTON,80,154,70,10\r
     CONTROL         "",OPT_EngineVariant+8,"Button",BS_AUTORADIOBUTTON,154,154,70,10\r
     CONTROL         "",OPT_EngineVariant+9,"Button",BS_AUTORADIOBUTTON,9,164,70,10\r