]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui_funcs.cxx
Merge branch 'torsten/auto'
[flightgear.git] / src / GUI / gui_funcs.cxx
index 5746111963097196a445ec44a4093d525bfbafce..52eb06662e95582229c0cf11af4f55bd89d031bf 100644 (file)
 #include <Cockpit/panel.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/fg_os.hxx>
 #include <Main/renderer.hxx>
 #include <Main/viewmgr.hxx>
 #include <GUI/new_gui.hxx>
 
-#if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
+#ifdef _WIN32
+#  include <shellapi.h>
+# if !defined(__MINGW32__)
 #  include <simgear/screen/win32-printer.h>
 #  include <simgear/screen/GlBitmaps.h>
-#endif
-#ifdef __MINGW32__
-#include <shellapi.h>
+# endif
 #endif
 #include "gui.h"
 
@@ -74,7 +75,7 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
         {"dumpHiResSnapShot", fgHiResDumpWrapper},
 #endif
         {"dumpSnapShot", fgDumpSnapShotWrapper},
-#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
+#if defined( _WIN32 ) && !defined(__MINGW32__)
         {"printScreen", printScreen},
 #endif
         // Help
@@ -141,7 +142,7 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable)
     string msg = txt;
     msg += '\n';
     msg += throwable.getFormattedMessage();
-    if (!throwable.getOrigin().empty()) {
+    if (!std::strlen(throwable.getOrigin()) != 0) {
         msg += "\n (reported by ";
         msg += throwable.getOrigin();
         msg += ')';
@@ -169,7 +170,7 @@ void helpCb ()
     SGPath path( globals->get_fg_root() );
     path.append( "Docs/index.html" );
        
-#if !defined(WIN32)
+#ifndef _WIN32
 
     command = globals->get_browser();
     string::size_type pos;
@@ -181,7 +182,7 @@ void helpCb ()
     command += " &";
     system( command.c_str() );
 
-#else // WIN32
+#else // _WIN32
 
     // Look for favorite browser
     char Dummy[1024], ExecName[1024], browserParameter[1024];
@@ -246,6 +247,7 @@ void fgHiResDump()
     /* allocate buffer large enough to store one tile */
     GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
     if (!tile) {
+        delete [] filename;
         printf("Malloc of tile buffer failed!\n");
         return;
     }
@@ -257,6 +259,7 @@ void fgHiResDump()
     GLubyte *buffer
         = (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
     if (!buffer) {
+        delete [] filename;
         free(tile);
         printf("Malloc of tile row buffer failed!\n");
         return;
@@ -283,6 +286,7 @@ void fgHiResDump()
     f = fopen(filename, "wb");
     if (!f) {
         printf("Couldn't open image file: %s\n", filename);
+        delete [] filename;
         free(buffer);
         free(tile);
         return;
@@ -295,6 +299,8 @@ void fgHiResDump()
     /* just to be safe... */
     glPixelStorei(GL_PACK_ALIGNMENT, 1);
 
+    // OSGFIXME
+#if 0
     /* Because the HUD and Panel change the ViewPort we will
      * need to handle some lowlevel stuff ourselves */
     int ncols = trGet(tr, TR_COLUMNS);
@@ -307,7 +313,7 @@ void fgHiResDump()
     bool do_panel = fgPanelVisible();
     GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
     GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
-
+#endif
     glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
     glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
@@ -319,7 +325,7 @@ void fgHiResDump()
     while (more) {
         trBeginTile(tr);
         int curColumn = trGet(tr, TR_CURRENT_COLUMN);
-        int curRow =  trGet(tr, TR_CURRENT_ROW);
+        // int curRow =  trGet(tr, TR_CURRENT_ROW);
 
         renderer->update( false );
         // OSGFIXME
@@ -398,7 +404,7 @@ void fgHiResDump()
 #endif // #if defined( TR_HIRES_SNAP)
 
 
-#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
+#if defined( _WIN32 ) && !defined(__MINGW32__)
 
 void rotateView( double roll, double pitch, double yaw )
 {
@@ -435,7 +441,7 @@ GLubyte *hiResScreenCapture( int multiplier )
 }
 #endif
 
-#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
+#if defined( _WIN32 ) && !defined(__MINGW32__)
 // win32 print screen function
 void printScreen () {
     int mouse = fgGetMouseCursor();
@@ -449,7 +455,7 @@ void printScreen () {
 
     fgSetMouseCursor(mouse);
 }
-#endif // #ifdef WIN32
+#endif // #ifdef _WIN32
 
 
 void fgDumpSnapShotWrapper () {
@@ -500,7 +506,7 @@ bool fgDumpSnapShot () {
     char filename[24];
     static int count = 1;
     while (count < 1000) {
-        snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
+        snprintf(filename, 24, "fgfs-screen-%03d.png", count++);
 
         SGPath p(dir);
         p.append(filename);
@@ -532,8 +538,6 @@ void fgDumpSceneGraph()
     string message;
     static int count = 1;
 
-    FGRenderer *renderer = globals->get_renderer();
-
     static const SGPropertyNode *master_freeze
        = fgGetNode("/sim/freeze/master");
 
@@ -577,8 +581,6 @@ void fgDumpTerrainBranch()
     string message;
     static int count = 1;
 
-    FGRenderer *renderer = globals->get_renderer();
-
     static const SGPropertyNode *master_freeze
        = fgGetNode("/sim/freeze/master");