]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/dialog.cxx
allow to not only set a general widget <color>, but also specific element
[flightgear.git] / src / GUI / dialog.cxx
index de7f3ad0fa6a0fde96fca993c1f10bc27a141603..b248fc9363f926605cfc1cb488fdaa3e0059609e 100644 (file)
@@ -561,7 +561,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
 
         int slider_width = props->getIntValue("slider", 20);
         puList * obj = new puList(x, y, x + width, y + height, entries, slider_width);
-        if(presetSize)
+        if (presetSize)
             obj->setSize(width, height);
         setupObject(obj, props);
         setColor(obj, props);
@@ -569,6 +569,8 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
 
     } else if (type == "airport-list") {
         AirportList * obj = new AirportList(x, y, x + width, y + height);
+        if (presetSize)
+            obj->setSize(width, height);
         setupObject(obj, props);
         setColor(obj, props);
         return obj;
@@ -592,8 +594,10 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
         }
         // Layed-out objects need their size set, and non-layout ones
         // get a different placement.
-        if(presetSize) obj->setSize(width, height);
-        else obj->setLabelPlace(PUPLACE_LABEL_DEFAULT);
+        if (presetSize)
+            obj->setSize(width, height);
+        else
+            obj->setLabelPlace(PUPLACE_LABEL_DEFAULT);
         setColor(obj, props, LABEL);
         return obj;
 
@@ -618,7 +622,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
             obj = new puOneShot(x, y, legend);
         else
             obj = new puButton(x, y, legend);
-        if(presetSize)
+        if (presetSize)
             obj->setSize(width, height);
         setupObject(obj, props);
         setColor(obj, props);
@@ -646,7 +650,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
         obj->setMinValue(props->getFloatValue("min", 0.0));
         obj->setMaxValue(props->getFloatValue("max", 1.0));
         setupObject(obj, props);
-        if(presetSize)
+        if (presetSize)
             obj->setSize(width, height);
         setColor(obj, props, FOREGROUND|LABEL);
         return obj;
@@ -672,7 +676,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
             else
                 obj->enableInput();
         }
-        if(presetSize)
+        if (presetSize)
             obj->setSize(width, height);
         setupObject(obj, props);
         setColor(obj, props, FOREGROUND|LABEL);
@@ -707,6 +711,7 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
 void
 FGDialog::setupObject (puObject * object, SGPropertyNode * props)
 {
+    string type = props->getName();
     object->setLabelPlace(PUPLACE_CENTERED_RIGHT);
 
     if (props->hasValue("legend"))
@@ -762,6 +767,10 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
             info->bindings.push_back(new FGBinding(binding));
         }
         object->setCallback(action_callback);
+
+        if (type == "input" && props->getBoolValue("live"))
+            object->setDownCallback(action_callback);
+
         object->setUserData(info);
         _info.push_back(info);
     }
@@ -832,6 +841,8 @@ FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
         if ((pucol[i].mask == LABEL) && !c->isValid())
             dirty |= c->merge(_gui->getColor("label"));
 
+        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());
     }