]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui_funcs.cxx
Melchior: Make line wrapping in textboxes configurable, and enable it by default
[flightgear.git] / src / GUI / gui_funcs.cxx
index e350d68090461cc0e8eaf435e77c04a6b57133c2..559d2ffb575b6d6f559ffd99140db785e1f0b9c4 100644 (file)
@@ -40,7 +40,7 @@
 #  include <windows.h>
 #endif
 
-#include <GL/gl.h>
+#include SG_GL_H
 
 #if defined(FX) && defined(XMESA)
 #  include <GL/xmesa.h>
@@ -60,6 +60,8 @@
 # endif
 #endif
 
+#include <plib/ssg.h>
+
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
@@ -77,6 +79,7 @@
 #include <Main/fg_io.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/renderer.hxx>
 #include <Main/viewmgr.hxx>
 
 #if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
@@ -100,7 +103,6 @@ extern void fgLatLonFormatToggle( puObject *);
 
 #if defined( TR_HIRES_SNAP)
 #include <simgear/screen/tr.h>
-extern void trRenderFrame( void );
 extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
                          GLfloat x_end, GLfloat y_end );
 #endif
@@ -137,9 +139,9 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
         {"loadFlight", loadFlight},
         {"reInit", reInit},
 #ifdef TR_HIRES_SNAP
-        {"dumpHiResSnapShot", dumpHiResSnapShot},
+        {"dumpHiResSnapShot", fgHiResDumpWrapper},
 #endif
-        {"dumpSnapShot", dumpSnapShot},
+        {"dumpSnapShot", fgDumpSnapShotWrapper},
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
         {"printScreen", printScreen},
 #endif
@@ -384,9 +386,6 @@ void goodBye(puObject *)
     //      "Program exiting normally at user request." );
     cout << "Program exiting normally at user request." << endl;
 
-    // close all external I/O connections
-    globals->get_io()->shutdown_all();
-
     exit(0);
 }
 
@@ -520,16 +519,17 @@ void fgHiResDump()
     static int count = 1;
 
     static const SGPropertyNode *master_freeze
-       = fgGetNode("/sim/freeze/master");
+        = fgGetNode("/sim/freeze/master");
 
     bool freeze = master_freeze->getBoolValue();
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", true);
     }
 
+    TurnCursorOff();
     if ( !puCursorIsHidden() ) {
-        show_pu_cursor = true;
-        puHideCursor();
+       show_pu_cursor = true;
+       puHideCursor();
     }
 
     FGRenderer *renderer = globals->get_renderer();
@@ -540,25 +540,15 @@ void fgHiResDump()
     // we need two render frames here to clear the menu and cursor
     // ... not sure why but doing an extra fgRenderFrame() shouldn't
     // hurt anything
-    renderer->update( 0.0 );
-    renderer->update( 0.0 );
-
-    // Make sure we have SSG projection primed for current view
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
-    ssgSetCamera( (sgVec4 *)globals->get_current_view()->get_VIEW() );
-    ssgSetFOV( globals->get_current_view()->get_h_fov(),
-              globals->get_current_view()->get_v_fov() );
-    // ssgSetNearFar( 10.0f, 120000.0f );
-    ssgSetNearFar( 0.5f, 1200000.0f );
+    renderer->update( true );
+    renderer->update( true );
 
-       
     // This ImageSize stuff is a temporary hack
     // should probably use 128x128 tile size and
     // support any image size
 
     // This should be a requester to get multiplier from user
-    int multiplier = 3;
+    int multiplier = fgGetInt("/sim/startup/hires-multiplier", 3);
     int width = fgGetInt("/sim/startup/xsize");
     int height = fgGetInt("/sim/startup/ysize");
        
@@ -632,7 +622,7 @@ void fgHiResDump()
         trBeginTile(tr);
         int curColumn = trGet(tr, TR_CURRENT_COLUMN);
         int curRow =  trGet(tr, TR_CURRENT_ROW);
-        trRenderFrame();
+        renderer->update( false );
         if ( do_hud )
             fgUpdateHUD( curColumn*hud_col_step,      curRow*hud_row_step,
                          (curColumn+1)*hud_col_step, (curRow+1)*hud_row_step );
@@ -669,7 +659,7 @@ void fgHiResDump()
 
     }
 
-    globals->get_renderer()->resize( width, height );
+    renderer->resize( width, height );
 
     trDelete(tr);
 
@@ -692,6 +682,8 @@ void fgHiResDump()
         puShowCursor();
     }
 
+    TurnCursorOn();
+
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", false);
     }
@@ -716,7 +708,7 @@ GLubyte *hiResScreenCapture( int multiplier )
     globals->get_renderer()->init();
     int cur_width = fgGetInt("/sim/startup/xsize");
     int cur_height = fgGetInt("/sim/startup/ysize");
-    if (b1) delete( b1 );
+    delete( b1 );
     // New empty (mostly) bitmap
     b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
     int x,y;
@@ -725,7 +717,7 @@ GLubyte *hiResScreenCapture( int multiplier )
            globals->get_renderer()->resize( cur_width, cur_height );
            // pan to tile
            rotateView( 0, (y*fov)-((multiplier-1)*fov/2), (x*fov)-((multiplier-1)*fov/2) );
-           fgRenderFrame();
+           globals->get_renderer()->update( false );
            // restore view
            GlBitmap b2;
            b1->copyBitmap( &b2, cur_width*x, cur_height*y );
@@ -751,7 +743,7 @@ void printScreen ( puObject *obj ) {
     int cur_width = fgGetInt("/sim/startup/xsize");
     int cur_height = fgGetInt("/sim/startup/ysize");
     p.Begin( "FlightGear", cur_width*3, cur_height*3 );
-       p.End( hiResScreenCapture(3) );
+    p.End( hiResScreenCapture(3) );
 
     // BusyCursor(1);
     if ( show_pu_cursor ) {
@@ -762,12 +754,12 @@ void printScreen ( puObject *obj ) {
 #endif // #ifdef WIN32
 
 
-void dumpSnapShot ( puObject *obj ) {
+void fgDumpSnapShotWrapper ( puObject *obj ) {
     fgDumpSnapShot();
 }
 
 
-void dumpHiResSnapShot ( puObject *obj ) {
+void fgHiResDumpWrapper ( puObject *obj ) {
     fgHiResDump();
 }
 
@@ -793,15 +785,16 @@ void fgDumpSnapShot () {
        puHideCursor();
     }
 
-    globals->get_renderer()->init();
-    globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"),
-                                     fgGetInt("/sim/startup/ysize") );
+    FGRenderer *renderer = globals->get_renderer();
+    renderer->init();
+    renderer->resize( fgGetInt("/sim/startup/xsize"),
+                        fgGetInt("/sim/startup/ysize") );
 
     // we need two render frames here to clear the menu and cursor
     // ... not sure why but doing an extra fgRenderFrame() shouldn't
     // hurt anything
-    fgRenderFrame();
-    fgRenderFrame();
+    renderer->update( true );
+    renderer->update( true );
 
     while (count < 1000) {
         FILE *fp;