]> git.mxchange.org Git - flightgear.git/commitdiff
replaced SGValue with SGPropertyNode throughout.
authorcurt <curt>
Tue, 12 Jun 2001 05:15:48 +0000 (05:15 +0000)
committercurt <curt>
Tue, 12 Jun 2001 05:15:48 +0000 (05:15 +0000)
src/Cockpit/cockpit.hxx
src/Cockpit/panel.cxx
src/Cockpit/panel.hxx
src/Cockpit/panel_io.cxx

index c48a1954321988dafb6f39f9c119b4f8d2996b8b..7510574ada47a15625f263b86914d6591c303f3a 100644 (file)
@@ -41,7 +41,7 @@ class fg_Cockpit  {
   private:
     int  Code;
     int  cockpitStatus;
-    SGValue * hud_status;
+    SGPropertyNode * hud_status;
 
   public:
     fg_Cockpit   () : Code(1), cockpitStatus(0) {};
index 3c3916a8b3cf4107f2a0f4b3aad23bb0b3603791..869aa7114db6c80c868c3576f1895a23c63e76a2 100644 (file)
@@ -404,10 +404,10 @@ FGPanelAction::~FGPanelAction ()
 ////////////////////////////////////////////////////////////////////////
 
 FGAdjustAction::FGAdjustAction (int button, int x, int y, int w, int h,
-                               SGValue * value, float increment, 
+                               SGPropertyNode * node, float increment, 
                                float min, float max, bool wrap)
   : FGPanelAction(button, x, y, w, h),
-    _value(value), _increment(increment), _min(min), _max(max), _wrap(wrap)
+    _node(node), _increment(increment), _min(min), _max(max), _wrap(wrap)
 {
 }
 
@@ -418,14 +418,14 @@ FGAdjustAction::~FGAdjustAction ()
 void
 FGAdjustAction::doAction ()
 {
-  float val = _value->getFloatValue();
+  float val = _node->getFloatValue();
   val += _increment;
   if (val < _min) {
     val = (_wrap ? _max : _min);
   } else if (val > _max) {
     val = (_wrap ? _min : _max);
   }
-  _value->setDoubleValue(val);
+  _node->setDoubleValue(val);
 }
 
 
@@ -435,8 +435,8 @@ FGAdjustAction::doAction ()
 ////////////////////////////////////////////////////////////////////////
 
 FGSwapAction::FGSwapAction (int button, int x, int y, int w, int h,
-                           SGValue * value1, SGValue * value2)
-  : FGPanelAction(button, x, y, w, h), _value1(value1), _value2(value2)
+                           SGPropertyNode * node1, SGPropertyNode * node2)
+  : FGPanelAction(button, x, y, w, h), _node1(node1), _node2(node2)
 {
 }
 
@@ -447,9 +447,9 @@ FGSwapAction::~FGSwapAction ()
 void
 FGSwapAction::doAction ()
 {
-  float val = _value1->getFloatValue();
-  _value1->setDoubleValue(_value2->getFloatValue());
-  _value2->setDoubleValue(val);
+  float val = _node1->getFloatValue();
+  _node1->setDoubleValue(_node2->getFloatValue());
+  _node2->setDoubleValue(val);
 }
 
 
@@ -459,8 +459,8 @@ FGSwapAction::doAction ()
 ////////////////////////////////////////////////////////////////////////
 
 FGToggleAction::FGToggleAction (int button, int x, int y, int w, int h,
-                               SGValue * value)
-  : FGPanelAction(button, x, y, w, h), _value(value)
+                               SGPropertyNode * node)
+  : FGPanelAction(button, x, y, w, h), _node(node)
 {
 }
 
@@ -471,7 +471,7 @@ FGToggleAction::~FGToggleAction ()
 void
 FGToggleAction::doAction ()
 {
-  _value->setBoolValue(!(_value->getBoolValue()));
+  _node->setBoolValue(!(_node->getBoolValue()));
 }
 
 
@@ -664,7 +664,7 @@ FGInstrumentLayer::transform () const
   transformation_list::const_iterator last = _transformations.end();
   while (it != last) {
     FGPanelTransformation *t = *it;
-    float val = (t->value == 0 ? 0.0 : t->value->getFloatValue());
+    float val = (t->node == 0 ? 0.0 : t->node->getFloatValue());
     if (val < t->min) {
       val = t->min;
     } else if (val > t->max) {
@@ -841,7 +841,7 @@ FGTextLayer::Chunk::Chunk (const string &text, const string &fmt)
     _fmt = "%s";
 }
 
-FGTextLayer::Chunk::Chunk (ChunkType type, const SGValue * value,
+FGTextLayer::Chunk::Chunk (ChunkType type, const SGPropertyNode * node,
                           const string &fmt, float mult)
   : _type(type), _fmt(fmt), _mult(mult)
 {
@@ -851,7 +851,7 @@ FGTextLayer::Chunk::Chunk (ChunkType type, const SGValue * value,
     else
       _fmt = "%.2f";
   }
-  _value = value;
+  _node = node;
 }
 
 const char *
@@ -862,10 +862,10 @@ FGTextLayer::Chunk::getValue () const
     sprintf(_buf, _fmt.c_str(), _text.c_str());
     return _buf;
   case TEXT_VALUE:
-    sprintf(_buf, _fmt.c_str(), _value->getStringValue().c_str());
+    sprintf(_buf, _fmt.c_str(), _node->getStringValue().c_str());
     break;
   case DOUBLE_VALUE:
-    sprintf(_buf, _fmt.c_str(), _value->getFloatValue() * _mult);
+    sprintf(_buf, _fmt.c_str(), _node->getFloatValue() * _mult);
     break;
   }
   return _buf;
@@ -877,10 +877,10 @@ FGTextLayer::Chunk::getValue () const
 // Implementation of FGSwitchLayer.
 ////////////////////////////////////////////////////////////////////////
 
-FGSwitchLayer::FGSwitchLayer (int w, int h, const SGValue * value,
+FGSwitchLayer::FGSwitchLayer (int w, int h, const SGPropertyNode * node,
                              FGInstrumentLayer * layer1,
                              FGInstrumentLayer * layer2)
-  : FGInstrumentLayer(w, h), _value(value), _layer1(layer1), _layer2(layer2)
+  : FGInstrumentLayer(w, h), _node(node), _layer1(layer1), _layer2(layer2)
 {
 }
 
@@ -894,7 +894,7 @@ void
 FGSwitchLayer::draw ()
 {
   transform();
-  if (_value->getBoolValue()) {
+  if (_node->getBoolValue()) {
     _layer1->draw();
   } else {
     _layer2->draw();
index 2fed9bc08982ea0a9366684029d6fc83250f799a..52bbf2e07164a10b91cafff9f3c891d706e48876 100644 (file)
@@ -254,13 +254,13 @@ class FGAdjustAction : public FGPanelAction
 {
 public:
   FGAdjustAction (int button, int x, int y, int w, int h,
-                 SGValue * value, float increment,
+                 SGPropertyNode * node, float increment,
                  float min, float max, bool wrap=false);
   virtual ~FGAdjustAction ();
   virtual void doAction ();
 
 private:
-  SGValue * _value;
+  SGPropertyNode * _node;
   float _increment;
   float _min;
   float _max;
@@ -280,13 +280,13 @@ class FGSwapAction : public FGPanelAction
 {
 public:
   FGSwapAction (int button, int x, int y, int w, int h,
-               SGValue * value1, SGValue * value2);
+               SGPropertyNode * node1, SGPropertyNode * node2);
   virtual ~FGSwapAction ();
   virtual void doAction ();
 
 private:
-  SGValue * _value1;
-  SGValue * _value2;
+  SGPropertyNode * _node1;
+  SGPropertyNode * _node2;
 };
 
 
@@ -301,12 +301,12 @@ class FGToggleAction : public FGPanelAction
 {
 public:
   FGToggleAction (int button, int x, int y, int w, int h,
-                 SGValue * value);
+                 SGPropertyNode * node);
   virtual ~FGToggleAction ();
   virtual void doAction ();
 
 private:
-  SGValue * _value;
+  SGPropertyNode * _node;
 };
 
 
@@ -379,7 +379,7 @@ public:
   virtual ~FGPanelTransformation ();
 
   Type type;
-  const SGValue * value;
+  const SGPropertyNode * node;
   float min;
   float max;
   float factor;
@@ -512,14 +512,14 @@ public:
   class Chunk {
   public:
     Chunk (const string &text, const string &fmt = "%s");
-    Chunk (ChunkType type, const SGValue * value,
+    Chunk (ChunkType type, const SGPropertyNode * node,
           const string &fmt = "", float mult = 1.0);
 
     const char * getValue () const;
   private:
     ChunkType _type;
     string _text;
-    const SGValue * _value;
+    const SGPropertyNode * _node;
     string _fmt;
     float _mult;
     mutable char _buf[1024];
@@ -561,7 +561,7 @@ class FGSwitchLayer : public FGInstrumentLayer
 {
 public:
                                // Transfer pointers!!
-  FGSwitchLayer (int w, int h, const SGValue * value,
+  FGSwitchLayer (int w, int h, const SGPropertyNode * node,
                 FGInstrumentLayer * layer1,
                 FGInstrumentLayer * layer2);
   virtual ~FGSwitchLayer ();
@@ -569,7 +569,7 @@ public:
   virtual void draw ();
 
 private:
-  const SGValue * _value;
+  const SGPropertyNode * _node;
   FGInstrumentLayer * _layer1, * _layer2;
 };
 
index 29e381986748ae04023ea853acab6b3c673329bc..0b190175084637b3a3e0c5808cc00a8e0ced4607 100644 (file)
@@ -232,8 +232,9 @@ readTexture (const SGPropertyNode * node)
  * Read an action from the instrument's property list.
  *
  * The action will be performed when the user clicks a mouse button
- * within the specified region of the instrument.  Actions always
- * work by modifying the value of a property (see the SGValue class).
+ * within the specified region of the instrument.  Actions always work
+ * by modifying the value of a property (see the SGPropertyNode
+ * class).
  *
  * The following action types are defined:
  *
@@ -276,7 +277,7 @@ readAction (const SGPropertyNode * node, float w_scale, float h_scale)
                                // Adjust a property value
   if (type == "adjust") {
     string propName = node->getStringValue("property");
-    SGValue * value = fgGetValue(propName, true);
+    SGPropertyNode * target = fgGetNode(propName, true);
     float increment = node->getFloatValue("increment", 1.0);
     float min = node->getFloatValue("min", 0.0);
     float max = node->getFloatValue("max", 0.0);
@@ -284,7 +285,7 @@ readAction (const SGPropertyNode * node, float w_scale, float h_scale)
     if (min == max)
       SG_LOG(SG_COCKPIT, SG_ALERT, "Action " << node->getName()
             << " has same min and max value");
-    action = new FGAdjustAction(button, x, y, w, h, value,
+    action = new FGAdjustAction(button, x, y, w, h, target,
                                increment, min, max, wrap);
   } 
 
@@ -292,16 +293,16 @@ readAction (const SGPropertyNode * node, float w_scale, float h_scale)
   else if (type == "swap") {
     string propName1 = node->getStringValue("property1");
     string propName2 = node->getStringValue("property2");
-    SGValue * value1 = fgGetValue(propName1, true);
-    SGValue * value2 = fgGetValue(propName2, true);
-    action = new FGSwapAction(button, x, y, w, h, value1, value2);
+    SGPropertyNode * target1 = fgGetNode(propName1, true);
+    SGPropertyNode * target2 = fgGetNode(propName2, true);
+    action = new FGSwapAction(button, x, y, w, h, target1, target2);
   } 
 
                                // Toggle a boolean value
   else if (type == "toggle") {
     string propName = node->getStringValue("property");
-    SGValue * value = fgGetValue(propName, true);
-    action = new FGToggleAction(button, x, y, w, h, value);
+    SGPropertyNode * target = fgGetNode(propName, true);
+    action = new FGToggleAction(button, x, y, w, h, target);
   } 
 
                                // Unrecognized type
@@ -347,7 +348,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
   string name = node->getName();
   string type = node->getStringValue("type");
   string propName = node->getStringValue("property", "");
-  SGValue * value = 0;
+  SGPropertyNode * target = 0;
 
   if (type == "") {
     SG_LOG( SG_COCKPIT, SG_ALERT,
@@ -357,10 +358,10 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
   }
 
   if (propName != (string)"") {
-    value = fgGetValue(propName, true);
+    target = fgGetNode(propName, true);
   }
 
-  t->value = value;
+  t->node = target;
   t->min = node->getFloatValue("min", -9999999);
   t->max = node->getFloatValue("max", 99999999);
   t->factor = node->getFloatValue("scale", 1.0);
@@ -464,17 +465,17 @@ readTextChunk (const SGPropertyNode * node)
 
                                // The value of a string property.
   else if (type == "text-value") {
-    SGValue * value =
-      fgGetValue(node->getStringValue("property"), true);
-    chunk = new FGTextLayer::Chunk(FGTextLayer::TEXT_VALUE, value, format);
+    SGPropertyNode * target =
+      fgGetNode(node->getStringValue("property"), true);
+    chunk = new FGTextLayer::Chunk(FGTextLayer::TEXT_VALUE, target, format);
   }
 
                                // The value of a float property.
   else if (type == "number-value") {
     string propName = node->getStringValue("property");
     float scale = node->getFloatValue("scale", 1.0);
-    SGValue * value = fgGetValue(propName, true);
-    chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, value,
+    SGPropertyNode * target = fgGetNode(propName, true);
+    chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, target,
                                   format, scale);
   }
 
@@ -576,13 +577,13 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
 
                                // A switch instrument layer.
   else if (type == "switch") {
-    SGValue * value =
-      fgGetValue(node->getStringValue("property"), true);
+    SGPropertyNode * target =
+      fgGetNode(node->getStringValue("property"), true);
     FGInstrumentLayer * layer1 =
       readLayer(node->getNode("layer1"), w_scale, h_scale);
     FGInstrumentLayer * layer2 =
       readLayer(node->getNode("layer2"), w_scale, h_scale);
-    layer = new FGSwitchLayer(w, h, value, layer1, layer2);
+    layer = new FGSwitchLayer(w, h, target, layer1, layer2);
   }
 
                                // A built-in instrument layer.
@@ -746,10 +747,10 @@ readPanel (const SGPropertyNode * root)
   //
   // Grab the panel's initial offsets, default to 0, 0.
   //
-  if (!fgHasValue("/sim/panel/x-offset"))
+  if (!fgHasNode("/sim/panel/x-offset"))
     fgSetInt("/sim/panel/x-offset", root->getIntValue("x-offset", 0));
 
-  if (!fgHasValue("/sim/panel/y-offset"))
+  if (!fgHasNode("/sim/panel/y-offset"))
     fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0));
 
   //