1
0
Fork 0

save and reload up to 20 history entries

This commit is contained in:
mfranz 2008-05-19 17:31:57 +00:00
parent 8fe1cf807d
commit 246ce973ec

View file

@ -288,3 +288,21 @@ var search = func(n, s) {
} }
_setlistener("/sim/signals/nasal-dir-initialized", func {
foreach (var p; props.globals.getNode("/sim/gui/prop-key-handler/history", 1).getChildren("entry"))
append(history, p.getValue());
});
_setlistener("/sim/signals/exit", func {
var max = props.initNode("/sim/gui/prop-key-handler/history-max-size", 20).getValue();
if (size(history) > max)
history = subvec(history, size(history) - max);
forindex (var i; history) {
var p = props.globals.getNode("/sim/gui/prop-key-handler/history", 1).getChild("entry", i, 1);
p.setValue(history[i]);
p.setAttribute("userarchive", 1);
}
});