property-browser vbox 3 true hbox 2 /sim/gui/dialogs/property-browser/title true true property-list 450 230 /sim/gui/dialogs/property-browser/list dialog-apply property-list nasal hbox 2 true /sim/gui/dialogs/property-browser/label 170 input 170 /sim/gui/dialogs/property-browser/input var dlg = props.globals.getNode("/sim/gui/dialogs/property-browser", 1); var title = dlg.getNode("title", 1); var label = dlg.getNode("label", 1); var input = dlg.getNode("input", 1); var list = dlg.getNode("list", 1); var node = nil; var dir = "/"; update = func(w) { fgcommand("dialog-update", props.Node.new({"object-name": w, "dialog-name": "property-browser"})); } squeeze = func(s, n) { if (size(s) <= n or n < 7) { return s; } var l = substr(s, 0, (n - 3) / 2); var r = substr(s, size(s) + size(l) + 3 - n); return l ~ "..." ~ r; } selected = func { var lst = list.getValue(); node = props.globals.getNode(lst); if (node == nil) { return; } if (size(node.getChildren())) { dir = node.getPath(); if (node.getPath() == "") { title.setValue("Internal Properties"); } else { title.setValue(lst); } node = nil; label.setValue(" --"); input.setValue(""); update("input"); } else { var name = node.getName(); var i = node.getIndex(); var type = node.getType(); if (i) { name ~= "[" ~ i ~ "]"; } label.setValue(squeeze(name, 30)); var value = nil; if (type == "BOOL") { value = node.getBoolValue() ? "true" : "false"; } elsif (type == "STRING") { value = node.getValue(); } elsif (type == "NONE") { value = ""; } elsif (type != "ALIAS") { value = node.getValue() ~ ""; } input.setValue(value); update("input"); } } set = func { if (node != nil) { node.setValue(input.getValue()); input.setValue(""); } } if (dlg.getNode("last") != nil) { dir = dlg.getNode("last").getValue(); list.setValue(dir); node = props.globals.getNode(dir); selected(); update("list"); } else { label.setValue(" --"); input.setValue(""); list.setValue("/"); } dlg.getNode("last", 1).setValue(dir);