1
0
Fork 0

write a more useful list on shift-"."-click, not the whole subtree

This commit is contained in:
mfranz 2007-05-03 21:20:15 +00:00
parent 3eb6d4f708
commit dad550e0eb

View 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;