]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/dialog.cxx
show verbose mode (see $FG_ROOT/Docs/README.gui -> property-list)
[flightgear.git] / src / GUI / dialog.cxx
index 929f4f8a52d758703f1e5e65ef41ee0ec05c0e1d..40d718e193dc890c7f43e823825dcd24fff20584 100644 (file)
@@ -327,17 +327,9 @@ copy_from_pui (puObject * object, SGPropertyNode * node)
         node->setFloatValue(object->getFloatValue());
         break;
     default:
-        // Special case to handle lists, as getStringValue cannot be overridden
-        if(object->getType() & PUCLASS_LIST)
-        {
-            const char *s = ((puList *) object)->getListStringValue();
-            if (s)
-                node->setStringValue(s);
-        }
-        else
-        {
-            node->setStringValue(object->getStringValue());
-        }
+        const char *s = object->getStringValue();
+        if (s)
+            node->setStringValue(s);
         break;
     }
 }
@@ -525,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");
@@ -642,11 +634,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
         fgComboBox * obj = new fgComboBox(x, y, x + width, y + height, props,
                            props->getBoolValue("editable", false));
         setupObject(obj, props);
-#ifdef PUCOL_EDITFIELD  // plib > 0.8.4
         setColor(obj, props, EDITFIELD);
-#else
-        setColor(obj, props, FOREGROUND|LABEL);
-#endif
         return obj;
 
     } else if (type == "slider") {
@@ -690,11 +678,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
     } else if (type == "select") {
         fgSelectBox * obj = new fgSelectBox(x, y, x + width, y + height, props);
         setupObject(obj, props);
-#ifdef PUCOL_EDITFIELD  // plib > 0.8.4
         setColor(obj, props, EDITFIELD);
-#else
-        setColor(obj, props, FOREGROUND|LABEL);
-#endif
         return obj;
     } else {
         return 0;
@@ -813,11 +797,11 @@ FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
     if (type == "textbox" && props->getBoolValue("editable"))
         type += "-editable";
 
-    FGColor *c = new FGColor(_gui->getColor("background"));
-    c->merge(_gui->getColor(type));
-    c->merge(props->getNode("color"));
-    if (c->isValid())
-        object->setColourScheme(c->red(), c->green(), c->blue(), c->alpha());
+    FGColor c(_gui->getColor("background"));
+    c.merge(_gui->getColor(type));
+    c.merge(props->getNode("color"));
+    if (c.isValid())
+        object->setColourScheme(c.red(), c.green(), c.blue(), c.alpha());
 
     const struct {
         int mask;
@@ -831,29 +815,27 @@ FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
         { LABEL,      PUCOL_LABEL,      "label",      "color-label" },
         { LEGEND,     PUCOL_LEGEND,     "legend",     "color-legend" },
         { MISC,       PUCOL_MISC,       "misc",       "color-misc" },
-#ifdef PUCOL_EDITFIELD  // plib > 0.8.4
         { EDITFIELD,  PUCOL_EDITFIELD,  "editfield",  "color-editfield" },
-#endif
     };
 
     const int numcol = sizeof(pucol) / sizeof(pucol[0]);
 
     for (int i = 0; i < numcol; i++) {
         bool dirty = false;
-        c->clear();
-        c->setAlpha(1.0);
+        c.clear();
+        c.setAlpha(1.0);
 
-        dirty |= c->merge(_gui->getColor(type + '-' + pucol[i].name));
+        dirty |= c.merge(_gui->getColor(type + '-' + pucol[i].name));
         if (which & pucol[i].mask)
-            dirty |= c->merge(props->getNode("color"));
+            dirty |= c.merge(props->getNode("color"));
 
-        if ((pucol[i].mask == LABEL) && !c->isValid())
-            dirty |= c->merge(_gui->getColor("label"));
+        if ((pucol[i].mask == LABEL) && !c.isValid())
+            dirty |= c.merge(_gui->getColor("label"));
 
-        dirty |= c->merge(props->getNode(pucol[i].cname));
+        dirty |= c.merge(props->getNode(pucol[i].cname));
 
-        if (c->isValid() && dirty)
-            object->setColor(pucol[i].id, c->red(), c->green(), c->blue(), c->alpha());
+        if (c.isValid() && dirty)
+            object->setColor(pucol[i].id, c.red(), c.green(), c.blue(), c.alpha());
     }
 }
 
@@ -1019,7 +1001,9 @@ void
 fgList::update()
 {
     fgValueList::update();
+    int top = getTopItem();
     newList(_list);
+    setTopItem(top);
 }
 
 // end of dialog.cxx