]> 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 6d0ac50a78f651e32af750ab71aa5d8a62c56975..e0cf55d9ec11698281db556df1c16c952dd26176 100644 (file)
@@ -32,7 +32,7 @@
 #include <plib/fnt.h>
 
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/fgpath.hxx>
+#include <simgear/misc/sg_path.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
@@ -66,7 +66,7 @@ FGTextureManager::createTexture (const string &relativePath)
   ssgTexture * texture = _textureMap[relativePath];
   if (texture == 0) {
     cerr << "Texture " << relativePath << " does not yet exist" << endl;
-    FGPath tpath(globals->get_fg_root());
+    SGPath tpath(globals->get_fg_root());
     tpath.append(relativePath);
     texture = new ssgTexture((char *)tpath.c_str(), false, false);
     _textureMap[relativePath] = texture;
@@ -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: