]> git.mxchange.org Git - flightgear.git/commitdiff
write a more useful list on shift-"."-click, not the whole subtree
authormfranz <mfranz>
Thu, 3 May 2007 21:20:15 +0000 (21:20 +0000)
committermfranz <mfranz>
Thu, 3 May 2007 21:20:15 +0000 (21:20 +0000)
src/GUI/property_list.cxx

index de30bc1679727fe1db10d0b339ac2c652e173061..4d6eeea9bb57a1ec9c384a6def092c1a7063d137 100644 (file)
@@ -25,6 +25,7 @@
 #  include <config.h>
 #endif
 
+#include <iomanip>
 #include <simgear/compiler.h>
 
 #include STL_STRING
@@ -64,6 +65,47 @@ static string getValueTypeString(const SGPropertyNode *node)
 }
 
 
+static void dumpProperties(const SGPropertyNode *node)
+{
+    cout << node->getPath() << "/" << endl;
+    for (int i = 0; i < node->nChildren(); i++) {
+        const SGPropertyNode *c = node->getChild(i);
+        SGPropertyNode::Type type = c->getType();
+        if (type == SGPropertyNode::ALIAS || c->nChildren())
+            continue;
+
+        int index = c->getIndex();
+        cout << std::setw(11) << getValueTypeString(c) << "  " << c->getName();
+        if (index > 0)
+            cout << '[' << index << ']';
+        cout << " = ";
+
+        switch (c->getType()) {
+        case SGPropertyNode::DOUBLE:
+        case SGPropertyNode::FLOAT:
+            cout << std::setprecision(15) << c->getDoubleValue();
+            break;
+        case SGPropertyNode::LONG:
+        case SGPropertyNode::INT:
+            cout << c->getLongValue();
+            break;
+        case SGPropertyNode::BOOL:
+            cout << (c->getBoolValue() ? "true" : "false");
+            break;
+        case SGPropertyNode::STRING:
+            cout << '"' << c->getStringValue() << '"';
+            break;
+        case SGPropertyNode::NONE:
+            break;
+        default:
+            cout << '\'' << c->getStringValue() << '\'';
+        }
+        cout << endl;
+    }
+    cout << endl;
+}
+
+
 static void sanitize(stdString& s)
 {
     stdString r = s;
@@ -153,7 +195,7 @@ void PropertyList::handle_select(puObject *list_box)
                 if (mod_ctrl)
                     prop_list->toggleFlags();
                 else if (mod_shift)
-                    writeProperties(cerr, prop_list->_curr, true);
+                    dumpProperties(prop_list->_curr);
 
                 prop_list->update();
                 return;