#endif
}
+char *
+PrintArg (ArgType t)
+{
+ char *p="";
+ switch(t) {
+ case ArgZ:
+ case ArgInt: p = " N"; break;
+ case ArgString: p = " STR"; break;
+ case ArgBoolean: p = " TF"; break;
+ case ArgSettingsFilename:
+ case ArgFilename: p = " FILE"; break;
+ case ArgX: p = " Nx"; break;
+ case ArgY: p = " Ny"; break;
+ case ArgAttribs: p = " TEXTCOL"; break;
+ case ArgColor: p = " COL"; break;
+ case ArgFont: p = " FONT"; break;
+ case ArgBoardSize: p = " SIZE"; break;
+ case ArgFloat: p = " FLOAT"; break;
+ case ArgTrue:
+ case ArgFalse:
+ case ArgTwo:
+ case ArgNone:
+ case ArgCommSettings:
+ break;
+ }
+ return p;
+}
+
+void
+PrintOptions ()
+{
+ char buf[MSG_SIZ];
+ int len=0;
+ ArgDescriptor *q, *p = argDescriptors+5;
+ printf("\nXBoard accepts the following options:\n"
+ "(N = integer, TF = true or false, STR = text string, FILE = filename,\n"
+ " Nx, Ny = relative coordinates, COL = color, FONT = X-font spec,\n"
+ " SIZE = board-size spec(s)\n"
+ " Within parentheses are short forms, or options to set to true or false.\n"
+ " Persistent options (saved in the settings file) are marked with *)\n\n");
+ while(p->argName) {
+ if(p->argType == ArgCommSettings) { p++; continue; } // XBoard has no comm port
+ snprintf(buf+len, MSG_SIZ, "-%s%s", p->argName, PrintArg(p->argType));
+ if(p->save) strcat(buf+len, "*");
+ for(q=p+1; q->argLoc == p->argLoc; q++) {
+ if(q->argName[0] == '-') continue;
+ strcat(buf+len, q == p+1 ? " (" : " ");
+ sprintf(buf+strlen(buf), "-%s%s", q->argName, PrintArg(q->argType));
+ }
+ if(q != p+1) strcat(buf+len, ")");
+ len = strlen(buf);
+ if(len > 39) len = 0, printf("%s\n", buf); else while(len < 39) buf[len++] = ' ';
+ p = q;
+ }
+ if(len) buf[len] = NULLCHAR, printf("%s\n", buf);
+}
+
int
main (int argc, char **argv)
{
exit(0);
}
+ if(argc > 1 && !strcmp(argv[1], "--help" )) {
+ PrintOptions();
+ exit(0);
+ }
+
programName = strrchr(argv[0], '/');
if (programName == NULL)
programName = argv[0];
CreateGrid();
CreateAnyPieces();
+ if(appData.logoSize)
+ { // locate and read user logo
+ char buf[MSG_SIZ];
+ snprintf(buf, MSG_SIZ, "%s/%s.xpm", appData.logoDir, UserName());
+ XpmReadFileToPixmap(xDisplay, xBoardWindow, buf, (Pixmap *) &userLogo, NULL, NULL);
+ }
+
if (appData.animate || appData.animateDragging)
CreateAnimVars();
gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes()
InitPosition(TRUE);
+ UpdateLogos(TRUE);
// XtSetKeyboardFocus(shellWidget, formWidget);
XSetInputFocus(xDisplay, XtWindow(formWidget), RevertToPointerRoot, CurrentTime);
return 1;
}
+void
+DrawLogo (void *handle, void *logo)
+{
+ if(!logo || !handle) return;
+ XCopyArea(xDisplay, (Pixmap) logo, XtWindow((Widget) handle), wlPieceGC,
+ 0, 0, appData.logoSize, appData.logoSize/2, 0, 0);
+}
+
static void
BlankSquare (int x, int y, int color, ChessSquare piece, Drawable dest, int fac)
{ // [HGM] extra param 'fac' for forcing destination to (0,0) for copying to animation buffer
/* Maybe all the enables should be handled here, not just this one */
EnableNamedMenuItem("Mode.Training", gameMode == Training || gameMode == PlayFromGameFile);
+
+ DisplayLogos(optList[W_WHITE-1].handle, optList[W_BLACK+1].handle);
}
foregroundOrWarningColor = lowTimeWarningColor;
if (appData.clockMode) {
- snprintf(buf, MSG_SIZ, "%s: %s", color, TimeString(timer));
+ snprintf(buf, MSG_SIZ, "%s:%s%s", color, appData.logoSize && !partnerUp ? "\n" : " ", TimeString(timer));
XtSetArg(args[0], XtNlabel, buf);
} else {
snprintf(buf, MSG_SIZ, "%s ", color);
if(appData.monoMode) arrow[nr] = arrow[0], XDrawLines(xDisplay, xBoardWindow, darkSquareGC, pts, nr+1, CoordModeOrigin);
}
+static void
+LoadLogo (ChessProgramState *cps, int n, Boolean ics)
+{
+ char buf[MSG_SIZ], *logoName = buf;
+ if(appData.logo[n][0]) {
+ logoName = appData.logo[n];
+ } else if(appData.autoLogo) {
+ if(ics) { // [HGM] logo: in ICS mode second can be used for ICS
+ sprintf(buf, "%s/%s.xpm", appData.logoDir, appData.icsHost);
+ } else if(appData.directory[n] && appData.directory[n][0]) {
+ sprintf(buf, "%s/%s.xpm", appData.logoDir, cps->tidy);
+ }
+ }
+ if(logoName[0])
+ XpmReadFileToPixmap(xDisplay, xBoardWindow, logoName, (Pixmap *) &(cps->programLogo), NULL, NULL);
+}
+
void
UpdateLogos (int displ)
{
- return; // no logos in XBoard yet
+ if(optList[W_WHITE-1].handle == NULL) return;
+ LoadLogo(&first, 0, 0);
+ LoadLogo(&second, 1, appData.icsActive);
+ if(displ) DisplayLogos(optList[W_WHITE-1].handle, optList[W_BLACK+1].handle);
+ return;
}