]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
1. Fixed FGInput bug preventing same key from being bound separately
[flightgear.git] / src / Cockpit / panel.cxx
index 5f638f44f09a3d19a5a15d07c657421ae88836e8..e0cf55d9ec11698281db556df1c16c952dd26176 100644 (file)
@@ -135,7 +135,8 @@ FGPanel::FGPanel (int window_x, int window_y, int window_w, int window_h)
     _mouseInstrument(0),
     _winx(window_x), _winy(window_y), _winw(window_w), _winh(window_h),
     _width(_winw), _height(int(_winh * 0.5768 + 1)),
-    _x_offset(0), _y_offset(0), _view_height(int(_winh * 0.4232))
+    _x_offset(0), _y_offset(0), _view_height(int(_winh * 0.4232)),
+    _bound(false)
 {
   setVisibility(fgPanelVisible());
 }
@@ -146,7 +147,8 @@ FGPanel::FGPanel (int window_x, int window_y, int window_w, int window_h)
  */
 FGPanel::~FGPanel ()
 {
-  unbind();
+  if (_bound)
+    unbind();
   for (instrument_list_type::iterator it = _instruments.begin();
        it != _instruments.end();
        it++) {
@@ -185,6 +187,7 @@ FGPanel::bind ()
   fgTie("/sim/panel/visibility", &_visibility);
   fgTie("/sim/panel/x-offset", &_x_offset);
   fgTie("/sim/panel/y-offset", &_y_offset);
+  _bound = true;
 }
 
 
@@ -197,6 +200,7 @@ FGPanel::unbind ()
   fgUntie("/sim/panel/visibility");
   fgUntie("/sim/panel/x-offset");
   fgUntie("/sim/panel/y-offset");
+  _bound = false;
 }
 
 
@@ -476,6 +480,7 @@ FGToggleAction::doAction ()
 ////////////////////////////////////////////////////////////////////////
 
 FGPanelTransformation::FGPanelTransformation ()
+  : table(0)
 {
 }
 
@@ -664,7 +669,11 @@ FGInstrumentLayer::transform () const
     } else if (val > t->max) {
       val = t->max;
     }
-    val = val * t->factor + t->offset;
+    if(t->table==0) {
+       val = val * t->factor + t->offset;
+    } else {
+       val = t->table->interpolate(val) * t->factor + t->offset;
+    }
 
     switch (t->type) {
     case FGPanelTransformation::XSHIFT: