* Massachusetts.
*
* Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
*
* The following terms apply to Digital Equipment Corporation's copyright
* interest in XBoard:
void DisplayMove P((int moveNumber));
void update_ics_width P(());
int CopyMemoProc P(());
+static int FindLogo P((char *place, char *name, char *buf));
/*
* XBoard depends on Xt R4 or higher
void
ParseColor (int n, char *name)
{ // in XBoard, just copy the color-name string
- if(colorVariable[n]) *(char**)colorVariable[n] = strdup(name);
+ if(colorVariable[n] && *name == '#') *(char**)colorVariable[n] = strdup(name);
}
char *
char *p;
int forceMono = False;
+ extern Option chatOptions[]; // FIXME: adapt Chat window, removing ICS pane and Hide button
+ chatOptions[6].type = chatOptions[10].type = Skip;
+
srandom(time(0)); // [HGM] book: make random truly random
setbuf(stdout, NULL);
CatchDeleteWindow(shellWidget, "QuitProc");
- CreateAnyPieces();
+ CreateAnyPieces(1);
CreateGrid();
if(appData.logoSize)
{ // locate and read user logo
- char buf[MSG_SIZ];
- snprintf(buf, MSG_SIZ, "%s/%s.png", appData.logoDir, UserName());
+ char buf[MSG_SIZ], name[MSG_SIZ];
+ snprintf(name, MSG_SIZ, "/home/%s", UserName());
+ if(!FindLogo(name, ".logo", buf))
+ FindLogo(appData.logoDir, name + 6, buf);
ASSIGN(userLogo, buf);
}
{
Arg args[16];
static int oldPausing = FALSE;
- static GameMode oldmode = (GameMode) -1;
+ static GameMode oldMode = (GameMode) -1;
char *wname;
if (!boardWidget || !XtIsRealized(boardWidget)) return;
}
}
- wname = ModeToWidgetName(oldmode);
+ wname = ModeToWidgetName(oldMode);
if (wname != NULL) {
MarkMenuItem(wname, False);
}
if (wname != NULL) {
MarkMenuItem(wname, True);
}
- oldmode = gameMode;
+ if(oldMode == TwoMachinesPlay) EnableNamedMenuItem("Mode.MachineMatch", True);
MarkMenuItem("Mode.MachineMatch", matchMode && matchGame < appData.matchGames);
+ oldMode = gameMode;
/* Maybe all the enables should be handled here, not just this one */
EnableNamedMenuItem("Mode.Training", gameMode == Training || gameMode == PlayFromGameFile);
}
void
+InfoProc ()
+{
+ char buf[MSG_SIZ];
+ snprintf(buf, sizeof(buf), "xterm -e info --directory %s --directory . -f %s &",
+ INFODIR, INFOFILE);
+ system(buf);
+}
+
+void
SetWindowTitle (char *text, char *title, char *icon)
{
Arg args[16];
#endif
+static int
+FindLogo (char *place, char *name, char *buf)
+{ // check if file exists in given place
+ FILE *f;
+ if(!place) return 0;
+ snprintf(buf, MSG_SIZ, "%s/%s.png", place, name);
+ if(*place && strcmp(place, ".") && (f = fopen(buf, "r")) ) {
+ fclose(f);
+ return 1;
+ }
+ return 0;
+}
+
static void
LoadLogo (ChessProgramState *cps, int n, Boolean ics)
{
} else if(appData.autoLogo) {
if(ics) { // [HGM] logo: in ICS mode second can be used for ICS
sprintf(buf, "%s/%s.png", appData.logoDir, appData.icsHost);
- } else if(appData.directory[n] && appData.directory[n][0]) {
- sprintf(buf, "%s/%s.png", appData.logoDir, cps->tidy);
+ } else { // engine; cascade
+ if(!FindLogo(appData.logoDir, cps->tidy, buf) && // first try user log folder
+ !FindLogo(appData.directory[n], "logo", buf) && // then engine directory
+ !FindLogo("/usr/local/share/games/plugins/logos", cps->tidy, buf) ) // then system folders
+ FindLogo("/usr/share/games/plugins/logos", cps->tidy, buf);
}
}
if(logoName[0])