From dad550e0eb312243c2c5712ac09e685cfde3ffad Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 3 May 2007 21:20:15 +0000 Subject: [PATCH] write a more useful list on shift-"."-click, not the whole subtree --- src/GUI/property_list.cxx | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/GUI/property_list.cxx b/src/GUI/property_list.cxx index de30bc167..4d6eeea9b 100644 --- a/src/GUI/property_list.cxx +++ b/src/GUI/property_list.cxx @@ -25,6 +25,7 @@ # include #endif +#include #include #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;