treat widget input correctly
This commit is contained in:
parent
e0b1d12a60
commit
9c98766700
2 changed files with 19 additions and 6 deletions
|
@ -111,10 +111,9 @@ void PropertyList::delete_arrays()
|
||||||
for (int i = 0; i < _num_entries; i++)
|
for (int i = 0; i < _num_entries; i++)
|
||||||
delete[] _entries[i];
|
delete[] _entries[i];
|
||||||
|
|
||||||
for (int j = 0; j < _num_children; j++) {
|
for (int j = 0; j < _num_children; j++)
|
||||||
if (!_children[j]->nChildren())
|
if (!_children[j]->nChildren())
|
||||||
_children[j]->removeChangeListener(this);
|
_children[j]->removeChangeListener(this);
|
||||||
}
|
|
||||||
|
|
||||||
delete[] _entries;
|
delete[] _entries;
|
||||||
delete[] _children;
|
delete[] _children;
|
||||||
|
@ -297,9 +296,23 @@ void PropertyList::valueChanged(SGPropertyNode *nd)
|
||||||
|
|
||||||
void PropertyList::setValue(const char *s)
|
void PropertyList::setValue(const char *s)
|
||||||
{
|
{
|
||||||
SGPropertyNode *p = fgGetNode(s, false);
|
SGPropertyNode *p;
|
||||||
if (p)
|
try {
|
||||||
setCurrent(p);
|
p = fgGetNode(s, false);
|
||||||
|
} catch (const stdString& m) {
|
||||||
|
SG_LOG(SG_GENERAL, SG_DEBUG, "property-list: " << m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setCurrent(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PropertyList::setCurrent(SGPropertyNode *p)
|
||||||
|
{
|
||||||
|
bool same = (_curr == p);
|
||||||
|
_return = _curr = p;
|
||||||
|
update(same);
|
||||||
|
if (!same)
|
||||||
|
publish(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
~PropertyList();
|
~PropertyList();
|
||||||
|
|
||||||
void update (bool restore_slider_pos = false);
|
void update (bool restore_slider_pos = false);
|
||||||
void setCurrent(SGPropertyNode *p) { _curr = p; update(); publish(p); }
|
void setCurrent(SGPropertyNode *p);
|
||||||
SGPropertyNode *getCurrent() const { return _curr; }
|
SGPropertyNode *getCurrent() const { return _curr; }
|
||||||
void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
|
void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
|
||||||
void toggleFlags() { _flags->setBoolValue(!_flags->getBoolValue()); }
|
void toggleFlags() { _flags->setBoolValue(!_flags->getBoolValue()); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue