return obj;
} else if (type == "list") {
- puList * obj = new puList(x, y, x + width, y + height);
+ vector<SGPropertyNode_ptr> value_nodes = props->getChildren("value");
+ char ** entries = make_char_array(value_nodes.size());
+ 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);
setupObject(obj, props);
setColor(obj, props);
return obj;
} else if (type == "combo") {
vector<SGPropertyNode_ptr> value_nodes = props->getChildren("value");
char ** entries = make_char_array(value_nodes.size());
- for (unsigned int i = 0, j = value_nodes.size() - 1;
- i < value_nodes.size();
- i++, j--)
+ for (unsigned int i = 0; i < value_nodes.size(); i++)
entries[i] = strdup((char *)value_nodes[i]->getStringValue());
+
puComboBox * obj = new puComboBox(x, y, x + width, y + height, entries,
props->getBoolValue("editable", false));
setupObject(obj, props);
value_nodes.push_back(selection_node->getChild(q));
char ** entries = make_char_array(value_nodes.size());
- for (unsigned int i = 0, j = value_nodes.size() - 1;
- i < value_nodes.size();
- i++, j--)
+ for (unsigned int i = 0; i < value_nodes.size(); i++)
entries[i] = strdup((char *)value_nodes[i]->getName());
+
puSelectBox * obj =
new puSelectBox(x, y, x + width, y + height, entries);
setupObject(obj, props);
bool
FGMenuBar::enable_item(const SGPropertyNode * node, bool state)
{
- if (!node || _objects.find(node->getPath()) == _objects.end()) {
- SG_LOG(SG_GENERAL, SG_WARN, "Trying to enable/disable "
- "non-existent menu item");
+ const char *path = node->getPath();
+ if (_objects.find(path) == _objects.end()) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "Trying to enable/disable "
+ "non-existent menu item for node `" << path << '\'');
return false;
}
- puObject *object = _objects[node->getPath()];
+ puObject *object = _objects[path];
if (state)
object->activate();
else