]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui.cxx
Close all iochannel connections on exit.
[flightgear.git] / src / GUI / gui.cxx
index 904321d4b951cb12018b8ee6e9de69540a304411..8fd6545d378b57f13a2789e4ed95260659702f05 100644 (file)
@@ -66,6 +66,7 @@
 #include <FDM/flight.hxx>
 #include <Main/bfi.hxx>
 #include <Main/fg_init.hxx>
+#include <Main/fg_io.hxx>
 #include <Main/globals.hxx>
 #include <Main/options.hxx>
 #include <Main/views.hxx>
@@ -667,26 +668,6 @@ void mkDialog (const char *txt)
     FG_PUSH_PUI_DIALOG( dialogBox );
 }
 
-// Repair any damage done to the Panel by other Gui Items
-void guiFixPanel( void )
-{
-#if 0 // this function does nothing anyway
-    bool freeze = globals->get_freeze();
-
-    if ( current_options.get_panel_status() ) {
-        // FGView *v = &current_view;
-        if( !freeze )
-            globals->set_freeze( true );
-
-       // we must have some something here at some point but this
-       // function does nothing now.
-
-        if( !freeze )
-            globals->set_freeze( false );
-    }
-#endif
-}
-
 // Toggle the Menu and Mouse display state
 void guiToggleMenu(void)
 {
@@ -779,10 +760,10 @@ void goodBye(puObject *)
     }
 #endif
 
-    //  if(gps_bug)
-    //      fclose(gps_bug);
+    // close all external I/O connections
+    fgIOShutdownAll();
 
-    exit(-1);
+    exit(0);
 }
 
 
@@ -972,6 +953,10 @@ void dumpSnapShot ( puObject *obj ) {
 void fgDumpSnapShot () {
     bool show_pu_cursor = false;
 
+    int freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
+
     mainMenuBar->hide();
     TurnCursorOff();
     if ( !puCursorIsHidden() ) {
@@ -980,7 +965,7 @@ void fgDumpSnapShot () {
     }
 
     fgInitVisuals();
-    fgReshape( current_options.get_xsize(), current_options.get_ysize() );
+    fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
 
     // we need two render frames here to clear the menu and cursor
     // ... not sure why but doing an extra fgFenderFrame() shoulnd't
@@ -1003,6 +988,8 @@ void fgDumpSnapShot () {
        mainMenuBar->reveal();
     }
 
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 
@@ -1056,6 +1043,10 @@ void AptDialog_OK (puObject *)
         if ( airports.search( AptId, &a ) )
         {
             current_options.set_airport_id( AptId.c_str() );
+            current_options.set_altitude( -9999.0 );
+           // fgSetPosFromAirportID( AptId );
+           fgSetPosFromAirportIDandHdg( AptId, 
+                                        cur_fdm_state->get_Psi() * RAD_TO_DEG);
             BusyCursor(0);
             fgReInitSubsystems();
             BusyCursor(1);
@@ -1572,7 +1563,9 @@ void guiInit()
     mainMenuBar -> add_submenu ("Environment", environmentSubmenu, environmentSubmenuCb);
     // mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
 #ifdef FG_NETWORK_OLK
-    mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
+    if ( current_options.get_network_olk() ) {
+       mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
+    }
 #endif
     mainMenuBar -> add_submenu ("Help", helpSubmenu, helpSubmenuCb);
     mainMenuBar-> close ();