/*\r
* woptions.c -- Options dialog box routines for WinBoard\r
*\r
- * Copyright 2000, 2009, 2010, 2011 Free Software Foundation, Inc.\r
+ * Copyright 2000, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free\r
+ * Software Foundation, Inc.\r
*\r
* Enhancements Copyright 2005 Alessandro Scotti\r
*\r
CHECK_BOX(OPT_HighlightMoveArrow, appData.highlightMoveWithArrow);\r
CHECK_BOX(OPT_AutoLogo, appData.autoLogo); // [HGM] logo\r
CHECK_BOX(OPT_SmartMove, appData.oneClick); // [HGM] one-click\r
+ CHECK_BOX(OPT_AutoTags, appData.autoDisplayTags); // [HGM]\r
+ CHECK_BOX(OPT_AutoComment, appData.autoDisplayComment); // [HGM]\r
+ CHECK_BOX(OPT_Headers, appData.headers); // [HGM]\r
+ CHECK_BOX(OPT_Variations, appData.variations); // [HGM]\r
+ CHECK_BOX(OPT_AutoExtend, appData.autoExtend); // [HGM]\r
\r
#undef CHECK_BOX\r
\r
appData.highlightMoveWithArrow=IS_CHECKED(OPT_HighlightMoveArrow);\r
appData.autoLogo =IS_CHECKED(OPT_AutoLogo); // [HGM] logo\r
appData.oneClick =IS_CHECKED(OPT_SmartMove); // [HGM] one-click\r
+ appData.autoDisplayTags =IS_CHECKED(OPT_AutoTags); // [HGM]\r
+ appData.autoDisplayComment =IS_CHECKED(OPT_AutoComment); // [HGM]\r
+ appData.headers =IS_CHECKED(OPT_Headers); // [HGM]\r
+ appData.variations =IS_CHECKED(OPT_Variations); // [HGM]\r
+ appData.autoExtend =IS_CHECKED(OPT_AutoExtend); // [HGM]\r
\r
#undef IS_CHECKED\r
\r
/*\r
* clean up\r
*/\r
- SelectObject(hdcMem, oldBrushPiece);\r
+ SelectObject(hdcMem, oldBrushSquare);\r
SelectObject(hdcMem, oldPen);\r
DeleteObject(brushPiece);\r
DeleteObject(brushPieceDetail);\r
LRESULT CALLBACK\r
BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
- static Boolean mono, white, flip, fonts, bitmaps;\r
+ static Boolean mono, white, flip, fonts, bitmaps, grid;\r
static BoardSize size;\r
static COLORREF lsc, dsc, wpc, bpc, hsc, phc;\r
static HBITMAP pieces[3];\r
if (appData.useFont)\r
CheckDlgButton(hDlg, OPT_PieceFont, TRUE);\r
\r
+ if (appData.overrideLineGap >= 0)\r
+ CheckDlgButton(hDlg, OPT_Grid, TRUE);\r
+\r
pieces[0] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "s");\r
pieces[1] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "w");\r
pieces[2] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "o");\r
\r
lsc = lightSquareColor;\r
dsc = darkSquareColor;\r
- wpc = whitePieceColor;\r
- bpc = blackPieceColor;\r
+ fonts = appData.useFont;\r
+ wpc = fonts ? appData.fontBackColorWhite : whitePieceColor;\r
+ bpc = fonts ? appData.fontForeColorBlack : blackPieceColor;\r
hsc = highlightSquareColor;\r
phc = premoveHighlightColor;\r
mono = appData.monoMode;\r
flip = appData.upsideDown;\r
size = boardSize;\r
bitmaps = appData.useBitmaps;\r
- fonts = appData.useFont;\r
+ grid = appData.overrideLineGap >= 0;\r
\r
SetBoardOptionEnables(hDlg);\r
return TRUE;\r
if ((mono != appData.monoMode) ||\r
(lsc != lightSquareColor) ||\r
(dsc != darkSquareColor) ||\r
- (wpc != whitePieceColor) ||\r
- (bpc != blackPieceColor) ||\r
+ (wpc != fonts ? appData.fontBackColorWhite : whitePieceColor) ||\r
+ (bpc != fonts ? appData.fontForeColorBlack : blackPieceColor) ||\r
(hsc != highlightSquareColor) ||\r
(flip != appData.upsideDown) ||\r
(white != appData.allWhite) ||\r
(fonts != appData.useFont) ||\r
(bitmaps != appData.useBitmaps) ||\r
+ (grid != appData.overrideLineGap >= 0) ||\r
(phc != premoveHighlightColor)) {\r
\r
lightSquareColor = lsc;\r
darkSquareColor = dsc;\r
- whitePieceColor = wpc;\r
- blackPieceColor = bpc;\r
+ if(fonts) {\r
+ appData.fontBackColorWhite = wpc;\r
+ appData.fontForeColorBlack = bpc;\r
+ } else {\r
+ whitePieceColor = wpc;\r
+ blackPieceColor = bpc;\r
+ }\r
highlightSquareColor = hsc;\r
premoveHighlightColor = phc;\r
appData.monoMode = mono;\r
appData.upsideDown = flip;\r
appData.useFont = fonts;\r
appData.useBitmaps = bitmaps;\r
+ if(grid != appData.overrideLineGap >= 0) appData.overrideLineGap = grid - 1;\r
\r
InitDrawingColors();\r
InitDrawingSizes(boardSize, 0);\r
}\r
DeleteObject(pieces[0]);\r
DeleteObject(pieces[1]);\r
+\r
DeleteObject(pieces[2]);\r
return TRUE;\r
\r
case OPT_PieceFont:\r
fonts = !fonts;\r
break;\r
+\r
+ case OPT_Grid:\r
+ grid = !grid;\r
+ break;\r
}\r
break;\r
}\r
-1,\r
-1,\r
OPT_VariantShogi,\r
- OPT_VariantXiangqi,\r
+ -1, // Chu\r
OPT_VariantCourier,\r
OPT_VariantGothic,\r
OPT_VariantCapablanca,\r
OPT_VariantSChess,\r
OPT_VariantGrand,\r
OPT_VariantSpartan, // Spartan\r
+ OPT_VariantXiangqi,\r
+ OPT_VariantASEAN,\r
+ OPT_VariantLion,\r
-2 // sentinel\r
};\r
\r
VariantWhichRadio(HWND hDlg)\r
{\r
int i=0, j;\r
+ *engineVariant = NULLCHAR;\r
while((j = radioButton[i++]) != -2) {\r
if(j == -1) continue; // no menu button\r
if(IsDlgButtonChecked(hDlg, j) &&\r
(appData.noChessProgram || strstr(first.variants, VariantName(i-1)))) return (VariantClass) i-1;\r
}\r
+ for(i=0; i<15; i++) { // check for engine-defined variants\r
+ if(IsDlgButtonChecked(hDlg, OPT_EngineVariant+i) ) {\r
+ GetDlgItemText(hDlg, OPT_EngineVariant+i, engineVariant, MSG_SIZ); // remember name, so we can resolve it later\r
+ return VariantUnknown;\r
+ }\r
+ }\r
return gameInfo.variant; // If no button checked, keep old\r
}\r
\r
void\r
VariantShowRadio(HWND hDlg)\r
{\r
+ char c = *engineVariant, *v, *p;\r
int i=0, j;\r
CheckDlgButton(hDlg, radioButton[gameInfo.variant], TRUE);\r
+ *engineVariant = NULLCHAR; // [HGM] kludge to prevent VariantName will always return engineVariant\r
while((j = radioButton[i++]) != -2) {\r
if(j == -1) continue; // no menu button\r
- EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || strstr(first.variants, VariantName(i-1)));\r
+ v = VariantName(i-1); p = strstr(first.variants, v);\r
+ EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || p && (!*v || strlen(v) == strlen(p) || p[strlen(v)] == ','));\r
+ }\r
+ *engineVariant = c;\r
+ for(i=0; i<15; i++) { // initialize engine-defined variants\r
+ char *v = EngineDefinedVariant(&first, i); // get name of #i\r
+ if(v) { // there is such a variant\r
+ EnableWindow(GetDlgItem(hDlg, OPT_EngineVariant+i), TRUE); // and enable the button\r
+ SetDlgItemText(hDlg, OPT_EngineVariant+i, v); // put its name on button\r
+ } else EnableWindow(GetDlgItem(hDlg, OPT_EngineVariant+i), FALSE); // no such variant; disable button\r
}\r
}\r
\r
}\r
\r
gameInfo.variant = v;\r
- appData.variant = VariantName(v);\r
+ ASSIGN(appData.variant, VariantName(v));\r
\r
appData.NrFiles = (int) GetDlgItemInt(hDlg, IDC_Files, NULL, FALSE );\r
appData.NrRanks = (int) GetDlgItemInt(hDlg, IDC_Ranks, NULL, FALSE );\r
shuffleOpenings = FALSE; /* [HGM] shuffle: possible shuffle reset when we switch */\r
startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */\r
appData.pieceToCharTable = NULL;\r
+ ASSIGN(appData.pieceNickNames, "");\r
+ ASSIGN(appData.colorNickNames, "");\r
+ ASSIGN(appData.men, "");\r
Reset(TRUE, TRUE);\r
\r
return TRUE;\r
CHECK_BOX(OPT_AutoKibitz, appData.autoKibitz);\r
CHECK_BOX(OPT_AutoComment, appData.autoComment);\r
CHECK_BOX(OPT_AutoObserve, appData.autoObserve);\r
+ CHECK_BOX(OPT_AutoCreate, appData.autoCreateLogon);\r
CHECK_BOX(OPT_GetMoveList, appData.getMoveList);\r
CHECK_BOX(OPT_LocalLineEditing, appData.localLineEditing);\r
CHECK_BOX(OPT_QuietPlay, appData.quietPlay);\r
appData.autoKibitz = IS_CHECKED(OPT_AutoKibitz);\r
appData.autoComment = IS_CHECKED(OPT_AutoComment);\r
appData.autoObserve = IS_CHECKED(OPT_AutoObserve);\r
+ appData.autoCreateLogon = IS_CHECKED(OPT_AutoCreate);\r
appData.getMoveList = IS_CHECKED(OPT_GetMoveList);\r
appData.localLineEditing = IS_CHECKED(OPT_LocalLineEditing);\r
appData.quietPlay = IS_CHECKED(OPT_QuietPlay);\r
UpdateSampleText(hDlg, OPT_SampleSeek, &mca[ColorSeek]);\r
break;\r
\r
+\r
+\r
+\r
case OPT_ChooseNormalColor:\r
ColorizeTextPopup(hDlg, ColorNormal);\r
UpdateSampleText(hDlg, OPT_SampleNormal, &mca[ColorNormal]);\r
SoundComboData soundComboData[] = {\r
{N_("Move"), NULL},\r
{N_("Bell"), NULL},\r
+ {N_("Roar"), NULL},\r
{N_("ICS Alarm"), NULL},\r
{N_("ICS Win"), NULL},\r
{N_("ICS Loss"), NULL},\r
return (IsDlgButtonChecked(hDlg, OPT_Exact) ? 1 :\r
(IsDlgButtonChecked(hDlg, OPT_Subset) ? 2 :\r
(IsDlgButtonChecked(hDlg, OPT_Struct) ? 3 :\r
- (IsDlgButtonChecked(hDlg, OPT_Material) ? 4 : -1))));\r
+ (IsDlgButtonChecked(hDlg, OPT_Material) ? 4 :\r
+ (IsDlgButtonChecked(hDlg, OPT_Range) ? 5 :\r
+ (IsDlgButtonChecked(hDlg, OPT_Difference) ? 6 : -1))))));\r
}\r
\r
VOID\r
SetDlgItemInt(hDlg, OPT_elo1, appData.eloThreshold1, FALSE);\r
SetDlgItemInt(hDlg, OPT_elo2, appData.eloThreshold2, FALSE);\r
SetDlgItemInt(hDlg, OPT_date, appData.dateThreshold, FALSE);\r
+ SetDlgItemInt(hDlg, OPT_Stretch, appData.stretch, FALSE);\r
+ CheckDlgButton(hDlg, OPT_Reversed, appData.ignoreColors);\r
+ CheckDlgButton(hDlg, OPT_Mirror, appData.findMirror);\r
+ SetDlgItemText(hDlg, OPT_Counts, "");\r
switch (appData.searchMode) {\r
case 1:\r
CheckDlgButton(hDlg, OPT_Exact, TRUE);\r
case 4:\r
CheckDlgButton(hDlg, OPT_Material, TRUE);\r
break;\r
+ case 5:\r
+ CheckDlgButton(hDlg, OPT_Range, TRUE);\r
+ break;\r
+ case 6:\r
+ CheckDlgButton(hDlg, OPT_Difference, TRUE);\r
+ break;\r
}\r
return TRUE;\r
\r
appData.eloThreshold1 = GetDlgItemInt(hDlg, OPT_elo1, &ok, FALSE);\r
appData.eloThreshold2 = GetDlgItemInt(hDlg, OPT_elo2, &ok, FALSE);\r
appData.dateThreshold = GetDlgItemInt(hDlg, OPT_date, &ok, FALSE);\r
+ appData.stretch = GetDlgItemInt(hDlg, OPT_Stretch, &ok, FALSE);\r
appData.searchMode = LoadOptionsWhichRadio(hDlg);\r
+ appData.ignoreColors = IsDlgButtonChecked(hDlg, OPT_Reversed);\r
+ appData.findMirror = IsDlgButtonChecked(hDlg, OPT_Mirror);\r
+ GetDlgItemText(hDlg, OPT_Counts, buf, MSG_SIZ);\r
+ appData.minPieces = appData.maxPieces = 0;\r
+ sscanf(buf, "%d-%d", &appData.minPieces, &appData.maxPieces);\r
+ if(appData.maxPieces < appData.minPieces) appData.maxPieces = appData.minPieces;\r
EndDialog(hDlg, TRUE);\r
return TRUE;\r
\r
TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
char buf[MSG_SIZ], *tc;\r
- int mps, increment, odds1, odds2, st;\r
+ int mps, odds1, odds2, st;\r
+ float increment;\r
BOOL ok, ok2;\r
\r
switch (message) {\r
CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
Translate(hDlg, DLG_TimeControl);\r
/* Initialize the dialog items */\r
- if (appData.clockMode && !appData.icsActive) {\r
+ if (/*appData.clockMode &&*/ !appData.icsActive) { // [HGM] even if !clockMode, we could want to set it in tournament dialog\r
if (searchTime) {\r
CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed,\r
OPT_TCUseFixed);\r
SetDlgItemText(hDlg, OPT_TCTime2, "");\r
SetDlgItemText(hDlg, OPT_TCInc, "");\r
} else {\r
+ int i = appData.timeIncrement;\r
+ if(i == appData.timeIncrement) snprintf(buf, MSG_SIZ, "%d", i);\r
+ else snprintf(buf, MSG_SIZ, "%4.2f", appData.timeIncrement);\r
CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed,\r
OPT_TCUseInc);\r
SetDlgItemText(hDlg, OPT_TCTime, "");\r
SetDlgItemText(hDlg, OPT_TCMoves, "");\r
SetDlgItemText(hDlg, OPT_TCTime2, appData.timeControl);\r
- SetDlgItemInt(hDlg, OPT_TCInc, appData.timeIncrement, FALSE);\r
+ SetDlgItemText(hDlg, OPT_TCInc, buf);\r
}\r
SetDlgItemInt(hDlg, OPT_TCOdds1, 1, FALSE);\r
SetDlgItemInt(hDlg, OPT_TCOdds2, 1, FALSE);\r
}\r
tc = buf;\r
} else {\r
- increment = GetDlgItemInt(hDlg, OPT_TCInc, &ok, FALSE);\r
+ GetDlgItemText(hDlg, OPT_TCInc, buf, MSG_SIZ);\r
+ ok = (sscanf(buf, "%f%c", &increment, buf) == 1);\r
if (!ok || increment < 0) {\r
MessageBox(hDlg, _("Invalid increment"),\r
_("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
* UCI Options Dialog functions\r
*\r
\*---------------------------------------------------------------------------*/\r
+INT CALLBACK BrowseCallbackProc(HWND hwnd, \r
+ UINT uMsg,\r
+ LPARAM lp, \r
+ LPARAM pData) \r
+{\r
+ switch(uMsg) \r
+ {\r
+ case BFFM_INITIALIZED: \r
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pData);\r
+ break;\r
+ }\r
+ return 0;\r
+}\r
+\r
BOOL BrowseForFolder( const char * title, char * path )\r
{\r
BOOL result = FALSE;\r
\r
bi.lpszTitle = title == 0 ? _("Choose Folder") : title;\r
bi.ulFlags = BIF_RETURNONLYFSDIRS;\r
+ bi.lpfn = BrowseCallbackProc;\r
+ bi.lParam = (LPARAM) path;\r
\r
pidl = SHBrowseForFolder( &bi );\r
\r
return result;\r
}\r
\r
+int\r
+IsMultiFormat(char *s)\r
+{\r
+ char *p = strchr(s, ':');\r
+ return p && p != s+1;\r
+}\r
+\r
LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
char buf[MAX_PATH];\r
/* Initialize the dialog items */\r
SetDlgItemText( hDlg, IDC_PolyglotDir, appData.polyglotDir );\r
SetDlgItemInt( hDlg, IDC_HashSize, appData.defaultHashSize, TRUE );\r
+ if(appData.defaultPathEGTB[0])\r
SetDlgItemText( hDlg, IDC_PathToEGTB, appData.defaultPathEGTB );\r
+ else\r
+ SetDlgItemText( hDlg, IDC_PathToEGTB, appData.egtFormats );\r
SetDlgItemInt( hDlg, IDC_SizeOfEGTB, appData.defaultCacheSizeEGTB, TRUE );\r
CheckDlgButton( hDlg, IDC_UseBook, (BOOL) appData.usePolyglotBook );\r
SetDlgItemText( hDlg, IDC_BookFile, appData.polyglotBook );\r
SetDlgItemInt( hDlg, IDC_Games, appData.defaultMatchGames, TRUE );\r
\r
SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 );\r
+ // [HGM] Yet another ponder duplicate\r
+ CheckDlgButton( hDlg, OPT_PonderNextMove, (BOOL) appData.ponderNextMove );\r
\r
return TRUE;\r
\r
appData.defaultHashSize = GetDlgItemInt(hDlg, IDC_HashSize, NULL, FALSE );\r
appData.defaultCacheSizeEGTB = GetDlgItemInt(hDlg, IDC_SizeOfEGTB, NULL, FALSE );\r
GetDlgItemText( hDlg, IDC_PathToEGTB, buf, sizeof(buf) );\r
- appData.defaultPathEGTB = strdup(buf);\r
+ if(IsMultiFormat(buf)) {\r
+ ASSIGN(appData.egtFormats, buf);\r
+ } else {\r
+ ASSIGN(appData.defaultPathEGTB, buf);\r
+ }\r
GetDlgItemText( hDlg, IDC_BookFile, buf, sizeof(buf) );\r
appData.polyglotBook = strdup(buf);\r
appData.usePolyglotBook = (Boolean) IsDlgButtonChecked( hDlg, IDC_UseBook );\r
- // [HGM] smp: get nr of cores:\r
+ // [HGM] smp: get nr of cores and ponder:\r
oldCores = appData.smpCores;\r
appData.smpCores = GetDlgItemInt(hDlg, IDC_Cores, NULL, FALSE );\r
if(appData.smpCores != oldCores) NewSettingEvent(FALSE, &(first.maxCores), "cores", appData.smpCores);\r
+ PonderNextMoveEvent((Boolean) IsDlgButtonChecked( hDlg, OPT_PonderNextMove ));\r
// [HGM] book: read tick boxes for own book use\r
appData.firstHasOwnBookUCI = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook1 );\r
appData.secondHasOwnBookUCI = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook2 );\r
ofn.hwndOwner = hDlg;\r
ofn.hInstance = hInst;\r
ofn.lpstrFilter = filter;\r
+\r
ofn.lpstrFile = buf;\r
ofn.nMaxFile = sizeof(buf);\r
ofn.lpstrTitle = _("Choose Book");\r