From 29df666d997ad990de5376c962b154b26eb73f2f Mon Sep 17 00:00:00 2001 From: A. Scotti Date: Thu, 16 Apr 2009 14:09:33 -0700 Subject: [PATCH] changes from Alessandro Scotti from 20060112 --- backend.c | 45 +++++- backend.h | 2 + bitmaps/baloon_14.ico | Bin 0 -> 294 bytes bitmaps/black_14.ico | Bin 0 -> 294 bytes bitmaps/clock_14.ico | Bin 0 -> 294 bytes bitmaps/ponder_14.ico | Bin 0 -> 294 bytes bitmaps/trans_14.ico | Bin 0 -> 294 bytes bitmaps/unknown_14.ico | Bin 0 -> 294 bytes bitmaps/white_14.ico | Bin 0 -> 294 bytes common.h | 12 ++ frontend.h | 2 +- uci.c | 101 ++++++++++++ winboard/resource.h | 66 ++++++++- winboard/wclipbrd.c | 32 ++++ winboard/wclipbrd.h | 1 + winboard/wengineoutput.c | 393 +++++++++++++++++++++++++++++++++++++++------- winboard/wevalgraph.c | 2 +- winboard/whistory.c | 18 ++- winboard/winboard.c | 51 ++++++- winboard/winboard.rc | 305 ++++++++++++++++++++---------------- winboard/wlayout.c | 2 +- winboard/woptions.c | 152 ++++++++++++++++++ winboard/woptions.h | 1 + winboard/wsnap.c | 6 +- winboard/wsnap.h | 4 +- zippy.c | 44 +++++- 26 files changed, 1026 insertions(+), 213 deletions(-) create mode 100644 bitmaps/baloon_14.ico create mode 100644 bitmaps/black_14.ico create mode 100644 bitmaps/clock_14.ico create mode 100644 bitmaps/ponder_14.ico create mode 100644 bitmaps/trans_14.ico create mode 100644 bitmaps/unknown_14.ico create mode 100644 bitmaps/white_14.ico create mode 100644 uci.c diff --git a/backend.c b/backend.c index d545851..5fbe8f0 100644 --- 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 ); + } + } } } diff --git a/backend.h b/backend.h index b08a092..5058ac3 100644 --- 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 index 0000000000000000000000000000000000000000..dfe056f5badd502171e0f57bcbafa5b3a7cfff33 GIT binary patch literal 294 zcmb78xeb6Y47^AwQ9?z<01QcyaTp^VbFe`MKr(kBiYU@x`ySbrY``%?n4y>*uuwN5 z5G&!}$-q&0L_M}d*-}>izqw) OoA|Qt4-Adw+Is+O161w+ literal 0 HcmV?d00001 diff --git a/bitmaps/black_14.ico b/bitmaps/black_14.ico new file mode 100644 index 0000000000000000000000000000000000000000..9661f7c67d9da6ece9eb9bca0ec61a12c483a1d9 GIT binary patch literal 294 zcmZ{f$qmCG6hsG!qXjX>@x^Z3PTyu|mJ@W<+fiN)u literal 0 HcmV?d00001 diff --git a/bitmaps/clock_14.ico b/bitmaps/clock_14.ico new file mode 100644 index 0000000000000000000000000000000000000000..0785d5c745a42a4250e8ddc393d7bf1876acb208 GIT binary patch literal 294 zcmZvX%MHRX5Jbl!N95$hi2^7BiN-j%oRr~GC?OJ8q~*=VIf3n&S(2Z5Ts!a3M8Uw}Iqy2xe*s#$NW%aC literal 0 HcmV?d00001 diff --git a/bitmaps/ponder_14.ico b/bitmaps/ponder_14.ico new file mode 100644 index 0000000000000000000000000000000000000000..484deaa49d303ff6d2ddee221324347b040478d1 GIT binary patch literal 294 zcmZvX%L&6U5JX4dqmg~eDFwI-HJQ3WGSp0T_ba$T)0420>y0Bq%88!X0#o8r$#A@&|%4#u`T*ppkbX zidFal8%(X_J^SY(1u /* required for all Windows applications */ + +#include +#include +#include + +#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 ); + } + } +} diff --git a/winboard/resource.h b/winboard/resource.h index daea88c..43b6a47 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -87,6 +87,19 @@ #define DLG_BoardOptions 455 #define DLG_Fonts 456 #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 #define PB_Queen 502 #define PB_Rook 503 @@ -154,6 +167,8 @@ #define OPT_DarkSquareColor 1023 #define IDC_GameListFilter 1023 #define IDC_NFG_Edit 1023 +#define IDC_EpDrawMoveCount 1023 +#define IDC_PolyglotDir 1023 #define OPT_ConsoleText 1024 #define OPT_LightSquareColor 1024 #define OPT_CommandInput 1025 @@ -170,6 +185,8 @@ #define OPT_SampleDarkSquare 1030 #define OPT_PremoveWhiteText 1031 #define IDC_EDIT2 1032 +#define IDC_EpAdjudicationThreshold 1032 +#define IDC_HashSize 1032 #define OPT_ConsoleInput 1033 #define OPT_AdditionalOptions 1034 #define OPT_PremoveBlackText 1035 @@ -221,10 +238,18 @@ #define IDM_UserAdjudication_Black 1303 #define IDM_UserAdjudication_Draw 1304 #define IDM_NewGameFRC 1305 +#define IDM_GameListOptions 1306 #define PB_King 1307 +#define IDM_ShowMoveHistory 1307 +#define IDM_PasteAny 1309 +#define IDM_ShowEvalGraph 1310 +#define IDM_CopyGameListToClipboard 1311 #define OPT_Bold 1312 +#define IDM_ShowEngineOutput 1312 #define OPT_Italic 1313 +#define IDM_EnginePlayOptions 1313 #define OPT_Underline 1314 +#define IDM_OptionsUCI 1314 #define OPT_Strikeout 1315 #define OPT_ChooseColor 1316 #define OPT_Sample 1318 @@ -352,6 +377,41 @@ #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 // Next default values for new objects @@ -359,9 +419,9 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 -#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 #endif #endif diff --git a/winboard/wclipbrd.c b/winboard/wclipbrd.c index 3eecd38..d04ce9a 100644 --- a/winboard/wclipbrd.c +++ b/winboard/wclipbrd.c @@ -57,6 +57,38 @@ CopyFENToClipboard() free(fen); } +/* [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 ); + } + } +} VOID CopyGameToClipboard() diff --git a/winboard/wclipbrd.h b/winboard/wclipbrd.h index 03c2a56..791dc74 100644 --- a/winboard/wclipbrd.h +++ b/winboard/wclipbrd.h @@ -23,6 +23,7 @@ VOID CopyFENToClipboard(); VOID CopyGameToClipboard(); +VOID CopyGameListToClipboard(); int CopyTextToClipboard(char *text); VOID PasteFENFromClipboard(); diff --git a/winboard/wengineoutput.c b/winboard/wengineoutput.c index 6486508..cac4744 100644 --- a/winboard/wengineoutput.c +++ b/winboard/wengineoutput.c @@ -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 ); } diff --git a/winboard/wevalgraph.c b/winboard/wevalgraph.c index 2efb15e..2896a23 100644 --- a/winboard/wevalgraph.c +++ b/winboard/wevalgraph.c @@ -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 diff --git a/winboard/whistory.c b/winboard/whistory.c index ba69a63..bab9332 100644 --- a/winboard/whistory.c +++ b/winboard/whistory.c @@ -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 ) { diff --git a/winboard/winboard.c b/winboard/winboard.c index 368c68d..1346da4 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -86,6 +86,8 @@ #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 ); /* * Setting "frozen" should disable all user input other than deleting @@ -620,6 +622,9 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine) InitBackEnd1(); + InitEngineUCI( installDir, &first ); + InitEngineUCI( installDir, &second ); + /* Create a main window for this application instance. */ hwnd = CreateWindow(szAppName, szTitle, (WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX), @@ -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: IcsOptionsPopup(hwnd); break; @@ -6253,9 +6286,21 @@ ErrorDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_INITDIALOG: GetWindowRect(hDlg, &rChild); + + /* SetWindowPos(hDlg, NULL, rChild.left, rChild.top + boardRect.top - (rChild.bottom - rChild.top), 0, 0, SWP_NOZORDER|SWP_NOSIZE); + */ + + /* + [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; SetWindowText(hDlg, errorTitle); hwndText = GetDlgItem(hDlg, OPT_ErrorText); @@ -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 ); } diff --git a/winboard/winboard.rc b/winboard/winboard.rc index b4635b2..9727241 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -49,7 +49,7 @@ BEGIN LTEXT "(unofficial version ""X"")",IDC_STATIC,88,4,71,8 END -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 CAPTION "Time Control" FONT 8, "MS Sans Serif" @@ -58,17 +58,16 @@ BEGIN BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,6,113,10 CONTROL "Incremental clock",OPT_TCUseInc,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,6,42,107,10 - EDITTEXT OPT_TCMoves,14,20,22,12,ES_AUTOHSCROLL | WS_GROUP - LTEXT "moves in",OPT_TCtext1,40,22,30,8,NOT WS_GROUP - 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 - LTEXT "minutes initially,",405,51,57,73,8,NOT WS_GROUP - LTEXT "plus",406,19,74,15,8,NOT WS_GROUP - EDITTEXT OPT_TCInc,37,72,32,12,ES_AUTOHSCROLL - LTEXT "seconds per move",408,74,74,67,8,NOT WS_GROUP - 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 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 -DLG_EditComment DIALOG DISCARDABLE 6, 18, 306, 104 +DLG_EditComment DIALOG DISCARDABLE 6, 18, 302, 102 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Edit Comment" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "OK",IDOK,61,86,40,14 - PUSHBUTTON "Cancel",OPT_CancelComment,109,86,40,14 - PUSHBUTTON "&Clear",OPT_ClearComment,157,86,40,14 - PUSHBUTTON "&Edit",OPT_EditComment,205,86,40,14 + PUSHBUTTON "OK",IDOK,194,84,50,14 + PUSHBUTTON "Cancel",OPT_CancelComment,250,84,50,14 CONTROL "",OPT_CommentText,"RICHEDIT",ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | - WS_HSCROLL | WS_TABSTOP,4,4,298,78 + 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 DLG_PromotionKing DIALOG DISCARDABLE 98, 90, 183, 41 @@ -227,17 +226,17 @@ BEGIN EDITTEXT IDC_GameListFilter,178,136,78,14,ES_AUTOHSCROLL END -DLG_EditTags DIALOG DISCARDABLE 6, 18, 160, 141 +DLG_EditTags DIALOG DISCARDABLE 6, 18, 167, 140 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Edit Tags" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "OK",IDOK,12,123,40,14 - PUSHBUTTON "Cancel",OPT_TagsCancel,60,123,40,14 - PUSHBUTTON "&Edit",OPT_EditTags,108,123,40,14 + PUSHBUTTON "OK",IDOK,58,122,50,14 + PUSHBUTTON "Cancel",OPT_TagsCancel,114,122,50,14 CONTROL "",OPT_TagsText,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | - WS_HSCROLL | WS_TABSTOP,4,4,152,115 + WS_HSCROLL | WS_TABSTOP,2,2,162,115 + PUSHBUTTON "&Edit",OPT_EditTags,2,122,50,14 END WBCONSOLE DIALOG DISCARDABLE 0, 0, 335, 133 @@ -267,21 +266,23 @@ BEGIN WS_HSCROLL | WS_TABSTOP,4,4,286,54 END -DLG_Error DIALOG DISCARDABLE 0, 0, 183, 33 +DLG_Error DIALOG DISCARDABLE 0, 0, 220, 66 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Error" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,163,9,16,14 - ICON 32515,IDC_STATIC,4,6,20,20 - LTEXT "Sorry Charlie",OPT_ErrorText,27,4,130,25 + 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 DLG_Colorize DIALOGEX 0, 0, 174, 61 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "ICS Interaction Colors" -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Sans Serif" BEGIN + 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 | WS_TABSTOP,4,24,30,10 @@ -291,8 +292,6 @@ BEGIN 24,45,10 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 | ES_READONLY | WS_GROUP,4,4,106,15,WS_EX_CLIENTEDGE END @@ -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.", OPT_QuestionText,30,2,153,28 - ICON 32514,IDC_STATIC,4,4,21,20 + ICON 32514,IDC_STATIC,4,4,20,20 END DLG_Startup DIALOG DISCARDABLE 0, 0, 276, 127 @@ -355,92 +354,92 @@ BEGIN EDITTEXT OPT_Move,4,4,86,13,ES_AUTOHSCROLL END -DLG_Sound DIALOG DISCARDABLE 0, 0, 257, 95 +DLG_Sound DIALOG DISCARDABLE 0, 0, 242, 105 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Sounds" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,199,6,47,14 - PUSHBUTTON "Cancel",IDCANCEL,199,23,47,14 - PUSHBUTTON "Defaults",OPT_DefaultSounds,199,40,47,14 - COMBOBOX CBO_Sounds,52,6,128,110,CBS_DROPDOWNLIST | WS_VSCROLL | + 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 CONTROL "No sound",OPT_NoSound,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,11,25,47,10 + WS_GROUP | WS_TABSTOP,12,22,47,10 CONTROL "Default beep",OPT_DefaultBeep,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,11,42,57,10 + BS_AUTORADIOBUTTON | WS_TABSTOP,12,36,57,10 CONTROL "Built-in sound:",OPT_BuiltInSound,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,11,59,60,10 - COMBOBOX OPT_BuiltInSoundName,78,58,103,109,CBS_DROPDOWNLIST | + BS_AUTORADIOBUTTON | WS_TABSTOP,12,51,60,10 + COMBOBOX OPT_BuiltInSoundName,76,48,103,109,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Play",OPT_PlaySound,200,57,47,14 + PUSHBUTTON "Play",OPT_PlaySound,188,47,50,14 CONTROL "WAV file:",OPT_WavFile,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,11,76,45,10 - EDITTEXT OPT_WavFileName,78,75,103,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",OPT_BrowseSound,200,74,47,14 - LTEXT "Event:",IDC_STATIC,19,9,26,9 + 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 -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 CAPTION "General Options" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,207,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,208,25,50,14 + DEFPUSHBUTTON "OK",IDOK,110,164,50,14 + PUSHBUTTON "Cancel",IDCANCEL,166,164,50,14 CONTROL "Always on &Top",OPT_AlwaysOnTop,"Button", 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 | 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", 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", 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 | 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", 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", 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 | 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", 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", - BS_AUTOCHECKBOX | WS_TABSTOP,109,6,79,10 - CONTROL "Periodic &Updates",OPT_PeriodicUpdates,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,20,79,10 - CONTROL "Ponder &Next Move",OPT_PonderNextMove,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,34,79,10 - CONTROL "&Popup Exit Message",OPT_PopupExitMessage,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,48,79,10 - CONTROL "Popup Move &Errors",OPT_PopupMoveErrors,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,62,79,10 - CONTROL "Show Butt&on Bar",OPT_ShowButtonBar,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,76,79,10 - CONTROL "Show &Coordinates",OPT_ShowCoordinates,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,90,79,10 - CONTROL "&Show Thinking",OPT_ShowThinking,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,104,79,10 - CONTROL "Test &Legality",OPT_TestLegality,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,109,118,79,10 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 -DLG_IcsOptions DIALOGEX 0, 0, 302, 265 +DLG_IcsOptions DIALOGEX 0, 0, 302, 255 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "ICS Options" FONT 8, "MS Sans Serif" BEGIN - 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 | WS_TABSTOP,10,12,63,8 CONTROL "Auto &Observe",OPT_AutoObserve,"Button",BS_AUTOCHECKBOX | @@ -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, - 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 ¬ colorize messages",OPT_DontColorize,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,104,225,97,10 + BS_AUTOCHECKBOX | WS_TABSTOP,192,212,97,10 CONTROL "",OPT_SampleShout,"RICHEDIT",ES_CENTER | ES_MULTILINE | - ES_READONLY | WS_DISABLED | WS_GROUP,11,101,75,15, + ES_READONLY | WS_DISABLED | WS_GROUP,10,101,75,15, WS_EX_CLIENTEDGE CONTROL "",OPT_SampleSShout,"RICHEDIT",ES_CENTER | ES_MULTILINE | - ES_READONLY | WS_DISABLED | WS_GROUP,11,121,75,15, + ES_READONLY | WS_DISABLED | WS_GROUP,10,121,75,15, WS_EX_CLIENTEDGE CONTROL "",OPT_SampleChannel1,"RICHEDIT",ES_CENTER | - ES_MULTILINE | ES_READONLY | WS_DISABLED | WS_GROUP,11, + ES_MULTILINE | ES_READONLY | WS_DISABLED | WS_GROUP,10, 141,75,15,WS_EX_CLIENTEDGE CONTROL "",OPT_SampleChannel,"RICHEDIT",ES_CENTER | ES_MULTILINE | - ES_READONLY | WS_DISABLED | WS_GROUP,11,161,75,15, + ES_READONLY | WS_DISABLED | WS_GROUP,10,161,75,15, WS_EX_CLIENTEDGE CONTROL "",OPT_SampleKibitz,"RICHEDIT",ES_CENTER | ES_MULTILINE | - 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 | ES_READONLY | WS_DISABLED | WS_GROUP,159,101,75,15, WS_EX_CLIENTEDGE @@ -507,9 +505,9 @@ BEGIN CONTROL "",OPT_SampleNormal,"RICHEDIT",ES_CENTER | ES_MULTILINE | ES_READONLY | WS_DISABLED | WS_GROUP,159,181,75,15, WS_EX_CLIENTEDGE - 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 @@ -522,7 +520,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,140,232,50,14 CONTROL "&Tiny",OPT_SizeTiny,"Button",BS_AUTORADIOBUTTON | 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 CONTROL "&Dinky",OPT_SizeDinky,"Button",BS_AUTORADIOBUTTON,9,34, 50,10 @@ -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 CONTROL "Medi&ocre",OPT_SizeMediocre,"Button",BS_AUTORADIOBUTTON, 70,14,50,10 CONTROL "&Middling",OPT_SizeMiddling,"Button",BS_AUTORADIOBUTTON, - 70,25,50,10 + 70,24,50,10 CONTROL "&Average",OPT_SizeAverage,"Button",BS_AUTORADIOBUTTON, 70,34,50,10 CONTROL "Mode&rate",OPT_SizeModerate,"Button",BS_AUTORADIOBUTTON, 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 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 CONTROL "&Huge",OPT_SizeHuge,"Button",BS_AUTORADIOBUTTON,134,34, 50,10 @@ -555,13 +553,15 @@ BEGIN CONTROL "&Colossal",OPT_SizeColossal,"Button",BS_AUTORADIOBUTTON, 134,54,50,10 CONTROL "Tita&nic",OPT_SizeTitanic,"Button",BS_AUTORADIOBUTTON, - 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 @@ -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 | - WS_TABSTOP,10,210,64,10 EDITTEXT OPT_SampleLightSquare,144,96,39,36,ES_READONLY | WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT OPT_SampleDarkSquare,144,138,39,36,ES_READONLY | WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP END -DLG_Fonts DIALOG DISCARDABLE 0, 0, 280, 231 +DLG_Fonts DIALOG DISCARDABLE 0, 0, 266, 226 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Fonts" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,168,212,50,14 - PUSHBUTTON "Cancel",IDCANCEL,224,212,50,14 - PUSHBUTTON "Choose...",OPT_ChooseClockFont,221,17,45,15 - PUSHBUTTON "Choose...",OPT_ChooseMessageFont,221,47,45,15 - PUSHBUTTON "Choose...",OPT_ChooseCoordFont,221,77,45,15 - PUSHBUTTON "Choose...",OPT_ChooseTagFont,221,120,45,15 - PUSHBUTTON "Choose...",OPT_ChooseCommentsFont,221,150,45,15 - PUSHBUTTON "Choose...",OPT_ChooseConsoleFont,221,180,45,15 - 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 | - WS_DISABLED | WS_BORDER,70,72,140,20 + WS_DISABLED | WS_BORDER,67,71,140,20 CONTROL "",OPT_SampleTagFont,"RICHEDIT",ES_READONLY | - WS_DISABLED | WS_BORDER,70,115,140,20 + WS_DISABLED | WS_BORDER,67,114,140,20 CONTROL "",OPT_SampleCommentsFont,"RICHEDIT",ES_READONLY | - WS_DISABLED | WS_BORDER,70,145,140,20 + WS_DISABLED | WS_BORDER,67,144,140,20 CONTROL "",OPT_SampleConsoleFont,"RICHEDIT",ES_READONLY | - WS_DISABLED | WS_BORDER,70,175,140,20 - LTEXT "Clocks",OPT_ClockFont,16,17,45,10,NOT WS_GROUP - LTEXT "Messages",OPT_MessageFont,16,47,45,10,NOT WS_GROUP - LTEXT "Coordinates",OPT_CoordFont,16,77,45,10,NOT WS_GROUP - LTEXT "Tags",OPT_EditTagsFont,16,120,45,10,NOT WS_GROUP - LTEXT "Comments",OPT_CommentsFont,16,150,45,10,NOT WS_GROUP - LTEXT "ICS Interaction",OPT_MessageFont5,16,180,50,10,NOT + 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 CONTROL "",OPT_SampleClockFont,"RICHEDIT",ES_READONLY | - WS_DISABLED | WS_BORDER,70,12,140,20 + WS_DISABLED | WS_BORDER,67,11,140,20 CONTROL "",OPT_SampleMessageFont,"RICHEDIT",ES_READONLY | - WS_DISABLED | WS_BORDER,70,42,140,20 - GROUPBOX "Current Board Size",IDC_STATIC,5,2,270,100 - GROUPBOX "All Board Sizes",IDC_STATIC,5,105,270,100 + 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 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 + ///////////////////////////////////////////////////////////////////////////// // @@ -743,9 +766,9 @@ BEGIN DLG_GeneralOptions, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 264 + RIGHTMARGIN, 213 TOPMARGIN, 7 - BOTTOMMARGIN, 155 + BOTTOMMARGIN, 176 END DLG_IcsOptions, DIALOG @@ -753,7 +776,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 295 TOPMARGIN, 7 - BOTTOMMARGIN, 258 + BOTTOMMARGIN, 248 END DLG_BoardOptions, DIALOG @@ -767,9 +790,9 @@ BEGIN DLG_Fonts, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 273 + RIGHTMARGIN, 259 TOPMARGIN, 7 - BOTTOMMARGIN, 224 + BOTTOMMARGIN, 219 END 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 #endif // APSTUDIO_INVOKED @@ -830,9 +861,16 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. +IDI_WHITE_14 ICON DISCARDABLE "bitmaps\\white_14.ico" ICON_BLACK ICON DISCARDABLE "bitmaps\\icon_ob.ico" ICON_BOARD ICON DISCARDABLE "bitmaps\\board.ico" ICON_WHITE ICON DISCARDABLE "bitmaps\\icon_whi.ico" +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" ///////////////////////////////////////////////////////////////////////////// // @@ -932,6 +970,7 @@ BEGIN MENUITEM "&General...", IDM_GeneralOptions MENUITEM "&Board...", IDM_BoardOptions MENUITEM "Engines...", IDM_EnginePlayOptions + MENUITEM "UCI...", IDM_OptionsUCI MENUITEM "&ICS...", IDM_IcsOptions, GRAYED MENUITEM "&Fonts...", IDM_Fonts MENUITEM "Soun&ds...", IDM_Sounds diff --git a/winboard/wlayout.c b/winboard/wlayout.c index 169c7ea..c0606bb 100644 --- a/winboard/wlayout.c +++ b/winboard/wlayout.c @@ -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 diff --git a/winboard/woptions.c b/winboard/woptions.c index 41df86c..16e9313 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -26,6 +26,7 @@ #include /* required for all Windows applications */ #include #include +#include /* [AS] Requires NT 4.0 or Win95 */ #include "common.h" #include "winboard.h" @@ -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); +} diff --git a/winboard/woptions.h b/winboard/woptions.h index a26d8e4..294b5f9 100644 --- a/winboard/woptions.h +++ b/winboard/woptions.h @@ -33,3 +33,4 @@ VOID LoadOptionsPopup(HWND hwnd); VOID SaveOptionsPopup(HWND hwnd); VOID TimeControlOptionsPopup(HWND hwnd); VOID EnginePlayOptionsPopup(HWND hwnd); +VOID UciOptionsPopup(HWND hwnd); \ No newline at end of file diff --git a/winboard/wsnap.c b/winboard/wsnap.c index cba18c0..e6f6151 100644 --- a/winboard/wsnap.c +++ b/winboard/wsnap.c @@ -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 ); } diff --git a/winboard/wsnap.h b/winboard/wsnap.h index 5fb226e..818144a 100644 --- a/winboard/wsnap.h +++ b/winboard/wsnap.h @@ -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 --- 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; } -- 1.7.0.4