]> git.mxchange.org Git - flightgear.git/blob - src/Main/keyboard.cxx
Updates to time parsing and setting by David Megginson.
[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                 FGBFI::setAltitude(FGBFI::getAltitude() + 1000);
150 //              double alt = cur_fdm_state->get_Altitude() + 1000;
151 //              fgFDMForceAltitude( globals->get_options()->get_flight_model(), 
152 //                                  alt * FEET_TO_METER );
153             }
154             return;
155         case 49: // numeric keypad 1
156             v->set_goal_view_offset( FG_PI * 0.75 );
157             return;
158         case 50: // numeric keypad 2
159             v->set_goal_view_offset( FG_PI );
160             return;
161         case 51: // numeric keypad 3
162             v->set_goal_view_offset( FG_PI * 1.25 );
163             return;
164         case 52: // numeric keypad 4
165             v->set_goal_view_offset( FG_PI * 0.50 );
166             return;
167         case 54: // numeric keypad 6
168             v->set_goal_view_offset( FG_PI * 1.50 );
169             return;
170         case 55: // numeric keypad 7
171             v->set_goal_view_offset( FG_PI * 0.25 );
172             return;
173         case 56: // numeric keypad 8
174             v->set_goal_view_offset( 0.00 );
175             return;
176         case 57: // numeric keypad 9
177             v->set_goal_view_offset( FG_PI * 1.75 );
178             return;
179         case 65: // A key
180             speed = globals->get_options()->get_speed_up();
181             speed--;
182             if ( speed < 1 ) {
183                 speed = 1;
184             }
185             globals->get_options()->set_speed_up( speed );
186             return;
187         case 72: // H key
188             // status = globals->get_options()->get_hud_status();
189             // globals->get_options()->set_hud_status(!status);
190             HUD_brightkey( true );
191             return;
192         case 73: // I key
193             // Minimal Hud
194             fgHUDInit2(&current_aircraft);
195             return;
196         case 77: // M key
197             globals->inc_warp( -60 );
198             fgUpdateSkyAndLightingParams();
199             return;
200         case 80: // P key
201             globals->get_options()->toggle_panel();
202             break;
203         case 84: // T key
204             globals->inc_warp_delta( -30 );
205             fgUpdateSkyAndLightingParams();
206             return;
207         case 87: // W key
208 #if defined(FX) && !defined(WIN32)
209             global_fullscreen = ( !global_fullscreen );
210 #  if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
211             XMesaSetFXmode( global_fullscreen ? 
212                             XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW );
213 #  endif
214 #endif
215             return;
216         case 88: // X key
217             fov = globals->get_current_view()->get_fov();
218             fov *= 1.05;
219             if ( fov > FG_FOV_MAX ) {
220                 fov = FG_FOV_MAX;
221             }
222             globals->get_current_view()->set_fov(fov);
223             // v->force_update_fov_math();
224             return;
225         case 90: // Z key
226 #ifndef FG_OLD_WEATHER
227             tmp = WeatherDatabase->getWeatherVisibility();
228             tmp /= 1.10;
229             WeatherDatabase->setWeatherVisibility( tmp );
230 #else
231             tmp = current_weather.get_visibility();   // in meters
232             tmp /= 1.10;
233             current_weather.set_visibility( tmp );
234 #endif
235             return;
236         }
237     } else {
238         FG_LOG( FG_INPUT, FG_DEBUG, "" );
239         switch (k) {
240         case 50: // numeric keypad 2
241             if ( current_autopilot->get_AltitudeEnabled() ) {
242                 current_autopilot->AltitudeAdjust( 100 );
243             } else {
244                 controls.move_elevator(-0.05);
245             }
246             return;
247         case 56: // numeric keypad 8
248             if ( current_autopilot->get_AltitudeEnabled() ) {
249                 current_autopilot->AltitudeAdjust( -100 );
250             } else {
251                 controls.move_elevator(0.05);
252             }
253             return;
254         case 49: // numeric keypad 1
255             controls.move_elevator_trim(-0.001);
256             return;
257         case 55: // numeric keypad 7
258             controls.move_elevator_trim(0.001);
259             return;
260         case 52: // numeric keypad 4
261             controls.move_aileron(-0.05);
262             return;
263         case 54: // numeric keypad 6
264             controls.move_aileron(0.05);
265             return;
266         case 48: // numeric keypad Ins
267             if ( current_autopilot->get_HeadingEnabled() ) {
268                 current_autopilot->HeadingAdjust( -1 );
269             } else {
270                 controls.move_rudder(-0.05);
271             }
272             return;
273         case 13: // numeric keypad Enter
274             if ( current_autopilot->get_HeadingEnabled() ) {
275                 current_autopilot->HeadingAdjust( 1 );
276             } else {
277                 controls.move_rudder(0.05);
278             }
279             return;
280         case 53: // numeric keypad 5
281             controls.set_aileron(0.0);
282             controls.set_elevator(0.0);
283             controls.set_rudder(0.0);
284             return;
285         case 57: // numeric keypad 9 (Pg Up)
286             if ( current_autopilot->get_AutoThrottleEnabled() ) {
287                 current_autopilot->AutoThrottleAdjust( 5 );
288             } else {
289                 controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
290             }
291             return;
292         case 51: // numeric keypad 3 (Pg Dn)
293             if ( current_autopilot->get_AutoThrottleEnabled() ) {
294                 current_autopilot->AutoThrottleAdjust( -5 );
295             } else {
296                 controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
297             }
298             return;
299         case 91: // [ key
300             controls.move_flaps(-0.34);
301             FG_LOG( FG_INPUT, FG_INFO,
302                     "Set flaps to " << controls.get_flaps() );
303             return;
304         case 93: // ] key
305             controls.move_flaps(0.34);
306             FG_LOG( FG_INPUT, FG_INFO,
307                     "Set flaps to " << controls.get_flaps() );
308             return;
309         case 97: // a key
310             speed = globals->get_options()->get_speed_up();
311             speed++;
312             globals->get_options()->set_speed_up( speed );
313             return;
314         case 98: // b key
315             int b_ret;
316             double b_set;
317             b_ret = int( controls.get_brake( 0 ) );
318             b_set = double(!b_ret);
319             controls.set_brake( FGControls::ALL_WHEELS, b_set);
320             return;
321         case 44: // , key
322             if (controls.get_brake(0) > 0.0) {
323                 controls.set_brake(0, 0.0);
324             } else {
325                 controls.set_brake(0, 1.0);
326             }
327             return;
328         case 46: // . key
329             if (controls.get_brake(1) > 0.0) {
330                 controls.set_brake(1, 0.0);
331             } else {
332                 controls.set_brake(1, 1.0);
333             }
334             return;
335         case 104: // h key
336             HUD_masterswitch( true );
337             return;
338         case 105: // i key
339             fgHUDInit(&current_aircraft);  // normal HUD
340             return;
341         case 109: // m key
342             globals->inc_warp( 60 );
343             fgUpdateSkyAndLightingParams();
344             return;
345         case 112: // p key
346             globals->set_freeze( ! globals->get_freeze() );
347
348             {
349                 FGBucket p( f->get_Longitude() * RAD_TO_DEG,
350                             f->get_Latitude() * RAD_TO_DEG );
351                 FGPath tile_path( globals->get_options()->get_fg_root() );
352                 tile_path.append( "Scenery" );
353                 tile_path.append( p.gen_base_path() );
354                 tile_path.append( p.gen_index_str() );
355
356                 // printf position and attitude information
357                 FG_LOG( FG_INPUT, FG_INFO,
358                         "Lon = " << f->get_Longitude() * RAD_TO_DEG
359                         << "  Lat = " << f->get_Latitude() * RAD_TO_DEG
360                         << "  Altitude = " << f->get_Altitude() * FEET_TO_METER
361                         );
362                 FG_LOG( FG_INPUT, FG_INFO,
363                         "Heading = " << f->get_Psi() * RAD_TO_DEG 
364                         << "  Roll = " << f->get_Phi() * RAD_TO_DEG
365                         << "  Pitch = " << f->get_Theta() * RAD_TO_DEG );
366                 FG_LOG( FG_INPUT, FG_INFO, tile_path.c_str());
367             }
368             return;
369         case 116: // t key
370             globals->inc_warp_delta( 30 );
371             fgUpdateSkyAndLightingParams();
372             return;
373         case 118: // v key
374             globals->set_current_view( globals->get_viewmgr()->next_view() );
375             fgReshape( globals->get_options()->get_xsize(),
376                        globals->get_options()->get_ysize() );
377             return;
378         case 120: // x key
379             fov = globals->get_current_view()->get_fov();
380             fov /= 1.05;
381             if ( fov < FG_FOV_MIN ) {
382                 fov = FG_FOV_MIN;
383             }
384             globals->get_current_view()->set_fov(fov);
385             // v->force_update_fov_math();
386             return;
387         case 122: // z key
388 #ifndef FG_OLD_WEATHER
389             tmp = WeatherDatabase->getWeatherVisibility();
390             tmp *= 1.10;
391             WeatherDatabase->setWeatherVisibility( tmp );
392 #else
393             tmp = current_weather.get_visibility();   // in meters
394             tmp *= 1.10;
395             current_weather.set_visibility( tmp );
396 #endif
397             return;
398         case 27: // ESC
399             // if( fg_DebugOutput ) {
400             //   fclose( fg_DebugOutput );
401             // }
402             FG_LOG( FG_INPUT, FG_ALERT, 
403                     "Program exit requested." );
404             ConfirmExitDialog();
405             return;
406         }
407     }
408 }
409
410
411 // Handle "special" keyboard events
412 void GLUTspecialkey(int k, int x, int y) {
413     FGViewer *v = globals->get_current_view();
414
415     FG_LOG( FG_INPUT, FG_DEBUG, "Special key hit = " << k );
416
417     if ( puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN) ) {
418         return;
419     }
420
421     if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
422         FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
423         switch (k) {
424         case GLUT_KEY_F1: {
425             ifstream input("fgfs.sav");
426             if (input.good() && fgLoadFlight(input)) {
427                 input.close();
428                 FG_LOG(FG_INPUT, FG_INFO, "Restored flight from fgfs.sav");
429             } else {
430                 FG_LOG(FG_INPUT, FG_ALERT, "Cannot load flight from fgfs.sav");
431             }
432             return;
433         }
434         case GLUT_KEY_F2: {
435             FG_LOG(FG_INPUT, FG_INFO, "Saving flight");
436             ofstream output("fgfs.sav");
437             if (output.good() && fgSaveFlight(output)) {
438                 output.close();
439                 FG_LOG(FG_INPUT, FG_INFO, "Saved flight to fgfs.sav");
440             } else {
441                 FG_LOG(FG_INPUT, FG_ALERT, "Cannot save flight to fgfs.sav");
442             }
443             return;
444         }
445         case GLUT_KEY_F3: {
446           string panel_path =
447             current_properties.getStringValue("/sim/panel/path",
448                                               "Panels/Default/default.xml");
449           FGPanel * new_panel = fgReadPanel(panel_path);
450           if (new_panel == 0) {
451             FG_LOG(FG_INPUT, FG_ALERT,
452                    "Error reading new panel from " << panel_path);
453             return;
454           }
455           FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
456           delete current_panel;
457           current_panel = new_panel;
458           return;
459         }
460         case GLUT_KEY_F4: {
461           FGPath props_path(globals->get_options()->get_fg_root());
462           props_path.append("preferences.xml");
463           FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
464           if (!readPropertyList(props_path.str(), &current_properties)) {
465             FG_LOG(FG_INPUT, FG_ALERT,
466                    "Failed to reread global preferences from "
467                    << props_path.str());
468           } else {
469             FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
470           }
471           return;
472         }
473         case GLUT_KEY_F5: {
474           current_panel->setYOffset(current_panel->getYOffset() - 5);
475           fgReshape(globals->get_options()->get_xsize(),
476                     globals->get_options()->get_ysize());
477           return;
478         }
479         case GLUT_KEY_F6: {
480           current_panel->setYOffset(current_panel->getYOffset() + 5);
481           fgReshape(globals->get_options()->get_xsize(),
482                     globals->get_options()->get_ysize());
483           return;
484         }
485         case GLUT_KEY_F7: {
486           current_panel->setXOffset(current_panel->getXOffset() - 5);
487           return;
488         }
489         case GLUT_KEY_F8: {
490           current_panel->setXOffset(current_panel->getXOffset() + 5);
491           return;
492         }
493         case GLUT_KEY_END: // numeric keypad 1
494             v->set_goal_view_offset( FG_PI * 0.75 );
495             return;
496         case GLUT_KEY_DOWN: // numeric keypad 2
497             v->set_goal_view_offset( FG_PI );
498             return;
499         case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
500             v->set_goal_view_offset( FG_PI * 1.25 );
501             return;
502         case GLUT_KEY_LEFT: // numeric keypad 4
503             v->set_goal_view_offset( FG_PI * 0.50 );
504             return;
505         case GLUT_KEY_RIGHT: // numeric keypad 6
506             v->set_goal_view_offset( FG_PI * 1.50 );
507             return;
508         case GLUT_KEY_HOME: // numeric keypad 7
509             v->set_goal_view_offset( FG_PI * 0.25 );
510             return;
511         case GLUT_KEY_UP: // numeric keypad 8
512             v->set_goal_view_offset( 0.00 );
513             return;
514         case GLUT_KEY_PAGE_UP: // numeric keypad 9
515             v->set_goal_view_offset( FG_PI * 1.75 );
516             return;
517         }
518     } else {
519         FG_LOG( FG_INPUT, FG_DEBUG, "" );
520         switch (k) {
521         case GLUT_KEY_F2: // F2 Reload Tile Cache...
522             {
523                 bool freeze = globals->get_freeze();
524                 FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
525                 if ( !freeze ) 
526                     globals->set_freeze( true );
527                 BusyCursor(0);
528                 if ( global_tile_mgr.init() ) {
529                     // Load the local scenery data
530                     global_tile_mgr.update( 
531                         cur_fdm_state->get_Longitude() * RAD_TO_DEG,
532                         cur_fdm_state->get_Latitude() * RAD_TO_DEG );
533                 } else {
534                     FG_LOG( FG_GENERAL, FG_ALERT, 
535                             "Error in Tile Manager initialization!" );
536                     exit(-1);
537                 }
538                 BusyCursor(1);
539                 if ( !freeze )
540                    globals->set_freeze( false );
541                 return;
542             }
543         case GLUT_KEY_F3: // F3 Take a screen shot
544             fgDumpSnapShot();
545             return;
546         case GLUT_KEY_F4: // F4 Update lighting manually
547             fgUpdateSkyAndLightingParams();
548         case GLUT_KEY_F6: // F6 toggles Autopilot target location
549             if ( current_autopilot->get_HeadingMode() !=
550                  FGAutopilot::FG_HEADING_WAYPOINT ) {
551                 current_autopilot->set_HeadingMode(
552                     FGAutopilot::FG_HEADING_WAYPOINT );
553                 current_autopilot->set_HeadingEnabled( true );
554             } else {
555                 current_autopilot->set_HeadingMode(
556                     FGAutopilot::FG_HEADING_LOCK );
557             }
558             return;
559         case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
560             globals->get_options()->cycle_fog();
561         
562             if ( globals->get_options()->get_fog() ==
563                  FGOptions::FG_FOG_DISABLED )
564             {
565                 FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
566             } else if ( globals->get_options()->get_fog() == 
567                         FGOptions::FG_FOG_FASTEST )
568             {
569                 FG_LOG( FG_INPUT, FG_INFO, 
570                         "Fog enabled, hint set to fastest" );
571             } else if ( globals->get_options()->get_fog() ==
572                         FGOptions::FG_FOG_NICEST )
573             {
574                 FG_LOG( FG_INPUT, FG_INFO,
575                         "Fog enabled, hint set to nicest" );
576             }
577
578             return;
579         case GLUT_KEY_F9: // F9 toggles textures on and off...
580             FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
581             if ( globals->get_options()->get_textures() ) {
582                 globals->get_options()->set_textures( false );
583                 material_lib.set_step( 1 );
584             } else {
585                 globals->get_options()->set_textures( true );
586                 material_lib.set_step( 0 );
587             }
588             return;
589         case GLUT_KEY_F10: // F10 toggles menu on and off...
590             FG_LOG(FG_INPUT, FG_INFO, "Invoking call back function");
591             guiToggleMenu();
592             return;
593         case GLUT_KEY_F11: // F11 Altitude Dialog.
594             FG_LOG(FG_INPUT, FG_INFO, "Invoking Altitude call back function");
595             NewAltitude( NULL );
596             return;
597         case GLUT_KEY_F12: // F12 Heading Dialog...
598             FG_LOG(FG_INPUT, FG_INFO, "Invoking Heading call back function");
599             NewHeading( NULL );
600             return;
601         case GLUT_KEY_UP:
602             if ( current_autopilot->get_AltitudeEnabled() ) {
603                 current_autopilot->AltitudeAdjust( -100 );
604             } else {
605                 controls.move_elevator(0.05);
606             }
607             return;
608         case GLUT_KEY_DOWN:
609             if ( current_autopilot->get_AltitudeEnabled() ) {
610                 current_autopilot->AltitudeAdjust( 100 );
611             } else {
612                 controls.move_elevator(-0.05);
613             }
614             return;
615         case GLUT_KEY_LEFT:
616             controls.move_aileron(-0.05);
617             return;
618         case GLUT_KEY_RIGHT:
619             controls.move_aileron(0.05);
620             return;
621         case GLUT_KEY_HOME: // numeric keypad 1
622             controls.move_elevator_trim(0.001);
623             return;
624         case GLUT_KEY_END: // numeric keypad 7
625             controls.move_elevator_trim(-0.001);
626             return;
627         case GLUT_KEY_INSERT: // numeric keypad Ins
628             if ( current_autopilot->get_HeadingEnabled() ) {
629                 current_autopilot->HeadingAdjust( -1 );
630             } else {
631                 controls.move_rudder(-0.05);
632             }
633             return;
634         case 13: // numeric keypad Enter
635             if ( current_autopilot->get_HeadingEnabled() ) {
636                 current_autopilot->HeadingAdjust( 1 );
637             } else {
638                 controls.move_rudder(0.05);
639             }
640             return;
641         case 53: // numeric keypad 5
642             controls.set_aileron(0.0);
643             controls.set_elevator(0.0);
644             controls.set_rudder(0.0);
645             return;
646         case GLUT_KEY_PAGE_UP: // numeric keypad 9 (Pg Up)
647             if ( current_autopilot->get_AutoThrottleEnabled() ) {
648                 current_autopilot->AutoThrottleAdjust( 5 );
649             } else {
650                 controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
651             }
652             return;
653         case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 (Pg Dn)
654             if ( current_autopilot->get_AutoThrottleEnabled() ) {
655                 current_autopilot->AutoThrottleAdjust( -5 );
656             } else {
657                 controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
658             }
659             return;
660         }
661     }
662 }
663
664