]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui_funcs.cxx
Merge branch 'maint2' into next
[flightgear.git] / src / GUI / gui_funcs.cxx
index 3d089161c1b38a774dc2e993740e0675a6681153..5746111963097196a445ec44a4093d525bfbafce 100644 (file)
 
 #include <simgear/compiler.h>
 
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include SG_GL_H
-
 #include <fstream>
 #include <string>
+#include <cstring>
+#include <sstream>
 
 #include <stdlib.h>
-#include <string.h>
 
-// for help call back
-#ifdef WIN32
-# include <shellapi.h>
-# ifdef __CYGWIN__
-#  include <sys/cygwin.h>
-# endif
-#endif
-
-#include <sstream>
-
-#include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/screen/screen-dump.hxx>
 
-#include <Include/general.hxx>
-#include <Aircraft/aircraft.hxx>
-#include <Aircraft/controls.hxx>
-#include <Airports/simple.hxx>
 #include <Cockpit/panel.hxx>
-#include <FDM/flight.hxx>
-#include <Main/main.hxx>
-#include <Main/fg_init.hxx>
-#include <Main/fg_io.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/renderer.hxx>
 #  include <simgear/screen/win32-printer.h>
 #  include <simgear/screen/GlBitmaps.h>
 #endif
-
+#ifdef __MINGW32__
+#include <shellapi.h>
+#endif
 #include "gui.h"
 
-SG_USING_STD(string);
-SG_USING_STD(cout);
+using std::string;
 
 
 #if defined( TR_HIRES_SNAP)
@@ -230,7 +207,6 @@ void fgHiResDump()
 {
     FILE *f;
     string message;
-    bool show_pu_cursor = false;
     bool menu_status = fgGetBool("/sim/menubar/visibility");
     char *filename = new char [24];
     static int count = 1;
@@ -244,11 +220,8 @@ void fgHiResDump()
     }
 
     fgSetBool("/sim/menubar/visibility", false);
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-       show_pu_cursor = true;
-       puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
 
     FGRenderer *renderer = globals->get_renderer();
 //     renderer->init();
@@ -415,11 +388,7 @@ void fgHiResDump()
 
     delete [] filename;
 
-    if ( show_pu_cursor ) {
-        puShowCursor();
-    }
-
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
     fgSetBool("/sim/menubar/visibility", menu_status);
 
     if ( !freeze ) {
@@ -469,12 +438,8 @@ GLubyte *hiResScreenCapture( int multiplier )
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
 // win32 print screen function
 void printScreen () {
-    bool show_pu_cursor = false;
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-       show_pu_cursor = true;
-       puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
 
     CGlPrinter p( CGlPrinter::PRINT_BITMAP );
     int cur_width = fgGetInt("/sim/startup/xsize");
@@ -482,10 +447,7 @@ void printScreen () {
     p.Begin( "FlightGear", cur_width*3, cur_height*3 );
     p.End( hiResScreenCapture(3) );
 
-    if ( show_pu_cursor ) {
-       puShowCursor();
-    }
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
 }
 #endif // #ifdef WIN32
 
@@ -502,7 +464,6 @@ void fgHiResDumpWrapper () {
 
 // do a screen snap shot
 bool fgDumpSnapShot () {
-    bool show_pu_cursor = false;
     static SGConstPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
 
     bool freeze = master_freeze->getBoolValue();
@@ -510,11 +471,9 @@ bool fgDumpSnapShot () {
         fgSetBool("/sim/freeze/master", true);
     }
 
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-        show_pu_cursor = true;
-        puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
+
     fgSetBool("/sim/signals/screenshot", true);
 
     FGRenderer *renderer = globals->get_renderer();
@@ -527,7 +486,10 @@ bool fgDumpSnapShot () {
     renderer->update( true );
     renderer->update( true );
 
-    string dir = fgGetString("/sim/paths/screenshot-dir", fgGetString("/sim/fg-current"));
+    string dir = fgGetString("/sim/paths/screenshot-dir");
+    if (dir.empty())
+        dir = fgGetString("/sim/fg-current");
+
     SGPath path(dir + '/');
     if (path.create_dir( 0755 )) {
         SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
@@ -555,11 +517,7 @@ bool fgDumpSnapShot () {
     fgSetString("/sim/paths/screenshot-last", path.c_str());
     fgSetBool("/sim/signals/screenshot", false);
 
-    if ( show_pu_cursor ) {
-        puShowCursor();
-    }
-
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
 
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", false);