/*\r
* woptions.c -- Options dialog box routines for WinBoard\r
*\r
- * Copyright 2000, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.\r
+ * Copyright 2000, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.\r
*\r
* Enhancements Copyright 2005 Alessandro Scotti\r
*\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
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
\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
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
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