changes from Alessandro Scotti from 20060112
authorA. Scotti <dev@ascotti.org>
Thu, 16 Apr 2009 21:09:33 +0000 (14:09 -0700)
committerArun Persaud <arun@nubati.net>
Thu, 16 Apr 2009 21:09:33 +0000 (14:09 -0700)
26 files changed:
backend.c
backend.h
bitmaps/baloon_14.ico [new file with mode: 0644]
bitmaps/black_14.ico [new file with mode: 0644]
bitmaps/clock_14.ico [new file with mode: 0644]
bitmaps/ponder_14.ico [new file with mode: 0644]
bitmaps/trans_14.ico [new file with mode: 0644]
bitmaps/unknown_14.ico [new file with mode: 0644]
bitmaps/white_14.ico [new file with mode: 0644]
common.h
frontend.h
uci.c [new file with mode: 0644]
winboard/resource.h
winboard/wclipbrd.c
winboard/wclipbrd.h
winboard/wengineoutput.c
winboard/wevalgraph.c
winboard/whistory.c
winboard/winboard.c
winboard/winboard.rc
winboard/wlayout.c
winboard/woptions.c
winboard/woptions.h
winboard/wsnap.c
winboard/wsnap.h
zippy.c

index d545851..5fbe8f0 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -597,8 +597,13 @@ InitBackEnd1()
     first.useFEN960 = FALSE; second.useFEN960 = FALSE;
     first.useOOCastle = TRUE; second.useOOCastle = TRUE;
     /* End of new features added by Tord. */
+
     first.scoreIsAbsolute = appData.firstScoreIsAbsolute; /* [AS] */
     second.scoreIsAbsolute = appData.secondScoreIsAbsolute; /* [AS] */
+    first.isUCI = appData.firstIsUCI; /* [AS] */
+    second.isUCI = appData.secondIsUCI; /* [AS] */
+    first.hasOwnBookUCI = appData.firstHasOwnBookUCI; /* [AS] */
+    second.hasOwnBookUCI = appData.secondHasOwnBookUCI; /* [AS] */
 
     if (appData.firstProtocolVersion > PROTOVER ||
        appData.firstProtocolVersion < 1) {
@@ -1593,6 +1598,8 @@ static int player1Rating = -1;
 static int player2Rating = -1;
 /*----------------------------*/
 
+ColorClass curColor = ColorNormal;
+
 void
 read_from_ics(isr, closure, data, count, error)
      InputSourceRef isr;
@@ -1616,7 +1623,6 @@ read_from_ics(isr, closure, data, count, error)
     static int parse_pos = 0;
     static char buf[BUF_SIZE + 1];
     static int firstTime = TRUE, intfSet = FALSE;
-    static ColorClass curColor = ColorNormal;
     static ColorClass prevColor = ColorNormal;
     static int savingComment = FALSE;
     char str[500];
@@ -4041,7 +4047,8 @@ void SendProgramStatsToFrontend( ChessProgramState * cps )
         programStats.nodes,
         programStats.score,
         programStats.time,
-        programStats.movelist );
+        programStats.movelist,
+        lastHint );
 }
 
 void
@@ -4877,6 +4884,40 @@ HandleMachineMove(message, cps)
                return;
            }
        }
+        else {
+           buf1[0] = NULLCHAR;
+
+           if (sscanf(message, "%d%c %d %d %lu %[^\n]\n",
+                      &plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5)
+            {
+               if (plyext != ' ' && plyext != '\t') {
+                   time *= 100;
+               }
+
+                /* [AS] Negate score if machine is playing black and reporting absolute scores */
+                if( cps->scoreIsAbsolute && ((gameMode == MachinePlaysBlack) || (gameMode == TwoMachinesPlay && cps->twoMachinesColor[0] == 'b')) ) {
+                    curscore = -curscore;
+                }
+
+               programStats.depth = plylev;
+               programStats.nodes = nodes;
+               programStats.time = time;
+               programStats.score = curscore;
+               programStats.got_only_move = 0;
+                programStats.movelist[0] = '\0';
+
+               if (buf1[0] != NULLCHAR) {
+                    safeStrCpy( programStats.movelist, buf1, sizeof(programStats.movelist) );
+               }
+
+               programStats.ok_to_send = 0;
+               programStats.line_is_book = 0;
+               programStats.nr_moves = 0;
+               programStats.moves_left = 0;
+
+                SendProgramStatsToFrontend( cps );
+            }
+        }
     }
 }
 
index b08a092..5058ac3 100644 (file)
--- a/backend.h
+++ b/backend.h
@@ -245,6 +245,8 @@ typedef struct _CPS {
     /* End of additions by Tord */
 
     int scoreIsAbsolute; /* [AS] 0=don't know (standard), 1=score is always from white side */
+    int isUCI;           /* [AS] 0=no (Winboard), 1=UCI (requires Polyglot) */
+    int hasOwnBookUCI;   /* [AS] 0=use GUI or Polyglot book, 1=has own book */
 } ChessProgramState;
 
 extern ChessProgramState first, second;
diff --git a/bitmaps/baloon_14.ico b/bitmaps/baloon_14.ico
new file mode 100644 (file)
index 0000000..dfe056f
Binary files /dev/null and b/bitmaps/baloon_14.ico differ
diff --git a/bitmaps/black_14.ico b/bitmaps/black_14.ico
new file mode 100644 (file)
index 0000000..9661f7c
Binary files /dev/null and b/bitmaps/black_14.ico differ
diff --git a/bitmaps/clock_14.ico b/bitmaps/clock_14.ico
new file mode 100644 (file)
index 0000000..0785d5c
Binary files /dev/null and b/bitmaps/clock_14.ico differ
diff --git a/bitmaps/ponder_14.ico b/bitmaps/ponder_14.ico
new file mode 100644 (file)
index 0000000..484deaa
Binary files /dev/null and b/bitmaps/ponder_14.ico differ
diff --git a/bitmaps/trans_14.ico b/bitmaps/trans_14.ico
new file mode 100644 (file)
index 0000000..a096131
Binary files /dev/null and b/bitmaps/trans_14.ico differ
diff --git a/bitmaps/unknown_14.ico b/bitmaps/unknown_14.ico
new file mode 100644 (file)
index 0000000..ea3cef3
Binary files /dev/null and b/bitmaps/unknown_14.ico differ
diff --git a/bitmaps/white_14.ico b/bitmaps/white_14.ico
new file mode 100644 (file)
index 0000000..4783e0f
Binary files /dev/null and b/bitmaps/white_14.ico differ
index 140f94f..4ea68ed 100644 (file)
--- a/common.h
+++ b/common.h
@@ -407,6 +407,7 @@ typedef struct {
     int firstProtocolVersion;
     int secondProtocolVersion;
     Boolean showButtonBar;
+
     /* [AS] New properties (down to the "ZIPPY" part) */
     Boolean firstScoreIsAbsolute;  /* If true, engine score is always from white side */
     Boolean secondScoreIsAbsolute; /* If true, engine score is always from white side */
@@ -441,6 +442,17 @@ typedef struct {
     int adjudicateDrawMoves;
     Boolean autoDisplayComment;
     Boolean autoDisplayTags;
+    Boolean firstIsUCI;
+    Boolean secondIsUCI;
+    Boolean firstHasOwnBookUCI;
+    Boolean secondHasOwnBookUCI;
+    char * polyglotDir;
+    Boolean usePolyglotBook;
+    char * polyglotBook;
+    int defaultHashSize;
+    int defaultCacheSizeEGTB;
+    char * defaultPathEGTB;
+
 #if ZIPPY
     char *zippyLines;
     char *zippyPinhead;
index ef79f23..853c665 100644 (file)
@@ -169,6 +169,6 @@ void FreezeUI P((void));
 void ThawUI P((void));
 extern char *programName;
 
-void SetProgramStats P(( int which, int depth, unsigned long nodes, int score, int time, char * pv )); /* [AS] */
+void SetProgramStats P(( int which, int depth, unsigned long nodes, int score, int time, char * pv, char * hint )); /* [AS] */
 
 #endif
diff --git a/uci.c b/uci.c
new file mode 100644 (file)
index 0000000..fdf7e6c
--- /dev/null
+++ b/uci.c
@@ -0,0 +1,101 @@
+/*
+ * UCI support thru Polyglot
+ *
+ * Author: Alessandro Scotti (Jan 2006)
+ *
+ * ------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * ------------------------------------------------------------------------
+ */
+#include "config.h"
+
+#include <windows.h> /* required for all Windows applications */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+
+#include "common.h"
+#include "winboard.h"
+#include "frontend.h"
+#include "backend.h"
+
+#define INIFILE_PREFIX      "polyglot_"
+#define INIFILE_SUFFIX_1ST  "1st"
+#define INIFILE_SUFFIX_2ND  "2nd"
+#define INIFILE_EXT         ".ini"
+
+static const char * GetIniFilename( ChessProgramState * cps )
+{
+    return cps == &first ? INIFILE_PREFIX INIFILE_SUFFIX_1ST INIFILE_EXT : INIFILE_PREFIX INIFILE_SUFFIX_2ND INIFILE_EXT;
+ }
+
+void InitEngineUCI( const char * iniDir, ChessProgramState * cps )
+{
+    if( cps->isUCI ) {
+        const char * iniFileName = GetIniFilename( cps );
+        char polyglotIniFile[ MAX_PATH ];
+        FILE * f;
+
+        /* Build name of initialization file */
+        if( strchr( iniDir, ' ' ) != NULL ) {
+            char iniDirShort[ MAX_PATH ];
+
+            GetShortPathName( iniDir, iniDirShort, sizeof(iniDirShort) );
+
+            strcpy( polyglotIniFile, iniDirShort );
+        }
+        else {
+            strcpy( polyglotIniFile, iniDir );
+        }
+
+        strcat( polyglotIniFile, "\\" );
+        strcat( polyglotIniFile, iniFileName );
+
+        /* Create initialization file */
+        f = fopen( polyglotIniFile, "w" );
+
+        if( f != NULL ) {
+            fprintf( f, "[Polyglot]\n" );
+
+            if( cps->dir != 0 && strlen(cps->dir) > 0 ) {
+                fprintf( f, "EngineDir = %s\n", cps->dir );
+            }
+
+            if( cps->program != 0 && strlen(cps->program) > 0 ) {
+                fprintf( f, "EngineCommand = %s\n", cps->program );
+            }
+
+            fprintf( f, "Book = %s\n", appData.usePolyglotBook ? "true" : "false" );
+            fprintf( f, "BookFile = %s\n", appData.polyglotBook );
+
+            fprintf( f, "[Engine]\n" );
+            fprintf( f, "Hash = %d\n", appData.defaultHashSize );
+
+            fprintf( f, "NalimovPath = %s\n", appData.defaultPathEGTB );
+            fprintf( f, "NalimovCache = %d\n", appData.defaultCacheSizeEGTB );
+
+            fprintf( f, "OwnBook = %s\n", cps->hasOwnBookUCI ? "true" : "false" );
+
+            fclose( f );
+
+            /* Replace program with properly configured Polyglot */
+            cps->dir = appData.polyglotDir;
+            cps->program = (char *) malloc( strlen(polyglotIniFile) + 32 );
+            strcpy( cps->program, "polyglot " );
+            strcat( cps->program, polyglotIniFile );
+        }
+    }
+}
index daea88c..43b6a47 100644 (file)
 #define DLG_BoardOptions                455\r
 #define DLG_Fonts                       456\r
 #define DLG_NewGameFRC                  457
+#define DLG_GameListOptions             458
+#define DLG_MoveHistory                 459
+#define DLG_EvalGraph                   461
+#define DLG_EngineOutput                463
+#define DLG_EnginePlayOptions           464
+#define IDI_WHITE_14                    466
+#define IDI_BLACK_14                    467
+#define DLG_OptionsUCI                  467
+#define IDI_PONDER_14                   468
+#define IDI_TRANS_14                    469
+#define IDI_CLOCK_14                    470
+#define IDI_UNKNOWN_14                  471
+#define IDI_BALOON_14                   472
 #define DLG_Promotion                   500\r
 #define PB_Queen                        502\r
 #define PB_Rook                         503\r
 #define OPT_DarkSquareColor             1023\r
 #define IDC_GameListFilter              1023
 #define IDC_NFG_Edit                    1023
+#define IDC_EpDrawMoveCount             1023
+#define IDC_PolyglotDir                 1023
 #define OPT_ConsoleText                 1024\r
 #define OPT_LightSquareColor            1024\r
 #define OPT_CommandInput                1025\r
 #define OPT_SampleDarkSquare            1030\r
 #define OPT_PremoveWhiteText            1031\r
 #define IDC_EDIT2                       1032\r
+#define IDC_EpAdjudicationThreshold     1032
+#define IDC_HashSize                    1032
 #define OPT_ConsoleInput                1033\r
 #define OPT_AdditionalOptions           1034\r
 #define OPT_PremoveBlackText            1035\r
 #define IDM_UserAdjudication_Black      1303
 #define IDM_UserAdjudication_Draw       1304
 #define IDM_NewGameFRC                  1305
+#define IDM_GameListOptions             1306
 #define PB_King                         1307\r
+#define IDM_ShowMoveHistory             1307
+#define IDM_PasteAny                    1309
+#define IDM_ShowEvalGraph               1310
+#define IDM_CopyGameListToClipboard     1311
 #define OPT_Bold                        1312\r
+#define IDM_ShowEngineOutput            1312
 #define OPT_Italic                      1313\r
+#define IDM_EnginePlayOptions           1313
 #define OPT_Underline                   1314\r
+#define IDM_OptionsUCI                  1314
 #define OPT_Strikeout                   1315\r
 #define OPT_ChooseColor                 1316\r
 #define OPT_Sample                      1318\r
 #define IDC_GameListDoFilter            1425
 #define IDC_NFG_Random                  1426
 #define IDC_NFG_Label                   1427
+#define IDC_GameListTags                1428
+#define IDC_GLT                         1429
+#define IDC_GLT_Up                      1430
+#define IDC_GLT_Down                    1431
+#define IDC_GLT_Restore                 1432
+#define IDC_GLT_Default                 1433
+#define IDC_GLT_RestoreTo               1434
+#define IDC_MoveHistory                 1435
+#define OPT_OutOfBookInfo               1436
+#define OPT_ExtraInfoInMoveHistory      1437
+#define OPT_HighlightMoveArrow          1438
+#define IDC_BUTTON1                     1440
+#define IDC_BrowseForPolyglotDir        1440
+#define IDC_BrowseForEGTB               1441
+#define IDC_BrowseForBook               1442
+#define IDC_EngineMemo1                 1443
+#define IDC_EngineMemo2                 1444
+#define IDC_EngineLabel1                1445
+#define IDC_EngineLabel2                1446
+#define IDC_EpShowThinking              1447
+#define IDC_EpHideThinkingHuman         1448
+#define IDC_EpPonder                    1449
+#define IDC_EpPeriodicUpdates           1450
+#define IDC_Engine1_NPS                 1451
+#define IDC_Engine2_NPS                 1452
+#define IDC_Color1                      1459
+#define IDC_Color2                      1460
+#define IDC_StateIcon1                  1461
+#define IDC_StateData1                  1462
+#define IDC_StateData2                  1463
+#define IDC_StateIcon2                  1464
+#define IDC_PathToEGTB                  1466
+#define IDC_SizeOfEGTB                  1467
+#define IDC_UseBook                     1469
+#define IDC_BookFile                    1470
 #define IDC_STATIC                      -1\r
 \r
 // Next default values for new objects\r
 #ifdef APSTUDIO_INVOKED\r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
 #define _APS_NO_MFC                     1\r
-#define _APS_NEXT_RESOURCE_VALUE        458
-#define _APS_NEXT_COMMAND_VALUE         1306
-#define _APS_NEXT_CONTROL_VALUE         1428
+#define _APS_NEXT_RESOURCE_VALUE        468
+#define _APS_NEXT_COMMAND_VALUE         1315
+#define _APS_NEXT_CONTROL_VALUE         1471
 #define _APS_NEXT_SYMED_VALUE           1404\r
 #endif\r
 #endif\r
index 3eecd38..d04ce9a 100644 (file)
@@ -57,6 +57,38 @@ CopyFENToClipboard()
   free(fen);\r
 }\r
 \r
+/* [AS] */
+HGLOBAL ExportGameListAsText();
+
+VOID CopyGameListToClipboard()
+{
+    HGLOBAL hMem = ExportGameListAsText();
+
+    if( hMem != NULL ) {
+        /* Assign memory block to clipboard */
+        BOOL ok = OpenClipboard( hwndMain );
+
+        if( ok ) {
+            ok = EmptyClipboard();
+
+            if( ok ) {
+                if( hMem != SetClipboardData( CF_TEXT, hMem ) ) {
+                    ok = FALSE;
+                }
+            }
+
+            CloseClipboard();
+
+            if( ! ok ) {
+                GlobalFree( hMem );
+            }
+        }
+
+        if( ! ok ) {
+            DisplayError( "Cannot copy list to clipboard.", 0 );
+        }
+    }
+}
 \r
 VOID\r
 CopyGameToClipboard()\r
index 03c2a56..791dc74 100644 (file)
@@ -23,6 +23,7 @@
 \r
 VOID CopyFENToClipboard();\r
 VOID CopyGameToClipboard();\r
+VOID CopyGameListToClipboard();
 int CopyTextToClipboard(char *text);\r
 \r
 VOID PasteFENFromClipboard();\r
index 6486508..cac4744 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Engine output (PV)
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
@@ -40,6 +40,8 @@ VOID EngineOutputPopUp();
 VOID EngineOutputPopDown();
 BOOL EngineOutputIsUp();
 
+#define SHOW_PONDERING
+
 /* Imports from backend.c */
 char * SavePart(char *str);
 
@@ -58,9 +60,62 @@ extern WindowPlacement wpEngineOutput;
 #define LABEL_V_DISTANCE    1   /* Distance between label and memo */
 #define SPLITTER_SIZE       4   /* Distance between first memo and second label */
 
+#define ICON_SIZE           14
+
+#define STATE_UNKNOWN   -1
+#define STATE_THINKING   0
+#define STATE_IDLE       1
+#define STATE_PONDERING  2
+
 static int  windowMode = 1;
 
+static BOOL needInit = TRUE;
+
+static HICON hiColorBlack = NULL;
+static HICON hiColorWhite = NULL;
+static HICON hiColorUnknown = NULL;
+static HICON hiClear = NULL;
+static HICON hiPondering = NULL;
+static HICON hiThinking = NULL;
+
 static int  lastDepth[2] = { -1, -1 };
+static int  lastForwardMostMove[2] = { -1, -1 };
+static int  engineState[2] = { -1, -1 };
+
+typedef struct {
+    int which;
+    HWND hColorIcon;
+    HWND hLabel;
+    HWND hStateIcon;
+    HWND hStateData;
+    HWND hLabelNPS;
+    HWND hMemo;
+    char * name;
+    int depth;
+    unsigned long nodes;
+    int score;
+    int time;
+    char * pv;
+    char * hint;
+} EngineOutputData;
+
+static HICON LoadIconEx( int id )
+{
+    return LoadImage( hInst, MAKEINTRESOURCE(id), IMAGE_ICON, ICON_SIZE, ICON_SIZE, 0 );
+}
+
+static VOID InitializeEngineOutput()
+{
+    if( needInit ) {
+        hiColorBlack = LoadIconEx( IDI_BLACK_14 );
+        hiColorWhite = LoadIconEx( IDI_WHITE_14 );
+        hiColorUnknown = LoadIconEx( IDI_UNKNOWN_14 );
+        hiClear = LoadIconEx( IDI_TRANS_14 );
+        hiPondering = LoadIconEx( IDI_PONDER_14 );
+        hiThinking = LoadIconEx( IDI_CLOCK_14 );
+        needInit = FALSE;
+    }
+}
 
 static VOID SetControlPos( HWND hDlg, int id, int x, int y, int width, int height )
 {
@@ -69,35 +124,132 @@ static VOID SetControlPos( HWND hDlg, int id, int x, int y, int width, int heigh
     SetWindowPos( hControl, HWND_TOP, x, y, width, height, SWP_NOZORDER );
 }
 
+#define HIDDEN_X    20000
+#define HIDDEN_Y    20000
+
 static VOID HideControl( HWND hDlg, int id )
 {
-    /* TODO: we should also hide/disable it!!! what about tab stops?!?! */
+    HWND hControl = GetDlgItem( hDlg, id );
+    RECT rc;
+
+    GetWindowRect( hControl, &rc );
+
+    /*
+        Avoid hiding an already hidden control, because that causes many
+        unnecessary WM_ERASEBKGND messages!
+    */
+    if( rc.left != HIDDEN_X || rc.top != HIDDEN_Y ) {
     SetControlPos( hDlg, id, 20000, 20000, 100, 100 );
+    }
 }
 
 static int GetControlWidth( HWND hDlg, int id )
 {
     RECT rc;
 
-    GetWindowRect( GetDlgItem( hDlg, IDC_EngineLabel1 ), &rc );
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );
 
     return rc.right - rc.left;
 }
 
+static int GetControlHeight( HWND hDlg, int id )
+{
+    RECT rc;
+
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );
+
+    return rc.bottom - rc.top;
+}
+
+static int GetHeaderHeight()
+{
+    int result = GetControlHeight( engineOutputDialog, IDC_EngineLabel1 );
+
+    if( result < ICON_SIZE ) result = ICON_SIZE;
+
+    return result;
+}
+
+#define ENGINE_COLOR_WHITE      'w'
+#define ENGINE_COLOR_BLACK      'b'
+#define ENGINE_COLOR_UNKNOWN    ' '
+
+char GetEngineColor( int which )
+{
+    char result = ENGINE_COLOR_UNKNOWN;
+
+    if( which == 0 || which == 1 ) {
+        ChessProgramState * cps;
+
+        switch (gameMode) {
+        case MachinePlaysBlack:
+        case IcsPlayingBlack:
+            result = ENGINE_COLOR_BLACK;
+            break;
+        case MachinePlaysWhite:
+        case IcsPlayingWhite:
+            result = ENGINE_COLOR_WHITE;
+            break;
+        case AnalyzeMode:
+        case AnalyzeFile:
+            result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;
+            break;
+        case TwoMachinesPlay:
+            cps = (which == 0) ? &first : &second;
+            result = cps->twoMachinesColor[0];
+            result = result == 'w' ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;
+            break;
+        }
+    }
+
+    return result;
+}
+
+char GetActiveEngineColor()
+{
+    char result = ENGINE_COLOR_UNKNOWN;
+
+    if( gameMode == TwoMachinesPlay ) {
+        result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;
+    }
+
+    return result;
+}
+
+static VOID PositionControlSet( HWND hDlg, int x, int y, int clientWidth, int memoHeight, int idColor, int idEngineLabel, int idNPS, int idMemo, int idStateIcon, int idStateData )
+{
+    int label_x = x + ICON_SIZE + H_MARGIN;
+    int label_h = GetControlHeight( hDlg, IDC_EngineLabel1 );
+    int label_y = y + ICON_SIZE - label_h;
+    int nps_w = GetControlWidth( hDlg, IDC_Engine1_NPS );
+    int nps_x = clientWidth - H_MARGIN - nps_w;
+    int state_data_w = GetControlWidth( hDlg, IDC_StateData1 );
+    int state_data_x = nps_x - H_MARGIN - state_data_w;
+    int state_icon_x = state_data_x - ICON_SIZE - 2;
+    int max_w = clientWidth - 2*H_MARGIN;
+    int memo_y = y + ICON_SIZE + LABEL_V_DISTANCE;
+
+    SetControlPos( hDlg, idColor, x, y, ICON_SIZE, ICON_SIZE );
+    SetControlPos( hDlg, idEngineLabel, label_x, label_y, max_w / 2, label_h );
+    SetControlPos( hDlg, idStateIcon, state_icon_x, y, ICON_SIZE, ICON_SIZE );
+    SetControlPos( hDlg, idStateData, state_data_x, label_y, state_data_w, label_h );
+    SetControlPos( hDlg, idNPS, nps_x, label_y, nps_w, label_h );
+    SetControlPos( hDlg, idMemo, x, memo_y, max_w, memoHeight );
+}
+
 static VOID ResizeWindowControls( HWND hDlg, int mode )
 {
     RECT rc;
-    int labelHeight;
+    int headerHeight = GetHeaderHeight();
+    int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 );
+    int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN;
+    int labelDeltaY = ICON_SIZE - labelHeight;
     int clientWidth;
     int clientHeight;
     int maxControlWidth;
     int npsWidth;
 
     /* Initialize variables */
-    GetWindowRect( GetDlgItem( hDlg, IDC_EngineLabel1 ), &rc );
-
-    labelHeight = rc.bottom - rc.top;
-
     GetClientRect( hDlg, &rc );
 
     clientWidth = rc.right - rc.left;
@@ -110,33 +262,32 @@ static VOID ResizeWindowControls( HWND hDlg, int mode )
     /* Resize controls */
     if( mode == 0 ) {
         /* One engine */
-        int memo_y = V_MARGIN + labelHeight + LABEL_V_DISTANCE;
-        int memo_h = clientHeight - memo_y - V_MARGIN;
-
-        SetControlPos( hDlg, IDC_EngineLabel1, H_MARGIN, V_MARGIN, maxControlWidth / 2, labelHeight );
-        SetControlPos( hDlg, IDC_EngineMemo1, H_MARGIN, memo_y, maxControlWidth, memo_h );
+        PositionControlSet( hDlg, H_MARGIN, V_MARGIN,
+            clientWidth,
+            clientHeight - V_MARGIN - LABEL_V_DISTANCE - headerHeight- V_MARGIN,
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );
 
         /* Hide controls for the second engine */
+        HideControl( hDlg, IDC_Color2 );
         HideControl( hDlg, IDC_EngineLabel2 );
+        HideControl( hDlg, IDC_StateIcon2 );
+        HideControl( hDlg, IDC_StateData2 );
         HideControl( hDlg, IDC_Engine2_NPS );
         HideControl( hDlg, IDC_EngineMemo2 );
+        SendDlgItemMessage( hDlg, IDC_EngineMemo2, WM_SETTEXT, 0, (LPARAM) "" );
         /* TODO: we should also hide/disable them!!! what about tab stops?!?! */
     }
     else {
         /* Two engines */
-        int memo1_y = V_MARGIN + labelHeight + LABEL_V_DISTANCE;
-        int memo_h = (clientHeight - memo1_y - V_MARGIN - labelHeight - LABEL_V_DISTANCE - SPLITTER_SIZE) / 2;
-        int label2_y = memo1_y + memo_h + SPLITTER_SIZE;
-        int memo2_y = label2_y + labelHeight + LABEL_V_DISTANCE;
-        int nps_x = clientWidth - H_MARGIN - npsWidth;
-
-        SetControlPos( hDlg, IDC_EngineLabel1, H_MARGIN, V_MARGIN, maxControlWidth / 2, labelHeight );
-        SetControlPos( hDlg, IDC_Engine1_NPS, nps_x, V_MARGIN, npsWidth, labelHeight );
-        SetControlPos( hDlg, IDC_EngineMemo1, H_MARGIN, memo1_y, maxControlWidth, memo_h );
-
-        SetControlPos( hDlg, IDC_EngineLabel2, H_MARGIN, label2_y, maxControlWidth / 2, labelHeight );
-        SetControlPos( hDlg, IDC_Engine2_NPS, nps_x, label2_y, npsWidth, labelHeight );
-        SetControlPos( hDlg, IDC_EngineMemo2, H_MARGIN, memo2_y, maxControlWidth, memo_h );
+        int memo_h = (clientHeight - headerHeight*2 - V_MARGIN*2 - LABEL_V_DISTANCE*2 - SPLITTER_SIZE) / 2;
+        int header1_y = V_MARGIN;
+        int header2_y = V_MARGIN + headerHeight + LABEL_V_DISTANCE + memo_h + SPLITTER_SIZE;
+
+        PositionControlSet( hDlg, H_MARGIN, header1_y, clientWidth, memo_h,
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );
+
+        PositionControlSet( hDlg, H_MARGIN, header2_y, clientWidth, memo_h,
+            IDC_Color2, IDC_EngineLabel2, IDC_Engine2_NPS, IDC_EngineMemo2, IDC_StateIcon2, IDC_StateData2 );
     }
 
     InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE );
@@ -162,6 +313,8 @@ static VOID VerifyDisplayMode()
     case AnalyzeFile:
     case MachinePlaysWhite:
     case MachinePlaysBlack:
+    case IcsPlayingWhite:
+    case IcsPlayingBlack:
         mode = 0;
         break;
     case TwoMachinesPlay:
@@ -182,11 +335,65 @@ static VOID InsertIntoMemo( HWND hMemo, char * text )
     SendMessage( hMemo, EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) text );
 }
 
+static VOID SetIcon( HWND hControl, HICON hIcon )
+{
+    if( hIcon != NULL ) {
+        SendMessage( hControl, STM_SETICON, (WPARAM) hIcon, 0 );
+    }
+}
+
+static VOID SetEngineColorIcon( HWND hControl, int which )
+{
+    char color = GetEngineColor(which);
+    HICON hicon = NULL;
+
+    if( color == ENGINE_COLOR_BLACK )
+        hicon = hiColorBlack;
+    else if( color == ENGINE_COLOR_WHITE )
+        hicon = hiColorWhite;
+    else
+        hicon = hiColorUnknown;
+
+    SetIcon( hControl, hicon );
+}
+
+static SetEngineState( int which, int state, char * state_data )
+{
+    int x_which = 1 - which;
+    HWND hStateIcon = GetDlgItem( engineOutputDialog, which == 0 ? IDC_StateIcon1 : IDC_StateIcon2 );
+    HWND hStateData = GetDlgItem( engineOutputDialog, which == 0 ? IDC_StateData1 : IDC_StateData2 );
+
+    if( engineState[ which ] != state ) {
+        engineState[ which ] = state;
+
+        switch( state ) {
+        case STATE_THINKING:
+            SetIcon( hStateIcon, hiThinking );
+            if( engineState[ x_which ] == STATE_THINKING ) {
+                SetEngineState( x_which, STATE_IDLE, "" );
+            }
+            break;
+        case STATE_PONDERING:
+            SetIcon( hStateIcon, hiPondering );
+            break;
+        default:
+            SetIcon( hStateIcon, hiClear );
+            break;
+        }
+    }
+
+    if( state_data != 0 ) {
+        SetWindowText( hStateData, state_data );
+    }
+}
+
 #define MAX_NAME_LENGTH 32
 
-static VOID UpdateControls( HWND hLabel, HWND hLabelNPS, HWND hMemo, char * name, int depth, unsigned long nodes, int score, int time, char * pv )
+static VOID UpdateControls( EngineOutputData * ed )
 {
-    char s_label[MAX_NAME_LENGTH + 64];
+    char s_label[MAX_NAME_LENGTH + 32];
+
+    char * name = ed->name;
 
     /* Label */
     if( name == 0 || *name == '\0' ) {
@@ -196,12 +403,47 @@ static VOID UpdateControls( HWND hLabel, HWND hLabelNPS, HWND hMemo, char * name
     strncpy( s_label, name, MAX_NAME_LENGTH );
     s_label[ MAX_NAME_LENGTH-1 ] = '\0';
 
-    SetWindowText( hLabel, s_label );
+#ifdef SHOW_PONDERING
+    if( GetActiveEngineColor() != ENGINE_COLOR_UNKNOWN ) {
+        if( GetEngineColor(ed->which) != GetActiveEngineColor() ) {
+            char buf[8];
+
+            buf[0] = '\0';
+
+            if( ed->hint != 0 && *ed->hint != '\0' ) {
+                strncpy( buf, ed->hint, sizeof(buf) );
+                buf[sizeof(buf)-1] = '\0';
+            }
+            else if( ed->pv != 0 && *ed->pv != '\0' ) {
+                char * sep = strchr( ed->pv, ' ' );
+                int buflen = sizeof(buf);
+
+                if( sep != NULL ) {
+                    buflen = sep - ed->pv + 1;
+                    if( buflen > sizeof(buf) ) buflen = sizeof(buf);
+                }
+
+                strncpy( buf, ed->pv, buflen );
+                buf[ buflen-1 ] = '\0';
+            }
+
+            SetEngineState( ed->which, STATE_PONDERING, buf );
+        }
+        else {
+            SetEngineState( ed->which, STATE_THINKING, "" );
+        }
+    }
+    else {
+        SetEngineState( ed->which, STATE_IDLE, "" );
+    }
+#endif
+
+    SetWindowText( ed->hLabel, s_label );
 
     s_label[0] = '\0';
 
-    if( time > 0 && nodes > 0 ) {
-        unsigned long nps_100 = nodes / time;
+    if( ed->time > 0 && ed->nodes > 0 ) {
+        unsigned long nps_100 = ed->nodes / ed->time;
 
         if( nps_100 < 100000 ) {
             sprintf( s_label, "NPS: %lu", nps_100 * 100 );
@@ -211,52 +453,55 @@ static VOID UpdateControls( HWND hLabel, HWND hLabelNPS, HWND hMemo, char * name
         }
     }
 
-    SetWindowText( hLabelNPS, s_label );
+    SetWindowText( ed->hLabelNPS, s_label );
 
     /* Memo */
-    if( pv != 0 && *pv != '\0' ) {
+    if( ed->pv != 0 && *ed->pv != '\0' ) {
         char s_nodes[24];
         char s_score[16];
         char s_time[24];
         char buf[256];
         int buflen;
-        int time_secs = time / 100;
-        int time_cent = time % 100;
+        int time_secs = ed->time / 100;
+        int time_cent = ed->time % 100;
 
         /* Nodes */
-        if( nodes < 1000000 ) {
-            sprintf( s_nodes, "%lu", nodes );
+        if( ed->nodes < 1000000 ) {
+            sprintf( s_nodes, "%lu", ed->nodes );
         }
         else {
-            sprintf( s_nodes, "%.1fM", nodes / 1000000.0 );
+            sprintf( s_nodes, "%.1fM", ed->nodes / 1000000.0 );
         }
 
         /* Score */
-        if( score > 0 ) {
-            sprintf( s_score, "+%.2f", score / 100.0 );
+        if( ed->score > 0 ) {
+            sprintf( s_score, "+%.2f", ed->score / 100.0 );
         }
         else {
-            sprintf( s_score, "%.2f", score / 100.0 );
+            sprintf( s_score, "%.2f", ed->score / 100.0 );
         }
 
         /* Time */
         sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent );
 
         /* Put all together... */
-        sprintf( buf, "%3d\t%s\t%s\t%s\t", depth, s_score, s_nodes, s_time );
+        sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time );
 
         /* Add PV */
         buflen = strlen(buf);
 
-        strncpy( buf + buflen, pv, sizeof(buf) - buflen );
+        strncpy( buf + buflen, ed->pv, sizeof(buf) - buflen );
 
         buf[ sizeof(buf) - 3 ] = '\0';
 
         strcat( buf + buflen, "\r\n" );
 
         /* Update memo */
-        InsertIntoMemo( hMemo, buf );
+        InsertIntoMemo( ed->hMemo, buf );
     }
+
+    /* Colors */
+    SetEngineColorIcon( ed->hColorIcon, ed->which );
 }
 
 LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
@@ -271,6 +516,9 @@ LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARA
             RestoreWindowPlacement( hDlg, &wpEngineOutput ); /* Restore window placement */
 
             ResizeWindowControls( hDlg, windowMode );
+
+            SetEngineState( 0, STATE_IDLE, "" );
+            SetEngineState( 1, STATE_IDLE, "" );
         }
 
         return FALSE;
@@ -328,6 +576,10 @@ VOID EngineOutputPopUp()
 {
   FARPROC lpProc;
 
+  if( needInit ) {
+      InitializeEngineOutput();
+  }
+
   CheckMenuItem(GetMenu(hwndMain), IDM_ShowEngineOutput, MF_CHECKED);
 
   if( engineOutputDialog ) {
@@ -365,12 +617,10 @@ BOOL EngineOutputIsUp()
     return engineOutputDialogUp;
 }
 
-VOID EngineOutputUpdate( int which, int depth, unsigned long nodes, int score, int time, char * pv )
+VOID EngineOutputUpdate( int which, int depth, unsigned long nodes, int score, int time, char * pv, char * hint )
 {
-    HWND hLabel;
-    HWND hLabelNPS;
-    HWND hMemo;
-    char * name;
+    EngineOutputData ed;
+    BOOL clearMemo = FALSE;
 
     if( which < 0 || which > 1 || depth < 0 || time < 0 || pv == 0 || *pv == '\0' ) {
         return;
@@ -382,33 +632,56 @@ VOID EngineOutputUpdate( int which, int depth, unsigned long nodes, int score, i
 
     VerifyDisplayMode();
 
+    ed.which = which;
+    ed.depth = depth;
+    ed.nodes = nodes;
+    ed.score = score;
+    ed.time = time;
+    ed.pv = pv;
+    ed.hint = hint;
+
     /* Get target control */
     if( which == 0 ) {
-        hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel1 );
-        hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine1_NPS );
-        hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo1 );
-        name = first.tidy;
+        ed.hColorIcon = GetDlgItem( engineOutputDialog, IDC_Color1 );
+        ed.hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel1 );
+        ed.hStateIcon = GetDlgItem( engineOutputDialog, IDC_StateIcon1 );
+        ed.hStateData = GetDlgItem( engineOutputDialog, IDC_StateData1 );
+        ed.hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine1_NPS );
+        ed.hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo1 );
+        ed.name = first.tidy;
     }
     else {
-        hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel2 );
-        hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine2_NPS );
-        hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo2 );
-        name = second.tidy;
+        ed.hColorIcon = GetDlgItem( engineOutputDialog, IDC_Color2 );
+        ed.hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel2 );
+        ed.hStateIcon = GetDlgItem( engineOutputDialog, IDC_StateIcon2 );
+        ed.hStateData = GetDlgItem( engineOutputDialog, IDC_StateData2 );
+        ed.hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine2_NPS );
+        ed.hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo2 );
+        ed.name = second.tidy;
     }
 
     /* Clear memo if needed */
     if( lastDepth[which] > depth || (lastDepth[which] == depth && depth <= 1) ) {
-        SendMessage( hMemo, WM_SETTEXT, 0, (LPARAM) "" );
+        clearMemo = TRUE;
+    }
+
+    if( lastForwardMostMove[which] != forwardMostMove ) {
+        clearMemo = TRUE;
+    }
+
+    if( clearMemo ) {
+        SendMessage( ed.hMemo, WM_SETTEXT, 0, (LPARAM) "" );
     }
 
     /* Update */
     lastDepth[which] = depth;
+    lastForwardMostMove[which] = forwardMostMove;
 
     if( pv[0] == ' ' ) {
         if( strncmp( pv, " no PV", 6 ) == 0 ) { /* Hack on hack! :-O */
-            pv = "";
+            ed.pv = "";
         }
     }
 
-    UpdateControls( hLabel, hLabelNPS, hMemo, name, depth, nodes, score, time, pv );
+    UpdateControls( &ed );
 }
index 2efb15e..2896a23 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Evaluation graph
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
index ba69a63..bab9332 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Move history for WinBoard
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
@@ -60,6 +60,8 @@ static int lastFirst = 0;
 static int lastLast = 0;
 static int lastCurrent = -1;
 
+static char lastLastMove[ MOVE_LEN ];
+
 static MoveHistoryString * currMovelist;
 static ChessProgramStats_Move * currPvInfo;
 static int currFirst = 0;
@@ -125,6 +127,13 @@ static BOOL OnlyCurrentPositionChanged()
         TRUE )
     {
         result = TRUE;
+
+        /* Special case: last move changed */
+        if( currCurrent == currLast-1 ) {
+            if( strcmp( currMovelist[currCurrent], lastLastMove ) != 0 ) {
+                result = FALSE;
+            }
+        }
     }
 
     return result;
@@ -214,7 +223,7 @@ static VOID AppendMoveToMemo( int index )
 
     /* PV info (if any) */
     if( appData.showEvalInMoveHistory && currPvInfo[index].depth > 0 ) {
-        sprintf( buf, "%{%s%.2f/%d} ",
+        sprintf( buf, "{%s%.2f/%d} ",
             currPvInfo[index].score >= 0 ? "+" : "",
             currPvInfo[index].score / 100.0,
             currPvInfo[index].depth );
@@ -245,6 +254,11 @@ static void MemoContentUpdated()
     lastFirst = currFirst;
     lastLast = currLast;
     lastCurrent = currCurrent;
+    lastLastMove[0] = '\0';
+
+    if( lastLast > 0 ) {
+        strcpy( lastLastMove, SavePart( currMovelist[lastLast-1] ) );
+    }
 
     /* Deselect any text, move caret to end of memo */
     if( currCurrent >= 0 ) {
index 368c68d..1346da4 100644 (file)
@@ -86,6 +86,8 @@
 \r
 #include "wsnap.h"
 
+void InitEngineUCI( const char * iniDir, ChessProgramState * cps );
+
 int myrandom(void);
 void mysrandom(unsigned int seed);
 
@@ -450,7 +452,7 @@ BOOL EvalGraphIsUp();
 VOID EngineOutputPopUp();
 VOID EngineOutputPopDown();
 BOOL EngineOutputIsUp();
-VOID EngineOutputUpdate( int which, int depth, unsigned long nodes, int score, int time, char * pv );
+VOID EngineOutputUpdate( int which, int depth, unsigned long nodes, int score, int time, char * pv, char * hint );
 \r
 /*\r
  * Setting "frozen" should disable all user input other than deleting\r
@@ -620,6 +622,9 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
 \r
   InitBackEnd1();\r
 \r
+  InitEngineUCI( installDir, &first );
+  InitEngineUCI( installDir, &second );
+
   /* Create a main window for this application instance. */\r
   hwnd = CreateWindow(szAppName, szTitle,\r
                      (WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX),\r
@@ -1145,6 +1150,20 @@ ArgDescriptor argDescriptors[] = {
   { "adjudicateDrawMoves", ArgInt, (LPVOID) &appData.adjudicateDrawMoves, TRUE },
   { "autoDisplayComment", ArgBoolean, (LPVOID) &appData.autoDisplayComment, TRUE },
   { "autoDisplayTags", ArgBoolean, (LPVOID) &appData.autoDisplayTags, TRUE },
+  { "firstIsUCI", ArgBoolean, (LPVOID) &appData.firstIsUCI, FALSE },
+  { "fUCI", ArgTrue, (LPVOID) &appData.firstIsUCI, FALSE },
+  { "secondIsUCI", ArgBoolean, (LPVOID) &appData.secondIsUCI, FALSE },
+  { "sUCI", ArgTrue, (LPVOID) &appData.secondIsUCI, FALSE },
+  { "firstHasOwnBookUCI", ArgBoolean, (LPVOID) &appData.firstHasOwnBookUCI, FALSE },
+  { "fNoOwnBookUCI", ArgFalse, (LPVOID) &appData.firstHasOwnBookUCI, FALSE },
+  { "secondHasOwnBookUCI", ArgBoolean, (LPVOID) &appData.secondHasOwnBookUCI, FALSE },
+  { "sNoOwnBookUCI", ArgFalse, (LPVOID) &appData.secondHasOwnBookUCI, FALSE },
+  { "polyglotDir", ArgFilename, (LPVOID) &appData.polyglotDir, TRUE },
+  { "usePolyglotBook", ArgBoolean, (LPVOID) &appData.usePolyglotBook, TRUE },
+  { "polyglotBook", ArgFilename, (LPVOID) &appData.polyglotBook, TRUE },
+  { "defaultHashSize", ArgInt, (LPVOID) &appData.defaultHashSize, TRUE },
+  { "defaultCacheSizeEGTB", ArgInt, (LPVOID) &appData.defaultCacheSizeEGTB, TRUE },
+  { "defaultPathEGTB", ArgFilename, (LPVOID) &appData.defaultPathEGTB, TRUE },
 
   /* [AS] Layout stuff */
   { "moveHistoryUp", ArgBoolean, (LPVOID) &wpMoveHistory.visible, TRUE },
@@ -1854,6 +1873,16 @@ InitAppData(LPSTR lpCmdLine)
   appData.adjudicateDrawMoves = 0;
   appData.autoDisplayComment = TRUE;
   appData.autoDisplayTags = TRUE;
+  appData.firstIsUCI = FALSE;
+  appData.secondIsUCI = FALSE;
+  appData.firstHasOwnBookUCI = TRUE;
+  appData.secondHasOwnBookUCI = TRUE;
+  appData.polyglotDir = "";
+  appData.usePolyglotBook = FALSE;
+  appData.polyglotBook = "";
+  appData.defaultHashSize = 64;
+  appData.defaultCacheSizeEGTB = 4;
+  appData.defaultPathEGTB = "c:\\egtb";
 
   InitWindowPlacement( &wpMoveHistory );
   InitWindowPlacement( &wpEvalGraph );
@@ -4970,6 +4999,10 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
       EnginePlayOptionsPopup(hwnd);
       break;
 
+    case IDM_OptionsUCI:
+      UciOptionsPopup(hwnd);
+      break;
+
     case IDM_IcsOptions:\r
       IcsOptionsPopup(hwnd);\r
       break;\r
@@ -6253,9 +6286,21 @@ ErrorDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   switch (message) {\r
   case WM_INITDIALOG:\r
     GetWindowRect(hDlg, &rChild);\r
+
+    /*
     SetWindowPos(hDlg, NULL, rChild.left,\r
       rChild.top + boardRect.top - (rChild.bottom - rChild.top), \r
       0, 0, SWP_NOZORDER|SWP_NOSIZE);\r
+    */
+
+    /*
+        [AS] It seems that the above code wants to move the dialog up in the "caption
+        area" of the main window, but it uses the dialog height as an hard-coded constant,
+        and it doesn't work when you resize the dialog.
+        For now, just give it a default position.
+    */
+    SetWindowPos(hDlg, NULL, boardRect.left+8, boardRect.top+8, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
+
     errorDialog = hDlg;\r
     SetWindowText(hDlg, errorTitle);\r
     hwndText = GetDlgItem(hDlg, OPT_ErrorText);\r
@@ -9426,7 +9471,7 @@ HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current )
     EvalGraphSet( first, last, current, pvInfoList );
 }
 
-void SetProgramStats( int which, int depth, unsigned long nodes, int score, int time, char * pv )
+void SetProgramStats( int which, int depth, unsigned long nodes, int score, int time, char * pv, char * hint )
 {
 #if 0
     char buf[1024];
@@ -9437,5 +9482,5 @@ void SetProgramStats( int which, int depth, unsigned long nodes, int score, int
     OutputDebugString( buf );
 #endif
 
-    EngineOutputUpdate( which, depth, nodes, score, time, pv );
+    EngineOutputUpdate( which, depth, nodes, score, time, pv, hint );
 }
index b4635b2..9727241 100644 (file)
@@ -49,7 +49,7 @@ BEGIN
     LTEXT           "(unofficial version ""X"")",IDC_STATIC,88,4,71,8
 END\r
 \r
-DLG_TimeControl DIALOG DISCARDABLE  6, 18, 165, 114
+DLG_TimeControl DIALOG DISCARDABLE  6, 18, 174, 98
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Time Control"\r
 FONT 8, "MS Sans Serif"\r
@@ -58,17 +58,16 @@ BEGIN
                     BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,6,113,10\r
     CONTROL         "Incremental clock",OPT_TCUseInc,"Button",\r
                     BS_AUTORADIOBUTTON | WS_TABSTOP,6,42,107,10\r
-    EDITTEXT        OPT_TCMoves,14,20,22,12,ES_AUTOHSCROLL | WS_GROUP\r
-    LTEXT           "moves in",OPT_TCtext1,40,22,30,8,NOT WS_GROUP\r
-    EDITTEXT        OPT_TCTime,74,20,50,12,ES_AUTOHSCROLL
-    LTEXT           "minutes",OPT_TCtext2,129,22,26,8,NOT WS_GROUP
-    EDITTEXT        OPT_TCTime2,14,56,32,12,ES_AUTOHSCROLL | WS_GROUP\r
-    LTEXT           "minutes initially,",405,51,57,73,8,NOT WS_GROUP\r
-    LTEXT           "plus",406,19,74,15,8,NOT WS_GROUP\r
-    EDITTEXT        OPT_TCInc,37,72,32,12,ES_AUTOHSCROLL\r
-    LTEXT           "seconds per move",408,74,74,67,8,NOT WS_GROUP\r
-    PUSHBUTTON      "OK",IDOK,34,95,40,14,WS_GROUP
-    PUSHBUTTON      "Cancel",IDCANCEL,90,95,40,14
+    EDITTEXT        OPT_TCMoves,14,20,26,12,ES_AUTOHSCROLL | WS_GROUP
+    LTEXT           "moves in",OPT_TCtext1,44,22,30,8,NOT WS_GROUP
+    EDITTEXT        OPT_TCTime,78,20,26,12,ES_AUTOHSCROLL
+    LTEXT           "minutes",OPT_TCtext2,108,22,26,8,NOT WS_GROUP
+    EDITTEXT        OPT_TCTime2,14,56,26,12,ES_AUTOHSCROLL | WS_GROUP
+    LTEXT           "minutes +",405,44,58,34,8,NOT WS_GROUP
+    EDITTEXT        OPT_TCInc,78,56,26,12,ES_AUTOHSCROLL
+    LTEXT           "seconds per move",408,108,58,62,8,NOT WS_GROUP
+    PUSHBUTTON      "OK",IDOK,64,80,50,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,120,80,50,14
 END\r
 \r
 DLG_LoadOptions DIALOG DISCARDABLE  10, 18, 136, 55
@@ -165,18 +164,18 @@ BEGIN
     PUSHBUTTON      "Help",OPT_SerialHelp,4,60,50,14,NOT WS_VISIBLE
 END\r
 \r
-DLG_EditComment DIALOG DISCARDABLE  6, 18, 306, 104\r
+DLG_EditComment DIALOG DISCARDABLE  6, 18, 302, 102
 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME\r
 CAPTION "Edit Comment"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    PUSHBUTTON      "OK",IDOK,61,86,40,14\r
-    PUSHBUTTON      "Cancel",OPT_CancelComment,109,86,40,14\r
-    PUSHBUTTON      "&Clear",OPT_ClearComment,157,86,40,14\r
-    PUSHBUTTON      "&Edit",OPT_EditComment,205,86,40,14\r
+    PUSHBUTTON      "OK",IDOK,194,84,50,14
+    PUSHBUTTON      "Cancel",OPT_CancelComment,250,84,50,14
     CONTROL         "",OPT_CommentText,"RICHEDIT",ES_MULTILINE | \r
                     ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | \r
-                    WS_HSCROLL | WS_TABSTOP,4,4,298,78\r
+                    WS_HSCROLL | WS_TABSTOP,2,2,298,78
+    PUSHBUTTON      "&Clear",OPT_ClearComment,2,84,50,14
+    PUSHBUTTON      "&Edit",OPT_EditComment,58,84,50,14
 END\r
 \r
 DLG_PromotionKing DIALOG DISCARDABLE  98, 90, 183, 41\r
@@ -227,17 +226,17 @@ BEGIN
     EDITTEXT        IDC_GameListFilter,178,136,78,14,ES_AUTOHSCROLL
 END\r
 \r
-DLG_EditTags DIALOG DISCARDABLE  6, 18, 160, 141\r
+DLG_EditTags DIALOG DISCARDABLE  6, 18, 167, 140
 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME\r
 CAPTION "Edit Tags"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    PUSHBUTTON      "OK",IDOK,12,123,40,14\r
-    PUSHBUTTON      "Cancel",OPT_TagsCancel,60,123,40,14\r
-    PUSHBUTTON      "&Edit",OPT_EditTags,108,123,40,14\r
+    PUSHBUTTON      "OK",IDOK,58,122,50,14
+    PUSHBUTTON      "Cancel",OPT_TagsCancel,114,122,50,14
     CONTROL         "",OPT_TagsText,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | \r
                     ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | \r
-                    WS_HSCROLL | WS_TABSTOP,4,4,152,115\r
+                    WS_HSCROLL | WS_TABSTOP,2,2,162,115
+    PUSHBUTTON      "&Edit",OPT_EditTags,2,122,50,14
 END\r
 \r
 WBCONSOLE DIALOG DISCARDABLE  0, 0, 335, 133\r
@@ -267,21 +266,23 @@ BEGIN
                     WS_HSCROLL | WS_TABSTOP,4,4,286,54\r
 END\r
 \r
-DLG_Error DIALOG DISCARDABLE  0, 0, 183, 33\r
+DLG_Error DIALOG DISCARDABLE  0, 0, 220, 66
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION\r
 CAPTION "Error"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,163,9,16,14\r
-    ICON            32515,IDC_STATIC,4,6,20,20\r
-    LTEXT           "Sorry Charlie",OPT_ErrorText,27,4,130,25\r
+    ICON            32515,IDC_STATIC,4,4,21,20
+    LTEXT           "Sorry Charlie",OPT_ErrorText,28,4,188,36
+    DEFPUSHBUTTON   "OK",IDOK,84,48,50,14
 END\r
 \r
 DLG_Colorize DIALOGEX 0, 0, 174, 61
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "ICS Interaction Colors"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif"
 BEGIN\r
+    DEFPUSHBUTTON   "OK",IDOK,64,42,50,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,120,42,50,14
     PUSHBUTTON      "&Color...",OPT_ChooseColor,119,4,51,14,WS_GROUP
     CONTROL         "&Bold",OPT_Bold,"Button",BS_AUTOCHECKBOX | WS_GROUP | \r
                     WS_TABSTOP,4,24,30,10
@@ -291,8 +292,6 @@ BEGIN
                     24,45,10\r
     CONTROL         "&Strikeout",OPT_Strikeout,"Button",BS_AUTOCHECKBOX,128,
                     24,42,10
-    DEFPUSHBUTTON   "OK",IDOK,64,42,50,14,WS_GROUP
-    PUSHBUTTON      "Cancel",IDCANCEL,120,42,50,14
     CONTROL         "",OPT_Sample,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
                     ES_READONLY | WS_GROUP,4,4,106,15,WS_EX_CLIENTEDGE
 END\r
@@ -307,7 +306,7 @@ BEGIN
     PUSHBUTTON      "Cancel",IDCANCEL,134,58,50,14
     LTEXT           "Enter a chess engine command or just type something stupid that will completely screw things up.",\r
                     OPT_QuestionText,30,2,153,28
-    ICON            32514,IDC_STATIC,4,4,21,20
+    ICON            32514,IDC_STATIC,4,4,20,20
 END\r
 \r
 DLG_Startup DIALOG DISCARDABLE  0, 0, 276, 127\r
@@ -355,92 +354,92 @@ BEGIN
     EDITTEXT        OPT_Move,4,4,86,13,ES_AUTOHSCROLL
 END\r
 \r
-DLG_Sound DIALOG DISCARDABLE  0, 0, 257, 95\r
+DLG_Sound DIALOG DISCARDABLE  0, 0, 242, 105
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Sounds"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,199,6,47,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,199,23,47,14\r
-    PUSHBUTTON      "Defaults",OPT_DefaultSounds,199,40,47,14\r
-    COMBOBOX        CBO_Sounds,52,6,128,110,CBS_DROPDOWNLIST | WS_VSCROLL | \r
+    DEFPUSHBUTTON   "OK",IDOK,132,86,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,188,86,50,14
+    LTEXT           "Event:",IDC_STATIC,4,7,26,9
+    COMBOBOX        CBO_Sounds,30,4,208,110,CBS_DROPDOWNLIST | WS_VSCROLL |
                     WS_TABSTOP\r
     CONTROL         "No sound",OPT_NoSound,"Button",BS_AUTORADIOBUTTON | \r
-                    WS_GROUP | WS_TABSTOP,11,25,47,10\r
+                    WS_GROUP | WS_TABSTOP,12,22,47,10
     CONTROL         "Default beep",OPT_DefaultBeep,"Button",\r
-                    BS_AUTORADIOBUTTON | WS_TABSTOP,11,42,57,10\r
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,12,36,57,10
     CONTROL         "Built-in sound:",OPT_BuiltInSound,"Button",\r
-                    BS_AUTORADIOBUTTON | WS_TABSTOP,11,59,60,10\r
-    COMBOBOX        OPT_BuiltInSoundName,78,58,103,109,CBS_DROPDOWNLIST | \r
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,12,51,60,10
+    COMBOBOX        OPT_BuiltInSoundName,76,48,103,109,CBS_DROPDOWNLIST |
                     CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Play",OPT_PlaySound,200,57,47,14\r
+    PUSHBUTTON      "Play",OPT_PlaySound,188,47,50,14
     CONTROL         "WAV file:",OPT_WavFile,"Button",BS_AUTORADIOBUTTON | \r
-                    WS_TABSTOP,11,76,45,10\r
-    EDITTEXT        OPT_WavFileName,78,75,103,12,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Browse...",OPT_BrowseSound,200,74,47,14\r
-    LTEXT           "Event:",IDC_STATIC,19,9,26,9\r
+                    WS_TABSTOP,12,66,45,10
+    EDITTEXT        OPT_WavFileName,76,65,103,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "Browse...",OPT_BrowseSound,188,64,50,14
+    PUSHBUTTON      "Defaults",OPT_DefaultSounds,6,86,50,14
 END\r
 \r
-DLG_GeneralOptions DIALOG DISCARDABLE  0, 0, 271, 162
+DLG_GeneralOptions DIALOG DISCARDABLE  0, 0, 220, 183
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "General Options"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,207,7,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,208,25,50,14\r
+    DEFPUSHBUTTON   "OK",IDOK,110,164,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,166,164,50,14
     CONTROL         "Always on &Top",OPT_AlwaysOnTop,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,6,79,10
+    CONTROL         "Highlight Last &Move",OPT_HighlightLastMove,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,6,79,10
     CONTROL         "Always &Queen",OPT_AlwaysQueen,"Button",BS_AUTOCHECKBOX | \r
                     WS_TABSTOP,4,20,79,10
+    CONTROL         "Periodic &Updates",OPT_PeriodicUpdates,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,20,79,10
     CONTROL         "Animate &Dragging",OPT_AnimateDragging,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,34,79,10
+    CONTROL         "Ponder &Next Move",OPT_PonderNextMove,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,34,79,10
     CONTROL         "&Animate Moving",OPT_AnimateMoving,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,48,79,10
+    CONTROL         "&Popup Exit Message",OPT_PopupExitMessage,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,48,79,10
     CONTROL         "Auto &Flag",OPT_AutoFlag,"Button",BS_AUTOCHECKBOX | \r
                     WS_TABSTOP,4,62,79,10
+    CONTROL         "Popup Move &Errors",OPT_PopupMoveErrors,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,62,79,10
     CONTROL         "Auto Flip &View",OPT_AutoFlipView,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,76,79,10
+    CONTROL         "Show Butt&on Bar",OPT_ShowButtonBar,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,76,79,10
     CONTROL         "Auto &Raise Board",OPT_AutoRaiseBoard,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,90,71,10
+    CONTROL         "Show &Coordinates",OPT_ShowCoordinates,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,90,79,10
     CONTROL         "&Blindfold",OPT_Blindfold,"Button",BS_AUTOCHECKBOX | \r
                     WS_TABSTOP,4,104,79,10
+    CONTROL         "&Show Thinking",OPT_ShowThinking,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,104,79,10
     CONTROL         "&Highlight Dragging",OPT_HighlightDragging,"Button",\r
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,118,79,10
+    CONTROL         "Test &Legality",OPT_TestLegality,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,118,79,10
     CONTROL         "Extended PGN Info",OPT_SaveExtPGN,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,4,132,79,10
-    CONTROL         "Highlight Last &Move",OPT_HighlightLastMove,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,6,79,10\r
-    CONTROL         "Periodic &Updates",OPT_PeriodicUpdates,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,20,79,10\r
-    CONTROL         "Ponder &Next Move",OPT_PonderNextMove,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,34,79,10\r
-    CONTROL         "&Popup Exit Message",OPT_PopupExitMessage,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,48,79,10\r
-    CONTROL         "Popup Move &Errors",OPT_PopupMoveErrors,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,62,79,10\r
-    CONTROL         "Show Butt&on Bar",OPT_ShowButtonBar,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,76,79,10\r
-    CONTROL         "Show &Coordinates",OPT_ShowCoordinates,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,90,79,10\r
-    CONTROL         "&Show Thinking",OPT_ShowThinking,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,104,79,10\r
-    CONTROL         "Test &Legality",OPT_TestLegality,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,118,79,10\r
     CONTROL         "Hide Thinking from Human",OPT_HideThinkFromHuman,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,109,132,100,10
+                    BS_AUTOCHECKBOX | WS_TABSTOP,116,132,100,10
     CONTROL         "Extra Info in Move History",OPT_ExtraInfoInMoveHistory,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,146,97,10
     CONTROL         "Highlight Move with Arrow",OPT_HighlightMoveArrow,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,109,145,111,9
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,145,100,9
 END\r
 \r
-DLG_IcsOptions DIALOGEX 0, 0, 302, 265
+DLG_IcsOptions DIALOGEX 0, 0, 302, 255
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "ICS Options"\r
 FONT 8, "MS Sans Serif"
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,194,246,50,15
-    PUSHBUTTON      "Cancel",IDCANCEL,248,246,50,15
+    DEFPUSHBUTTON   "OK",IDOK,194,237,50,15
+    PUSHBUTTON      "Cancel",IDCANCEL,248,237,50,15
     CONTROL         "&Auto Comment",OPT_AutoComment,"Button",BS_AUTOCHECKBOX | \r
                     WS_TABSTOP,10,12,63,8
     CONTROL         "Auto &Observe",OPT_AutoObserve,"Button",BS_AUTOCHECKBOX | \r
@@ -463,35 +462,34 @@ BEGIN
                     WS_TABSTOP,160,72,63,10
     EDITTEXT        OPT_IcsAlarmTime,236,68,26,14,ES_AUTOHSCROLL
     LTEXT           "seconds",IDC_STATIC,264,72,28,8
-    PUSHBUTTON      "Choose...",OPT_ChooseShoutColor,98,101,45,15
-    PUSHBUTTON      "Choose...",OPT_ChooseSShoutColor,98,121,45,15
-    PUSHBUTTON      "Choose...",OPT_ChooseChannel1Color,98,141,45,15
-    PUSHBUTTON      "Choose...",OPT_ChooseChannelColor,98,161,45,15
-    PUSHBUTTON      "Choose...",OPT_ChooseKibitzColor,98,181,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseShoutColor,97,101,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseSShoutColor,97,121,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseChannel1Color,97,141,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseChannelColor,97,161,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseKibitzColor,97,181,45,15
     PUSHBUTTON      "Choose...",OPT_ChooseTellColor,246,101,45,15
     PUSHBUTTON      "Choose...",OPT_ChooseChallengeColor,246,121,45,15
     PUSHBUTTON      "Choose...",OPT_ChooseRequestColor,246,141,45,15
     PUSHBUTTON      "Choose...",OPT_ChooseSeekColor,246,161,45,15
     PUSHBUTTON      "Choose...",OPT_ChooseNormalColor,246,181,45,15
-    PUSHBUTTON      "&Choose Background Color...",OPT_ChooseBackgroundColor,\r
-                    11,204,132,16
-    PUSHBUTTON      "&Default ICS Colors",OPT_DefaultColors,159,204,132,16
+    PUSHBUTTON      "Background...",OPT_ChooseBackgroundColor,10,208,50,16
+    PUSHBUTTON      "&Defaults...",OPT_DefaultColors,68,208,50,16
     CONTROL         "Do &not colorize messages",OPT_DontColorize,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,104,225,97,10
+                    BS_AUTOCHECKBOX | WS_TABSTOP,192,212,97,10
     CONTROL         "",OPT_SampleShout,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
-                    ES_READONLY | WS_DISABLED | WS_GROUP,11,101,75,15,
+                    ES_READONLY | WS_DISABLED | WS_GROUP,10,101,75,15,
                     WS_EX_CLIENTEDGE\r
     CONTROL         "",OPT_SampleSShout,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
-                    ES_READONLY | WS_DISABLED | WS_GROUP,11,121,75,15,
+                    ES_READONLY | WS_DISABLED | WS_GROUP,10,121,75,15,
                     WS_EX_CLIENTEDGE\r
     CONTROL         "",OPT_SampleChannel1,"RICHEDIT",ES_CENTER | \r
-                    ES_MULTILINE | ES_READONLY | WS_DISABLED | WS_GROUP,11,
+                    ES_MULTILINE | ES_READONLY | WS_DISABLED | WS_GROUP,10,
                     141,75,15,WS_EX_CLIENTEDGE\r
     CONTROL         "",OPT_SampleChannel,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
-                    ES_READONLY | WS_DISABLED | WS_GROUP,11,161,75,15,
+                    ES_READONLY | WS_DISABLED | WS_GROUP,10,161,75,15,
                     WS_EX_CLIENTEDGE\r
     CONTROL         "",OPT_SampleKibitz,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
-                    ES_READONLY | WS_GROUP,11,181,75,15,WS_EX_CLIENTEDGE
+                    ES_READONLY | WS_GROUP,10,181,75,15,WS_EX_CLIENTEDGE
     CONTROL         "",OPT_SampleTell,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
                     ES_READONLY | WS_DISABLED | WS_GROUP,159,101,75,15,
                     WS_EX_CLIENTEDGE\r
@@ -507,9 +505,9 @@ BEGIN
     CONTROL         "",OPT_SampleNormal,"RICHEDIT",ES_CENTER | ES_MULTILINE | \r
                     ES_READONLY | WS_DISABLED | WS_GROUP,159,181,75,15,
                     WS_EX_CLIENTEDGE\r
-    GROUPBOX        "Interaction Colors",IDC_STATIC,4,90,294,150
+    GROUPBOX        "Interaction Colors",IDC_STATIC,4,90,294,140
     GROUPBOX        "Premove",IDC_STATIC,154,0,144,56
-    GROUPBOX        "",IDC_STATIC,4,0,146,88
+    GROUPBOX        "General",IDC_STATIC,4,0,146,88
     GROUPBOX        "Alarm",IDC_STATIC,154,58,144,30
 END\r
 \r
@@ -522,7 +520,7 @@ BEGIN
     PUSHBUTTON      "Cancel",IDCANCEL,140,232,50,14
     CONTROL         "&Tiny",OPT_SizeTiny,"Button",BS_AUTORADIOBUTTON | \r
                     WS_GROUP | WS_TABSTOP,9,14,50,10
-    CONTROL         "T&eeny",OPT_SizeTeeny,"Button",BS_AUTORADIOBUTTON,9,25,
+    CONTROL         "T&eeny",OPT_SizeTeeny,"Button",BS_AUTORADIOBUTTON,9,24,
                     50,10\r
     CONTROL         "&Dinky",OPT_SizeDinky,"Button",BS_AUTORADIOBUTTON,9,34,
                     50,10\r
@@ -530,23 +528,23 @@ BEGIN
                     44,50,10
     CONTROL         "Sl&im",OPT_SizeSlim,"Button",BS_AUTORADIOBUTTON,9,54,50,
                     10
-    CONTROL         "&Small",OPT_SizeSmall,"Button",BS_AUTORADIOBUTTON,9,65,
+    CONTROL         "&Small",OPT_SizeSmall,"Button",BS_AUTORADIOBUTTON,9,64,
                     50,10\r
     CONTROL         "Medi&ocre",OPT_SizeMediocre,"Button",BS_AUTORADIOBUTTON,\r
                     70,14,50,10
     CONTROL         "&Middling",OPT_SizeMiddling,"Button",BS_AUTORADIOBUTTON,\r
-                    70,25,50,10
+                    70,24,50,10
     CONTROL         "&Average",OPT_SizeAverage,"Button",BS_AUTORADIOBUTTON,\r
                     70,34,50,10
     CONTROL         "Mode&rate",OPT_SizeModerate,"Button",BS_AUTORADIOBUTTON,\r
                     70,44,50,10
     CONTROL         "Medi&um",OPT_SizeMedium,"Button",BS_AUTORADIOBUTTON,70,
                     54,50,10
-    CONTROL         "Bul&ky",OPT_SizeBulky,"Button",BS_AUTORADIOBUTTON,70,65,
+    CONTROL         "Bul&ky",OPT_SizeBulky,"Button",BS_AUTORADIOBUTTON,70,64,
                     50,10\r
     CONTROL         "&Large",OPT_SizeLarge,"Button",BS_AUTORADIOBUTTON,134,
                     14,50,10
-    CONTROL         "&Big",OPT_SizeBig,"Button",BS_AUTORADIOBUTTON,134,25,50,
+    CONTROL         "&Big",OPT_SizeBig,"Button",BS_AUTORADIOBUTTON,134,24,50,
                     10\r
     CONTROL         "&Huge",OPT_SizeHuge,"Button",BS_AUTORADIOBUTTON,134,34,
                     50,10\r
@@ -555,13 +553,15 @@ BEGIN
     CONTROL         "&Colossal",OPT_SizeColossal,"Button",BS_AUTORADIOBUTTON,\r
                     134,54,50,10
     CONTROL         "Tita&nic",OPT_SizeTitanic,"Button",BS_AUTORADIOBUTTON,\r
-                    134,65,50,10
+                    134,64,50,10
     PUSHBUTTON      "...",OPT_ChooseLightSquareColor,110,94,20,15
     PUSHBUTTON      "...",OPT_ChooseDarkSquareColor,110,112,20,15
     PUSHBUTTON      "...",OPT_ChooseWhitePieceColor,110,130,20,15
     PUSHBUTTON      "...",OPT_ChooseBlackPieceColor,110,148,20,15
     PUSHBUTTON      "...",OPT_ChooseHighlightSquareColor,110,166,20,15
     PUSHBUTTON      "...",OPT_ChoosePremoveHighlightColor,110,184,20,15
+    CONTROL         "Monochrome",OPT_Monochrome,"Button",BS_AUTOCHECKBOX |
+                    WS_TABSTOP,10,210,64,10
     PUSHBUTTON      "Defaults",OPT_DefaultBoardColors,80,206,50,15
     EDITTEXT        OPT_DarkSquareColor,80,112,25,15,ES_READONLY |
                     WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP\r
@@ -583,49 +583,47 @@ BEGIN
     LTEXT           "Square Highlights",IDC_STATIC,10,170,60,10
     LTEXT           "Premove Highlights",IDC_STATIC,10,188,70,10
     GROUPBOX        "Size",IDC_STATIC,4,4,185,75
-    CONTROL         "Monochrome",OPT_Monochrome,"Button",BS_AUTOCHECKBOX | \r
-                    WS_TABSTOP,10,210,64,10
     EDITTEXT        OPT_SampleLightSquare,144,96,39,36,ES_READONLY |
                     WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP\r
     EDITTEXT        OPT_SampleDarkSquare,144,138,39,36,ES_READONLY |
                     WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP\r
 END\r
 \r
-DLG_Fonts DIALOG DISCARDABLE  0, 0, 280, 231\r
+DLG_Fonts DIALOG DISCARDABLE  0, 0, 266, 226
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Fonts"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,168,212,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,224,212,50,14
-    PUSHBUTTON      "Choose...",OPT_ChooseClockFont,221,17,45,15\r
-    PUSHBUTTON      "Choose...",OPT_ChooseMessageFont,221,47,45,15\r
-    PUSHBUTTON      "Choose...",OPT_ChooseCoordFont,221,77,45,15\r
-    PUSHBUTTON      "Choose...",OPT_ChooseTagFont,221,120,45,15\r
-    PUSHBUTTON      "Choose...",OPT_ChooseCommentsFont,221,150,45,15\r
-    PUSHBUTTON      "Choose...",OPT_ChooseConsoleFont,221,180,45,15\r
-    PUSHBUTTON      "&Revert to Defaults",OPT_DefaultFonts,6,210,80,15
+    DEFPUSHBUTTON   "OK",IDOK,156,208,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,212,208,50,14
+    PUSHBUTTON      "Choose...",OPT_ChooseClockFont,212,15,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseMessageFont,212,45,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseCoordFont,212,75,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseTagFont,212,118,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseCommentsFont,212,148,45,15
+    PUSHBUTTON      "Choose...",OPT_ChooseConsoleFont,212,178,45,15
+    PUSHBUTTON      "&Defaults",OPT_DefaultFonts,3,208,50,15
     CONTROL         "",OPT_SampleCoordFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,72,140,20\r
+                    WS_DISABLED | WS_BORDER,67,71,140,20
     CONTROL         "",OPT_SampleTagFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,115,140,20\r
+                    WS_DISABLED | WS_BORDER,67,114,140,20
     CONTROL         "",OPT_SampleCommentsFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,145,140,20\r
+                    WS_DISABLED | WS_BORDER,67,144,140,20
     CONTROL         "",OPT_SampleConsoleFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,175,140,20\r
-    LTEXT           "Clocks",OPT_ClockFont,16,17,45,10,NOT WS_GROUP\r
-    LTEXT           "Messages",OPT_MessageFont,16,47,45,10,NOT WS_GROUP\r
-    LTEXT           "Coordinates",OPT_CoordFont,16,77,45,10,NOT WS_GROUP\r
-    LTEXT           "Tags",OPT_EditTagsFont,16,120,45,10,NOT WS_GROUP\r
-    LTEXT           "Comments",OPT_CommentsFont,16,150,45,10,NOT WS_GROUP\r
-    LTEXT           "ICS Interaction",OPT_MessageFont5,16,180,50,10,NOT \r
+                    WS_DISABLED | WS_BORDER,67,174,140,20
+    LTEXT           "Clocks",OPT_ClockFont,13,16,45,10,NOT WS_GROUP
+    LTEXT           "Messages",OPT_MessageFont,13,46,45,10,NOT WS_GROUP
+    LTEXT           "Coordinates",OPT_CoordFont,13,76,45,10,NOT WS_GROUP
+    LTEXT           "Tags",OPT_EditTagsFont,13,119,45,10,NOT WS_GROUP
+    LTEXT           "Comments",OPT_CommentsFont,13,149,45,10,NOT WS_GROUP
+    LTEXT           "ICS Interaction",OPT_MessageFont5,13,179,50,10,NOT
                     WS_GROUP\r
     CONTROL         "",OPT_SampleClockFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,12,140,20\r
+                    WS_DISABLED | WS_BORDER,67,11,140,20
     CONTROL         "",OPT_SampleMessageFont,"RICHEDIT",ES_READONLY | \r
-                    WS_DISABLED | WS_BORDER,70,42,140,20\r
-    GROUPBOX        "Current Board Size",IDC_STATIC,5,2,270,100\r
-    GROUPBOX        "All Board Sizes",IDC_STATIC,5,105,270,100\r
+                    WS_DISABLED | WS_BORDER,67,41,140,20
+    GROUPBOX        "Current Board Size",IDC_STATIC,3,1,259,100
+    GROUPBOX        "All Board Sizes",IDC_STATIC,3,102,259,100
 END\r
 \r
 DLG_NewGameFRC DIALOG DISCARDABLE  0, 0, 176, 47
@@ -667,11 +665,11 @@ BEGIN
                     WS_BORDER | WS_VSCROLL | WS_TABSTOP,2,2,222,128
 END
 
-DLG_EvalGraph DIALOGEX 0, 0, 215, 75
+DLG_EvalGraph DIALOGEX 0, 0, 216, 75
 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
 EXSTYLE WS_EX_TOOLWINDOW
-CAPTION "Evaluation Graph"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+CAPTION "Evaluation Diagram"
+FONT 8, "MS Sans Serif"
 BEGIN
 END
 
@@ -681,16 +679,22 @@ EXSTYLE WS_EX_TOOLWINDOW
 CAPTION "Engine output"
 FONT 8, "MS Sans Serif"
 BEGIN
-    LTEXT           "Engine #1",IDC_EngineLabel1,2,2,152,8
-    RTEXT           "",IDC_Engine1_NPS,194,2,69,8
+    LTEXT           "Engine #1",IDC_EngineLabel1,14,2,110,8
+    RTEXT           "NPS",IDC_Engine1_NPS,206,2,57,8
     CONTROL         "",IDC_EngineMemo1,"RICHEDIT",ES_MULTILINE |
                     ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_BORDER | WS_VSCROLL |
-                    WS_HSCROLL | WS_TABSTOP,2,10,262,72
-    LTEXT           "Engine #2",IDC_EngineLabel2,2,84,152,8
-    RTEXT           "",IDC_Engine2_NPS,196,84,67,8
+                    WS_HSCROLL | WS_TABSTOP,0,10,262,72
+    LTEXT           "Engine #2",IDC_EngineLabel2,15,84,103,8
+    RTEXT           "NPS",IDC_Engine2_NPS,210,84,55,8
     CONTROL         "",IDC_EngineMemo2,"RICHEDIT",ES_MULTILINE |
                     ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_BORDER | WS_VSCROLL |
                     WS_HSCROLL | WS_TABSTOP,2,92,262,74
+    ICON            IDI_UNKNOWN_14,IDC_Color1,2,4,20,20,SS_REALSIZEIMAGE
+    ICON            IDI_UNKNOWN_14,IDC_Color2,4,84,20,20
+    LTEXT           "Static",IDC_StateData1,182,2,19,8
+    ICON            IDI_TRANS_14,IDC_StateIcon1,160,2,20,20
+    LTEXT           "Static",IDC_StateData2,186,84,19,8
+    ICON            IDI_TRANS_14,IDC_StateIcon2,164,84,20,20
 END
 
 DLG_EnginePlayOptions DIALOG DISCARDABLE  0, 0, 208, 129
@@ -721,6 +725,25 @@ BEGIN
     PUSHBUTTON      "Cancel",IDCANCEL,154,112,50,14
 END
 
+DLG_OptionsUCI DIALOG DISCARDABLE  0, 0, 228, 102
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "UCI Options"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT           "Polyglot Directory:",IDC_STATIC,2,8,58,8
+    EDITTEXT        IDC_PolyglotDir,62,4,140,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_BrowseForPolyglotDir,206,4,17,14
+    LTEXT           "Hash Size (MB):",IDC_STATIC,2,26,52,8
+    EDITTEXT        IDC_HashSize,62,22,40,14,ES_AUTOHSCROLL
+    LTEXT           "EGTB Path:",IDC_STATIC,2,44,39,8
+    EDITTEXT        IDC_PathToEGTB,62,40,140,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_BrowseForEGTB,206,40,17,14
+    LTEXT           "EGTB Size (MB):",IDC_STATIC,2,62,54,8
+    EDITTEXT        IDC_SizeOfEGTB,62,58,40,14,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,118,84,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,174,84,50,14
+END
+
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
@@ -743,9 +766,9 @@ BEGIN
     DLG_GeneralOptions, DIALOG\r
     BEGIN\r
         LEFTMARGIN, 7\r
-        RIGHTMARGIN, 264\r
+        RIGHTMARGIN, 213
         TOPMARGIN, 7\r
-        BOTTOMMARGIN, 155
+        BOTTOMMARGIN, 176
     END\r
 \r
     DLG_IcsOptions, DIALOG\r
@@ -753,7 +776,7 @@ BEGIN
         LEFTMARGIN, 7\r
         RIGHTMARGIN, 295
         TOPMARGIN, 7\r
-        BOTTOMMARGIN, 258
+        BOTTOMMARGIN, 248
     END\r
 \r
     DLG_BoardOptions, DIALOG\r
@@ -767,9 +790,9 @@ BEGIN
     DLG_Fonts, DIALOG\r
     BEGIN\r
         LEFTMARGIN, 7\r
-        RIGHTMARGIN, 273\r
+        RIGHTMARGIN, 259
         TOPMARGIN, 7\r
-        BOTTOMMARGIN, 224\r
+        BOTTOMMARGIN, 219
     END\r
 
     DLG_NewGameFRC, DIALOG
@@ -799,7 +822,7 @@ BEGIN
     DLG_EvalGraph, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 208
+        RIGHTMARGIN, 209
         TOPMARGIN, 7
         BOTTOMMARGIN, 68
     END
@@ -819,6 +842,14 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 122
     END
+
+    DLG_OptionsUCI, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 221
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 95
+    END
 END\r
 #endif    // APSTUDIO_INVOKED\r
 \r
@@ -830,9 +861,16 @@ END
 \r
 // Icon with lowest ID value placed first to ensure application icon\r
 // remains consistent on all systems.\r
+IDI_WHITE_14            ICON    DISCARDABLE     "bitmaps\\white_14.ico"
 ICON_BLACK              ICON    DISCARDABLE     "bitmaps\\icon_ob.ico"\r
 ICON_BOARD              ICON    DISCARDABLE     "bitmaps\\board.ico"\r
 ICON_WHITE              ICON    DISCARDABLE     "bitmaps\\icon_whi.ico"\r
+IDI_BLACK_14            ICON    DISCARDABLE     "bitmaps\\black_14.ico"
+IDI_PONDER_14           ICON    DISCARDABLE     "bitmaps\\ponder_14.ico"
+IDI_TRANS_14            ICON    DISCARDABLE     "bitmaps\\trans_14.ico"
+IDI_CLOCK_14            ICON    DISCARDABLE     "bitmaps\\clock_14.ico"
+IDI_UNKNOWN_14          ICON    DISCARDABLE     "bitmaps\\unknown_14.ico"
+IDI_BALOON_14           ICON    DISCARDABLE     "bitmaps\\baloon_14.ico"
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
@@ -932,6 +970,7 @@ BEGIN
         MENUITEM "&General...",                 IDM_GeneralOptions\r
         MENUITEM "&Board...",                   IDM_BoardOptions\r
         MENUITEM "Engines...",                  IDM_EnginePlayOptions
+        MENUITEM "UCI...",                      IDM_OptionsUCI
         MENUITEM "&ICS...",                     IDM_IcsOptions, GRAYED\r
         MENUITEM "&Fonts...",                   IDM_Fonts\r
         MENUITEM "Soun&ds...",                  IDM_Sounds\r
index 169c7ea..c0606bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Layout management
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
index 41df86c..16e9313 100644 (file)
@@ -26,6 +26,7 @@
 #include <windows.h>   /* required for all Windows applications */\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
+#include <shlobj.h>    /* [AS] Requires NT 4.0 or Win95 */
 \r
 #include "common.h"\r
 #include "winboard.h"\r
@@ -2516,3 +2517,154 @@ VOID EnginePlayOptionsPopup(HWND hwnd)
   DialogBox(hInst, MAKEINTRESOURCE(DLG_EnginePlayOptions), hwnd, (DLGPROC) lpProc);
   FreeProcInstance(lpProc);
 }
+
+/*---------------------------------------------------------------------------*\
+ *
+ * UCI Options Dialog functions
+ *
+\*---------------------------------------------------------------------------*/
+static BOOL BrowseForFolder( const char * title, char * path )
+{
+    BOOL result = FALSE;
+    BROWSEINFO bi;
+    LPITEMIDLIST pidl;
+
+    ZeroMemory( &bi, sizeof(bi) );
+
+    bi.lpszTitle = title == 0 ? "Choose Folder" : title;
+    bi.ulFlags = BIF_RETURNONLYFSDIRS;
+
+    pidl = SHBrowseForFolder( &bi );
+
+    if( pidl != 0 ) {
+        IMalloc * imalloc = 0;
+
+        if( SHGetPathFromIDList( pidl, path ) ) {
+            result = TRUE;
+        }
+
+        if( SUCCEEDED( SHGetMalloc ( &imalloc ) ) ) {
+            imalloc->lpVtbl->Free(imalloc,pidl);
+            imalloc->lpVtbl->Release(imalloc);
+        }
+    }
+
+    return result;
+}
+
+LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+  char buf[MAX_PATH];
+
+  switch (message) {
+  case WM_INITDIALOG: /* message: initialize dialog box */
+
+    /* Center the dialog over the application window */
+    CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
+
+    /* Initialize the dialog items */
+    SetDlgItemText( hDlg, IDC_PolyglotDir, appData.polyglotDir );
+    SetDlgItemInt( hDlg, IDC_HashSize, appData.defaultHashSize, TRUE );
+    SetDlgItemText( hDlg, IDC_PathToEGTB, appData.defaultPathEGTB );
+    SetDlgItemInt( hDlg, IDC_SizeOfEGTB, appData.defaultCacheSizeEGTB, TRUE );
+    CheckDlgButton( hDlg, IDC_UseBook, (BOOL) appData.usePolyglotBook );
+    SetDlgItemText( hDlg, IDC_BookFile, appData.polyglotBook );
+
+    SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 );
+
+    return TRUE;
+
+  case WM_COMMAND: /* message: received a command */
+    switch (LOWORD(wParam)) {
+    case IDOK:
+      GetDlgItemText( hDlg, IDC_PolyglotDir, buf, sizeof(buf) );
+      appData.polyglotDir = strdup(buf);
+      appData.defaultHashSize = GetDlgItemInt(hDlg, IDC_HashSize, NULL, FALSE );
+      appData.defaultCacheSizeEGTB = GetDlgItemInt(hDlg, IDC_SizeOfEGTB, NULL, FALSE );
+      GetDlgItemText( hDlg, IDC_PathToEGTB, buf, sizeof(buf) );
+      appData.defaultPathEGTB = strdup(buf);
+      GetDlgItemText( hDlg, IDC_BookFile, buf, sizeof(buf) );
+      appData.polyglotBook = strdup(buf);
+      appData.usePolyglotBook = (Boolean) IsDlgButtonChecked( hDlg, IDC_UseBook );
+
+      EndDialog(hDlg, TRUE);
+      return TRUE;
+
+    case IDCANCEL:
+      EndDialog(hDlg, FALSE);
+      return TRUE;
+
+    case IDC_BrowseForBook:
+      {
+          char filter[] = {
+              'A','l','l',' ','F','i','l','e','s', 0,
+              '*','.','*', 0,
+              'B','I','N',' ','F','i','l','e','s', 0,
+              '*','.','b','i','n', 0,
+              0 };
+
+          OPENFILENAME ofn;
+
+          strcpy( buf, "" );
+
+          ZeroMemory( &ofn, sizeof(ofn) );
+
+          ofn.lStructSize = sizeof(ofn);
+          ofn.hwndOwner = hDlg;
+          ofn.hInstance = hInst;
+          ofn.lpstrFilter = filter;
+          ofn.lpstrFile = buf;
+          ofn.nMaxFile = sizeof(buf);
+          ofn.lpstrTitle = "Choose Book";
+          ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY;
+
+          if( GetOpenFileName( &ofn ) ) {
+              SetDlgItemText( hDlg, IDC_BookFile, buf );
+          }
+      }
+      return TRUE;
+
+    case IDC_BrowseForPolyglotDir:
+      if( BrowseForFolder( "Choose Polyglot Directory", buf ) ) {
+        SetDlgItemText( hDlg, IDC_PolyglotDir, buf );
+
+        strcat( buf, "\\polyglot.exe" );
+
+        if( GetFileAttributes(buf) == 0xFFFFFFFF ) {
+            MessageBox( hDlg, "Polyglot was not found in the specified folder!", "Warning", MB_OK | MB_ICONWARNING );
+        }
+      }
+      return TRUE;
+
+    case IDC_BrowseForEGTB:
+      if( BrowseForFolder( "Choose EGTB Directory:", buf ) ) {
+        SetDlgItemText( hDlg, IDC_PathToEGTB, buf );
+      }
+      return TRUE;
+
+    case IDC_HashSize:
+    case IDC_SizeOfEGTB:
+        if( HIWORD(wParam) == EN_CHANGE ) {
+            int n1_ok;
+            int n2_ok;
+
+            GetDlgItemInt(hDlg, IDC_HashSize, &n1_ok, FALSE );
+            GetDlgItemInt(hDlg, IDC_SizeOfEGTB, &n2_ok, FALSE );
+
+            EnableWindow( GetDlgItem(hDlg, IDOK), n1_ok && n2_ok ? TRUE : FALSE );
+        }
+        return TRUE;
+    }
+    break;
+  }
+  return FALSE;
+}
+
+VOID UciOptionsPopup(HWND hwnd)
+{
+  FARPROC lpProc;
+
+  lpProc = MakeProcInstance((FARPROC)UciOptionsDialog, hInst);
+  DialogBox(hInst, MAKEINTRESOURCE(DLG_OptionsUCI), hwnd, (DLGPROC) lpProc);
+  FreeProcInstance(lpProc);
+}
index a26d8e4..294b5f9 100644 (file)
@@ -33,3 +33,4 @@ VOID LoadOptionsPopup(HWND hwnd);
 VOID SaveOptionsPopup(HWND hwnd);\r
 VOID TimeControlOptionsPopup(HWND hwnd);\r
 VOID EnginePlayOptionsPopup(HWND hwnd);
+VOID UciOptionsPopup(HWND hwnd);
\ No newline at end of file
index cba18c0..e6f6151 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * wsnap.c -- Smart "snapping" for window moving and sizing
+ * Smart "snapping" for window moving and sizing
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
@@ -27,6 +27,7 @@ extern HINSTANCE hInst;
 extern HWND hwndMain;
 extern HWND moveHistoryDialog;
 extern HWND evalGraphDialog;
+extern HWND engineOutputDialog;
 extern HWND gameListDialog;
 
 static BOOL SnappingEnabled = TRUE;
@@ -107,6 +108,7 @@ LRESULT OnEnterSizeMove( SnapData * snapData, HWND hWnd, WPARAM wParam, LPARAM l
         AddSnapWindow( hWnd, snapData, hwndMain );
         AddSnapWindow( hWnd, snapData, moveHistoryDialog );
         AddSnapWindow( hWnd, snapData, evalGraphDialog );
+        AddSnapWindow( hWnd, snapData, engineOutputDialog );
         AddSnapWindow( hWnd, snapData, gameListDialog );
     }
 
index 5fb226e..818144a 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * wsnap.h -- Smart "snapping" for window moving and sizing
+ * Smart "snapping" for window moving and sizing
  *
- * Author: Alessandro Scotti
+ * Author: Alessandro Scotti (Dec 2005)
  *
  * ------------------------------------------------------------------------
  * This program is free software; you can redistribute it and/or modify
diff --git a/zippy.c b/zippy.c
index c15b0b3..aed634e 100644 (file)
--- a/zippy.c
+++ b/zippy.c
@@ -377,6 +377,21 @@ int ZippyCalled(str)
 static char opp_name[128][32];
 static int num_opps=0;
 
+extern ColorClass curColor;
+
+static void SetCurColor( ColorClass color )
+{
+    curColor = color;
+}
+
+static void ColorizeEx( ColorClass color, int cont )
+{
+    if( appData.colorize ) {
+        Colorize( color, cont );
+        SetCurColor( color );
+    }
+}
+
 int ZippyControl(buf, i)
      char *buf;
      int *i;
@@ -390,7 +405,8 @@ int ZippyControl(buf, i)
 
     /* Possibly reject Crafty as opponent */
     if (appData.zippyPlay && appData.zippyNoplayCrafty && forwardMostMove < 4
-       && looking_at(buf, i, "* kibitzes: Hello from Crafty")) {
+       && looking_at(buf, i, "* kibitzes: Hello from Crafty"))
+    {
         player = StripHighlightAndTitle(star_match[0]);
        if ((gameMode == IcsPlayingWhite &&
             StrCaseCmp(player, gameInfo.black) == 0) ||
@@ -491,7 +507,8 @@ int ZippyControl(buf, i)
     }
 
     if (looking_at(buf, i, "* tells you: *") ||
-       looking_at(buf, i, "* says: *")) {
+       looking_at(buf, i, "* says: *"))
+    {
        player = StripHighlightAndTitle(star_match[0]);
        if (appData.zippyPassword[0] != NULLCHAR &&
            strncmp(star_match[1], appData.zippyPassword,
@@ -534,14 +551,23 @@ int ZippyControl(buf, i)
                Speak("tell", player);
            }
        }
+
+        ColorizeEx( ColorTell, FALSE );
+
        return TRUE;
     }
 
+    if( appData.colorize && looking_at(buf, i, "* (*) seeking") ) {
+       ColorizeEx(ColorSeek, FALSE);
+        return FALSE;
+    }
+
     if (looking_at(buf, i, "* spoofs you:")) {
         player = StripHighlightAndTitle(star_match[0]);
         sprintf(reply, "spoofedby %s\n", player);
         SendToICS(reply);
     }
+
     return FALSE;
 }
 
@@ -555,7 +581,8 @@ int ZippyConverse(buf, i)
 
     /* Shouts and emotes */
     if (looking_at(buf, i, "--> * *") ||
-       looking_at(buf, i, "* shouts: *")) {
+       looking_at(buf, i, "* shouts: *"))
+    {
       if (appData.zippyTalk) {
        char *player = StripHighlightAndTitle(star_match[0]);
        if (strcmp(player, ics_handle) == 0) {
@@ -568,6 +595,9 @@ int ZippyConverse(buf, i)
            Speak("shout", NULL);
        }
       }
+
+      ColorizeEx(ColorShout, FALSE);
+
       return TRUE;
     }
 
@@ -578,6 +608,9 @@ int ZippyConverse(buf, i)
            Speak("kibitz", NULL);
        }
       }
+
+      ColorizeEx(ColorKibitz, FALSE);
+
       return TRUE;
     }
 
@@ -588,6 +621,9 @@ int ZippyConverse(buf, i)
            Speak("whisper", NULL);
        }
       }
+
+      ColorizeEx(ColorKibitz, FALSE);
+
       return TRUE;
     }
 
@@ -643,6 +679,8 @@ int ZippyConverse(buf, i)
            Speak("tell", channel);
          }
 #endif
+
+          ColorizeEx( atoi(channel) == 1 ? ColorChannel1 : ColorChannel, FALSE );
        }
        return TRUE;
     }