]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui.cxx
The following changes were made to flightgear-0.7.5 code to implement the follow
[flightgear.git] / src / GUI / gui.cxx
index dba7223c3b728d450b0efdd60c89ff938adcb219..64bd707d88220a7b9827e515d94b948cf834e41c 100644 (file)
 #endif
 
 #include <GL/glut.h>
-#include <simgear/xgl.h>
+#include <simgear/xgl/xgl.h>
 
 #if defined(FX) && defined(XMESA)
 #  include <GL/xmesa.h>
 #endif
 
+#include STL_FSTREAM
 #include STL_STRING
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <simgear/constants.h>
-#include <simgear/logstream.hxx>
-#include <simgear/fgpath.hxx>
-#include <simgear/screen-dump.hxx>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/fgpath.hxx>
+#include <simgear/screen/screen-dump.hxx>
 
 #include <Include/general.hxx>
 #include <Aircraft/aircraft.hxx>
 #include <Airports/simple.hxx>
+#include <Autopilot/auto_gui.hxx>
+#include <Autopilot/newauto.hxx>
 #include <Cockpit/panel.hxx>
 #include <Controls/controls.hxx>
 #include <FDM/flight.hxx>
-#include <Main/options.hxx>
+#include <Main/bfi.hxx>
 #include <Main/fg_init.hxx>
-#include <Main/views.hxx>
+#include <Main/fg_io.hxx>
+#include <Main/globals.hxx>
+#include <Main/options.hxx>
+#include <Main/save.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
-#include <Time/fg_time.hxx>
 
 #if defined( WIN32 ) && !defined( __CYGWIN__ )
-#  include <Screen/win32-printer.h>
-#  include <Screen/GlBitmaps.h>
+#  include <simgear/screen/win32-printer.h>
+#  include <simgear/screen/GlBitmaps.h>
 #endif
 
 /*
@@ -169,15 +174,15 @@ char *gui_msg_RESET;  // "RESET"
 static char global_dialog_string[256];
 
 // from autopilot.cxx
-extern void NewAltitude( puObject *cb );
-extern void NewHeading( puObject *cb );
-extern void fgAPAdjust( puObject * );
-extern void NewTgtAirport( puObject *cb );
-bool fgAPTerrainFollowEnabled( void );
-bool fgAPAltitudeEnabled( void );
-bool fgAPHeadingEnabled( void );
-bool fgAPWayPointEnabled( void );
-bool fgAPAutoThrottleEnabled( void );
+// extern void NewAltitude( puObject *cb );
+// extern void NewHeading( puObject *cb );
+// extern void fgAPAdjust( puObject * );
+// extern void NewTgtAirport( puObject *cb );
+// bool fgAPTerrainFollowEnabled( void );
+// bool fgAPAltitudeEnabled( void );
+// bool fgAPHeadingEnabled( void );
+// bool fgAPWayPointEnabled( void );
+// bool fgAPAutoThrottleEnabled( void );
 
 // from cockpit.cxx
 extern void fgLatLonFormatToggle( puObject *);
@@ -294,7 +299,8 @@ static inline void TurnCursorOn( void )
     }
 #endif
 #if defined(X_CURSOR_TWEAKS)
-    glutWarpPointer( current_view.get_winWidth()/2, current_view.get_winHeight()/2);
+    glutWarpPointer( globals->get_current_view()->get_winWidth()/2,
+                    globals->get_current_view()->get_winHeight()/2);
 #endif
 }
 
@@ -304,7 +310,8 @@ static inline void TurnCursorOff( void )
 #if defined(WIN32_CURSOR_TWEAKS)
     glutSetCursor(GLUT_CURSOR_NONE);
 #elif defined(X_CURSOR_TWEAKS)
-    glutWarpPointer( current_view.get_winWidth(), current_view.get_winHeight());
+    glutWarpPointer( globals->get_current_view()->get_winWidth(),
+                    globals->get_current_view()->get_winHeight());
 #endif
 }
 
@@ -364,14 +371,6 @@ void guiMotionFunc ( int x, int y )
     int ww, wh, need_warp = 0;
     float W, H;
     double offset;
-//  FGTime *t = FGTime::cur_time_params;
-//  if( mouse_timed_out ) {
-//      if( t->get_cur_time() > mouse_off_time ) {
-//          moused_timed_out = 0;
-//          TurnCursorOn();
-//          glutPostRedisplay () ;
-//      }
-//  }
 
     if (mouse_mode == MOUSE_POINTER) {
         puMouse ( x, y ) ;
@@ -383,8 +382,8 @@ void guiMotionFunc ( int x, int y )
         // reset left click MOUSE_VIEW toggle feature
         _mVtoggle = 0;
         
-        ww = current_view.get_winWidth();
-        wh = current_view.get_winHeight();
+        ww = globals->get_current_view()->get_winWidth();
+        wh = globals->get_current_view()->get_winHeight();
         
         switch (mouse_mode) {
             case MOUSE_YOKE:
@@ -398,20 +397,20 @@ void guiMotionFunc ( int x, int y )
                         offset = (_mY - y) * throttle_sensitivity;
                         controls.move_throttle(FGControls::ALL_ENGINES, offset);
                     } else if ( right_button() ) {
-                        if( !fgAPHeadingEnabled() ) {
+                        if( ! current_autopilot->get_HeadingEnabled() ) {
                             offset = (x - _mX) * rudder_sensitivity;
                             controls.move_rudder(offset);
                         }
-                        if( !fgAPAltitudeEnabled() ) {
+                        if( ! current_autopilot->get_AltitudeEnabled() ) {
                             offset = (_mY - y) * trim_sensitivity;
                             controls.move_elevator_trim(offset);
                         }
                     } else {
-                        if( !fgAPHeadingEnabled() ) {
+                        if( ! current_autopilot->get_HeadingEnabled() ) {
                             offset = (x - _mX) * aileron_sensitivity;
                             controls.move_aileron(offset);
                         }
-                        if( !fgAPAltitudeEnabled() ) {
+                        if( ! current_autopilot->get_AltitudeEnabled() ) {
                             offset = (_mY - y) * elevator_sensitivity;
                             controls.move_elevator(offset);
                         }
@@ -478,7 +477,7 @@ void guiMotionFunc ( int x, int y )
                 // do horizontal pan
                 // this could be done in above quat
                 // but requires redoing view pipeline
-                offset = current_view.get_goal_view_offset();
+                offset = globals->get_current_view()->get_goal_view_offset();
                 offset += ((_mX - x) * FG_2PI / W );
                 while (offset < 0.0) {
                     offset += FG_2PI;
@@ -486,9 +485,9 @@ void guiMotionFunc ( int x, int y )
                 while (offset > FG_2PI) {
                     offset -= FG_2PI;
                 }
-                current_view.set_goal_view_offset(offset);
+                globals->get_current_view()->set_goal_view_offset(offset);
 #ifdef NO_SMOOTH_MOUSE_VIEW
-                current_view.set_view_offset(offset);
+                globals->get_current_view()->set_view_offset(offset);
 #endif
                 break;
             
@@ -545,9 +544,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
                         curquat[1] = _quat[1];
                         curquat[2] = _quat[2];
                         curquat[3] = _quat[3];
-                        current_view.set_goal_view_offset(_view_offset);
+                        globals->get_current_view()->set_goal_view_offset(_view_offset);
 #ifdef NO_SMOOTH_MOUSE_VIEW
-                        current_view.set_view_offset(_view_offset);
+                        globals->get_current_view()->set_view_offset(_view_offset);
 #endif
                     } else {
                         // center view
@@ -559,13 +558,13 @@ void guiMouseFunc(int button, int updown, int x, int y)
                         _quat[1] = curquat[1];
                         _quat[2] = curquat[2];
                         _quat[3] = curquat[3];
-                        x = current_view.get_winWidth()/2;
-                        y = current_view.get_winHeight()/2;
+                        x = globals->get_current_view()->get_winWidth()/2;
+                        y = globals->get_current_view()->get_winHeight()/2;
                         Quat0();
-                        _view_offset = current_view.get_goal_view_offset();
-                        current_view.set_goal_view_offset(0.0);
+                        _view_offset = globals->get_current_view()->get_goal_view_offset();
+                        globals->get_current_view()->set_goal_view_offset(0.0);
 #ifdef NO_SMOOTH_MOUSE_VIEW
-                        current_view.set_view_offset(0.0);
+                        globals->get_current_view()->set_view_offset(0.0);
 #endif
                     }
                     glutWarpPointer( x , y);
@@ -581,8 +580,8 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     _savedX = x;
                     _savedY = y;
                     // start with zero point in center of screen
-                    _mX = current_view.get_winWidth()/2;
-                    _mY = current_view.get_winHeight()/2;
+                    _mX = globals->get_current_view()->get_winWidth()/2;
+                    _mY = globals->get_current_view()->get_winHeight()/2;
                     
                     // try to have the MOUSE_YOKE position
                     // reflect the current stick position
@@ -598,8 +597,8 @@ void guiMouseFunc(int button, int updown, int x, int y)
                 case MOUSE_YOKE:
                     mouse_mode = MOUSE_VIEW;
                     current_options.set_control_mode( fgOPTIONS::FG_JOYSTICK );
-                    x = current_view.get_winWidth()/2;
-                    y = current_view.get_winHeight()/2;
+                    x = globals->get_current_view()->get_winWidth()/2;
+                    y = globals->get_current_view()->get_winHeight()/2;
                     _mVtoggle = 0;
                     Quat0();
                     build_rotmatrix(quat_mat, curquat);
@@ -614,9 +613,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
 #ifdef RESET_VIEW_ON_LEAVING_MOUSE_VIEW
                     Quat0();
                     build_rotmatrix(quat_mat, curquat);
-                    current_view.set_goal_view_offset(0.0);
+                    globals->get_current_view()->set_goal_view_offset(0.0);
 #ifdef NO_SMOOTH_MOUSE_VIEW
-                    current_view.set_view_offset(0.0);
+                    globals->get_current_view()->set_view_offset(0.0);
 #endif
 #endif      // RESET_VIEW_ON_LEAVING_MOUSE_VIEW
                     glutSetCursor(GLUT_CURSOR_INHERIT);
@@ -641,7 +640,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
     // If we're in pointer mode, let PUI
     // know what's going on.
     if (mouse_mode == MOUSE_POINTER) {
-        puMouse (button, updown, x,y);
+      if (!puMouse (button, updown, x,y)) {
+       current_panel->doMouseAction(button, updown, x, y);
+      }
     }
     
     // Register the new position (if it
@@ -668,28 +669,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 )
-{
-    int toggle_pause;
-
-    if ( current_options.get_panel_status() ) {
-        FGView *v = &current_view;
-        FGTime *t = FGTime::cur_time_params;
-
-        if( (toggle_pause = !t->getPause()) )
-            t->togglePauseMode();
-
-        // this seems to be the only way to do this :-(
-        // problem is the viewport has been mucked with
-        xglViewport(0, 0 , (GLint)(v->winWidth), (GLint)(v->winHeight) );
-        FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
-
-        if(toggle_pause)
-            t->togglePauseMode();
-    }
-}
-
 // Toggle the Menu and Mouse display state
 void guiToggleMenu(void)
 {
@@ -714,6 +693,36 @@ void guiToggleMenu(void)
 the Gui callback functions 
 ____________________________________________________________________*/
 
+static void saveFlight(puObject *cv)
+{
+    BusyCursor(0);
+    ofstream output("fgfs.sav");
+    if (output.good() && fgSaveFlight(output)) {
+      output.close();
+      mkDialog("Saved flight to ./fgfs.sav");
+      FG_LOG(FG_INPUT, FG_INFO, "Saved flight to fgfs.sav");
+    } else {
+      mkDialog("Cannot save flight to ./fgfs.sav");
+      FG_LOG(FG_INPUT, FG_ALERT, "Cannot save flight to fgfs.sav");
+    }
+    BusyCursor(1);
+}
+
+static void loadFlight(puObject *cb)
+{
+    BusyCursor(0);
+    ifstream input("fgfs.sav");
+    if (input.good() && fgLoadFlight(input)) {
+      input.close();
+      mkDialog("Loaded flight from fgfs.sav");
+      FG_LOG(FG_INPUT, FG_INFO, "Restored flight from ./fgfs.sav");
+    } else {
+      mkDialog("Failed to load flight from fgfs.sav");
+      FG_LOG(FG_INPUT, FG_ALERT, "Cannot load flight from ./fgfs.sav");
+    }
+    BusyCursor(1);
+}
+
 void reInit(puObject *cb)
 {
     BusyCursor(0);
@@ -722,6 +731,11 @@ void reInit(puObject *cb)
     fgReInitSubsystems();
     BusyCursor(1);
 }
+
+static void toggleClouds(puObject *cb)
+{
+    FGBFI::setClouds( !FGBFI::getClouds() );
+}
        
 // This is the accessor function
 void guiTogglePanel(puObject *cb)
@@ -742,13 +756,15 @@ void goodBye(puObject *)
     cout << "Program exiting normally at user request." << endl;
 
 #ifdef FG_NETWORK_OLK    
-    if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
+    if ( current_options.get_network_olk() ) {
+       if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
+    }
 #endif
 
-    //  if(gps_bug)
-    //      fclose(gps_bug);
+    // close all external I/O connections
+    fgIOShutdownAll();
 
-    exit(-1);
+    exit(0);
 }
 
 
@@ -808,11 +824,11 @@ void ConfirmExitDialogInit(void)
         
         YNdialogBoxOkButton =  new puOneShot      (100, 10, 160, 50);
         YNdialogBoxOkButton -> setLegend          (gui_msg_OK);
+        YNdialogBoxOkButton -> makeReturnDefault  (TRUE );
         YNdialogBoxOkButton -> setCallback        (goodBye);
         
         YNdialogBoxNoButton =  new puOneShot      (240, 10, 300, 50);
         YNdialogBoxNoButton -> setLegend          (gui_msg_NO);
-        //      YNdialogBoxNoButton -> makeReturnDefault  (TRUE );
         YNdialogBoxNoButton -> setCallback        (goAwayYesNoCb);
     }
     FG_FINALIZE_PUI_DIALOG( YNdialogBox );
@@ -862,18 +878,18 @@ static void rotateView( double roll, double pitch, double yaw )
        // rotate view
 }
 
-static GLBitmap *b1 = NULL;
+static GlBitmap *b1 = NULL;
 extern FGInterface cur_view_fdm;
 GLubyte *hiResScreenCapture( int multiplier )
 {
        float oldfov = current_options.get_fov();
        float fov = oldfov / multiplier;
-       FGView *v = &current_view;
+       FGViewer *v = globals->get_current_view();
        current_options.set_fov(fov);
        v->force_update_fov_math();
     fgInitVisuals();
-    int cur_width = current_view.get_winWidth( );
-    int cur_height = current_view.get_winHeight( );
+    int cur_width = globals->get_current_view()->get_winWidth( );
+    int cur_height = globals->get_current_view()->get_winHeight( );
        if (b1) delete( b1 );
        // New empty (mostly) bitmap
        b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
@@ -891,7 +907,7 @@ GLubyte *hiResScreenCapture( int multiplier )
                        b1->copyBitmap( &b2, cur_width*x, cur_height*y );
                }
        }
-       current_view.UpdateViewParams(cur_view_fdm);
+       globals->get_current_view()->UpdateViewParams(cur_view_fdm);
        current_options.set_fov(oldfov);
        v->force_update_fov_math();
        return b1->getBitmap();
@@ -912,8 +928,8 @@ void printScreen ( puObject *obj ) {
     mainMenuBar->hide();
 
     CGlPrinter p( CGlPrinter::PRINT_BITMAP );
-    int cur_width = current_view.get_winWidth( );
-    int cur_height = current_view.get_winHeight( );
+    int cur_width = globals->get_current_view()->get_winWidth( );
+    int cur_height = globals->get_current_view()->get_winHeight( );
     p.Begin( "FlightGear", cur_width*3, cur_height*3 );
        p.End( hiResScreenCapture(3) );
 
@@ -938,6 +954,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() ) {
@@ -946,7 +966,8 @@ void fgDumpSnapShot () {
     }
 
     fgInitVisuals();
-    fgReshape( current_options.get_xsize(), current_options.get_ysize() );
+    fgReshape( globals->get_current_view()->get_winWidth(),
+              globals->get_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
@@ -969,6 +990,8 @@ void fgDumpSnapShot () {
        mainMenuBar->reveal();
     }
 
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 
@@ -994,13 +1017,16 @@ void AptDialog_Cancel(puObject *)
 
 void AptDialog_OK (puObject *)
 {
-       fgAIRPORTS airports;
-       fgAIRPORT a;
+    FGPath path( current_options.get_fg_root() );
+    path.append( "Airports" );
+    path.append( "simple.mk4" );
+    FGAirports airports( path.c_str() );
+
+    FGAirport a;
     
-    FGTime *t = FGTime::cur_time_params;
-    int PauseMode = t->getPause();
-    if(!PauseMode)
-        t->togglePauseMode();
+    int freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 
     char *s;
     AptDialogInput->getValue(&s);
@@ -1016,10 +1042,13 @@ void AptDialog_OK (puObject *)
                 "Attempting to set starting position from airport code "
                 << AptId );
 
-        airports.load("apt_simple");
         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);
@@ -1028,8 +1057,8 @@ void AptDialog_OK (puObject *)
             mkDialog(AptId.c_str());
         }
     }
-    if( PauseMode != t->getPause() )
-        t->togglePauseMode();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void AptDialog_Reset(puObject *)
@@ -1109,10 +1138,9 @@ void NetIdDialog_OK (puObject *)
 {
     string NetId;
     
-    FGTime *t = FGTime::cur_time_params;
-    int PauseMode = t->getPause();
-    if(!PauseMode)
-        t->togglePauseMode();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 /*  
    The following needs some cleanup because 
    "string options.NetId" and "char *net_callsign" 
@@ -1127,8 +1155,8 @@ void NetIdDialog_OK (puObject *)
 /* Entering a callsign indicates : user wants Net HUD Info */
     net_hud_display = 1;
 
-    if( PauseMode != t->getPause() )
-        t->togglePauseMode();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void NewCallSign(puObject *cb)
@@ -1228,16 +1256,16 @@ void NetFGDDialog_OK (puObject *)
 {
     char *NetFGD;    
 
-    FGTime *t = FGTime::cur_time_params;
-    int PauseMode = t->getPause();
-    if(!PauseMode) t->togglePauseMode();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
     NetFGDHostDialogInput->getValue( &NetFGD );
     strcpy( fgd_host, NetFGD);
     NetFGDPortLoDialogInput->getValue( (int *) &base_port );
     NetFGDPortHiDialogInput->getValue( (int *) &end_port );
     NetFGDDialog_Cancel( NULL );
-    if( PauseMode != t->getPause() )
-        t->togglePauseMode();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void NetFGDDialog_SCAN (puObject *)
@@ -1245,9 +1273,9 @@ void NetFGDDialog_SCAN (puObject *)
     char *NetFGD;
     int fgd_port;
     
-    FGTime *t = FGTime::cur_time_params;
-    int PauseMode = t->getPause();
-    if(!PauseMode) t->togglePauseMode();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 //    printf("Vor getvalue %s\n");
     NetFGDHostDialogInput->getValue( &NetFGD );
 //    printf("Vor strcpy %s\n", (char *) NetFGD);
@@ -1258,7 +1286,8 @@ void NetFGDDialog_SCAN (puObject *)
                  base_port, end_port);
     net_resolv_fgd(fgd_host);
     printf("Resolve : %d\n", net_r);
-    if( PauseMode != t->getPause() )  t->togglePauseMode();
+    if(!freeze)
+        globals->set_freeze( false );
     if ( net_r == 0 ) {
       fgd_port = 10000;
       strcpy( fgd_name, "");
@@ -1359,8 +1388,11 @@ char *fileSubmenu               [] = {
     "Print",
 #endif
     "Snap Shot",
-    /* "---------", "Save", */ 
-    "Reset", NULL
+    "---------", 
+    "Reset", 
+    "Load flight",
+    "Save flight",
+    NULL
 };
 puCallback fileSubmenuCb        [] = {
     MayBeGoodBye, /* hideMenuCb, NULL, */
@@ -1369,7 +1401,11 @@ puCallback fileSubmenuCb        [] = {
 #endif
     /* NULL, notCb, */
     dumpSnapShot,
-    reInit, NULL
+    NULL,
+    reInit, 
+    loadFlight,
+    saveFlight,
+    NULL
 };
 
 /*
@@ -1381,26 +1417,44 @@ puCallback editSubmenuCb        [] = {
 };
 */
 
+extern void fgHUDalphaAdjust( puObject * );
 char *viewSubmenu               [] = {
-    /* "Cockpit View > ", "View >","------------", */ "Toggle Panel...", NULL
+    "HUD Alpha",
+    /* "Cockpit View > ", "View >","------------", */
+    "Toggle Panel...", NULL
 };
 puCallback viewSubmenuCb        [] = {
-    /* notCb, notCb, NULL, guiTogglePanel, */ NULL
+    fgHUDalphaAdjust,
+    /* notCb, notCb, NULL, */
+    guiTogglePanel, NULL
 };
 
-char *aircraftSubmenu           [] = {
-    "Autopilot", "Heading", "Altitude", "Navigation", "Airport", 
-    /* "Communication", */ NULL
+//  "---------", 
+
+char *autopilotSubmenu           [] = {
+    "Toggle HUD Format", "Adjust AP Settings",
+    "---------", 
+    "Clear Route", "Skip Current Waypoint", "Add Waypoint",
+    "---------", 
+    "Set Altitude", "Set Heading",
+    NULL
 };
-puCallback aircraftSubmenuCb    [] = {
-    fgAPAdjust, NewHeading, NewAltitude, fgLatLonFormatToggle, NewTgtAirport, 
+
+puCallback autopilotSubmenuCb    [] = {
+    fgLatLonFormatToggle, fgAPAdjust,
+    NULL,
+    ClearRoute, PopWayPoint, AddWayPoint,
+    NULL,
+    NewAltitude, NewHeading,
     /* notCb, */ NULL
 };
 
 char *environmentSubmenu        [] = {
-    "Airport", /* "Terrain", "Weather", */ NULL
+    "Toggle Clouds",
+    "Goto Airport", /* "Terrain", "Weather", */ NULL
 };
 puCallback environmentSubmenuCb [] = {
+    toggleClouds,
     NewAirport, /* notCb, notCb, */ NULL
 };
 
@@ -1518,11 +1572,13 @@ void guiInit()
     mainMenuBar -> add_submenu ("File", fileSubmenu, fileSubmenuCb);
     // mainMenuBar -> add_submenu ("Edit", editSubmenu, editSubmenuCb);
     mainMenuBar -> add_submenu ("View", viewSubmenu, viewSubmenuCb);
-    mainMenuBar -> add_submenu ("Aircraft", aircraftSubmenu, aircraftSubmenuCb);
     mainMenuBar -> add_submenu ("Environment", environmentSubmenu, environmentSubmenuCb);
+    mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
     // 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 ();