Make location of man file dynamic for OSX
[xboard.git] / gtk / xboard.c
index 1599cf4..62de768 100644 (file)
@@ -5,7 +5,8 @@
  * Massachusetts.
  *
  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
+ * Software Foundation, Inc.
  *
  * The following terms apply to Digital Equipment Corporation's copyright
  * interest in XBoard:
@@ -175,14 +176,17 @@ extern char *getenv();
    // redefine some defaults
 #  undef ICS_LOGON
 #  undef DATADIR
+#  undef MANDIR
 #  undef LOCALEDIR
 #  undef SETTINGS_FILE
 #  define ICS_LOGON "Library/Preferences/XboardICS.conf"
 #  define DATADIR dataDir
+#  define MANDIR manDir
 #  define LOCALEDIR localeDir
 #  define SETTINGS_FILE masterSettings
 #  define SYNC_MENUBAR gtkosx_application_sync_menubar(theApp)
    char dataDir[MSG_SIZ]; // for expanding ~~
+   char manDir[MSG_SIZ];
    char localeDir[MSG_SIZ];
    char masterSettings[MSG_SIZ];
 #else
@@ -891,6 +895,7 @@ main (int argc, char **argv)
         theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
         snprintf(masterSettings, MSG_SIZ, "%s/Contents/Resources/etc/xboard.conf", path);
         snprintf(dataDir, MSG_SIZ, "%s/Contents/Resources/share/xboard", path);
+        snprintf(manDir, MSG_SIZ, "%s/Contents/Resources/share/man", path);
         snprintf(svgDir, MSG_SIZ, "%s/themes/default", dataDir);
         g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL);
         g_signal_connect(theApp, "NSApplicationWillTerminate", G_CALLBACK(ExitEvent), NULL);
@@ -1138,7 +1143,7 @@ main (int argc, char **argv)
     boardWidget      = optList[W_BOARD].handle;
     menuBarWidget    = optList[W_MENU].handle;
     dropMenu         = optList[W_DROP].handle;
-    titleWidget = optList[optList[W_TITLE].type != -1 ? W_TITLE : W_SMALL].handle;
+    titleWidget = optList[optList[W_TITLE].type != Skip ? W_TITLE : W_SMALL].handle;
 #ifdef TODO_GTK
     formWidget  = XtParent(boardWidget);
     XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
@@ -1886,7 +1891,7 @@ PasteGameProc ()
 {
     gchar *text=NULL;
     GtkClipboard *cb;
-    guint len=0;
+    guint len=0; int flip = appData.flipView;
     FILE* f;
 
     // get game from clipboard
@@ -1910,7 +1915,9 @@ PasteGameProc ()
     fclose(f);
 
     // load from file
+    if(!appData.autoFlipView) appData.flipView = flipView;
     LoadGameFromFile(gamePasteFilename, 0, gamePasteFilename, TRUE);
+    appData.flipView = flip;
     return;
 }