]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Internal interface changes by David Megginson.
[flightgear.git] / src / Cockpit / panel.cxx
index 3e371f43e6392b84d98e6163ada299ab51829d78..8cfc864a892987f6e092786feb9b1c1a00df9a39 100644 (file)
 
 #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>
 
 #include "hud.hxx"
 #include "panel.hxx"
@@ -44,7 +47,7 @@ bool
 fgPanelVisible ()
 {
   return ((globals->get_options()->get_panel_status()) &&
-         (globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT) &&
+         (globals->get_viewmgr()->get_current() == 0) &&
          (globals->get_current_view()->get_view_offset() == 0.0));
 }
 
@@ -142,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++) {
@@ -161,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())