]> git.mxchange.org Git - flightgear.git/commitdiff
Internal interface changes by David Megginson.
authorcurt <curt>
Thu, 11 Jan 2001 22:44:18 +0000 (22:44 +0000)
committercurt <curt>
Thu, 11 Jan 2001 22:44:18 +0000 (22:44 +0000)
13 files changed:
FlightGear.dsp
src/Autopilot/newauto.cxx
src/Cockpit/cockpit.cxx
src/Cockpit/panel.cxx
src/Cockpit/panel.hxx
src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx
src/Cockpit/steam.cxx
src/Main/bfi.cxx
src/Main/bfi.hxx
src/Main/fg_init.cxx
src/Main/keyboard.cxx
src/Main/main.cxx

index c7da4d2967299aa04064695d0697c8eff16d0aeb..3209be438c23442b9fdd06eff6f76c96e873bb57 100644 (file)
@@ -1093,6 +1093,21 @@ SOURCE=.\src\FDM\LaRCsim\ls_step.c
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\src\FDM\LaRCsim\ls_trim.c\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_LaRCsim"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_LaRCsim"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\src\FDM\LaRCsim\c172_aero.c\r
 \r
 !IF  "$(CFG)" == "FlightGear - Win32 Release"\r
@@ -2095,6 +2110,21 @@ SOURCE=.\src\FDM\MagicCarpet.cxx
 # PROP Default_Filter ""\r
 # Begin Source File\r
 \r
+SOURCE=.\src\GUI\apt_dlg.cxx\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\src\GUI\gui.cxx\r
 \r
 !IF  "$(CFG)" == "FlightGear - Win32 Release"\r
@@ -2107,6 +2137,66 @@ SOURCE=.\src\GUI\gui.cxx
 \r
 !ENDIF \r
 \r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\gui_local.cxx\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\mouse.cxx\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\net_dlg.cxx\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\trackball.c\r
+\r
+!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
 # End Source File\r
 # End Group\r
 # Begin Group "Lib_Joystick"\r
index aaea3e23b95ce30e26dbd18a26916d2dc282847b..e432ee0949f8e473a6c10c94106d2bf4699ddd4d 100644 (file)
@@ -184,10 +184,10 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
 
 
 void FGAutopilot::update_old_control_values() {
-    old_aileron = FGBFI::getAileron();
-    old_elevator = FGBFI::getElevator();
-    old_elevator_trim = FGBFI::getElevatorTrim();
-    old_rudder = FGBFI::getRudder();
+    old_aileron = controls.get_aileron();
+    old_elevator = controls.get_elevator();
+    old_elevator_trim = controls.get_elevator_trim();
+    old_rudder = controls.get_rudder();
 }
 
 
index cd77d685df418a862a2eb5f19a614d92630ae16f..76de6c0dededc9091549fdbb2798ec679b92e2f6 100644 (file)
@@ -755,6 +755,4 @@ void fgCockpitUpdate( void ) {
                globals->get_options()->get_xsize(),
                globals->get_options()->get_ysize() );
 
-    if (current_panel != 0)
-      current_panel->update();
 }
index 11370d7452ea70c783d1d68f5cbc1997844679de..8cfc864a892987f6e092786feb9b1c1a00df9a39 100644 (file)
@@ -33,7 +33,9 @@
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/fgpath.hxx>
+
 #include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
 #include <Objects/texload.h>
 #include <Time/light.hxx>
 
@@ -143,6 +145,7 @@ FGPanel::FGPanel (int window_x, int window_y, int window_w, int window_h)
  */
 FGPanel::~FGPanel ()
 {
+  unbind();
   for (instrument_list_type::iterator it = _instruments.begin();
        it != _instruments.end();
        it++) {
@@ -162,11 +165,45 @@ FGPanel::addInstrument (FGPanelInstrument * instrument)
 }
 
 
+/**
+ * Initialize the panel.
+ */
+void
+FGPanel::init ()
+{
+  // NO-OP
+}
+
+
+/**
+ * Bind panel properties.
+ */
+void
+FGPanel::bind ()
+{
+  fgTie("/sim/panel/visibility", &_visibility);
+  fgTie("/sim/panel/x-offset", &_x_offset);
+  fgTie("/sim/panel/y-offset", &_y_offset);
+}
+
+
+/**
+ * Unbind panel properties.
+ */
+void
+FGPanel::unbind ()
+{
+  fgUntie("/sim/panel/visibility");
+  fgUntie("/sim/panel/x-offset");
+  fgUntie("/sim/panel/y-offset");
+}
+
+
 /**
  * Update the panel.
  */
 void
-FGPanel::update () const
+FGPanel::update ()
 {
                                // Do nothing if the panel isn't visible.
   if (!fgPanelVisible())
index 38a7725eeda67c7e21555ecd569e05da25de4e6e..1adc9e811569859c14e7cdf5e909cea6bfed5f24 100644 (file)
@@ -46,6 +46,8 @@
 #include <map>
 #include <plib/fnt.h>
 
+#include <Main/fgfs.hxx>
+
 
 FG_USING_STD(vector);
 FG_USING_STD(map);
@@ -119,19 +121,22 @@ private:
 // the appropriate instruments for processing.
 ////////////////////////////////////////////////////////////////////////
 
-class FGPanel
+class FGPanel : public FGSubsystem
 {
 public:
 
   FGPanel (int window_x, int window_y, int window_w, int window_h);
   virtual ~FGPanel ();
 
+                               // Update the panel (every frame).
+  virtual void init ();
+  virtual void bind ();
+  virtual void unbind ();
+  virtual void update ();
+
                                // transfer pointer ownership!!!
   virtual void addInstrument (FGPanelInstrument * instrument);
 
-                               // Update the panel (every frame).
-  virtual void update () const;
-
                                // Background texture.
   virtual void setBackground (ssgTexture * texture);
 
index d8ccdd181468de1c7c32273f526ba63108750817..15221e36ce79ad47037c35d5bb06b93ce536c116 100644 (file)
@@ -25,6 +25,7 @@
 #include <Main/bfi.hxx>
 #include <Navaids/ilslist.hxx>
 #include <Navaids/navlist.hxx>
+#include <Time/event.hxx>
 
 #include "radiostack.hxx"
 
@@ -56,6 +57,11 @@ kludgeRange (double stationElev, double aircraftElev, double nominalRange)
 FGRadioStack *current_radiostack;
 
 
+// periodic radio station search wrapper
+static void fgRadioSearch( void ) {
+    current_radiostack->search();
+}
+
 // Constructor
 FGRadioStack::FGRadioStack() {
     nav1_radial = 0.0;
@@ -63,16 +69,114 @@ FGRadioStack::FGRadioStack() {
     nav2_radial = 0.0;
     nav2_dme_dist = 0.0;
     need_update = true;
+    longitudeVal = globals->get_props()->getValue("/position/longitude");
+    latitudeVal = globals->get_props()->getValue("/position/latitude");
+    altitudeVal = globals->get_props()->getValue("/position/altitude");
 }
 
 
 // Destructor
-FGRadioStack::~FGRadioStack() {
+FGRadioStack::~FGRadioStack() 
+{
+    unbind();                  // FIXME: should be called externally
+}
+
+
+void
+FGRadioStack::init ()
+{
+    search();
+    update();
+
+    // Search radio database once per second
+    global_events.Register( "fgRadioSearch()", fgRadioSearch,
+                           fgEVENT::FG_EVENT_READY, 1000);
+}
+
+void
+FGRadioStack::bind ()
+{
+                               // User inputs
+    fgTie("/radios/nav1/frequencies/selected", this,
+         &FGRadioStack::get_nav1_freq, &FGRadioStack::set_nav1_freq);
+    fgTie("/radios/nav1/frequencies/standby", this,
+         &FGRadioStack::get_nav1_alt_freq, &FGRadioStack::set_nav1_alt_freq);
+    fgTie("/radios/nav1/radials/selected", this,
+         &FGRadioStack::get_nav1_sel_radial,
+         &FGRadioStack::set_nav1_sel_radial);
+
+                               // Radio outputs
+    fgTie("/radios/nav1/radials/actual", this, &FGRadioStack::get_nav1_radial);
+    fgTie("/radios/nav1/to-flag", this, &FGRadioStack::get_nav1_to_flag);
+    fgTie("/radios/nav1/from-flag", this, &FGRadioStack::get_nav1_from_flag);
+    fgTie("/radios/nav1/in-range", this, &FGRadioStack::get_nav1_inrange);
+    fgTie("/radios/nav1/dme/distance", this, &FGRadioStack::get_nav1_dme_dist);
+    fgTie("/radios/nav1/dme/in-range", this,
+         &FGRadioStack::get_nav1_dme_inrange);
+
+                               // User inputs
+    fgTie("/radios/nav2/frequencies/selected", this,
+         &FGRadioStack::get_nav2_freq, &FGRadioStack::set_nav2_freq);
+    fgTie("/radios/nav2/frequencies/standby", this,
+         &FGRadioStack::get_nav2_alt_freq, &FGRadioStack::set_nav2_alt_freq);
+    fgTie("/radios/nav2/radials/selected", this,
+         &FGRadioStack::get_nav2_sel_radial,
+         &FGRadioStack::set_nav2_sel_radial);
+
+                               // Radio outputs
+    fgTie("/radios/nav2/radials/actual", this, &FGRadioStack::get_nav2_radial);
+    fgTie("/radios/nav2/to-flag", this, &FGRadioStack::get_nav2_to_flag);
+    fgTie("/radios/nav2/from-flag", this, &FGRadioStack::get_nav2_from_flag);
+    fgTie("/radios/nav2/in-range", this, &FGRadioStack::get_nav2_inrange);
+    fgTie("/radios/nav2/dme/distance", this, &FGRadioStack::get_nav2_dme_dist);
+    fgTie("/radios/nav2/dme/in-range", this,
+         &FGRadioStack::get_nav2_dme_inrange);
+
+                               // User inputs
+    fgTie("/radios/adf/frequencies/selected", this,
+         &FGRadioStack::get_adf_freq, &FGRadioStack::set_adf_freq);
+    fgTie("/radios/adf/frequencies/standby", this,
+         &FGRadioStack::get_adf_alt_freq, &FGRadioStack::set_adf_alt_freq);
+    fgTie("/radios/adf/rotation", this,
+         &FGRadioStack::get_adf_rotation, &FGRadioStack::set_adf_rotation);
 }
 
+void
+FGRadioStack::unbind ()
+{
+    fgUntie("/radios/nav1/frequencies/selected");
+    fgUntie("/radios/nav1/frequencies/standby");
+    fgUntie("/radios/nav1/radials/actual");
+    fgUntie("/radios/nav1/radials/selected");
+    fgUntie("/radios/nav1/to-flag");
+    fgUntie("/radios/nav1/from-flag");
+    fgUntie("/radios/nav1/in-range");
+    fgUntie("/radios/nav1/dme/distance");
+    fgUntie("/radios/nav1/dme/in-range");
+
+    fgUntie("/radios/nav2/frequencies/selected");
+    fgUntie("/radios/nav2/frequencies/standby");
+    fgUntie("/radios/nav2/radials/actual");
+    fgUntie("/radios/nav2/radials/selected");
+    fgUntie("/radios/nav2/to-flag");
+    fgUntie("/radios/nav2/from-flag");
+    fgUntie("/radios/nav2/in-range");
+    fgUntie("/radios/nav2/dme/distance");
+    fgUntie("/radios/nav2/dme/in-range");
+
+    fgUntie("/radios/adf/frequencies/selected");
+    fgUntie("/radios/adf/frequencies/standby");
+    fgUntie("/radios/adf/rotation");
+}
 
 // Search the database for the current frequencies given current location
-void FGRadioStack::update( double lon, double lat, double elev ) {
+void 
+FGRadioStack::update() 
+{
+    double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
+    double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+    double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
+
     need_update = false;
 
     Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
@@ -194,7 +298,12 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
 
 
 // Update current nav/adf radio stations based on current postition
-void FGRadioStack::search( double lon, double lat, double elev ) {
+void FGRadioStack::search () 
+{
+    double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
+    double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+    double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
+
     // nav1
     FGILS ils;
     FGNav nav;
@@ -249,7 +358,7 @@ void FGRadioStack::search( double lon, double lat, double elev ) {
     } else {
        nav1_valid = false;
        nav1_radial = 0;
-       nav2_dme_dist = 0;
+       nav1_dme_dist = 0;
        // cout << "not picking up vor1. :-(" << endl;
     }
 
@@ -323,9 +432,75 @@ void FGRadioStack::search( double lon, double lat, double elev ) {
 }
 
 
-// periodic radio station search wrapper
-void fgRadioSearch( void ) {
-    current_radiostack->search( cur_fdm_state->get_Longitude(),
-                               cur_fdm_state->get_Latitude(),
-                               cur_fdm_state->get_Altitude() * FEET_TO_METER );
+/**
+ * Return true if the NAV1 TO flag should be active.
+ */
+bool 
+FGRadioStack::get_nav1_to_flag () const
+{
+  if (nav1_inrange) {
+    double offset = fabs(nav1_heading - nav1_radial);
+    if (nav1_loc)
+      return (offset <= 8.0 || offset >= 352.0);
+    else
+      return (offset <= 20.0 || offset >= 340.0);
+  } else {
+    return false;
+  }
 }
+
+
+/**
+ * Return true if the NAV1 FROM flag should be active.
+ */
+bool
+FGRadioStack::get_nav1_from_flag () const
+{
+  if (nav1_inrange) {
+    double offset = fabs(nav1_heading - nav1_radial);
+    if (nav1_loc)
+      return (offset >= 172.0 && offset <= 188.0);
+    else
+      return (offset >= 160.0 && offset <= 200.0);
+  } else {
+    return false;
+  }
+}
+
+
+/**
+ * Return true if the NAV2 TO flag should be active.
+ */
+bool 
+FGRadioStack::get_nav2_to_flag () const
+{
+  if (nav2_inrange) {
+    double offset = fabs(nav2_heading - nav2_radial);
+    if (nav2_loc)
+      return (offset <= 8.0 || offset >= 352.0);
+    else
+      return (offset <= 20.0 || offset >= 340.0);
+  } else {
+    return false;
+  }
+}
+
+
+/**
+ * Return true if the NAV2 FROM flag should be active.
+ */
+bool
+FGRadioStack::get_nav2_from_flag () const
+{
+  if (nav2_inrange) {
+    double offset = fabs(nav2_heading - nav2_radial);
+    if (nav2_loc)
+      return (offset >= 172.0 && offset <= 188.0);
+    else
+      return (offset >= 160.0 && offset <= 200.0);
+  } else {
+    return false;
+  }
+}
+
+
index dc4472564514d8c248d34f3eaf515786ebdbde3d..58abb3f39156c6f7d89840436d67bb8b460213ac 100644 (file)
 #define _FG_RADIOSTACK_HXX
 
 
+#include <Main/fgfs.hxx>
+#include <Main/fg_props.hxx>
+
 #include <simgear/compiler.h>
 
 #include <Navaids/ilslist.hxx>
 #include <Navaids/navlist.hxx>
 
 
-class FGRadioStack {
+
+class FGRadioStack : public FGSubsystem
+{
+
+    SGValue * latitudeVal;
+    SGValue * longitudeVal;
+    SGValue * altitudeVal;
 
     bool need_update;
 
@@ -121,11 +130,13 @@ public:
     FGRadioStack();
     ~FGRadioStack();
 
-    // Update nav/adf radios based on current postition
-    void search( double lon, double lat, double elev );
+    void init ();
+    void bind ();
+    void unbind ();
+    void update ();
 
     // Update nav/adf radios based on current postition
-    void update( double lon, double lat, double elev );
+    void search ();
 
     // NAV1 Setters
     inline void set_nav1_freq( double freq ) {
@@ -170,7 +181,12 @@ public:
 
     // Calculated values.
     inline bool get_nav1_inrange() const { return nav1_inrange; }
+    bool get_nav1_to_flag () const;
+    bool get_nav1_from_flag () const;
     inline bool get_nav1_has_dme() const { return nav1_has_dme; }
+    inline bool get_nav1_dme_inrange () const {
+       return nav1_inrange && nav1_has_dme;
+    }
     inline bool get_nav1_has_gs() const { return nav1_has_gs; }
     inline bool get_nav1_loc() const { return nav1_loc; }
     inline double get_nav1_loclon() const { return nav1_loclon; }
@@ -188,7 +204,12 @@ public:
     inline double get_nav1_target_gs() const { return nav1_target_gs; }
 
     inline bool get_nav2_inrange() const { return nav2_inrange; }
+    bool get_nav2_to_flag () const;
+    bool get_nav2_from_flag () const;
     inline bool get_nav2_has_dme() const { return nav2_has_dme; }
+    inline bool get_nav2_dme_inrange () const {
+       return nav2_inrange && nav2_has_dme;
+    }
     inline bool get_nav2_has_gs() const { return nav2_has_gs; }
     inline bool get_nav2_loc() const { return nav2_loc; }
     inline double get_nav2_loclon() const { return nav2_loclon; }
@@ -214,9 +235,4 @@ public:
 
 extern FGRadioStack *current_radiostack;
 
-
-// periodic radio station search wrapper
-void fgRadioSearch( void );
-
-
 #endif // _FG_RADIOSTACK_HXX
index 3c159e86b038e170efdb5c6f2c130e6423dca3f8..98025811b82f83a6938837e33243c3a16e926da4 100644 (file)
@@ -299,7 +299,7 @@ void FGSteam::_CatchUp()
        scaling capability for the vacuum pump later on.
        When we have a real engine model, we can ask it.
        */
-       the_ENGINE_rpm = FGBFI::getThrottle() * 26.0;
+       the_ENGINE_rpm = controls.get_throttle(0) * 26.0;
 
        /**************************
        This is just temporary, until the static source works,
index 6e7761d638f8a3157af03dd4aa44cf61598b67d6..ca61b498c3c4fb806c790cf05930c8eba613741c 100644 (file)
@@ -4,6 +4,8 @@
 //
 // Copyright (C) 2000  David Megginson - david@megginson.com
 //
+// THIS CLASS IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
+//
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 // published by the Free Software Foundation; either version 2 of the
@@ -84,13 +86,6 @@ reinit ()
   FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI reinit");
 
                                // TODO: add more AP stuff
-  double elevator = FGBFI::getElevator();
-  double aileron = FGBFI::getAileron();
-  double rudder = FGBFI::getRudder();
-  double throttle = FGBFI::getThrottle();
-  double elevator_trim = FGBFI::getElevatorTrim();
-  double flaps = FGBFI::getFlaps();
-  double brake = FGBFI::getBrakes();
   bool apHeadingLock = FGBFI::getAPHeadingLock();
   double apHeadingMag = FGBFI::getAPHeadingMag();
   bool apAltitudeLock = FGBFI::getAPAltitudeLock();
@@ -113,16 +108,9 @@ reinit ()
   cur_light_params.Update();
   fgUpdateLocalTime();
   fgUpdateWeatherDatabase();
-  fgRadioSearch();
+  current_radiostack->search();
 
                                // Restore all of the old states.
-  FGBFI::setElevator(elevator);
-  FGBFI::setAileron(aileron);
-  FGBFI::setRudder(rudder);
-  FGBFI::setThrottle(throttle);
-  FGBFI::setElevatorTrim(elevator_trim);
-  FGBFI::setFlaps(flaps);
-  FGBFI::setBrakes(brake);
   FGBFI::setAPHeadingLock(apHeadingLock);
   FGBFI::setAPHeadingMag(apHeadingMag);
   FGBFI::setAPAltitudeLock(apAltitudeLock);
@@ -229,9 +217,6 @@ FGBFI::init ()
   fgTie("/sim/time/gmt", getDateString, setDateString);
   fgTie("/sim/time/gmt-string", getGMTString);
   fgTie("/sim/hud/visibility", getHUDVisible, setHUDVisible);
-  fgTie("/sim/panel/visibility", getPanelVisible, setPanelVisible);
-  fgTie("/sim/panel/x-offset", getPanelXOffset, setPanelXOffset);
-  fgTie("/sim/panel/y-offset", getPanelYOffset, setPanelYOffset);
 
                                // Position
   fgTie("/position/airport-id", getTargetAirport, setTargetAirport);
@@ -260,22 +245,6 @@ FGBFI::init ()
   fgTie("/velocities/speed-east", getSpeedEast);
   fgTie("/velocities/speed-down", getSpeedDown);
 
-                               // Controls
-#if 0
-  fgTie("/controls/throttle", getThrottle, setThrottle);
-  fgTie("/controls/mixture", getMixture, setMixture);
-  fgTie("/controls/propellor-pitch", getPropAdvance, setPropAdvance);
-  fgTie("/controls/flaps", getFlaps, setFlaps);
-  fgTie("/controls/aileron", getAileron, setAileron);
-  fgTie("/controls/rudder", getRudder, setRudder);
-  fgTie("/controls/elevator", getElevator, setElevator);
-  fgTie("/controls/elevator-trim", getElevatorTrim, setElevatorTrim);
-  fgTie("/controls/brakes/all", getBrakes, setBrakes);
-  fgTie("/controls/brakes/left", getLeftBrake, setLeftBrake);
-  fgTie("/controls/brakes/right", getRightBrake, setRightBrake);
-  fgTie("/controls/brakes/center", getRightBrake, setCenterBrake);
-#endif
-
                                // Autopilot
   fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
   fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
@@ -285,34 +254,6 @@ FGBFI::init ()
              getAPHeadingMag, setAPHeadingMag);
   fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
 
-                               // Radio navigation
-  fgTie("/radios/nav1/frequencies/selected", getNAV1Freq, setNAV1Freq);
-  fgTie("/radios/nav1/frequencies/standby", getNAV1AltFreq, setNAV1AltFreq);
-  fgTie("/radios/nav1/radials/actual", getNAV1Radial);
-  fgTie("/radios/nav1/radials/selected",
-             getNAV1SelRadial, setNAV1SelRadial);
-  fgTie("/radios/nav1/dme/distance", getNAV1DistDME);
-  fgTie("/radios/nav1/to-flag", getNAV1TO);
-  fgTie("/radios/nav1/from-flag", getNAV1FROM);
-  fgTie("/radios/nav1/in-range", getNAV1InRange);
-  fgTie("/radios/nav1/dme/in-range", getNAV1DMEInRange);
-                              
-  fgTie("/radios/nav2/frequencies/selected", getNAV2Freq, setNAV2Freq);
-  fgTie("/radios/nav2/frequencies/standby",
-             getNAV2AltFreq, setNAV2AltFreq);
-  fgTie("/radios/nav2/radials/actual", getNAV2Radial);
-  fgTie("/radios/nav2/radials/selected",
-             getNAV2SelRadial, setNAV2SelRadial);
-  fgTie("/radios/nav2/dme/distance", getNAV2DistDME);
-  fgTie("/radios/nav2/to-flag", getNAV2TO);
-  fgTie("/radios/nav2/from-flag", getNAV2FROM);
-  fgTie("/radios/nav2/in-range", getNAV2InRange);
-  fgTie("/radios/nav2/dme/in-range", getNAV2DMEInRange);
-
-  fgTie("/radios/adf/frequencies/selected", getADFFreq, setADFFreq);
-  fgTie("/radios/adf/frequencies/standby", getADFAltFreq, setADFAltFreq);
-  fgTie("/radios/adf/rotation", getADFRotation, setADFRotation);
-
                                // Weather
   fgTie("/environment/visibility", getVisibility, setVisibility);
   fgTie("/environment/wind-north", getWindNorth, setWindNorth);
@@ -531,78 +472,6 @@ FGBFI::setHUDVisible (bool visible)
 }
 
 
-/**
- * Return true if the 2D panel is visible.
- */
-bool
-FGBFI::getPanelVisible ()
-{
-  return globals->get_options()->get_panel_status();
-}
-
-
-/**
- * Ensure that the 2D panel is visible or hidden.
- */
-void
-FGBFI::setPanelVisible (bool visible)
-{
-  if (globals->get_options()->get_panel_status() != visible) {
-    globals->get_options()->toggle_panel();
-  }
-}
-
-
-/**
- * Get the panel's current x-shift.
- */
-int
-FGBFI::getPanelXOffset ()
-{
-  if (current_panel != 0)
-    return current_panel->getXOffset();
-  else
-    return 0;
-}
-
-
-/**
- * Set the panel's current x-shift.
- */
-void
-FGBFI::setPanelXOffset (int offset)
-{
-  if (current_panel != 0)
-    current_panel->setXOffset(offset);
-}
-
-
-/**
- * Get the panel's current y-shift.
- */
-int
-FGBFI::getPanelYOffset ()
-{
-  if (current_panel != 0)
-    return current_panel->getYOffset();
-  else
-    return 0;
-}
-
-
-/**
- * Set the panel's current y-shift.
- */
-void
-FGBFI::setPanelYOffset (int offset)
-{
-  if (current_panel != 0)
-    current_panel->setYOffset(offset);
-}
-
-
-
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // Position
@@ -969,6 +838,7 @@ FGBFI::getSpeedDown ()
 // Controls
 ////////////////////////////////////////////////////////////////////////
 
+#if 0
 
 /**
  * Get the throttle setting, from 0.0 (none) to 1.0 (full).
@@ -1226,7 +1096,7 @@ FGBFI::setRightBrake (double brake)
 }
 
 
-
+#endif
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -1377,255 +1247,6 @@ FGBFI::setAPNAV1Lock (bool lock)
 }
 
 
-\f
-////////////////////////////////////////////////////////////////////////
-// Radio navigation.
-////////////////////////////////////////////////////////////////////////
-
-double
-FGBFI::getNAV1Freq ()
-{
-  return current_radiostack->get_nav1_freq();
-}
-
-double
-FGBFI::getNAV1AltFreq ()
-{
-  return current_radiostack->get_nav1_alt_freq();
-}
-
-double
-FGBFI::getNAV1Radial ()
-{
-  return current_radiostack->get_nav1_radial();
-}
-
-double
-FGBFI::getNAV1SelRadial ()
-{
-  return current_radiostack->get_nav1_sel_radial();
-}
-
-double
-FGBFI::getNAV1DistDME ()
-{
-  return current_radiostack->get_nav1_dme_dist();
-}
-
-bool 
-FGBFI::getNAV1TO ()
-{
-  if (current_radiostack->get_nav1_inrange()) {
-    double heading = current_radiostack->get_nav1_heading();
-    double radial = current_radiostack->get_nav1_radial();
-//     double var = FGBFI::getMagVar();
-    if (current_radiostack->get_nav1_loc()) {
-      double offset = fabs(heading - radial);
-      return (offset<= 8.0 || offset >= 352.0);
-    } else {
-//       double offset =
-//     fabs(heading - var - radial);
-      double offset = fabs(heading - radial);
-      return (offset <= 20.0 || offset >= 340.0);
-    }
-  } else {
-    return false;
-  }
-}
-
-bool
-FGBFI::getNAV1FROM ()
-{
-  if (current_radiostack->get_nav1_inrange()) {
-    double heading = current_radiostack->get_nav1_heading();
-    double radial = current_radiostack->get_nav1_radial();
-//     double var = FGBFI::getMagVar();
-    if (current_radiostack->get_nav1_loc()) {
-      double offset = fabs(heading - radial);
-      return (offset >= 172.0 && offset<= 188.0);
-    } else {
-//       double offset =
-//     fabs(heading - var - radial);
-      double offset = fabs(heading - radial);
-      return (offset >= 160.0 && offset <= 200.0);
-    }
-  } else {
-    return false;
-  }
-}
-
-bool
-FGBFI::getNAV1InRange ()
-{
-  return current_radiostack->get_nav1_inrange();
-}
-
-bool
-FGBFI::getNAV1DMEInRange ()
-{
-  return (current_radiostack->get_nav1_inrange() &&
-         current_radiostack->get_nav1_has_dme());
-}
-
-double
-FGBFI::getNAV2Freq ()
-{
-  return current_radiostack->get_nav2_freq();
-}
-
-double
-FGBFI::getNAV2AltFreq ()
-{
-  return current_radiostack->get_nav2_alt_freq();
-}
-
-double
-FGBFI::getNAV2Radial ()
-{
-  return current_radiostack->get_nav2_radial();
-}
-
-double
-FGBFI::getNAV2SelRadial ()
-{
-  return current_radiostack->get_nav2_sel_radial();
-}
-
-double
-FGBFI::getNAV2DistDME ()
-{
-  return current_radiostack->get_nav2_dme_dist();
-}
-
-bool 
-FGBFI::getNAV2TO ()
-{
-  if (current_radiostack->get_nav2_inrange()) {
-    double heading = current_radiostack->get_nav2_heading();
-    double radial = current_radiostack->get_nav2_radial();
-//     double var = FGBFI::getMagVar();
-    if (current_radiostack->get_nav2_loc()) {
-      double offset = fabs(heading - radial);
-      return (offset<= 8.0 || offset >= 352.0);
-    } else {
-//       double offset =
-//     fabs(heading - var - radial);
-      double offset = fabs(heading - radial);
-      return (offset <= 20.0 || offset >= 340.0);
-    }
-  } else {
-    return false;
-  }
-}
-
-bool 
-FGBFI::getNAV2FROM ()
-{
-  if (current_radiostack->get_nav2_inrange()) {
-    double heading = current_radiostack->get_nav2_heading();
-    double radial = current_radiostack->get_nav2_radial();
-//     double var = FGBFI::getMagVar();
-    if (current_radiostack->get_nav2_loc()) {
-      double offset = fabs(heading - radial);
-      return (offset >= 172.0 && offset<= 188.0);
-    } else {
-//       double offset =
-//     fabs(heading - var - radial);
-      double offset = fabs(heading - radial);
-      return (offset >= 160.0 && offset <= 200.0);
-    }
-  } else {
-    return false;
-  }
-}
-
-
-bool
-FGBFI::getNAV2InRange ()
-{
-  return current_radiostack->get_nav2_inrange();
-}
-
-bool
-FGBFI::getNAV2DMEInRange ()
-{
-  return (current_radiostack->get_nav2_inrange() &&
-         current_radiostack->get_nav2_has_dme());
-}
-
-double
-FGBFI::getADFFreq ()
-{
-  return current_radiostack->get_adf_freq();
-}
-
-double
-FGBFI::getADFAltFreq ()
-{
-  return current_radiostack->get_adf_alt_freq();
-}
-
-double
-FGBFI::getADFRotation ()
-{
-  return current_radiostack->get_adf_rotation();
-}
-
-void
-FGBFI::setNAV1Freq (double freq)
-{
-  current_radiostack->set_nav1_freq(freq);
-}
-
-void
-FGBFI::setNAV1AltFreq (double freq)
-{
-  current_radiostack->set_nav1_alt_freq(freq);
-}
-
-void
-FGBFI::setNAV1SelRadial (double radial)
-{
-  current_radiostack->set_nav1_sel_radial(radial);
-}
-
-void
-FGBFI::setNAV2Freq (double freq)
-{
-  current_radiostack->set_nav2_freq(freq);
-}
-
-void
-FGBFI::setNAV2AltFreq (double freq)
-{
-  current_radiostack->set_nav2_alt_freq(freq);
-}
-
-void
-FGBFI::setNAV2SelRadial (double radial)
-{
-  current_radiostack->set_nav2_sel_radial(radial);
-}
-
-void
-FGBFI::setADFFreq (double freq)
-{
-  current_radiostack->set_adf_freq(freq);
-}
-
-void
-FGBFI::setADFAltFreq (double freq)
-{
-  current_radiostack->set_adf_alt_freq(freq);
-}
-
-void
-FGBFI::setADFRotation (double rot)
-{
-  current_radiostack->set_adf_rotation(rot);
-}
-
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // GPS
index 16f345ef473e64a400da08a843bae7bd8312990d..cacc8499e1363632cec9f730afb63bb4cb54c412 100644 (file)
@@ -4,6 +4,8 @@
 //
 // Copyright (C) 2000  David Megginson - david@megginson.com
 //
+// THIS INTERFACE IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
+//
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 // published by the Free Software Foundation; either version 2 of the
@@ -73,16 +75,6 @@ public:
   static bool getHUDVisible ();
   static void setHUDVisible (bool hudVisible);
 
-  static bool getPanelVisible ();
-  static void setPanelVisible (bool panelVisible);
-
-  static int getPanelXOffset (); // pixels
-  static void setPanelXOffset (int i); // pixels
-
-  static int getPanelYOffset (); // pixels
-  static void setPanelYOffset (int i); // pixels
-
-
                                // Position
   static double getLatitude ();        // degrees
   static void setLatitude (double latitude); // degrees
@@ -135,6 +127,7 @@ public:
 //   static void setSpeedDown (double speed);
 
 
+#if 0
                                // Controls
   static double getThrottle ();        // 0.0:1.0
   static void setThrottle (double throttle); // 0.0:1.0
@@ -172,6 +165,7 @@ public:
   static double getCenterBrake (); // 0.0:1.0
   static void setCenterBrake (double brake); // 0.0:1.0
 
+#endif
 
                                // Autopilot
   static bool getAPAltitudeLock ();
@@ -192,57 +186,6 @@ public:
   static bool getAPNAV1Lock ();
   static void setAPNAV1Lock (bool lock);
 
-                               // Radio Navigation
-  static double getNAV1Freq ();
-  static void setNAV1Freq (double freq);
-
-  static double getNAV1AltFreq ();
-  static void setNAV1AltFreq (double freq);
-
-  static double getNAV1Radial (); // degrees
-
-  static double getNAV1SelRadial (); // degrees
-  static void setNAV1SelRadial (double radial);        // degrees
-
-  static double getNAV1DistDME (); // nautical miles
-
-  static bool getNAV1TO ();
-
-  static bool getNAV1FROM ();
-
-  static bool getNAV1InRange ();
-
-  static bool getNAV1DMEInRange ();
-
-  static double getNAV2Freq ();
-  static void setNAV2Freq (double freq);
-
-  static double getNAV2AltFreq ();
-  static void setNAV2AltFreq (double freq);
-
-  static double getNAV2Radial (); // degrees
-
-  static double getNAV2SelRadial (); // degrees
-  static void setNAV2SelRadial (double radial);        // degrees
-
-  static double getNAV2DistDME (); // nautical miles
-
-  static bool getNAV2TO ();
-
-  static bool getNAV2FROM ();
-
-  static bool getNAV2InRange ();
-
-  static bool getNAV2DMEInRange ();
-
-  static double getADFFreq ();
-  static void setADFFreq (double freq);
-
-  static double getADFAltFreq ();
-  static void setADFAltFreq (double freq);
-
-  static double getADFRotation (); // degrees
-  static void setADFRotation (double rot); // degrees
 
                                // GPS
   static string getTargetAirport ();
index ec69b9aca5973e44c6da9d6570960ecd331582bc..bb94291f1823aa443b5524957303e793751ae0e6 100644 (file)
@@ -663,21 +663,10 @@ bool fgInitSubsystems( void ) {
     p_fix.append( "Navaids/default.fix" );
     current_fixlist->init( p_fix );
 
-    // Initialize the underlying radio stack model
+    // Radio stack subsystem.
     current_radiostack = new FGRadioStack;
-
-    current_radiostack->search( cur_fdm_state->get_Longitude(),
-                               cur_fdm_state->get_Latitude(),
-                               cur_fdm_state->get_Altitude() * FEET_TO_METER );
-
-    current_radiostack->update( cur_fdm_state->get_Longitude(),
-                               cur_fdm_state->get_Latitude(),
-                               cur_fdm_state->get_Altitude() * FEET_TO_METER );
-
-    // Search radio database once per second
-    global_events.Register( "fgRadioSearch()", fgRadioSearch,
-                           fgEVENT::FG_EVENT_READY, 1000);
-
+    current_radiostack->init();
+    current_radiostack->bind();
 
     // Initialize the Cockpit subsystem
     if( fgCockpitInit( &current_aircraft )) {
@@ -746,6 +735,8 @@ bool fgInitSubsystems( void ) {
                "Error reading new panel from " << panel_path );
     } else {
        FG_LOG( FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path );
+       current_panel->init();
+       current_panel->bind();
     }
 
     // Initialize the BFI
index e44497ea4d8524b1bac3defdb99ad6eab938f24e..9b03121a2e490f32031f0be0a46bdf63703ec88d 100644 (file)
@@ -456,6 +456,7 @@ void GLUTspecialkey(int k, int x, int y) {
            return;
          }
          FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
+         current_panel->unbind();
          delete current_panel;
          current_panel = new_panel;
          return;
index 309c1f9d23cd33bbf0927c3ff956086247b52fec..5dbee70bb4cff6bb816ba1375ee27ab197094875 100644 (file)
@@ -642,7 +642,7 @@ void fgRenderFrame( void ) {
 
            // set up moving parts
            if (flaps_selector != NULL) {
-             flaps_selector->select( (FGBFI::getFlaps() > 0.5f) ? 1 : 2 );
+             flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
            }
 
            if (prop_selector != NULL) {
@@ -708,9 +708,17 @@ void fgRenderFrame( void ) {
        glDisable( GL_DEPTH_TEST );
        // glDisable( GL_CULL_FACE );
        // glDisable( GL_TEXTURE_2D );
+
+       // update the controls subsystem
+       controls.update();
+
        hud_and_panel->apply();
        fgCockpitUpdate();
 
+       // update the panel subsystem
+       if (current_panel != 0)
+         current_panel->update();
+
        // We can do translucent menus, so why not. :-)
        menus->apply();
        glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
@@ -823,9 +831,7 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
                                  cur_fdm_state->get_Latitude() );
 
     // Update radio stack model
-    current_radiostack->update( cur_fdm_state->get_Longitude(),
-                               cur_fdm_state->get_Latitude(),
-                               cur_fdm_state->get_Altitude() * FEET_TO_METER );
+    current_radiostack->update();
 }