add an optional property node pointer to ObjectProperty. This is currently
only used by the <list> widget. It allows to "dialog-update" the list, which rescans the <value> children and redraws the list widget with new contents. The old contents are only freed at dialog close, which should eventually get changed.
This commit is contained in:
parent
5b1dd6c8ae
commit
ff52ed5072
2 changed files with 17 additions and 6 deletions
|
@ -391,7 +391,11 @@ FGDialog::updateValues (const char * objectName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
puObject *obj = _propertyObjects[i]->object;
|
puObject *obj = _propertyObjects[i]->object;
|
||||||
copy_to_pui(_propertyObjects[i]->node, obj);
|
SGPropertyNode *values = _propertyObjects[i]->values;
|
||||||
|
if (obj->getType() & PUCLASS_LIST && values)
|
||||||
|
((puList *)obj)->newList(value_list(values));
|
||||||
|
else
|
||||||
|
copy_to_pui(_propertyObjects[i]->node, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,7 +725,9 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
|
||||||
const char * propname = props->getStringValue("property");
|
const char * propname = props->getStringValue("property");
|
||||||
SGPropertyNode_ptr node = fgGetNode(propname, true);
|
SGPropertyNode_ptr node = fgGetNode(propname, true);
|
||||||
copy_to_pui(node, object);
|
copy_to_pui(node, object);
|
||||||
PropertyObject* po = new PropertyObject(name, object, node);
|
|
||||||
|
SGPropertyNode * values = type == "list" ? props : 0;
|
||||||
|
PropertyObject* po = new PropertyObject(name, object, node, values);
|
||||||
_propertyObjects.push_back(po);
|
_propertyObjects.push_back(po);
|
||||||
if(props->getBoolValue("live"))
|
if(props->getBoolValue("live"))
|
||||||
_liveObjects.push_back(po);
|
_liveObjects.push_back(po);
|
||||||
|
@ -962,10 +968,12 @@ FGDialog::destroy_char_array (char ** array)
|
||||||
|
|
||||||
FGDialog::PropertyObject::PropertyObject (const char * n,
|
FGDialog::PropertyObject::PropertyObject (const char * n,
|
||||||
puObject * o,
|
puObject * o,
|
||||||
SGPropertyNode_ptr p)
|
SGPropertyNode_ptr p,
|
||||||
|
SGPropertyNode_ptr v)
|
||||||
: name(n),
|
: name(n),
|
||||||
object(o),
|
object(o),
|
||||||
node(p)
|
node(p),
|
||||||
|
values(v)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,15 +141,18 @@ private:
|
||||||
// PUI provides no way for userdata to be deleted automatically
|
// PUI provides no way for userdata to be deleted automatically
|
||||||
// with a GUI object, so we have to keep track of all the special
|
// with a GUI object, so we have to keep track of all the special
|
||||||
// data we allocated and then free it manually when the dialog
|
// data we allocated and then free it manually when the dialog
|
||||||
// closes.
|
// closes. "values" is a node with "value" children and only used
|
||||||
|
// by the <list> widget.
|
||||||
vector<void *> _info;
|
vector<void *> _info;
|
||||||
struct PropertyObject {
|
struct PropertyObject {
|
||||||
PropertyObject (const char * name,
|
PropertyObject (const char * name,
|
||||||
puObject * object,
|
puObject * object,
|
||||||
SGPropertyNode_ptr node);
|
SGPropertyNode_ptr node,
|
||||||
|
SGPropertyNode_ptr values = 0);
|
||||||
string name;
|
string name;
|
||||||
puObject * object;
|
puObject * object;
|
||||||
SGPropertyNode_ptr node;
|
SGPropertyNode_ptr node;
|
||||||
|
SGPropertyNode_ptr values;
|
||||||
};
|
};
|
||||||
vector<PropertyObject *> _propertyObjects;
|
vector<PropertyObject *> _propertyObjects;
|
||||||
vector<PropertyObject *> _liveObjects;
|
vector<PropertyObject *> _liveObjects;
|
||||||
|
|
Loading…
Add table
Reference in a new issue