Updated copyright notice to 2015
[xboard.git] / gtk / xboard.c
index ef35f2a..5da2d3e 100644 (file)
@@ -5,7 +5,7 @@
  * 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:
@@ -168,7 +168,7 @@ extern char *getenv();
 #include "draw.h"
 
 #ifdef OSXAPP
-#  include <gtkmacintegration/gtkosxapplication.h>
+#  include <gtkmacintegration-gtk2/gtkosxapplication.h>
    // 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 '-'
@@ -1930,7 +1930,7 @@ void MoveTypeInProc(eventkey)
 
     buf[0]=eventkey->keyval;
     buf[1]='\0';
-    if (eventkey->keyval > 32 && eventkey->keyval < 256)
+    if (eventkey->keyval > 32 && eventkey->keyval < 256 || *buf == 27)
        ConsoleAutoPopUp (buf);
 }
 
@@ -1966,7 +1966,7 @@ ManProc ()
 {   // called from menu
 #ifdef OSXAPP
     char buf[MSG_SIZ];
-    snprintf(buf, MSG_SIZ, "%s ./man.command", appData.sysOpen);
+    snprintf(buf, MSG_SIZ, "osascript -e 'tell application \"Terminal\"' -e 'activate' -e 'do script \"man %s/../man/man6/xboard.6\"' -e 'end tell'", dataDir);
     system(buf);
 #else
     system("xterm -e man xboard &");
@@ -1974,6 +1974,20 @@ ManProc ()
 }
 
 void
+InfoProc ()
+{
+    char buf[MSG_SIZ];
+#ifdef OSXAPP
+    snprintf(buf, MSG_SIZ, "osascript -e 'tell application \"Terminal\"' -e 'activate' -e 'do script \"info -d %s/../info -f xboard.info\"' -e 'end tell'", dataDir);
+#else
+        snprintf(buf, sizeof(buf), "xterm -e info --directory %s --directory . -f %s &",
+                 INFODIR, INFOFILE);
+#endif
+    system(buf);
+}
+
+
+void
 SetWindowTitle (char *text, char *title, char *icon)
 {
 #ifdef TODO_GTK
@@ -2319,11 +2333,14 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp
   char *cp;
   char curDir[MSG_SIZ];
 
+  StartDir(filter, NULL); // change to start directory for this file type
+
   if(def && *def && def[strlen(def)-1] == '/') {
     getcwd(curDir, MSG_SIZ);
     chdir(def);
   }
 
+
   /* make a copy of the filter string, so that strtok can work with it*/
   cp = strdup(filter);
 
@@ -2396,8 +2413,10 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp
            ASSIGN(*name, filename);
            ScheduleDelayedEvent(DelayedLoad, 50);
         }
+      StartDir(filter, filename);
       g_free (filename);
-    };
+    }
+  else StartDir(filter, "");
 
   gtk_widget_destroy (dialog);
   ModeHighlight();