From: curt Date: Tue, 10 Oct 2000 17:45:04 +0000 (+0000) Subject: Added keyboard mappings to move panel up/down/right/left. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c64a9649567216d8a4dc25c1420b1b356e4f2810;p=flightgear.git Added keyboard mappings to move panel up/down/right/left. --- diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index 2b9945057..ac50f56e3 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -104,6 +104,8 @@ FGBFI::init () getPanelVisible, setPanelVisible); // Position + current_properties.tieString("/position/airport-id", + getTargetAirport, setTargetAirport); current_properties.tieDouble("/position/latitude", getLatitude, setLatitude); current_properties.tieDouble("/position/longitude", @@ -1522,10 +1524,14 @@ FGBFI::setGPSLock (bool lock) /** * Get the GPS target airport code. */ -const string +const string & FGBFI::getTargetAirport () { - return current_options.get_airport_id(); + // FIXME: not thread-safe + static string out; + out = current_options.get_airport_id(); + + return out; } @@ -1535,6 +1541,7 @@ FGBFI::getTargetAirport () void FGBFI::setTargetAirport (const string &airportId) { + // cout << "setting target airport id = " << airportId << endl; current_options.set_airport_id(airportId); } diff --git a/src/Main/bfi.hxx b/src/Main/bfi.hxx index 75f617485..851dd0d4f 100644 --- a/src/Main/bfi.hxx +++ b/src/Main/bfi.hxx @@ -190,7 +190,7 @@ public: static void setADFRotation (double rot); // GPS - static const string getTargetAirport (); + static const string &getTargetAirport (); static bool getGPSLock (); static double getGPSTargetLatitude (); static double getGPSTargetLongitude (); diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index ba6e96092..ba0702c82 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -74,6 +74,9 @@ #include "save.hxx" #include "views.hxx" + // From main.cxx +extern void fgReshape( int width, int height ); + // Handle keyboard events void GLUTkey(unsigned char k, int x, int y) { @@ -471,6 +474,26 @@ void GLUTspecialkey(int k, int x, int y) { } return; } + case GLUT_KEY_F5: { + current_panel->setYOffset(current_panel->getYOffset() - 5); + fgReshape(current_view.get_winWidth(), + current_view.get_winHeight()); + return; + } + case GLUT_KEY_F6: { + current_panel->setYOffset(current_panel->getYOffset() + 5); + fgReshape(current_view.get_winWidth(), + current_view.get_winHeight()); + return; + } + case GLUT_KEY_F7: { + current_panel->setXOffset(current_panel->getXOffset() - 5); + return; + } + case GLUT_KEY_F8: { + current_panel->setXOffset(current_panel->getXOffset() + 5); + return; + } case GLUT_KEY_END: // numeric keypad 1 v->set_goal_view_offset( FG_PI * 0.75 ); return; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index bf37839ec..8274269ef 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -1333,6 +1333,8 @@ int main( int argc, char **argv ) { // fg_root was specified (ignore all other options for now) fgInitFGRoot(argc, argv); + // cout << "1. airport_id = " << current_options.get_airport_id() << endl; + // Read global preferences from $FG_ROOT/preferences.xml FGPath props_path(current_options.get_fg_root()); props_path.append("preferences.xml"); @@ -1344,6 +1346,8 @@ int main( int argc, char **argv ) { FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences"); } + // cout << "2. airport_id = " << current_options.get_airport_id() << endl; + // Initialize the Aircraft directory to "" (UIUC) aircraft_dir = ""; @@ -1379,6 +1383,7 @@ int main( int argc, char **argv ) { guiInit(); // set current_options lon/lat if an airport id is specified + // cout << "3. airport_id = " << current_options.get_airport_id() << endl; if ( current_options.get_airport_id().length() ) { // fgSetPosFromAirportID( current_options.get_airport_id() ); fgSetPosFromAirportIDandHdg( current_options.get_airport_id(), diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 89cceff5d..30edd121c 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -233,7 +233,7 @@ fgOPTIONS::fgOPTIONS() : fg_scenery = ""; } - airport_id = "P13"; // default airport id + airport_id = "KPAO"; // default airport id net_id = "Johnney"; // default pilot's name // initialize port config string list @@ -644,14 +644,17 @@ int fgOPTIONS::parse_option( const string& arg ) { sound = true; } else if ( arg.find( "--airport-id=") != string::npos ) { airport_id = arg.substr( 13 ); + current_properties.setStringValue("/position/airport-id", airport_id); } else if ( arg.find( "--lon=" ) != string::npos ) { lon = parse_degree( arg.substr(6) ); airport_id = ""; current_properties.setDoubleValue("/position/longitude", lon); + current_properties.setStringValue("/position/airport-id", airport_id); } else if ( arg.find( "--lat=" ) != string::npos ) { lat = parse_degree( arg.substr(6) ); airport_id = ""; current_properties.setDoubleValue("/position/latitude", lat); + current_properties.setStringValue("/position/airport-id", airport_id); } else if ( arg.find( "--altitude=" ) != string::npos ) { if ( units == FG_UNITS_FEET ) { altitude = atof( arg.substr(11) ) * FEET_TO_METER;