1
0
Fork 0

- display of SGPropertyNode flags can now be toggled per <property-list>

widget (Ctrl-click on "." entry), so we don't need a global property
  for this
- s/dotFiles/_dot_files/ for consistency reasons
This commit is contained in:
mfranz 2006-06-03 11:20:19 +00:00
parent 6fb021ee01
commit 18d09b569f
2 changed files with 11 additions and 11 deletions

View file

@ -104,10 +104,10 @@ PropertyList::PropertyList(int minx, int miny, int maxx, int maxy, SGPropertyNod
puList(minx, miny, maxx, maxy, short(0), 20),
GUI_ID(FGCLASS_PROPERTYLIST),
_curr(start),
_flags(fgGetNode("/sim/gui/dialogs/property-browser/show-flags", true)),
_return(0),
_entries(0),
_num_entries(0)
_num_entries(0),
_flags(false)
{
_list_box->setUserData(this);
@ -147,7 +147,7 @@ void PropertyList::handle_select(puObject *list_box)
if (selected >= 0 && selected < prop_list->_num_entries) {
const char *src = prop_list->_entries[selected];
if (prop_list->dotFiles && (selected < 2)) {
if (prop_list->_dot_files && (selected < 2)) {
if (!strcmp(src, ".")) {
if (mod_ctrl)
prop_list->toggleFlags();
@ -169,7 +169,7 @@ void PropertyList::handle_select(puObject *list_box)
// we know we're dealing with a regular entry, so convert
// it to an index into children[]
if (prop_list->dotFiles)
if (prop_list->_dot_files)
selected -= 2;
SGPropertyNode_ptr child = prop_list->_children[selected].node;
@ -207,7 +207,7 @@ void PropertyList::update(bool restore_pos)
if (!_curr->getParent()) {
_entries = new char*[_num_entries + 1];
pi = 0;
dotFiles = false;
_dot_files = false;
} else {
_num_entries += 2; // for . and ..
@ -220,7 +220,7 @@ void PropertyList::update(bool restore_pos)
strcpy(_entries[1], "..");
pi = 2;
dotFiles = true;
_dot_files = true;
}
int i;
@ -271,7 +271,7 @@ void PropertyList::updateTextForEntry(int index)
stdString line = name + " = '" + value + "' (" + type;
if (_flags->getBoolValue()) {
if (_flags) {
stdString ext;
if (!node->getAttribute(SGPropertyNode::READ))
ext += 'r';
@ -296,7 +296,7 @@ void PropertyList::updateTextForEntry(int index)
if (line.size() >= PUSTRING_MAX)
line.resize(PUSTRING_MAX - 1);
if (dotFiles)
if (_dot_files)
index += 2;
delete[] _entries[index];

View file

@ -39,7 +39,7 @@ public:
void setCurrent(SGPropertyNode *p);
SGPropertyNode *getCurrent() const { return _curr; }
void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
void toggleFlags() { _flags->setBoolValue(!_flags->getBoolValue()); }
void toggleFlags() { _flags = !_flags; }
// overridden plib pui methods
virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); }
@ -60,7 +60,6 @@ private:
static int nodeNameCompare(const void *, const void *);
SGPropertyNode_ptr _curr;
SGPropertyNode_ptr _flags;
SGPropertyNode_ptr _return;
char **_entries;
@ -81,7 +80,8 @@ private:
NodeData *_children;
int _num_children;
bool dotFiles; // . and .. pseudo-dirs currently shown?
bool _dot_files; // . and .. pseudo-dirs currently shown?
bool _flags; // show SGPropertyNode flags
};