1
0
Fork 0

- write last clicked entry to /sim/gui/dialogs/property-browser/selected

- darken clone button
- cleanup & cosmetics
This commit is contained in:
mfranz 2008-05-14 10:19:17 +00:00
parent d12dfeda42
commit 6a577072da

View file

@ -14,13 +14,13 @@
<pref-width>16</pref-width> <pref-width>16</pref-width>
<pref-height>16</pref-height> <pref-height>16</pref-height>
<border>2</border> <border>2</border>
<!-- looks better in anthrax style <!-- looks better in anthrax style -->
<color> <color>
<red>0.34</red> <red>0.34</red>
<green>0.33</green> <green>0.33</green>
<blue>0.35</blue> <blue>0.35</blue>
</color> </color>
--> <!-- -->
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>clone(dir)</script> <script>clone(dir)</script>
@ -121,9 +121,9 @@
} }
var squeeze = func(s, n) { var squeeze = func(s, n) {
if (n >= size(s) or 7 > n ) { if (n >= size(s) or 7 > n )
return s; return s;
}
var l = substr(s, 0, (n - 3) / 2); var l = substr(s, 0, (n - 3) / 2);
var r = substr(s, size(s) + size(l) + 3 - n); var r = substr(s, size(s) + size(l) + 3 - n);
return l ~ "..." ~ r; return l ~ "..." ~ r;
@ -132,9 +132,10 @@
var select = func { var select = func {
var lst = list.getValue(); var lst = list.getValue();
node = props.globals.getNode(lst); node = props.globals.getNode(lst);
if (node == nil) { if (node == nil)
node = props.globals; node = props.globals;
}
setprop("/sim/gui/dialogs/property-browser/selected", node.getPath());
if (size(node.getChildren())) { if (size(node.getChildren())) {
dir = node.getPath(); dir = node.getPath();
title.setValue(node.getPath() == "" ? root_title : lst); title.setValue(node.getPath() == "" ? root_title : lst);
@ -145,9 +146,9 @@
var name = node.getName(); var name = node.getName();
var index = node.getIndex(); var index = node.getIndex();
var type = node.getType(); var type = node.getType();
if (index) { if (index)
name ~= "[" ~ index ~ "]"; name ~= "[" ~ index ~ "]";
}
var value = nil; var value = nil;
if (type == "BOOL") { if (type == "BOOL") {
value = node.getBoolValue() ? "true" : "false"; value = node.getBoolValue() ? "true" : "false";
@ -167,10 +168,9 @@
} }
var set = func { var set = func {
if (node != nil) { if (node != nil)
node.setValue(input.getValue()); node.setValue(input.getValue());
} }
}
var clone = func(startdir) { var clone = func(startdir) {
var base = props.globals.getNode("/sim/gui/dialogs", 1); var base = props.globals.getNode("/sim/gui/dialogs", 1);
@ -196,10 +196,9 @@
var auto_update = func { var auto_update = func {
list.setValue(dir); list.setValue(dir);
update("property-list"); update("property-list");
if (update_interval) { if (update_interval)
settimer(auto_update, update_interval, 1); settimer(auto_update, update_interval, 1);
} }
}
dir = dlg.getNode("last") != nil ? dlg.getNode("last").getValue() : "/"; dir = dlg.getNode("last") != nil ? dlg.getNode("last").getValue() : "/";
list.setValue(dir); list.setValue(dir);
@ -209,11 +208,10 @@
<close> <close>
update_interval = 0; update_interval = 0;
if (find("property-browser-", dlgname) >= 0) { if (find("property-browser-", dlgname) >= 0)
dlg.getParent().removeChildren(dlgname); dlg.getParent().removeChildren(dlgname);
} else { else
dlg.getNode("last", 1).setValue(dir); dlg.getNode("last", 1).setValue(dir);
}
</close> </close>
</nasal> </nasal>
</PropertyList> </PropertyList>