]> git.mxchange.org Git - flightgear.git/commitdiff
Added keyboard mappings to move panel up/down/right/left.
authorcurt <curt>
Tue, 10 Oct 2000 17:45:04 +0000 (17:45 +0000)
committercurt <curt>
Tue, 10 Oct 2000 17:45:04 +0000 (17:45 +0000)
src/Main/bfi.cxx
src/Main/bfi.hxx
src/Main/keyboard.cxx
src/Main/main.cxx
src/Main/options.cxx

index 2b9945057d24ab4c08e41d7bada28e06c912e533..ac50f56e344c0963a6bf6e9ffea27079a54f85c0 100644 (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);
 }
 
index 75f617485d815dd33d5c7490bcf36b8ab0c64749..851dd0d4ff87c9d1e8282a3678b4ee1efc7fb3b9 100644 (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 ();
index ba6e96092ce8baa43a203a9520cf24ae79f25b4b..ba0702c82042f1df26417afeee538e4f7029bc18 100644 (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;
index bf37839ecb9c24f97c38756b639a814a3b5929f1..8274269eff617bff1f2a9f7752fe239e88970350 100644 (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(),
index 89cceff5dfdd6c17cae8e86d2421597359bb8627..30edd121c4157ed9294f16474767b7f946800ef3 100644 (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;