]> git.mxchange.org Git - flightgear.git/commitdiff
treat widget input correctly
authormfranz <mfranz>
Tue, 23 May 2006 20:24:56 +0000 (20:24 +0000)
committermfranz <mfranz>
Tue, 23 May 2006 20:24:56 +0000 (20:24 +0000)
src/GUI/property_list.cxx
src/GUI/property_list.hxx

index 76de6031481cb200800a2779adfd2eeecf97b7f9..28dc91973d816bf4bb6c64a6546db67e0cbeb36e 100644 (file)
@@ -111,10 +111,9 @@ void PropertyList::delete_arrays()
     for (int i = 0; i < _num_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())
             _children[j]->removeChangeListener(this);
-    }
 
     delete[] _entries;
     delete[] _children;
@@ -297,9 +296,23 @@ void PropertyList::valueChanged(SGPropertyNode *nd)
 
 void PropertyList::setValue(const char *s)
 {
-    SGPropertyNode *p = fgGetNode(s, false);
-    if (p)
-        setCurrent(p);
+    SGPropertyNode *p;
+    try {
+        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);
+}
+
index 90965f02ccad6a9a075367ba8b153546b46a8685..b044361b1abd049ce7566596330c81414e84273c 100644 (file)
@@ -36,7 +36,7 @@ public:
     ~PropertyList();
 
     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; }
     void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
     void toggleFlags() { _flags->setBoolValue(!_flags->getBoolValue()); }