]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel_io.cxx
Attempt #1 to sort out confusion between left / right / parking brake
[flightgear.git] / src / Cockpit / panel_io.cxx
index ef83c6b1ab2f8cc583b280b6970f5a0cd722526c..e24aafc62b8744c987520ea750721735754e4615 100644 (file)
 #include <string.h>            // for strcmp()
 
 #include <simgear/compiler.h>
-#include <simgear/misc/exception.hxx>
-
-#include <simgear/misc/sg_path.hxx>
+#include <simgear/structure/exception.hxx>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
 
 #include STL_IOSTREAM
 #include STL_FSTREAM
@@ -44,7 +43,7 @@
 
 #include <GUI/gui.h>
 
-#include "panel.hxx"
+// #include "panel.hxx"
 #include "panel_io.hxx"
 
 //built-in layers
@@ -132,12 +131,13 @@ readTexture (const SGPropertyNode * node)
 ////////////////////////////////////////////////////////////////////////
 
 static void
-readConditions (FGConditional * component, const SGPropertyNode * node)
+readConditions (SGConditional *component, const SGPropertyNode *node)
 {
   const SGPropertyNode * conditionNode = node->getChild("condition");
   if (conditionNode != 0)
                                // The top level is implicitly AND
-    component->setCondition(fgReadCondition(conditionNode));
+    component->setCondition(sgReadCondition(globals->get_props(),
+                                            conditionNode) );
 }
 
 
@@ -238,7 +238,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
   SGPropertyNode * target = 0;
 
   if (type.empty()) {
-    SG_LOG( SG_COCKPIT, SG_ALERT,
+    SG_LOG( SG_COCKPIT, SG_INFO,
             "No type supplied for transformation " << name
             << " assuming \"rotation\"" );
     type = "rotation";
@@ -418,7 +418,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
 
 
   if (type.empty()) {
-    SG_LOG( SG_COCKPIT, SG_ALERT,
+    SG_LOG( SG_COCKPIT, SG_INFO,
             "No type supplied for layer " << name
             << " assuming \"texture\"" );
     type = "texture";
@@ -436,11 +436,8 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
     layer = new FGGroupLayer();
     for (int i = 0; i < node->nChildren(); i++) {
       const SGPropertyNode * child = node->getChild(i);
-      cerr << "Trying child " << child->getName() << endl;
-      if (!strcmp(child->getName(), "layer")) {
-       cerr << "succeeded!" << endl;
+      if (!strcmp(child->getName(), "layer"))
        ((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
-      }
     }
   }
 
@@ -483,13 +480,12 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
 
                                // A switch instrument layer.
   else if (type == "switch") {
-    SGPropertyNode * target =
-      fgGetNode(node->getStringValue("property"), true);
-    FGInstrumentLayer * layer1 =
-      readLayer(node->getNode("layer[0]"), w_scale, h_scale);
-    FGInstrumentLayer * layer2 =
-      readLayer(node->getNode("layer[1]"), w_scale, h_scale);
-    layer = new FGSwitchLayer(w, h, target, layer1, layer2);
+    layer = new FGSwitchLayer();
+    for (int i = 0; i < node->nChildren(); i++) {
+      const SGPropertyNode * child = node->getChild(i);
+      if (!strcmp(child->getName(), "layer"))
+       ((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
+    }
   }
 
                                // A built-in instrument layer.