]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui_funcs.cxx
Added static port system and a new altimeter model connected to it.
[flightgear.git] / src / GUI / gui_funcs.cxx
index 6640b1f709449469f91b1e3e158759c0760cf670..aaec44362eba04c85cd9dd7507e2bf9098eee962 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+// for help call back
+#ifdef WIN32
+# include <shellapi.h>
+# ifdef __CYGWIN__
+#  include <sys/cygwin.h>
+# endif
+#endif
+
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
@@ -99,7 +107,6 @@ extern void fgInitVisuals( void );
 extern void fgReshape( int width, int height );
 extern void fgRenderFrame( void );
 
-extern FGInterface cur_view_fdm;
 extern void fgHUDalphaAdjust( puObject * );
 
 // from cockpit.cxx
@@ -109,8 +116,6 @@ extern void fgLatLonFormatToggle( puObject *);
 extern void net_fgd_scan(puObject *cb);
 #endif // #ifdef FG_NETWORK_OLK
 
-#define TR_HIRES_SNAP  1
-
 #if defined( TR_HIRES_SNAP)
 #include <simgear/screen/tr.h>
 extern void trRenderFrame( void );
@@ -145,6 +150,55 @@ char msg_RESET[]  = "Reset";
 
 char global_dialog_string[256];
 
+const __fg_gui_fn_t __fg_gui_fn[] = {
+
+        // File
+        {"saveFlight", saveFlight},
+        {"loadFlight", loadFlight},
+        {"reInit", reInit},
+#ifdef TR_HIRES_SNAP
+        {"dumpHiResSnapShot", dumpHiResSnapShot},
+#endif
+        {"dumpSnapShot", dumpSnapShot},
+#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
+        {"printScreen", printScreen},
+#endif
+        {"MayBeGoodBye", MayBeGoodBye},
+
+        //View
+        {"guiTogglePanel", guiTogglePanel},
+        {"PilotOffsetAdjust", PilotOffsetAdjust},
+        {"fgHUDalphaAdjust", fgHUDalphaAdjust},
+        {"prop_pickerView", prop_pickerView},
+
+        // Environment
+        {"NewAirport", NewAirport},
+
+        // Network
+#ifdef FG_NETWORK_OLK
+        {"net_display_toggle", net_display_toggle},
+        {"NewCallSign", NewCallSign},
+        {"net_fgd_scan", net_fgd_scan},
+        {"net_register", net_register},
+        {"net_unregister", net_unregister},
+#endif
+
+        // Autopilot
+        {"NewAltitude", NewAltitude},
+       {"NewHeading", NewHeading},
+        {"AddWayPoint", AddWayPoint},
+        {"PopWayPoint", PopWayPoint},
+        {"ClearRoute", ClearRoute},
+        {"fgAPAdjust", fgAPAdjust},
+        {"fgLatLonFormatToggle", fgLatLonFormatToggle},
+
+        // Help
+        {"helpCb", helpCb},
+
+        // Structure termination
+        {"", NULL}
+};
+
 
 /* ================ General Purpose Functions ================ */
 
@@ -480,6 +534,7 @@ void helpCb (puObject *)
     path.append( "Docs/index.html" );
        
 #if !defined(WIN32)
+
     string help_app = fgGetString("/sim/startup/browser-app");
 
     if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
@@ -488,13 +543,27 @@ void helpCb (puObject *)
         command = help_app + " " + path.str();
     }
     command += " &";
+    system( command.c_str() );
+
 #else // WIN32
-       command = "start ";
-       command += path.str();
+
+    // Look for favorite browser
+    char Dummy[1024], ExecName[1024], browserParameter[1024];
+    char win32_name[1024];
+# ifdef __CYGWIN__
+    cygwin32_conv_to_full_win32_path(path.c_str(),win32_name);
+# else
+    strcpy(win32_name,path.c_str());
+# endif
+    Dummy[0] = 0;
+    FindExecutable(win32_name, Dummy, ExecName);
+    sprintf(browserParameter, "file:///%s", win32_name);
+    ShellExecute ( NULL, "open", ExecName, browserParameter, Dummy,
+                   SW_SHOWNORMAL ) ;
+
 #endif
        
-    system( command.c_str() );
-    mkDialog ("Help started in netscape window.");
+    mkDialog ("Help started in your web browser window.");
 }
 
 #if defined( TR_HIRES_SNAP)