// prevent pathname of positional file argument provided by OS X being be mistaken for option name
// (price is that we won't recognize Windows option format anymore).
# define SLASH '-'
+# define IMG ".png"
// redefine some defaults
# undef ICS_LOGON
# undef DATADIR
# define ICS_LOGON "Library/Preferences/XboardICS.conf"
# define DATADIR dataDir
# define SETTINGS_FILE masterSettings
+# define SYNC_MENUBAR gtkosx_application_sync_menubar(theApp)
char dataDir[MSG_SIZ]; // for expanding ~~
char masterSettings[MSG_SIZ];
#else
# define SLASH '/'
+# define IMG ".svg"
+# define SYNC_MENUBAR
#endif
#ifdef __EMX__
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 *
if(!fontIsSet[GAMELIST_FONT] && fontValid[GAMELIST_FONT][squareSize])
appData.gameListFont = fontTable[GAMELIST_FONT][squareSize];
- appData.font = InsertPxlSize(appData.font, fontPxlSize);
+ appData.font = InsertPxlSize(appData.font, coordFontPxlSize);
appData.clockFont = InsertPxlSize(appData.clockFont, clockFontPxlSize);
appData.coordFont = InsertPxlSize(appData.coordFont, coordFontPxlSize);
appData.icsFont = InsertPxlSize(appData.icsFont, coordFontPxlSize);
gtk_window_resize(GTK_WINDOW(shells[DummyDlg]), slaveW + opt->max, slaveH + opt->value);
}
+GdkPixbuf *
+LoadIconFile (gchar *svgFilename)
+{
+ char buf[MSG_SIZ];
+
+ snprintf(buf, MSG_SIZ, "%s/%s" IMG, svgDir, svgFilename);
+ return gdk_pixbuf_new_from_file(buf, NULL);
+}
+
#ifdef __APPLE__
static char clickedFile[MSG_SIZ];
static int suppress;
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
strncpy(dataDir, path, MSG_SIZ);
snprintf(masterSettings, MSG_SIZ, "%s/Contents/Resources/etc/xboard.conf", path);
+ snprintf(svgDir, MSG_SIZ, "%s/Contents/Resources/share/xboard/themes/default", path);
suppress = (argc == 1 || argc > 1 && argv[1][00] != '-'); // OSX sends signal even if name was already argv[1]!
g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL);
// we must call application ready before we can get the signal,
/*
* Create an icon. (Use two icons, to indicate whther it is white's or black's turn.)
*/
- WhiteIcon = gdk_pixbuf_new_from_file(SVGDIR "/icon_white.svg", NULL);
- BlackIcon = gdk_pixbuf_new_from_file(SVGDIR "/icon_black.svg", NULL);
+ WhiteIcon = LoadIconFile("icon_white");
+ BlackIcon = LoadIconFile("icon_black");
SetClockIcon(0); // sets white icon
marginH = h - a.height - hc; // subtract current clock height, so it can be added back dynamically
}
- CreateAnyPieces();
+ CreateAnyPieces(1);
CreateGrid();
if(appData.logoSize)
#endif
void
+MarkMenuItem (char *menuRef, int state)
+{
+ MenuItem *item = MenuNameToItem(menuRef);
+
+ if(item && item->handle) {
+ ((GtkCheckMenuItem *) (item->handle))->active = state;
+ }
+ SYNC_MENUBAR;
+}
+
+void
EnableNamedMenuItem (char *menuRef, int state)
{
MenuItem *item = MenuNameToItem(menuRef);
if(item && item->handle) gtk_widget_set_sensitive(item->handle, state);
+ SYNC_MENUBAR;
}
void
GdkPixbuf *pm = *clockIcons[color];
if (mainwindowIcon != pm) {
mainwindowIcon = pm;
- gtk_window_set_icon(GTK_WINDOW(shellWidget), mainwindowIcon);
+#ifdef __APPLE__
+ gtkosx_application_set_dock_icon_pixbuf(theApp, mainwindowIcon);
+#else
+ gtk_window_set_icon(GTK_WINDOW(shellWidget), mainwindowIcon);
+#endif
}
}
LoadLogo (ChessProgramState *cps, int n, Boolean ics)
{
char buf[MSG_SIZ], *logoName = buf;
+ FILE *f;
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.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; look in engine-dir (if any) first
+ snprintf(buf, MSG_SIZ, "%s/logo.png", appData.directory[n]);
+ if(appData.directory[n] && appData.directory[n][0]
+ && strcmp(appData.directory[n], ".") && (f = fopen(buf, "r")) )
+ fclose(f);
+ else // no engine dir or no logo.png in it: look in logo dir
+ if(appData.logoDir && appData.logoDir[0])
+ sprintf(buf, "%s/%s.png", appData.logoDir, cps->tidy);
}
}
if(logoName[0])