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);
string propName = node->getStringValue("property");
float scale = node->getFloatValue("scale", 1.0);
float offset = node->getFloatValue("offset", 0.0);
- bool truncation = node->getFloatValue("truncate", false);
+ bool truncation = node->getBoolValue("truncate", false);
SGPropertyNode * target = fgGetNode(propName.c_str(), true);
chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, target,
format, scale, offset, truncation);