{ "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
{ "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
{ "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
+ { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
+ { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
// [HGM] tournament options
{ "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
Boolean scoreIsAbsolute[ENGINES]; /* If true, engine score is always from white side */
Boolean saveExtendedInfoInPGN; /* If true, saved PGN games contain extended info */
Boolean hideThinkingFromHuman; /* If true, program thinking is generated but not displayed in human/computer matches */
+ Boolean useBitmaps;
+ Boolean useFont;
char * liteBackTextureFile; /* Name of texture bitmap for lite squares */
char * darkBackTextureFile; /* Name of texture bitmap for dark squares */
int liteBackTextureMode;
#define OPT_Subset 1966\r
#define OPT_Struct 1967\r
#define OPT_Material 1968\r
+#define OPT_Bitmaps 1976\r
+#define OPT_PieceFont 1977\r
+#define OPT_MessageFont8 1978\r
+#define OPT_SamplePieceFont 1979\r
+#define OPT_ChoosePieceFont 1980\r
\r
\r
// Next default values for new objects\r
#define ABOUTBOX -1 /* not sure why these are needed */\r
#define ABOUTBOX2 -1\r
\r
-int dialogItems[][40] = {\r
+int dialogItems[][41 ] = {\r
{ ABOUTBOX, IDOK, OPT_MESS, 400 }, \r
{ DLG_TimeControl, IDC_Babble, OPT_TCUseMoves, OPT_TCUseInc, OPT_TCUseFixed, \r
OPT_TCtext1, OPT_TCtext2, OPT_TCitext1, OPT_TCitext2, OPT_TCftext, GPB_Factors, IDC_Factor1, IDC_Factor2, IDOK, IDCANCEL }, \r
-{ DLG_LoadOptions, OPT_Autostep, OPT_AStext1, IDOK, IDCANCEL }, \r
+{ DLG_LoadOptions, OPT_Autostep, OPT_AStext1, IDOK, IDCANCEL },\r
{ DLG_SaveOptions, OPT_Autosave, OPT_AVPrompt, OPT_AVToFile, OPT_AVBrowse,\r
801, OPT_PGN, OPT_Old, OPT_OutOfBookInfo, IDOK, IDCANCEL }, \r
{ 1536, 1090, IDC_Directories, 1089, 1091, IDOK, IDCANCEL, 1038, IDC_IndexNr, 1037 }, \r
OPT_ChooseLightSquareColor, OPT_ChooseDarkSquareColor, OPT_ChooseWhitePieceColor,\r
OPT_ChooseBlackPieceColor, OPT_ChooseHighlightSquareColor, OPT_ChoosePremoveHighlightColor,\r
OPT_Monochrome, OPT_AllWhite, OPT_UpsideDown, OPT_DefaultBoardColors, GPB_Colors,\r
- IDC_Light, IDC_Dark, IDC_White, IDC_Black, IDC_High, IDC_PreHigh, GPB_Size }, \r
+ IDC_Light, IDC_Dark, IDC_White, IDC_Black, IDC_High, IDC_PreHigh, GPB_Size, OPT_Bitmaps, OPT_PieceFont }, \r
{ DLG_NewVariant, IDOK, IDCANCEL, OPT_VariantNormal, OPT_VariantFRC, OPT_VariantWildcastle,\r
OPT_VariantNocastle, OPT_VariantLosers, OPT_VariantGiveaway, OPT_VariantSuicide,\r
OPT_Variant3Check, OPT_VariantTwoKings, OPT_VariantAtomic, OPT_VariantCrazyhouse,\r
IDC_Width, IDC_Hand, IDC_Pieces, IDC_Def }, \r
{ DLG_Fonts, IDOK, IDCANCEL, OPT_ChooseClockFont, OPT_ChooseMessageFont,\r
OPT_ChooseCoordFont, OPT_ChooseTagFont, OPT_ChooseCommentsFont, OPT_ChooseConsoleFont, OPT_ChooseMoveHistoryFont, OPT_DefaultFonts,\r
- OPT_ClockFont, OPT_MessageFont, OPT_CoordFont, OPT_EditTagsFont,\r
+ OPT_ClockFont, OPT_MessageFont, OPT_CoordFont, OPT_EditTagsFont, OPT_ChoosePieceFont, OPT_MessageFont8,\r
OPT_SampleGameListFont, OPT_ChooseGameListFont, OPT_MessageFont7, \r
OPT_CommentsFont, OPT_MessageFont5, GPB_Current, GPB_All, OPT_MessageFont6 }, \r
{ DLG_NewGameFRC, IDC_NFG_Label, IDC_NFG_Random, IDOK, IDCANCEL }, \r
SetCurrentDirectory(dir); /* return to prev directory */\r
}\r
\r
+VOID\r
+InitTextures()\r
+{\r
+ ZeroMemory( &backTextureSquareInfo, sizeof(backTextureSquareInfo) );\r
+ backTextureSquareSize = 0; // kludge to force recalculation of texturemode\r
+ \r
+ if( appData.liteBackTextureFile && appData.liteBackTextureFile[0] != NULLCHAR && appData.liteBackTextureFile[0] != '*' ) {\r
+ liteBackTexture = LoadImage( 0, appData.liteBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+ liteBackTextureMode = appData.liteBackTextureMode;\r
+\r
+ if (liteBackTexture == NULL && appData.debugMode) {\r
+ fprintf( debugFP, "Unable to load lite texture bitmap '%s'\n", appData.liteBackTextureFile );\r
+ }\r
+ }\r
+ \r
+ if( appData.darkBackTextureFile && appData.darkBackTextureFile[0] != NULLCHAR && appData.darkBackTextureFile[0] != '*' ) {\r
+ darkBackTexture = LoadImage( 0, appData.darkBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+ darkBackTextureMode = appData.darkBackTextureMode;\r
+\r
+ if (darkBackTexture == NULL && appData.debugMode) {\r
+ fprintf( debugFP, "Unable to load dark texture bitmap '%s'\n", appData.darkBackTextureFile );\r
+ }\r
+ }\r
+}\r
+\r
BOOL\r
InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)\r
{\r
buttonCount = GetSystemMetrics(SM_CMOUSEBUTTONS);\r
\r
/* [AS] Load textures if specified */\r
- ZeroMemory( &backTextureSquareInfo, sizeof(backTextureSquareInfo) );\r
- \r
- if( appData.liteBackTextureFile && appData.liteBackTextureFile[0] != NULLCHAR && appData.liteBackTextureFile[0] != '*' ) {\r
- liteBackTexture = LoadImage( 0, appData.liteBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
- liteBackTextureMode = appData.liteBackTextureMode;\r
-\r
- if (liteBackTexture == NULL && appData.debugMode) {\r
- fprintf( debugFP, "Unable to load lite texture bitmap '%s'\n", appData.liteBackTextureFile );\r
- }\r
- }\r
- \r
- if( appData.darkBackTextureFile && appData.darkBackTextureFile[0] != NULLCHAR && appData.darkBackTextureFile[0] != '*' ) {\r
- darkBackTexture = LoadImage( 0, appData.darkBackTextureFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
- darkBackTextureMode = appData.darkBackTextureMode;\r
-\r
- if (darkBackTexture == NULL && appData.debugMode) {\r
- fprintf( debugFP, "Unable to load dark texture bitmap '%s'\n", appData.darkBackTextureFile );\r
- }\r
- }\r
+ InitTextures();\r
\r
mysrandom( (unsigned) time(NULL) );\r
\r
return;\r
}\r
\r
- if( appData.renderPiecesWithFont == NULL || appData.renderPiecesWithFont[0] == NULLCHAR || appData.renderPiecesWithFont[0] == '*' ) {\r
+ if( !appData.useFont || appData.renderPiecesWithFont == NULL ||\r
+ appData.renderPiecesWithFont[0] == NULLCHAR || appData.renderPiecesWithFont[0] == '*' ) {\r
fontBitmapSquareSize = -1;\r
return;\r
}\r
DrawPieceOnDC(hdc, piece, piece_color, square_color, x, y, tmphdc);\r
}\r
} \r
- else if( backTextureSquareInfo[row][column].mode > 0 ) {\r
+ else if( appData.useBitmaps && backTextureSquareInfo[row][column].mode > 0 ) {\r
/* [AS] Draw the square using a texture bitmap */\r
HBITMAP hbm = SelectObject( texture_hdc, square_color ? liteBackTexture : darkBackTexture );\r
int r = row, c = column; // [HGM] do not flip board in flipView\r
CONTROL "Monochrome",OPT_Monochrome,"Button",BS_AUTOCHECKBOX | \r
WS_TABSTOP,10,210,64,10\r
CONTROL "All White",OPT_AllWhite,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,140,180,73,10\r
+ WS_TABSTOP,140,179,73,10\r
CONTROL "Flip Black",OPT_UpsideDown,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,140,192,73,10\r
+ WS_TABSTOP,140,191,73,10\r
+ CONTROL "Use Board Textures",OPT_Bitmaps,"Button",BS_AUTOCHECKBOX | \r
+ WS_TABSTOP,140,203,73,10\r
+ CONTROL "Use Piece Font",OPT_PieceFont,"Button",BS_AUTOCHECKBOX | \r
+ WS_TABSTOP,140,215,73,10\r
PUSHBUTTON "Defaults",OPT_DefaultBoardColors,80,206,50,15\r
EDITTEXT OPT_DarkSquareColor,80,112,25,15,ES_READONLY | \r
WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP\r
PUSHBUTTON "Cancel",IDCANCEL,170,232,50,14\r
END\r
\r
-DLG_Fonts DIALOG DISCARDABLE 0, 0, 266, 250\r
+DLG_Fonts DIALOG DISCARDABLE 0, 0, 266, 274\r
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
CAPTION "Fonts"\r
FONT 8, "MS Sans Serif"\r
BEGIN\r
- DEFPUSHBUTTON "OK",IDOK,156,232,50,14\r
- PUSHBUTTON "Cancel",IDCANCEL,212,232,50,14\r
+ DEFPUSHBUTTON "OK",IDOK,156,256,50,14\r
+ PUSHBUTTON "Cancel",IDCANCEL,212,256,50,14\r
PUSHBUTTON "Choose...",OPT_ChooseClockFont,212,15,45,15\r
PUSHBUTTON "Choose...",OPT_ChooseMessageFont,212,39,45,15\r
PUSHBUTTON "Choose...",OPT_ChooseCoordFont,212,63,45,15\r
PUSHBUTTON "Choose...",OPT_ChooseConsoleFont,212,149,45,15\r
PUSHBUTTON "Choose...",OPT_ChooseMoveHistoryFont,212,174,45,15\r
PUSHBUTTON "Choose...",OPT_ChooseGameListFont,212,198,45,15\r
- PUSHBUTTON "&Defaults",OPT_DefaultFonts,3,232,50,15\r
+ PUSHBUTTON "Choose...",OPT_ChoosePieceFont,212,222,45,15\r
+ PUSHBUTTON "&Defaults",OPT_DefaultFonts,3,256,50,15\r
CONTROL "",OPT_SampleCoordFont,"RICHEDIT",ES_READONLY | \r
WS_DISABLED | WS_BORDER,77,59,130,20\r
CONTROL "",OPT_SampleTagFont,"RICHEDIT",ES_READONLY | \r
CONTROL "",OPT_SampleMessageFont,"RICHEDIT",ES_READONLY | \r
WS_DISABLED | WS_BORDER,77,35,130,20\r
GROUPBOX "Current Board Size",GPB_Current,3,1,259,83\r
- GROUPBOX "All Board Sizes",GPB_All,3,87,259,133\r
+ GROUPBOX "All Board Sizes",GPB_All,3,87,259,157\r
CONTROL "",OPT_SampleMoveHistoryFont,"RICHEDIT",ES_READONLY | \r
WS_DISABLED | WS_BORDER,77,170,130,20\r
LTEXT "Move History, Engine Output",OPT_MessageFont6,13,171,63,20,NOT \r
WS_DISABLED | WS_BORDER,77,194,130,20\r
LTEXT "Game List",OPT_MessageFont7,13,199,63,20,NOT \r
WS_GROUP\r
+ CONTROL "",OPT_SamplePieceFont,"RICHEDIT", ES_AUTOHSCROLL | \r
+ WS_BORDER,77,218,130,20\r
+ LTEXT "Piece Font",OPT_MessageFont8,13,223,63,20,NOT \r
+ WS_GROUP\r
END\r
\r
DLG_NewGameFRC DIALOG DISCARDABLE 0, 0, 176, 47\r
LRESULT CALLBACK\r
BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
- static Boolean mono, white, flip;\r
+ static Boolean mono, white, flip, fonts, bitmaps;\r
static BoardSize size;\r
static COLORREF lsc, dsc, wpc, bpc, hsc, phc;\r
static HBITMAP pieces[3];\r
if (appData.upsideDown)\r
CheckDlgButton(hDlg, OPT_UpsideDown, TRUE);\r
\r
+ if (appData.useBitmaps)\r
+ CheckDlgButton(hDlg, OPT_Bitmaps, TRUE);\r
+\r
+ if (appData.useFont)\r
+ CheckDlgButton(hDlg, OPT_PieceFont, 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
white= appData.allWhite;\r
flip = appData.upsideDown;\r
size = boardSize;\r
+ bitmaps = appData.useBitmaps;\r
+ fonts = appData.useFont;\r
\r
SetBoardOptionEnables(hDlg);\r
return TRUE;\r
ChangeBoardSize(size);\r
}\r
\r
+ if (bitmaps && !appData.useBitmaps) InitTextures();\r
+\r
if ((mono != appData.monoMode) ||\r
(lsc != lightSquareColor) ||\r
(dsc != darkSquareColor) ||\r
(hsc != highlightSquareColor) ||\r
(flip != appData.upsideDown) ||\r
(white != appData.allWhite) ||\r
+ (fonts != appData.useFont) ||\r
+ (bitmaps != appData.useBitmaps) ||\r
(phc != premoveHighlightColor)) {\r
\r
lightSquareColor = lsc;\r
appData.monoMode = mono;\r
appData.allWhite = white;\r
appData.upsideDown = flip;\r
+ appData.useFont = fonts;\r
+ appData.useBitmaps = bitmaps;\r
\r
InitDrawingColors();\r
InitDrawingSizes(boardSize, 0);\r
\r
case OPT_AllWhite:\r
white = !white;\r
- SetBoardOptionEnables(hDlg);\r
break;\r
\r
case OPT_UpsideDown:\r
flip = !flip;\r
- SetBoardOptionEnables(hDlg);\r
+ break;\r
+\r
+ case OPT_Bitmaps:\r
+ bitmaps = !bitmaps;\r
+ break;\r
+\r
+ case OPT_PieceFont:\r
+ fonts = !fonts;\r
break;\r
}\r
break;\r
*\r
\*---------------------------------------------------------------------------*/\r
\r
+char *string; // sorry\r
+\r
VOID\r
SetSampleFontText(HWND hwnd, int id, const MyFont *mf)\r
{\r
mf->mfp.pointSize, mf->mfp.faceName,\r
mf->mfp.bold ? " bold" : "",\r
mf->mfp.italic ? " italic" : "");\r
+ if(id != OPT_SamplePieceFont)\r
SetDlgItemText(hwnd, id, buf);\r
+ else SetDlgItemText(hwnd, id, string);\r
\r
hControl = GetDlgItem(hwnd, id);\r
hdc = GetDC(hControl);\r
\r
/* format the text in the rich edit control */\r
SendMessage(hControl, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) &cf);\r
+ if(id != OPT_SamplePieceFont)\r
SendMessage(hControl, EM_SETRECT, (WPARAM)0, (LPARAM) &rectFormat);\r
\r
/* clean up */\r
LRESULT CALLBACK\r
FontOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
- static MyFont workFont[NUM_FONTS];\r
+ static MyFont workFont[NUM_FONTS+1];\r
static BOOL firstPaint;\r
+ static char pieceText[] = "ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";\r
int i;\r
RECT rect;\r
\r
/* copy the current font settings into a working copy */\r
for (i=0; i < NUM_FONTS; i++)\r
CopyFont(&workFont[i], font[boardSize][i]);\r
+ strncpy(workFont[NUM_FONTS].mfp.faceName, appData.renderPiecesWithFont, sizeof(workFont[NUM_FONTS].mfp.faceName));\r
+ workFont[NUM_FONTS].mfp.pointSize = 16.;\r
+ workFont[NUM_FONTS].mfp.charset = DEFAULT_CHARSET;\r
\r
Translate(hDlg, DLG_Fonts);\r
if (!appData.icsActive)\r
SetSampleFontText(hDlg, OPT_SampleConsoleFont, &workFont[CONSOLE_FONT]);\r
SetSampleFontText(hDlg, OPT_SampleMoveHistoryFont, &workFont[MOVEHISTORY_FONT]);\r
SetSampleFontText(hDlg, OPT_SampleGameListFont, &workFont[GAMELIST_FONT]);\r
+ string = appData.fontToPieceTable;\r
+ SetSampleFontText(hDlg, OPT_SamplePieceFont, &workFont[NUM_FONTS]);\r
firstPaint = FALSE;\r
}\r
break;\r
for (i=0; i < NUM_FONTS; i++)\r
CopyFont(font[boardSize][i], &workFont[i]);\r
\r
+ { // Make new piece-to-char table\r
+ char buf[MSG_SIZ];\r
+ GetDlgItemText(hDlg, OPT_SamplePieceFont, buf, MSG_SIZ);\r
+ ASSIGN(appData.fontToPieceTable, buf);\r
+ }\r
+ ASSIGN(appData.renderPiecesWithFont, workFont[NUM_FONTS].mfp.faceName); // piece font\r
+\r
/* a sad necessity due to the original design of having a separate\r
* console font, tags font, and comment font for each board size. IMHO\r
* these fonts should not be dependent on the current board size. I'm\r
SetSampleFontText(hDlg, OPT_SampleGameListFont, &workFont[GAMELIST_FONT]);\r
break;\r
\r
+ case OPT_ChoosePieceFont:\r
+ MyCreateFont(hDlg, &workFont[NUM_FONTS]);\r
+ string = pieceText;\r
+ SetSampleFontText(hDlg, OPT_SamplePieceFont, &workFont[NUM_FONTS]);\r
+ break;\r
+\r
case OPT_DefaultFonts:\r
for (i=0; i<NUM_FONTS; i++) {\r
DeleteObject(&workFont[i].hf);\r
{
XpmAttributes attr;
attr.valuemask = 0;
- if(s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
+ if(!appData.useBitmaps || s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
if (XpmReadFileToPixmap(xDisplay, xBoardWindow, s, &(xpmBoardBitmap[kind]), NULL, &attr) == 0) {
useTexture |= kind + 1; textureW[kind] = attr.width; textureH[kind] = attr.height;
}
//{ 0, 0, 0, NULL, (void*) &appData.allWhite, "", NULL, CheckBox, N_("Use Outline Pieces for Black") },
{ 0, 0, 0, NULL, (void*) &appData.monoMode, "", NULL, CheckBox, N_("Mono Mode") },
{ 0,-1, 5, NULL, (void*) &appData.overrideLineGap, "", NULL, Spin, N_("Line Gap ( -1 = default for board size):") },
+{ 0, 0, 0, NULL, (void*) &appData.useBitmaps, "", NULL, CheckBox, N_("Use Board Textures") },
{ 0, 0, 0, NULL, (void*) &appData.liteBackTextureFile, ".xpm", NULL, FileName, N_("Light-Squares Texture File:") },
{ 0, 0, 0, NULL, (void*) &appData.darkBackTextureFile, ".xpm", NULL, FileName, N_("Dark-Squares Texture File:") },
{ 0, 0, 0, NULL, (void*) &appData.bitmapDirectory, "", NULL, PathName, N_("Directory with Bitmap Pieces:") },