char *firstEngineLine;
char *secondEngineLine;
char *icsNick;
+char *theme;
void EnsureOnScreen(int *x, int *y, int minX, int minY);
char StringGet(void *getClosure);
{ "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
{ "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
{ "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
+ { "theme", ArgString, (void *) &theme, FALSE, (ArgIniType) "" },
/* some options only used by the XBoard front end, and ignored in WinBoard */
/* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
TRUE, (ArgIniType) FCP_NAMES },
{ "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
!XBOARD, (ArgIniType) SCP_NAMES },
+ { "themeNames", ArgString, (void *) &appData.themeNames, !XBOARD, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" },
{ "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
{ "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
{ "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
{ "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
{ "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
{ "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
- { "liteBackTextureFile", ArgString, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
- { "darkBackTextureFile", ArgString, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
+ { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
+ { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID },
+ { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
+ { "dbtf", ArgFilename, (void *) &appData.darkBackTextureFile, FALSE, INVALID },
{ "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
+ { "lbtm", ArgInt, (void *) &appData.liteBackTextureMode, FALSE, INVALID },
{ "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
+ { "dbtm", ArgInt, (void *) &appData.darkBackTextureMode, FALSE, INVALID },
{ "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
+ { "pf", ArgString, (void *) &appData.renderPiecesWithFont, FALSE, INVALID },
{ "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
+ { "fptc", ArgString, (void *) &appData.fontToPieceTable, FALSE, INVALID },
{ "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
{ "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
{ "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
{ "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
+ { "fpfcw", ArgColor, (void *) 9, FALSE, INVALID },
+ { "fpbcb", ArgColor, (void *) 10, FALSE, INVALID },
{ "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
{ "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
{ "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
{ "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
{ "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
{ "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
+ { "upf", ArgBoolean, (void *) &appData.useFont, FALSE, INVALID },
{ "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
+ { "ubt", ArgBoolean, (void *) &appData.useBitmaps, FALSE, INVALID },
{ "useBorder", ArgBoolean, (void *) &appData.useBorder, TRUE, (ArgIniType) FALSE },
+ { "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
{ "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
// [HGM] tournament options
ToNrEvent(currentMove+1);
}
+void
+LoadTheme ()
+{
+ char *p, *q, buf[MSG_SIZ];
+ if(engineLine && engineLine[0]) { // a theme was selected from the listbox
+ snprintf(buf, MSG_SIZ, "-theme %s", engineLine);
+ ParseArgsFromString(buf);
+ ActivateTheme(TRUE); // also redo colors
+ return;
+ }
+ p = nickName;
+ if(*p && !strchr(p, '"')) // theme name specified and well-formed; add settings to theme list
+ {
+ int len;
+ q = appData.themeNames;
+ snprintf(buf, MSG_SIZ, "\"%s\"", nickName);
+ if(appData.useBitmaps) {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ubt true -lbtf \"%s\" -dbtf \"%s\" -lbtm %d -dbtm %d",
+ appData.liteBackTextureFile, appData.darkBackTextureFile,
+ appData.liteBackTextureMode,
+ appData.darkBackTextureMode );
+ } else {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ubt false -lsc %s -dsc %s",
+ Col2Text(2), // lightSquareColor
+ Col2Text(3) ); // darkSquareColor
+ }
+ if(appData.useBorder) {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ub true -border \"%s\"",
+ appData.border);
+ } else {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ub false");
+ }
+ if(appData.useFont) {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -upf true -pf \"%s\" -fptc \"%s\" -fpfcw %s -fpbcb %s",
+ appData.renderPiecesWithFont,
+ appData.fontToPieceTable,
+ Col2Text(9), // appData.fontBackColorWhite
+ Col2Text(10) ); // appData.fontForeColorBlack
+ } else {
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -upf false -pid \"%s\"",
+ appData.pieceDirectory);
+ if(!appData.pieceDirectory[0])
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -wpc %s -bpc %s",
+ Col2Text(0), // whitePieceColor
+ Col2Text(1) ); // blackPieceColor
+ }
+ snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -hsc %s -phc %s\n",
+ Col2Text(4), // highlightSquareColor
+ Col2Text(5) ); // premoveHighlightColor
+ appData.themeNames = malloc(len = strlen(q) + strlen(buf) + 1);
+ if(insert != q) insert[-1] = NULLCHAR;
+ snprintf(appData.themeNames, len, "%s\n%s%s", q, buf, insert);
+ if(q) free(q);
+ }
+ ActivateTheme(FALSE);
+}
int MultiPV P((ChessProgramState *cps));
void MoveHistorySet P(( char movelist[][2*MOVE_LEN], int first, int last, int current, ChessProgramStats_Move * pvInfo ));
void MakeEngineOutputTitle P((void));
+void LoadTheme P((void));
/* A point in time */
typedef struct {
Boolean firstPlaysBlack;
Boolean noChessProgram;
char *host[ENGINES];
+ char *themeNames;
char *pieceDirectory;
char *border;
char *soundDirectory;
#endif
}
+void
+ActivateTheme (int col)
+{
+}
+
+char *
+Col2Text (int n)
+{
+ return NULL;
+}
Boolean EvalGraphIsUp P((void));
int EvalGraphDialogExists P((void));
void SlavePopUp P((void));
+void ActivateTheme P((int new));
+char *Col2Text P((int n));
/* these are in xhistory.c */
Boolean MoveHistoryIsUp P((void));
#define DLG_NewGameFRC 457\r
#define DLG_GameListOptions 458\r
#define DLG_MoveHistory 459\r
+#define IDM_ThemeOptions 460\r
#define DLG_EvalGraph 461\r
#define DLG_EngineOutput 463\r
#define DLG_EnginePlayOptions 464\r
backTextureSquareSize = 0; // kludge to force recalculation of texturemode\r
\r
if( appData.liteBackTextureFile && appData.liteBackTextureFile[0] != NULLCHAR && appData.liteBackTextureFile[0] != '*' ) {\r
+ if(liteBackTexture) DeleteObject(liteBackTexture);\r
liteBackTexture = LoadImage( 0, appData.liteBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
liteBackTextureMode = appData.liteBackTextureMode;\r
\r
}\r
\r
if( appData.darkBackTextureFile && appData.darkBackTextureFile[0] != NULLCHAR && appData.darkBackTextureFile[0] != '*' ) {\r
+ if(darkBackTexture) DeleteObject(darkBackTexture);\r
darkBackTexture = LoadImage( 0, appData.darkBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
darkBackTextureMode = appData.darkBackTextureMode;\r
\r
BoardOptionsPopup(hwnd);\r
break;\r
\r
+ case IDM_ThemeOptions:\r
+ ThemeOptionsPopup(hwnd);\r
+ break;\r
+\r
case IDM_EnginePlayOptions:\r
EnginePlayOptionsPopup(hwnd);\r
break;\r
}\r
return 0;\r
}\r
+\r
+char *\r
+Col2Text (int n)\r
+{\r
+ static int i=0;\r
+ static char col[8][20];\r
+ COLORREF color = *(COLORREF *) colorVariable[n];\r
+ i = i+1 & 7;\r
+ snprintf(col[i], 20, "#%02lx%02lx%02lx", color&0xff, (color>>8)&0xff, (color>>16)&0xff);\r
+ return col[i];\r
+}\r
+\r
+void\r
+ActivateTheme (int new)\r
+{ // Redo initialization of features depending on options that can occur in themes\r
+ InitTextures();\r
+ if(new) InitDrawingColors();\r
+ fontBitmapSquareSize = 0; // request creation of new font pieces\r
+ InitDrawingSizes(-2, 0);\r
+ InvalidateRect(hwndMain, NULL, TRUE);\r
+}\r
VOID LoadEnginePopUp();\r
VOID LoadOptionsPopup(HWND hDlg);\r
VOID InitTextures();\r
+void ThemeOptionsPopup(HWND hwnd);\r
\r
/* Constants */\r
\r
MENUITEM "&Comments", IDM_Comment\r
MENUITEM SEPARATOR\r
MENUITEM "&Game List Tags...", IDM_GameListOptions\r
- MENUITEM "&Board...", IDM_BoardOptions\r
+ MENUITEM "Colo&rs...", IDM_BoardOptions\r
+ MENUITEM "&Board Themes...", IDM_ThemeOptions\r
MENUITEM "&Fonts...", IDM_Fonts\r
END\r
POPUP "&Mode"\r
char filter[] =\r
"All files\0*.*\0Game files\0*.pgn;*.gam\0Position files\0*.fen;*.epd;*.pos\0"\r
"EXE files\0*.exe\0Tournament files (*.trn)\0*.trn\0"\r
- "BIN Files\0*.bin\0LOG Files\0*.log\0INI Files\0*.ini\0\0";\r
+ "BIN Files\0*.bin\0LOG Files\0*.log\0INI Files\0*.ini\0"\r
+ "Image files\0*.bmp\0\0";\r
OPENFILENAME ofn;\r
\r
safeStrCpy( buf, "" , sizeof( buf)/sizeof( buf[0]) );\r
GenericPopup(hwnd, installOptions);\r
}\r
\r
+int PickTheme P((HWND hDlg));\r
+void DeleteTheme P((HWND hDlg));\r
+\r
+int ThemeOK()\r
+{\r
+ if(selected >= 0) { ASSIGN(engineLine, engineList[selected]); }\r
+ if(engineLine[0] == '#') { DisplayError(_("Select single theme from the group"), 0); return 0; }\r
+ LoadTheme();\r
+ return 1;\r
+}\r
+\r
+Option themeOptions[] = {\r
+ { 195, 14, 0, NULL, (void*) &PickTheme, (char*) &selected, engineMnemonic, ListBox, N_("Select theme from list:") },\r
+ { 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("or specify new theme below:") },\r
+ { 0, 0, 0, NULL, (void*) &nickName, NULL, NULL, TextBox, N_("Theme name:") },\r
+ { 0, 0, 0, NULL, (void*) &appData.useBitmaps, NULL, NULL, CheckBox, N_("Use board textures") },\r
+ { 0, 0, 32+0, NULL, (void*) &appData.liteBackTextureFile, NULL, NULL, FileName, N_("Light-square texture:") },\r
+ { 0, 0, 32+0, NULL, (void*) &appData.darkBackTextureFile, NULL, NULL, FileName, N_("Dark-square texture:") },\r
+ { 0, 0, 3, NULL, (void*) &appData.darkBackTextureMode, "", NULL, Spin, N_("Dark reorientation mode:") },\r
+ { 0, 0, 3, NULL, (void*) &appData.liteBackTextureMode, "", NULL, Spin, N_("Light reorientation mode:") },\r
+ { 0, 0, 0, NULL, (void*) &appData.useBorder, NULL, NULL, CheckBox, N_("Draw border around board") },\r
+ { 0, 0, 32+0, NULL, (void*) &appData.border, NULL, NULL, FileName, N_("Optional border bitmap:") },\r
+ { 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_(" Beware: a specified piece font will prevail over piece bitmaps") },\r
+ { 0, 0, 0, NULL, (void*) &appData.bitmapDirectory, NULL, NULL, PathName, N_("Directory with piece bitmaps:") },\r
+ { 0, 0, 0, NULL, (void*) &appData.useFont, NULL, NULL, CheckBox, N_("Use piece font") },\r
+ { 0, 50, 150, NULL, (void*) &appData.fontPieceSize, "", NULL, Spin, N_("Font size (%):") },\r
+ { 0, 0, 0, NULL, (void*) &appData.renderPiecesWithFont, NULL, NULL, TextBox, N_("Font name:") },\r
+ { 0, 0, 0, NULL, (void*) &appData.fontToPieceTable, NULL, NULL, TextBox, N_("Font piece to char:") },\r
+// { 0, 0, 0, NULL, (void*) &DeleteTheme, NULL, NULL, Button, N_("Up") },\r
+// { 0, 0, 0, NULL, (void*) &DeleteTheme, NULL, NULL, Button, N_("Down") },\r
+ { 0, 0, 0, NULL, (void*) &DeleteTheme, NULL, NULL, Button, N_("Delete Theme") },\r
+ { 0, 1, 0, NULL, (void*) &ThemeOK, "", NULL, EndMark , "" }\r
+};\r
+\r
+void\r
+DeleteTheme (HWND hDlg)\r
+{\r
+ char *p, *q;\r
+ int i, selected = SendDlgItemMessage(hDlg, 2001+2*1, LB_GETCURSEL, 0, 0);\r
+ HANDLE hwndCombo = GetDlgItem(hDlg, 2001+2*1);\r
+ if(selected < 0) return;\r
+ if(p = strstr(appData.themeNames, engineList[selected])) {\r
+ if(q = strchr(p, '\n')) strcpy(p, q+1);\r
+ }\r
+ themeOptions[0].max = NamesToList(appData.themeNames, engineList, engineMnemonic, ""); // replace list by only the group contents\r
+ SendMessage(hwndCombo, LB_RESETCONTENT, 0, 0);\r
+ SendMessage(hwndCombo, LB_ADDSTRING, 0, (LPARAM) "");\r
+ for(i=1; i<themeOptions[0].max; i++) {\r
+ SendMessage(hwndCombo, LB_ADDSTRING, 0, (LPARAM) engineMnemonic[i]);\r
+ }\r
+}\r
+\r
+int\r
+PickTheme (HWND hDlg)\r
+{\r
+ char buf[MSG_SIZ];\r
+ HANDLE hwndCombo = GetDlgItem(hDlg, 2001+2*1);\r
+ int i = SendDlgItemMessage(hDlg, 2001+2*1, LB_GETCURSEL, 0, 0);\r
+ if(i == 0) buf[0] = NULLCHAR; // back to top level\r
+ else if(engineList[i][0] == '#') safeStrCpy(buf, engineList[i], MSG_SIZ); // group header, open group\r
+ else {\r
+ ASSIGN(engineLine, engineList[i]);\r
+ LoadTheme();\r
+ EndDialog( hDlg, 0 );\r
+ return 0; // normal line, select engine\r
+ }\r
+ themeOptions[0].max = NamesToList(appData.themeNames, engineList, engineMnemonic, buf); // replace list by only the group contents\r
+ SendMessage(hwndCombo, LB_RESETCONTENT, 0, 0);\r
+ SendMessage(hwndCombo, LB_ADDSTRING, 0, (LPARAM) buf);\r
+ for(i=1; i<themeOptions[0].max; i++) {\r
+ SendMessage(hwndCombo, LB_ADDSTRING, 0, (LPARAM) engineMnemonic[i]);\r
+ }\r
+ return 0;\r
+}\r
+\r
+void ThemeOptionsPopup(HWND hwnd)\r
+{\r
+ addToList = TRUE; // defaults\r
+ if(nickName) free(nickName); nickName = strdup("");\r
+ if(engineLine) free(engineLine); engineLine = strdup("");\r
+ themeOptions[0].max = NamesToList(appData.themeNames, engineList, engineMnemonic, ""); // only top level\r
+ snprintf(title, MSG_SIZ, _("Board themes"));\r
+\r
+ GenericPopup(hwnd, themeOptions);\r
+}\r
+\r
Boolean autoinc, twice, swiss;\r
char *tfName;\r
\r