// Special case to handle lists, as getStringValue cannot be overridden
if(object->getType() & PUCLASS_LIST)
{
- node->setStringValue(((puList *) object)->getListStringValue());
+ const char *s = ((puList *) object)->getListStringValue();
+ if (s)
+ node->setStringValue(s);
}
else
{
for (unsigned int i = 0; i < value_nodes.size(); i++)
entries[i] = strdup((char *)value_nodes[i]->getStringValue());
- puList * obj = new puList(x, y, x + width, y + height, entries);
+ int slider_width = props->getIntValue("slider", 20);
+ puList * obj = new puList(x, y, x + width, y + height, entries, slider_width);
+ if (presetSize)
+ obj->setSize(width, height);
setupObject(obj, props);
setColor(obj, props);
return obj;
} 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;
}
// 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;
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);
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;
return obj;
} else if (type == "textbox") {
- int slider_width = props->getIntValue("slider", parentHeight);
+ int slider_width = props->getIntValue("slider", 20);
int wrap = props->getBoolValue("wrap", true);
- if (slider_width==0) slider_width=20;
puLargeInput * obj = new puLargeInput(x, y,
x+width, x+height, 2, slider_width, wrap);
else
obj->enableInput();
}
+ if (presetSize)
+ obj->setSize(width, height);
setupObject(obj, props);
setColor(obj, props, FOREGROUND|LABEL);
return obj;
void
FGDialog::setupObject (puObject * object, SGPropertyNode * props)
{
+ string type = props->getName();
object->setLabelPlace(PUPLACE_CENTERED_RIGHT);
if (props->hasValue("legend"))
j++;
const char *cmd = bindings[i]->getStringValue("command");
- if (!strcmp(cmd, "nasal") && _module[0])
+ if (!strcmp(cmd, "nasal"))
bindings[i]->setStringValue("module", _module.c_str());
binding = dest->getChild("binding", j, true);
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);
}
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());
}