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