- float oldfov = fgGetDouble("/sim/field-of-view");
- float fov = oldfov / multiplier;
- FGViewer *v = globals->get_current_view();
- fgSetDouble("/sim/field-of-view", fov);
- fgInitVisuals();
- int cur_width = fgGetInt("/sim/startup/xsize");
- int cur_height = fgGetInt("/sim/startup/ysize");
- if (b1) delete( b1 );
- // New empty (mostly) bitmap
- b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
- int x,y;
- for ( y = 0; y < multiplier; y++ ) {
- for ( x = 0; x < multiplier; x++ ) {
- fgReshape( cur_width, cur_height );
- // pan to tile
- rotateView( 0, (y*fov)-((multiplier-1)*fov/2), (x*fov)-((multiplier-1)*fov/2) );
- fgRenderFrame();
- // restore view
- GlBitmap b2;
- b1->copyBitmap( &b2, cur_width*x, cur_height*y );
- }
- }
- fgSetDouble("/sim/field-of-view", oldfov);
- return b1->getBitmap();
-}
-#endif
-
-
-#if defined( WIN32 ) && !defined( __CYGWIN__)
-// win32 print screen function
-void printScreen ( puObject *obj ) {
- bool show_pu_cursor = false;
- TurnCursorOff();
- if ( !puCursorIsHidden() ) {
- show_pu_cursor = true;
- puHideCursor();
- }
- BusyCursor( 0 );
- mainMenuBar->hide();
-
- CGlPrinter p( CGlPrinter::PRINT_BITMAP );
- 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) );
-
- if( gui_menu_on ) {
- mainMenuBar->reveal();
- }
- BusyCursor(1);
- if ( show_pu_cursor ) {
- puShowCursor();
- }
- TurnCursorOn();
-}
-#endif // #ifdef WIN32
-
-
-void dumpSnapShot ( puObject *obj ) {
- fgDumpSnapShot();
-}
-
-
-// do a screen snap shot
-void fgDumpSnapShot () {
- bool show_pu_cursor = false;
-
- int freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
-
- mainMenuBar->hide();
- TurnCursorOff();
- if ( !puCursorIsHidden() ) {
- show_pu_cursor = true;
- puHideCursor();
- }
-
- fgInitVisuals();
- fgReshape( 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 fgFenderFrame() shoulnd't
- // hurt anything
- fgRenderFrame();
- fgRenderFrame();
-
- my_glDumpWindow( "fgfs-screen.ppm",
- fgGetInt("/sim/startup/xsize"),
- fgGetInt("/sim/startup/ysize") );
-
- mkDialog ("Snap shot saved to fgfs-screen.ppm");
-
- if ( show_pu_cursor ) {
- puShowCursor();
- }
-
- TurnCursorOn();
- if( gui_menu_on ) {
- mainMenuBar->reveal();
- }
-
- if(!freeze)
- globals->set_freeze( false );
-}
-
-#ifdef FG_NETWORK_OLK
-static void net_display_toggle( puObject *cb)
-{
- net_hud_display = (net_hud_display) ? 0 : 1;
- printf("Toggle net_hud_display : %d\n", net_hud_display);
-}
-
-static void net_register( puObject *cb)
-{
- fgd_send_com( "1", FGFS_host );
- net_is_registered = 0;
- printf("Registering to deamon\n");
-}
-
-static void net_unregister( puObject *cb)
-{
- fgd_send_com( "8", FGFS_host );
- net_is_registered = -1;
- printf("Unregistering from deamon\n");
-}
-
-extern void net_fgd_scan(puObject *cb);
-#endif // #ifdef FG_NETWORK_OLK
-
-/* -----------------------------------------------------------------------
-The menu stuff
----------------------------------------------------------------------*/
-char *fileSubmenu [] = {
- "Exit", /* "Close", "---------", */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
- "Print",
-#endif
- "Snap Shot",
- "---------",
- "Reset",
- "Load flight",
- "Save flight",
- NULL
-};
-puCallback fileSubmenuCb [] = {
- MayBeGoodBye, /* hideMenuCb, NULL, */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
- printScreen,
-#endif
- /* NULL, notCb, */
- dumpSnapShot,
- NULL,
- reInit,
- loadFlight,
- saveFlight,
- NULL
-};
-
-/*
-char *editSubmenu [] = {
- "Edit text", NULL
-};
-puCallback editSubmenuCb [] = {
- notCb, NULL
-};
-*/
-
-extern void fgHUDalphaAdjust( puObject * );
-char *viewSubmenu [] = {
- "HUD Alpha",
- "Pilot Offset",
- /* "Cockpit View > ", "View >","------------", */
- "Toggle Panel...", NULL
-};
-puCallback viewSubmenuCb [] = {
- fgHUDalphaAdjust,
- PilotOffsetAdjust,
- /* notCb, notCb, NULL, */
- guiTogglePanel, NULL
-};
-
-// "---------",
-
-char *autopilotSubmenu [] = {
- "Toggle HUD Format", "Adjust AP Settings",
- "---------",
- "Clear Route", "Skip Current Waypoint", "Add Waypoint",
- "---------",
- "Set Altitude", "Set Heading",
- NULL
-};
-
-puCallback autopilotSubmenuCb [] = {
- fgLatLonFormatToggle, fgAPAdjust,
- NULL,
- ClearRoute, PopWayPoint, AddWayPoint,
- NULL,
- NewAltitude, NewHeading,
- /* notCb, */ NULL
-};
-
-char *environmentSubmenu [] = {
- "Goto Airport", /* "Terrain", "Weather", */ NULL
-};
-puCallback environmentSubmenuCb [] = {
- NewAirport, /* notCb, notCb, */ NULL
-};
-
-/*
-char *optionsSubmenu [] = {
- "Preferences", "Realism & Reliablity...", NULL
-};
-puCallback optionsSubmenuCb [] = {
- notCb, notCb, NULL
-};
-*/
-
-#ifdef FG_NETWORK_OLK
-char *networkSubmenu [] = {
- "Unregister from FGD ", /* "Send MSG to All", "Send MSG", "Show Pilots", */
- "Register to FGD",
- "Scan for Deamons", "Enter Callsign", /* "Display Netinfos", */
- "Toggle Display", NULL
-};
-puCallback networkSubmenuCb [] = {
- /* notCb, notCb, notCb, notCb, */
- net_unregister,
- net_register,
- net_fgd_scan, NewCallSign,
- net_display_toggle, NULL
-};
-#endif
-
-char *helpSubmenu [] = {
- /* "About...", */ "Help", NULL
-};
-puCallback helpSubmenuCb [] = {
- /* notCb, */ helpCb, NULL
-};
-
-
-/* -------------------------------------------------------------------------
-init the gui
-_____________________________________________________________________*/
-
-
-void guiInit()
-{
- char *mesa_win_state;
-
- // Initialize PUI
- puInit();
- puSetDefaultStyle ( PUSTYLE_SMALL_BEVELLED ); //PUSTYLE_DEFAULT
- puSetDefaultColourScheme (0.8, 0.8, 0.8, 0.4);
-
- // Initialize our GLOBAL GUI STRINGS
- gui_msg_OK = msg_OK; // "OK"
- gui_msg_NO = msg_NO; // "NO"
- gui_msg_YES = msg_YES; // "YES"
- gui_msg_CANCEL = msg_CANCEL; // "CANCEL"
- gui_msg_RESET = msg_RESET; // "RESET"
-
- // Next check home directory
- SGPath fntpath;
- char* envp = ::getenv( "FG_FONTS" );
- if ( envp != NULL ) {
- fntpath.set( envp );
- } else {
- fntpath.set( globals->get_fg_root() );
- fntpath.append( "Fonts" );
- }
-
- // Install our fast fonts
- fntpath.append( "typewriter.txf" );
- guiFntHandle = new fntTexFont ;
- guiFntHandle -> load ( (char *)fntpath.c_str() ) ;
- puFont GuiFont ( guiFntHandle, 15 ) ;
- puSetDefaultFonts( GuiFont, GuiFont ) ;
- guiFnt = puGetDefaultLabelFont();
-
- if (!fgHasValue("/sim/startup/mouse-pointer")) {
- // no preference specified for mouse pointer, attempt to autodetect...
- // Determine if we need to render the cursor, or if the windowing
- // system will do it. First test if we are rendering with glide.
- if ( strstr ( general.get_glRenderer(), "Glide" ) ) {
- // Test for the MESA_GLX_FX env variable
- if ( (mesa_win_state = getenv( "MESA_GLX_FX" )) != NULL) {
- // test if we are fullscreen mesa/glide
- if ( (mesa_win_state[0] == 'f') ||
- (mesa_win_state[0] == 'F') ) {
- puShowCursor ();
- }
- }
- }
-// mouse_active = ~mouse_active;
- } else if ( !fgGetBool("/sim/startup/mouse-pointer") ) {
- // don't show pointer
- } else {
- // force showing pointer
- puShowCursor();
-// mouse_active = ~mouse_active;
- }
-
- // MOUSE_VIEW mode stuff
- initMouseQuat();
-
- // Set up our Dialog Boxes
- ConfirmExitDialogInit();
- NewAirportInit();
-#ifdef FG_NETWORK_OLK
- NewNetIdInit();
- NewNetFGDInit();
-#endif
-
- mkDialogInit();
-
- // Make the menu bar
- mainMenuBar = new puMenuBar ();
- mainMenuBar -> add_submenu ("File", fileSubmenu, fileSubmenuCb);
- // mainMenuBar -> add_submenu ("Edit", editSubmenu, editSubmenuCb);
- mainMenuBar -> add_submenu ("View", viewSubmenu, viewSubmenuCb);
- mainMenuBar -> add_submenu ("Environment", environmentSubmenu, environmentSubmenuCb);
- mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
- // mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
-#ifdef FG_NETWORK_OLK
- if ( fgGetBool("/sim/networking/network-olk") ) {
- mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
- }
-#endif
- mainMenuBar -> add_submenu ("Help", helpSubmenu, helpSubmenuCb);
- mainMenuBar-> close ();
- // Set up menu bar toggle
- gui_menu_on = ~0;