]> git.mxchange.org Git - flightgear.git/blob - src/Main/keyboard.cxx
Moved fov and win_ration from FGOptions to FGViewer so we can control these
[flightgear.git] / src / Main / keyboard.cxx
1 // keyboard.cxx -- handle GLUT keyboard events
2 //
3 // Written by Curtis Olson, started May 1997.
4 //
5 // Copyright (C) 1997 - 1999  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #ifdef HAVE_WINDOWS_H
29 #  include <windows.h>                     
30 #endif
31
32 #include <simgear/compiler.h>
33
34 #include <GL/glut.h>
35 #include <simgear/xgl/xgl.h>
36
37 #if defined(FX) && defined(XMESA)
38 #include <GL/xmesa.h>
39 #endif
40
41 #include <stdio.h>
42 #include <stdlib.h>
43
44 #include STL_FSTREAM
45
46 #include <plib/pu.h>            // plib include
47
48 #include <simgear/constants.h>
49 #include <simgear/debug/logstream.hxx>
50 #include <simgear/misc/fgpath.hxx>
51
52 #include <Aircraft/aircraft.hxx>
53 #include <Autopilot/auto_gui.hxx>
54 #include <Autopilot/newauto.hxx>
55 #include <Cockpit/hud.hxx>
56 #include <Cockpit/panel.hxx>
57 #include <Cockpit/panel_io.hxx>
58 #include <GUI/gui.h>
59 #include <Scenery/tilemgr.hxx>
60 #include <Objects/matlib.hxx>
61 #include <Time/light.hxx>
62 #include <Time/tmp.hxx>
63
64 #ifndef FG_OLD_WEATHER
65 #  include <WeatherCM/FGLocalWeatherDatabase.h>
66 #else
67 #  include <Weather/weather.hxx>
68 #endif
69
70 #include "bfi.hxx"
71 #include "globals.hxx"
72 #include "keyboard.hxx"
73 #include "save.hxx"
74
75                                 // From main.cxx
76 extern void fgReshape( int width, int height );
77
78
79 // Handle keyboard events
80 void GLUTkey(unsigned char k, int x, int y) {
81     float fov, tmp;
82     static bool winding_ccw = true;
83     int speed;
84
85     FGInterface *f = current_aircraft.fdm_state;
86     FGViewer *v = globals->get_current_view();
87
88     FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
89     if ( puKeyboard(k, PU_DOWN) ) {
90         return;
91     }
92
93     if ( GLUT_ACTIVE_ALT && glutGetModifiers() ) {
94         FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
95         switch (k) {
96         case 1: // Ctrl-A key
97             current_autopilot->set_AltitudeMode( 
98                   FGAutopilot::FG_ALTITUDE_LOCK );
99             current_autopilot->set_AltitudeEnabled(
100                   ! current_autopilot->get_AltitudeEnabled()
101                 );
102             return;
103         case 7: // Ctrl-G key
104             current_autopilot->set_AltitudeMode( 
105                   FGAutopilot::FG_ALTITUDE_GS1 );
106             current_autopilot->set_AltitudeEnabled(
107                   ! current_autopilot->get_AltitudeEnabled()
108                 );
109             return;
110         case 8: // Ctrl-H key
111             current_autopilot->set_HeadingMode( 
112                   FGAutopilot::FG_HEADING_LOCK );
113             current_autopilot->set_HeadingEnabled(
114                   ! current_autopilot->get_HeadingEnabled()
115                 );
116             return;
117         case 14: // Ctrl-N key
118             current_autopilot->set_HeadingMode( 
119                   FGAutopilot::FG_HEADING_NAV1 );
120             current_autopilot->set_HeadingEnabled(
121                   ! current_autopilot->get_HeadingEnabled()
122                 );
123             return;
124         case 18: // Ctrl-R key
125             // temporary
126             winding_ccw = !winding_ccw;
127             if ( winding_ccw ) {
128                 glFrontFace ( GL_CCW );
129             } else {
130                 glFrontFace ( GL_CW );
131             }
132             return;
133         case 19: // Ctrl-S key
134             current_autopilot->set_AutoThrottleEnabled(
135                   ! current_autopilot->get_AutoThrottleEnabled()
136                 );
137             return;
138         case 20: // Ctrl-T key
139             current_autopilot->set_AltitudeMode( 
140                   FGAutopilot::FG_ALTITUDE_TERRAIN );
141             current_autopilot->set_AltitudeEnabled(
142                   ! current_autopilot->get_AltitudeEnabled()
143                 );
144             return;
145         case 21: // Ctrl-U key
146             // add 1000' of emergency altitude.  Possibly good for 
147             // unflipping yourself :-)
148             {
149                 double alt = cur_fdm_state->get_Altitude() + 1000;
150                 fgFDMForceAltitude( globals->get_options()->get_flight_model(), 
151                                     alt * FEET_TO_METER );
152             }
153             return;
154         case 49: // numeric keypad 1
155             v->set_goal_view_offset( FG_PI * 0.75 );
156             return;
157         case 50: // numeric keypad 2
158             v->set_goal_view_offset( FG_PI );
159             return;
160         case 51: // numeric keypad 3
161             v->set_goal_view_offset( FG_PI * 1.25 );
162             return;
163         case 52: // numeric keypad 4
164             v->set_goal_view_offset( FG_PI * 0.50 );
165             return;
166         case 54: // numeric keypad 6
167             v->set_goal_view_offset( FG_PI * 1.50 );
168             return;
169         case 55: // numeric keypad 7
170             v->set_goal_view_offset( FG_PI * 0.25 );
171             return;
172         case 56: // numeric keypad 8
173             v->set_goal_view_offset( 0.00 );
174             return;
175         case 57: // numeric keypad 9
176             v->set_goal_view_offset( FG_PI * 1.75 );
177             return;
178         case 65: // A key
179             speed = globals->get_options()->get_speed_up();
180             speed--;
181             if ( speed < 1 ) {
182                 speed = 1;
183             }
184             globals->get_options()->set_speed_up( speed );
185             return;
186         case 72: // H key
187             // status = globals->get_options()->get_hud_status();
188             // globals->get_options()->set_hud_status(!status);
189             HUD_brightkey( true );
190             return;
191         case 73: // I key
192             // Minimal Hud
193             fgHUDInit2(&current_aircraft);
194             return;
195         case 77: // M key
196             globals->inc_warp( -60 );
197             fgUpdateSkyAndLightingParams();
198             return;
199         case 80: // P key
200             globals->get_options()->toggle_panel();
201             break;
202         case 84: // T key
203             globals->inc_warp_delta( -30 );
204             fgUpdateSkyAndLightingParams();
205             return;
206         case 87: // W key
207 #if defined(FX) && !defined(WIN32)
208             global_fullscreen = ( !global_fullscreen );
209 #  if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
210             XMesaSetFXmode( global_fullscreen ? 
211                             XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW );
212 #  endif
213 #endif
214             return;
215         case 88: // X key
216             fov = globals->get_current_view()->get_fov();
217             fov *= 1.05;
218             if ( fov > FG_FOV_MAX ) {
219                 fov = FG_FOV_MAX;
220             }
221             globals->get_current_view()->set_fov(fov);
222             // v->force_update_fov_math();
223             return;
224         case 90: // Z key
225 #ifndef FG_OLD_WEATHER
226             tmp = WeatherDatabase->getWeatherVisibility();
227             tmp /= 1.10;
228             WeatherDatabase->setWeatherVisibility( tmp );
229 #else
230             tmp = current_weather.get_visibility();   // in meters
231             tmp /= 1.10;
232             current_weather.set_visibility( tmp );
233 #endif
234             return;
235         }
236     } else {
237         FG_LOG( FG_INPUT, FG_DEBUG, "" );
238         switch (k) {
239         case 50: // numeric keypad 2
240             if ( current_autopilot->get_AltitudeEnabled() ) {
241                 current_autopilot->AltitudeAdjust( 100 );
242             } else {
243                 controls.move_elevator(-0.05);
244             }
245             return;
246         case 56: // numeric keypad 8
247             if ( current_autopilot->get_AltitudeEnabled() ) {
248                 current_autopilot->AltitudeAdjust( -100 );
249             } else {
250                 controls.move_elevator(0.05);
251             }
252             return;
253         case 49: // numeric keypad 1
254             controls.move_elevator_trim(-0.001);
255             return;
256         case 55: // numeric keypad 7
257             controls.move_elevator_trim(0.001);
258             return;
259         case 52: // numeric keypad 4
260             controls.move_aileron(-0.05);
261             return;
262         case 54: // numeric keypad 6
263             controls.move_aileron(0.05);
264             return;
265         case 48: // numeric keypad Ins
266             if ( current_autopilot->get_HeadingEnabled() ) {
267                 current_autopilot->HeadingAdjust( -1 );
268             } else {
269                 controls.move_rudder(-0.05);
270             }
271             return;
272         case 13: // numeric keypad Enter
273             if ( current_autopilot->get_HeadingEnabled() ) {
274                 current_autopilot->HeadingAdjust( 1 );
275             } else {
276                 controls.move_rudder(0.05);
277             }
278             return;
279         case 53: // numeric keypad 5
280             controls.set_aileron(0.0);
281             controls.set_elevator(0.0);
282             controls.set_rudder(0.0);
283             return;
284         case 57: // numeric keypad 9 (Pg Up)
285             if ( current_autopilot->get_AutoThrottleEnabled() ) {
286                 current_autopilot->AutoThrottleAdjust( 5 );
287             } else {
288                 controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
289             }
290             return;
291         case 51: // numeric keypad 3 (Pg Dn)
292             if ( current_autopilot->get_AutoThrottleEnabled() ) {
293                 current_autopilot->AutoThrottleAdjust( -5 );
294             } else {
295                 controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
296             }
297             return;
298         case 91: // [ key
299             controls.move_flaps(-0.34);
300             FG_LOG( FG_INPUT, FG_INFO,
301                     "Set flaps to " << controls.get_flaps() );
302             return;
303         case 93: // ] key
304             controls.move_flaps(0.34);
305             FG_LOG( FG_INPUT, FG_INFO,
306                     "Set flaps to " << controls.get_flaps() );
307             return;
308         case 97: // a key
309             speed = globals->get_options()->get_speed_up();
310             speed++;
311             globals->get_options()->set_speed_up( speed );
312             return;
313         case 98: // b key
314             int b_ret;
315             double b_set;
316             b_ret = int( controls.get_brake( 0 ) );
317             b_set = double(!b_ret);
318             controls.set_brake( FGControls::ALL_WHEELS, b_set);
319             return;
320         case 44: // , key
321             if (controls.get_brake(0) > 0.0) {
322                 controls.set_brake(0, 0.0);
323             } else {
324                 controls.set_brake(0, 1.0);
325             }
326             return;
327         case 46: // . key
328             if (controls.get_brake(1) > 0.0) {
329                 controls.set_brake(1, 0.0);
330             } else {
331                 controls.set_brake(1, 1.0);
332             }
333             return;
334         case 104: // h key
335             HUD_masterswitch( true );
336             return;
337         case 105: // i key
338             fgHUDInit(&current_aircraft);  // normal HUD
339             return;
340         case 109: // m key
341             globals->inc_warp( 60 );
342             fgUpdateSkyAndLightingParams();
343             return;
344         case 112: // p key
345             globals->set_freeze( ! globals->get_freeze() );
346
347             {
348                 FGBucket p( f->get_Longitude() * RAD_TO_DEG,
349                             f->get_Latitude() * RAD_TO_DEG );
350                 FGPath tile_path( globals->get_options()->get_fg_root() );
351                 tile_path.append( "Scenery" );
352                 tile_path.append( p.gen_base_path() );
353                 tile_path.append( p.gen_index_str() );
354
355                 // printf position and attitude information
356                 FG_LOG( FG_INPUT, FG_INFO,
357                         "Lon = " << f->get_Longitude() * RAD_TO_DEG
358                         << "  Lat = " << f->get_Latitude() * RAD_TO_DEG
359                         << "  Altitude = " << f->get_Altitude() * FEET_TO_METER
360                         );
361                 FG_LOG( FG_INPUT, FG_INFO,
362                         "Heading = " << f->get_Psi() * RAD_TO_DEG 
363                         << "  Roll = " << f->get_Phi() * RAD_TO_DEG
364                         << "  Pitch = " << f->get_Theta() * RAD_TO_DEG );
365                 FG_LOG( FG_INPUT, FG_INFO, tile_path.c_str());
366             }
367             return;
368         case 116: // t key
369             globals->inc_warp_delta( 30 );
370             fgUpdateSkyAndLightingParams();
371             return;
372         case 118: // v key
373             globals->set_current_view( globals->get_viewmgr()->next_view() );
374             fgReshape( globals->get_options()->get_xsize(),
375                        globals->get_options()->get_ysize() );
376             return;
377         case 120: // x key
378             fov = globals->get_current_view()->get_fov();
379             fov /= 1.05;
380             if ( fov < FG_FOV_MIN ) {
381                 fov = FG_FOV_MIN;
382             }
383             globals->get_current_view()->set_fov(fov);
384             // v->force_update_fov_math();
385             return;
386         case 122: // z key
387 #ifndef FG_OLD_WEATHER
388             tmp = WeatherDatabase->getWeatherVisibility();
389             tmp *= 1.10;
390             WeatherDatabase->setWeatherVisibility( tmp );
391 #else
392             tmp = current_weather.get_visibility();   // in meters
393             tmp *= 1.10;
394             current_weather.set_visibility( tmp );
395 #endif
396             return;
397         case 27: // ESC
398             // if( fg_DebugOutput ) {
399             //   fclose( fg_DebugOutput );
400             // }
401             FG_LOG( FG_INPUT, FG_ALERT, 
402                     "Program exit requested." );
403             ConfirmExitDialog();
404             return;
405         }
406     }
407 }
408
409
410 // Handle "special" keyboard events
411 void GLUTspecialkey(int k, int x, int y) {
412     FGViewer *v = globals->get_current_view();
413
414     FG_LOG( FG_INPUT, FG_DEBUG, "Special key hit = " << k );
415
416     if ( puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN) ) {
417         return;
418     }
419
420     if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
421         FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
422         switch (k) {
423         case GLUT_KEY_F1: {
424             ifstream input("fgfs.sav");
425             if (input.good() && fgLoadFlight(input)) {
426                 input.close();
427                 FG_LOG(FG_INPUT, FG_INFO, "Restored flight from fgfs.sav");
428             } else {
429                 FG_LOG(FG_INPUT, FG_ALERT, "Cannot load flight from fgfs.sav");
430             }
431             return;
432         }
433         case GLUT_KEY_F2: {
434             FG_LOG(FG_INPUT, FG_INFO, "Saving flight");
435             ofstream output("fgfs.sav");
436             if (output.good() && fgSaveFlight(output)) {
437                 output.close();
438                 FG_LOG(FG_INPUT, FG_INFO, "Saved flight to fgfs.sav");
439             } else {
440                 FG_LOG(FG_INPUT, FG_ALERT, "Cannot save flight to fgfs.sav");
441             }
442             return;
443         }
444         case GLUT_KEY_F3: {
445           string panel_path =
446             current_properties.getStringValue("/sim/panel/path",
447                                               "Panels/Default/default.xml");
448           FGPanel * new_panel = fgReadPanel(panel_path);
449           if (new_panel == 0) {
450             FG_LOG(FG_INPUT, FG_ALERT,
451                    "Error reading new panel from " << panel_path);
452             return;
453           }
454           FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
455           delete current_panel;
456           current_panel = new_panel;
457           return;
458         }
459         case GLUT_KEY_F4: {
460           FGPath props_path(globals->get_options()->get_fg_root());
461           props_path.append("preferences.xml");
462           FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
463           if (!readPropertyList(props_path.str(), &current_properties)) {
464             FG_LOG(FG_INPUT, FG_ALERT,
465                    "Failed to reread global preferences from "
466                    << props_path.str());
467           } else {
468             FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
469           }
470           return;
471         }
472         case GLUT_KEY_F5: {
473           current_panel->setYOffset(current_panel->getYOffset() - 5);
474           fgReshape(globals->get_options()->get_xsize(),
475                     globals->get_options()->get_ysize());
476           return;
477         }
478         case GLUT_KEY_F6: {
479           current_panel->setYOffset(current_panel->getYOffset() + 5);
480           fgReshape(globals->get_options()->get_xsize(),
481                     globals->get_options()->get_ysize());
482           return;
483         }
484         case GLUT_KEY_F7: {
485           current_panel->setXOffset(current_panel->getXOffset() - 5);
486           return;
487         }
488         case GLUT_KEY_F8: {
489           current_panel->setXOffset(current_panel->getXOffset() + 5);
490           return;
491         }
492         case GLUT_KEY_END: // numeric keypad 1
493             v->set_goal_view_offset( FG_PI * 0.75 );
494             return;
495         case GLUT_KEY_DOWN: // numeric keypad 2
496             v->set_goal_view_offset( FG_PI );
497             return;
498         case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
499             v->set_goal_view_offset( FG_PI * 1.25 );
500             return;
501         case GLUT_KEY_LEFT: // numeric keypad 4
502             v->set_goal_view_offset( FG_PI * 0.50 );
503             return;
504         case GLUT_KEY_RIGHT: // numeric keypad 6
505             v->set_goal_view_offset( FG_PI * 1.50 );
506             return;
507         case GLUT_KEY_HOME: // numeric keypad 7
508             v->set_goal_view_offset( FG_PI * 0.25 );
509             return;
510         case GLUT_KEY_UP: // numeric keypad 8
511             v->set_goal_view_offset( 0.00 );
512             return;
513         case GLUT_KEY_PAGE_UP: // numeric keypad 9
514             v->set_goal_view_offset( FG_PI * 1.75 );
515             return;
516         }
517     } else {
518         FG_LOG( FG_INPUT, FG_DEBUG, "" );
519         switch (k) {
520         case GLUT_KEY_F2: // F2 Reload Tile Cache...
521             {
522                 bool freeze = globals->get_freeze();
523                 FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
524                 if ( !freeze ) 
525                     globals->set_freeze( true );
526                 BusyCursor(0);
527                 if ( global_tile_mgr.init() ) {
528                     // Load the local scenery data
529                     global_tile_mgr.update( 
530                         cur_fdm_state->get_Longitude() * RAD_TO_DEG,
531                         cur_fdm_state->get_Latitude() * RAD_TO_DEG );
532                 } else {
533                     FG_LOG( FG_GENERAL, FG_ALERT, 
534                             "Error in Tile Manager initialization!" );
535                     exit(-1);
536                 }
537                 BusyCursor(1);
538                 if ( !freeze )
539                    globals->set_freeze( false );
540                 return;
541             }
542         case GLUT_KEY_F3: // F3 Take a screen shot
543             fgDumpSnapShot();
544             return;
545         case GLUT_KEY_F6: // F6 toggles Autopilot target location
546             if ( current_autopilot->get_HeadingMode() !=
547                  FGAutopilot::FG_HEADING_WAYPOINT ) {
548                 current_autopilot->set_HeadingMode(
549                     FGAutopilot::FG_HEADING_WAYPOINT );
550                 current_autopilot->set_HeadingEnabled( true );
551             } else {
552                 current_autopilot->set_HeadingMode(
553                     FGAutopilot::FG_HEADING_LOCK );
554             }
555             return;
556         case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
557             globals->get_options()->cycle_fog();
558         
559             if ( globals->get_options()->get_fog() ==
560                  FGOptions::FG_FOG_DISABLED )
561             {
562                 FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
563             } else if ( globals->get_options()->get_fog() == 
564                         FGOptions::FG_FOG_FASTEST )
565             {
566                 FG_LOG( FG_INPUT, FG_INFO, 
567                         "Fog enabled, hint set to fastest" );
568             } else if ( globals->get_options()->get_fog() ==
569                         FGOptions::FG_FOG_NICEST )
570             {
571                 FG_LOG( FG_INPUT, FG_INFO,
572                         "Fog enabled, hint set to nicest" );
573             }
574
575             return;
576         case GLUT_KEY_F9: // F9 toggles textures on and off...
577             FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
578             if ( globals->get_options()->get_textures() ) {
579                 globals->get_options()->set_textures( false );
580                 material_lib.set_step( 1 );
581             } else {
582                 globals->get_options()->set_textures( true );
583                 material_lib.set_step( 0 );
584             }
585             return;
586         case GLUT_KEY_F10: // F10 toggles menu on and off...
587             FG_LOG(FG_INPUT, FG_INFO, "Invoking call back function");
588             guiToggleMenu();
589             return;
590         case GLUT_KEY_F11: // F11 Altitude Dialog.
591             FG_LOG(FG_INPUT, FG_INFO, "Invoking Altitude call back function");
592             NewAltitude( NULL );
593             return;
594         case GLUT_KEY_F12: // F12 Heading Dialog...
595             FG_LOG(FG_INPUT, FG_INFO, "Invoking Heading call back function");
596             NewHeading( NULL );
597             return;
598         case GLUT_KEY_UP:
599             if ( current_autopilot->get_AltitudeEnabled() ) {
600                 current_autopilot->AltitudeAdjust( -100 );
601             } else {
602                 controls.move_elevator(0.05);
603             }
604             return;
605         case GLUT_KEY_DOWN:
606             if ( current_autopilot->get_AltitudeEnabled() ) {
607                 current_autopilot->AltitudeAdjust( 100 );
608             } else {
609                 controls.move_elevator(-0.05);
610             }
611             return;
612         case GLUT_KEY_LEFT:
613             controls.move_aileron(-0.05);
614             return;
615         case GLUT_KEY_RIGHT:
616             controls.move_aileron(0.05);
617             return;
618         case GLUT_KEY_HOME: // numeric keypad 1
619             controls.move_elevator_trim(0.001);
620             return;
621         case GLUT_KEY_END: // numeric keypad 7
622             controls.move_elevator_trim(-0.001);
623             return;
624         case GLUT_KEY_INSERT: // numeric keypad Ins
625             if ( current_autopilot->get_HeadingEnabled() ) {
626                 current_autopilot->HeadingAdjust( -1 );
627             } else {
628                 controls.move_rudder(-0.05);
629             }
630             return;
631         case 13: // numeric keypad Enter
632             if ( current_autopilot->get_HeadingEnabled() ) {
633                 current_autopilot->HeadingAdjust( 1 );
634             } else {
635                 controls.move_rudder(0.05);
636             }
637             return;
638         case 53: // numeric keypad 5
639             controls.set_aileron(0.0);
640             controls.set_elevator(0.0);
641             controls.set_rudder(0.0);
642             return;
643         case GLUT_KEY_PAGE_UP: // numeric keypad 9 (Pg Up)
644             if ( current_autopilot->get_AutoThrottleEnabled() ) {
645                 current_autopilot->AutoThrottleAdjust( 5 );
646             } else {
647                 controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
648             }
649             return;
650         case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 (Pg Dn)
651             if ( current_autopilot->get_AutoThrottleEnabled() ) {
652                 current_autopilot->AutoThrottleAdjust( -5 );
653             } else {
654                 controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
655             }
656             return;
657         }
658     }
659 }
660
661