]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel_io.cxx
allow to trigger widgets via accelerator key, which is defined via "keynum"
[flightgear.git] / src / Cockpit / panel_io.cxx
index 55dcb52ac85ffb03596c7fa9b1783b6917f1cdd3..978aac540057753635333c47548201c3ee54d019 100644 (file)
@@ -182,19 +182,34 @@ readAction (const SGPropertyNode * node, float w_scale, float h_scale)
   FGPanelAction * action = new FGPanelAction(button, x, y, w, h, repeatable);
 
   vector<SGPropertyNode_ptr>bindings = node->getChildren("binding");
+  SGPropertyNode * dest = fgGetNode("/sim/bindings/panel", true);
 
-  unsigned int i;
+  SGPropertyNode *binding;
+  unsigned int i, j;
   for (i = 0; i < bindings.size(); i++) {
     SG_LOG(SG_INPUT, SG_INFO, "Reading binding "
-          << bindings[i]->getStringValue("command"));
-    action->addBinding(new FGBinding(bindings[i]), 0);
+      << bindings[i]->getStringValue("command"));
+
+    j = 0;
+    while (dest->getChild("binding", j))
+      j++;
+
+    binding = dest->getChild("binding", j, true);
+    copyProperties(bindings[i], binding);
+    action->addBinding(new FGBinding(binding), 0);
   }
 
   if (node->hasChild("mod-up")) {
-      bindings = node->getChild("mod-up")->getChildren("binding");
-      for (i = 0; i < bindings.size(); i++) {
-          action->addBinding(new FGBinding(bindings[i]), 1);
-      }
+    bindings = node->getChild("mod-up")->getChildren("binding");
+    for (i = 0; i < bindings.size(); i++) {
+      j = 0;
+      while (dest->getChild("binding", j))
+        j++;
+
+      binding = dest->getChild("binding", j, true);
+      copyProperties(bindings[i], binding);
+      action->addBinding(new FGBinding(binding), 1);
+    }
   }
 
   readConditions(action, node);
@@ -366,9 +381,10 @@ readTextChunk (const SGPropertyNode * node)
     string propName = node->getStringValue("property");
     float scale = node->getFloatValue("scale", 1.0);
     float offset = node->getFloatValue("offset", 0.0);
+    bool truncation = node->getBoolValue("truncate", false);
     SGPropertyNode * target = fgGetNode(propName.c_str(), true);
     chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, target,
-                                  format, scale, offset);
+                                  format, scale, offset, truncation);
   }
 
                                // Unknown type.