1
0
Fork 0

Added keyboard mappings to move panel up/down/right/left.

This commit is contained in:
curt 2000-10-10 17:45:04 +00:00
parent 6caf599f2b
commit c64a964956
5 changed files with 42 additions and 4 deletions

View file

@ -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);
}

View file

@ -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 ();

View file

@ -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;

View file

@ -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(),

View file

@ -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;