FGMagRibbon::FGMagRibbon (int w, int h)
: FGTexturedLayer(w, h)
{
- FGCroppedTexture texture("Aircraft/c172/Instruments/Textures/compass-ribbon.rgb");
+ FGCroppedTexture texture("Aircraft/Instruments/Textures/compass-ribbon.rgb");
setTexture(texture);
}
}
+/**
+ * Test for a condition in the current node.
+ */
+\f
+////////////////////////////////////////////////////////////////////////
+// Read a condition and use it if necessary.
+////////////////////////////////////////////////////////////////////////
+
+static void
+readConditions (FGConditional * component, const SGPropertyNode * node)
+{
+ const SGPropertyNode * conditionNode = node->getChild("condition");
+ if (conditionNode != 0)
+ // The top level is implicitly AND
+ component->setCondition(fgReadCondition(conditionNode));
+}
+
+
/**
* Read an action from the instrument's property list.
*
FGPanelAction * action = new FGPanelAction(button, x, y, w, h);
vector<const SGPropertyNode *>bindings = node->getChildren("binding");
- for (int i = 0; i < bindings.size(); i++) {
+ for (unsigned int i = 0; i < bindings.size(); i++) {
SG_LOG(SG_INPUT, SG_INFO, "Reading binding "
<< bindings[i]->getStringValue("command"));
- action->addBinding(FGBinding(bindings[i])); // TODO: allow modifiers
+ action->addBinding(new FGBinding(bindings[i])); // TODO: allow modifiers
}
+ readConditions(action, node);
return action;
}
return 0;
}
+ readConditions(t, node);
SG_LOG( SG_COCKPIT, SG_DEBUG, "Read transformation " << name );
return t;
}
return 0;
}
+ readConditions(chunk, node);
return chunk;
}
layer = new FGTexturedLayer(texture, w, h);
}
+ // A group of sublayers.
+ else if (type == "group") {
+ layer = new FGGroupLayer();
+ for (int i = 0; i < node->nChildren(); i++) {
+ const SGPropertyNode * child = node->getChild(i);
+ cerr << "Trying child " << child->getName() << endl;
+ if (child->getName() == "layer") {
+ cerr << "succeeded!" << endl;
+ ((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
+ }
+ }
+ }
+
// A textual instrument layer.
else if (type == "text") {
tlayer->setPointSize(pointSize);
// Set the font.
- // TODO
+ string fontName = node->getStringValue("font", "default");
+ tlayer->setFontName(fontName);
const SGPropertyNode * chunk_group = node->getNode("chunks");
if (chunk_group != 0) {
}
}
}
-
+
+ readConditions(layer, node);
SG_LOG( SG_COCKPIT, SG_DEBUG, "Read layer " << name );
return layer;
}
}
}
}
-
+
+ readConditions(instrument, node);
SG_LOG( SG_COCKPIT, SG_DEBUG, "Done reading instrument " << name );
return instrument;
}
if (!fgHasNode("/sim/panel/x-offset"))
fgSetInt("/sim/panel/x-offset", root->getIntValue("x-offset", 0));
- if (!fgHasNode("/sim/panel/y-offset"))
+ // conditional removed by jim wilson to allow panel xml code
+ // with y-offset defined to work...
+ // if (!fgHasNode("/sim/panel/y-offset"))
fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0));
//
panel->setBackground(FGTextureManager::createTexture(bgTexture.c_str()));
SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << bgTexture );
+ //
+ // Get multibackground if any...
+ //
+ string mbgTexture = root->getStringValue("multibackground[0]");
+ if (mbgTexture != "") {
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 0);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[1]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 1);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[2]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 2);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[3]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 3);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[4]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 4);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[5]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 5);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[6]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 6);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[7]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 7);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ }
+
+
//
// Create each instrument.
// end of panel_io.cxx
+
+
+