2009-01-31 19:30:31 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<PropertyList>
|
|
|
|
<name>model-view-select</name>
|
2009-02-05 00:58:05 +00:00
|
|
|
<dialog-name>model-view-select</dialog-name>
|
2009-01-31 19:30:31 +00:00
|
|
|
<x>46</x>
|
|
|
|
<y>33</y>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<default-padding>0</default-padding>
|
|
|
|
|
|
|
|
<nasal>
|
|
|
|
<open>
|
2009-02-05 00:58:05 +00:00
|
|
|
var self = cmdarg();
|
2009-01-31 19:30:31 +00:00
|
|
|
var dlg = props.globals.getNode("sim/gui/dialogs/model-view-select", 1);
|
|
|
|
dlg.getNode("open", 1).setBoolValue(1);
|
|
|
|
var maxh = getprop("sim/startup/ysize") - 50;
|
|
|
|
var gui = getprop("sim/gui/current-style");
|
|
|
|
var baseline = getprop("/sim/gui/style[" ~ gui ~ "]/fonts/gui/baseline-height") or 21;
|
|
|
|
var list = cmdarg().getNode("list");
|
|
|
|
|
|
|
|
var data = view.model_view_handler.list;
|
|
|
|
var height = size(data) * baseline;
|
|
|
|
if (height > maxh)
|
|
|
|
height = maxh;
|
|
|
|
list.getNode("pref-height").setValue(height);
|
|
|
|
list.removeChildren("value");
|
|
|
|
|
|
|
|
var entries = {};
|
|
|
|
forindex (var i; data) {
|
|
|
|
if (i == 0) {
|
2009-02-05 21:19:04 +00:00
|
|
|
var ident = var myself = '[' ~ data[i].callsign ~ ']';
|
2009-01-31 19:30:31 +00:00
|
|
|
list.getChild("value", size(data), 1).setValue(ident);
|
|
|
|
} else {
|
|
|
|
var ident = '"' ~ data[i].callsign ~ '" (' ~ data[i].model ~ ')';
|
|
|
|
list.getChild("value", i - 1, 1).setValue(ident);
|
|
|
|
}
|
|
|
|
entries[ident] = data[i].callsign;
|
|
|
|
}
|
|
|
|
|
|
|
|
var select = func {
|
|
|
|
var e = dlg.initNode("choice", "").getValue();
|
2009-02-05 21:19:04 +00:00
|
|
|
if (e == myself or contains(multiplayer.model.callsign, entries[e]))
|
2013-08-25 14:54:14 +00:00
|
|
|
view.model_view_handler.select(which: entries[e], by_callsign: 1);
|
2009-02-05 00:58:05 +00:00
|
|
|
else
|
|
|
|
settimer(func fgcommand("dialog-show", self), 0);
|
2009-01-31 19:30:31 +00:00
|
|
|
}
|
|
|
|
</open>
|
|
|
|
|
|
|
|
<close>
|
|
|
|
dlg.getNode("open").setValue(0);
|
|
|
|
</close>
|
|
|
|
</nasal>
|
|
|
|
|
|
|
|
<list>
|
|
|
|
<legend/>
|
|
|
|
<pref-height>100</pref-height>
|
2009-01-31 21:39:20 +00:00
|
|
|
<pref-width>250</pref-width>
|
2009-01-31 19:30:31 +00:00
|
|
|
<border>0</border>
|
|
|
|
<property>/sim/gui/dialogs/model-view-select/choice</property>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>select()</script>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
|
|
|
</list>
|
|
|
|
</PropertyList>
|