]> git.mxchange.org Git - flightgear.git/commitdiff
use <enabled>false</enabled> flag for widgets that shouldn't be drawn
authormfranz <mfranz>
Tue, 5 Aug 2008 05:27:07 +0000 (05:27 +0000)
committermfranz <mfranz>
Tue, 5 Aug 2008 05:27:07 +0000 (05:27 +0000)
instead of <hide>true</hide>. This is consistent with other places
in fgfs, like menu entries, hud elements, subsystem switches, etc.

src/GUI/dialog.cxx
src/GUI/layout-props.cxx
src/GUI/layout.cxx
src/GUI/layout.hxx

index a74cd9ef9b81f33ee7128c8b7728686588f2531d..40d718e193dc890c7f43e823825dcd24fff20584 100644 (file)
@@ -517,7 +517,7 @@ FGDialog::display (SGPropertyNode * props)
 puObject *
 FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
 {
-    if (props->getBoolValue("hide"))
+    if (!props->getBoolValue("enabled", true))
         return 0;
 
     bool presetSize = props->hasValue("width") && props->hasValue("height");
index 8533c17c8c06401e8a72942dd9d265b798d33574..2d691036fae35047df8c763f14d20937fbcb474b 100644 (file)
@@ -82,9 +82,9 @@ int LayoutWidget::getNum(const char* f)
     return _prop->getIntValue(f);
 }
 
-bool LayoutWidget::getBool(const char* f)
+bool LayoutWidget::getBool(const char* f, bool dflt)
 {
-    return _prop->getBoolValue(f);
+    return _prop->getBoolValue(f, dflt);
 }
 
 const char* LayoutWidget::getStr(const char* f)
index 12d13df7d476046695a9e6d8ce1dbd9fdcc8db30..aeec747c657ab9de237ba446572f3d924edde68c 100644 (file)
@@ -39,7 +39,7 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
 {
     *w = *h = 0; // Ask for nothing by default
 
-    if (getBool("hide") || isType("nasal"))
+    if (!getBool("enabled", true) || isType("nasal"))
         return;
 
     int legw = stringLength(getStr("legend"));
@@ -97,7 +97,7 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
 // Set up geometry such that the widget lives "inside" the specified 
 void LayoutWidget::layout(int x, int y, int w, int h)
 {
-    if (getBool("hide") || isType("nasal"))
+    if (!getBool("enabled", true) || isType("nasal"))
         return;
 
     setNum("__bx", x);
@@ -198,7 +198,7 @@ void LayoutWidget::doHVBox(bool doLayout, bool vertical, int* w, int* h)
     int nEq = 0, eqA = 0, eqB = 0, eqTotalA = 0;
     for(i=0; i<nc; i++) {
         LayoutWidget child = getChild(i);
-        if (child.getBool("hide"))
+        if (!child.getBool("enabled", true))
             continue;
 
         int a, b;
@@ -236,7 +236,7 @@ void LayoutWidget::doHVBox(bool doLayout, bool vertical, int* w, int* h)
         // from top to bottom instead of along the cartesian Y axis.
         int idx = vertical ? (nc-i-1) : i;
         LayoutWidget child = getChild(idx);
-        if (child.getBool("hide"))
+        if (!child.getBool("enabled", true))
             continue;
 
         if(child.getBool("equal")) {
index 924b4c27f1b8d678eab4e56206ff98bab1e9f6b2..e2dce3b6de1c3e031d4fc4c854297bd31c279912 100644 (file)
@@ -31,7 +31,7 @@ public:
     LayoutWidget getChild(int i);
     bool         hasField(const char* f);
     int          getNum(const char* f);
-    bool         getBool(const char* f);
+    bool         getBool(const char* f, bool dflt = false);
     const char*  getStr(const char* f);
     void         setNum(const char* f, int num);