X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwoptions.c;h=1979228276b248dad57cfc18c326228c16d4158d;hb=a009a27e8c1e0bfa818f12fdcae675d0babc510a;hp=71ccea99da3b1fe2450908a4dbdf4f0f46560546;hpb=fd0f5f8d849c581ac265dce6dd7de3cbec38b7cb;p=xboard.git diff --git a/winboard/woptions.c b/winboard/woptions.c index 71ccea9..1979228 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -1,7 +1,7 @@ /* * woptions.c -- Options dialog box routines for WinBoard * - * Copyright 2000, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * Copyright 2000, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -608,8 +608,9 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lsc = lightSquareColor; dsc = darkSquareColor; - wpc = whitePieceColor; - bpc = blackPieceColor; + fonts = appData.useFont; + wpc = fonts ? appData.fontBackColorWhite : whitePieceColor; + bpc = fonts ? appData.fontForeColorBlack : blackPieceColor; hsc = highlightSquareColor; phc = premoveHighlightColor; mono = appData.monoMode; @@ -617,7 +618,6 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) flip = appData.upsideDown; size = boardSize; bitmaps = appData.useBitmaps; - fonts = appData.useFont; grid = appData.overrideLineGap >= 0; SetBoardOptionEnables(hDlg); @@ -661,8 +661,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if ((mono != appData.monoMode) || (lsc != lightSquareColor) || (dsc != darkSquareColor) || - (wpc != whitePieceColor) || - (bpc != blackPieceColor) || + (wpc != fonts ? appData.fontBackColorWhite : whitePieceColor) || + (bpc != fonts ? appData.fontForeColorBlack : blackPieceColor) || (hsc != highlightSquareColor) || (flip != appData.upsideDown) || (white != appData.allWhite) || @@ -673,8 +673,13 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lightSquareColor = lsc; darkSquareColor = dsc; - whitePieceColor = wpc; - blackPieceColor = bpc; + if(fonts) { + appData.fontBackColorWhite = wpc; + appData.fontForeColorBlack = bpc; + } else { + whitePieceColor = wpc; + blackPieceColor = bpc; + } highlightSquareColor = hsc; premoveHighlightColor = phc; appData.monoMode = mono; @@ -1188,6 +1193,7 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) CHECK_BOX(OPT_AutoKibitz, appData.autoKibitz); CHECK_BOX(OPT_AutoComment, appData.autoComment); CHECK_BOX(OPT_AutoObserve, appData.autoObserve); + CHECK_BOX(OPT_AutoCreate, appData.autoCreateLogon); CHECK_BOX(OPT_GetMoveList, appData.getMoveList); CHECK_BOX(OPT_LocalLineEditing, appData.localLineEditing); CHECK_BOX(OPT_QuietPlay, appData.quietPlay); @@ -1273,6 +1279,7 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) appData.autoKibitz = IS_CHECKED(OPT_AutoKibitz); appData.autoComment = IS_CHECKED(OPT_AutoComment); appData.autoObserve = IS_CHECKED(OPT_AutoObserve); + appData.autoCreateLogon = IS_CHECKED(OPT_AutoCreate); appData.getMoveList = IS_CHECKED(OPT_GetMoveList); appData.localLineEditing = IS_CHECKED(OPT_LocalLineEditing); appData.quietPlay = IS_CHECKED(OPT_QuietPlay); @@ -2707,7 +2714,8 @@ LRESULT CALLBACK TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { char buf[MSG_SIZ], *tc; - int mps, increment, odds1, odds2, st; + int mps, odds1, odds2, st; + float increment; BOOL ok, ok2; switch (message) { @@ -2731,12 +2739,15 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, OPT_TCTime2, ""); SetDlgItemText(hDlg, OPT_TCInc, ""); } else { + int i = appData.timeIncrement; + if(i == appData.timeIncrement) snprintf(buf, MSG_SIZ, "%d", i); + else snprintf(buf, MSG_SIZ, "%4.2f", appData.timeIncrement); CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed, OPT_TCUseInc); SetDlgItemText(hDlg, OPT_TCTime, ""); SetDlgItemText(hDlg, OPT_TCMoves, ""); SetDlgItemText(hDlg, OPT_TCTime2, appData.timeControl); - SetDlgItemInt(hDlg, OPT_TCInc, appData.timeIncrement, FALSE); + SetDlgItemText(hDlg, OPT_TCInc, buf); } SetDlgItemInt(hDlg, OPT_TCOdds1, 1, FALSE); SetDlgItemInt(hDlg, OPT_TCOdds2, 1, FALSE); @@ -2776,7 +2787,8 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } tc = buf; } else { - increment = GetDlgItemInt(hDlg, OPT_TCInc, &ok, FALSE); + GetDlgItemText(hDlg, OPT_TCInc, buf, MSG_SIZ); + ok = (sscanf(buf, "%f%c", &increment, buf) == 1); if (!ok || increment < 0) { MessageBox(hDlg, _("Invalid increment"), _("Option Error"), MB_OK|MB_ICONEXCLAMATION); @@ -2946,6 +2958,20 @@ VOID EnginePlayOptionsPopup(HWND hwnd) * UCI Options Dialog functions * \*---------------------------------------------------------------------------*/ +INT CALLBACK BrowseCallbackProc(HWND hwnd, + UINT uMsg, + LPARAM lp, + LPARAM pData) +{ + switch(uMsg) + { + case BFFM_INITIALIZED: + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pData); + break; + } + return 0; +} + BOOL BrowseForFolder( const char * title, char * path ) { BOOL result = FALSE; @@ -2956,6 +2982,8 @@ BOOL BrowseForFolder( const char * title, char * path ) bi.lpszTitle = title == 0 ? _("Choose Folder") : title; bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.lpfn = BrowseCallbackProc; + bi.lParam = (LPARAM) path; pidl = SHBrowseForFolder( &bi );