99 lines
1.9 KiB
XML
99 lines
1.9 KiB
XML
|
<?xml version="1.0"?>
|
||
|
|
||
|
<PropertyList>
|
||
|
<name>callsign</name>
|
||
|
<layout>vbox</layout>
|
||
|
<x>30</x>
|
||
|
<y>60</y>
|
||
|
<pref-width>160</pref-width>
|
||
|
|
||
|
<nasal>
|
||
|
<open>
|
||
|
var loopid = 0;
|
||
|
var list = cmdarg().getNode("list");
|
||
|
|
||
|
var search = func(list, item) {
|
||
|
var left = 0;
|
||
|
var right = size(list);
|
||
|
while (left < right) {
|
||
|
var middle = int((left + right) / 2);
|
||
|
var c = cmp(list[middle].getNode("callsign").getValue(), item);
|
||
|
if (!c)
|
||
|
return middle;
|
||
|
if (c > 0)
|
||
|
right = middle;
|
||
|
else
|
||
|
left = middle + 1;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
var select = func(which) {
|
||
|
var index = search(cam.aircraft_list, which);
|
||
|
if (index >= 0)
|
||
|
cam.select_aircraft(index);
|
||
|
}
|
||
|
|
||
|
var loop = func(id) {
|
||
|
id == loopid or return;
|
||
|
cam.update_aircraft_list();
|
||
|
list.removeChildren("value");
|
||
|
|
||
|
forindex (var i; cam.aircraft_list) {
|
||
|
var name = cam.aircraft_list[i].getNode("callsign").getValue();
|
||
|
list.getChild("value", i, 1).setValue(name);
|
||
|
}
|
||
|
gui.dialog_update("callsign", "list");
|
||
|
settimer(func { loop(id) }, 5);
|
||
|
}
|
||
|
|
||
|
loop(loopid);
|
||
|
</open>
|
||
|
|
||
|
<close>
|
||
|
loopid += 1;
|
||
|
</close>
|
||
|
</nasal>
|
||
|
|
||
|
<group>
|
||
|
<layout>hbox</layout>
|
||
|
<empty><stretch>1</stretch></empty>
|
||
|
|
||
|
<text>
|
||
|
<label>Select Aircraft</label>
|
||
|
</text>
|
||
|
|
||
|
<empty><stretch>1</stretch></empty>
|
||
|
|
||
|
<button>
|
||
|
<pref-width>16</pref-width>
|
||
|
<pref-height>16</pref-height>
|
||
|
<legend></legend>
|
||
|
<default>1</default>
|
||
|
<keynum>27</keynum>
|
||
|
<border>2</border>
|
||
|
|
||
|
<binding>
|
||
|
<command>nasal</command>
|
||
|
<script>cam.callsign_dialog.close()</script>
|
||
|
</binding>
|
||
|
</button>
|
||
|
</group>
|
||
|
|
||
|
<hrule/>
|
||
|
|
||
|
<list>
|
||
|
<name>list</name>
|
||
|
<halign>fill</halign>
|
||
|
<pref-height>300</pref-height>
|
||
|
<property>/sim/gui/dialogs/cam/select</property>
|
||
|
<binding>
|
||
|
<command>dialog-apply</command>
|
||
|
</binding>
|
||
|
<binding>
|
||
|
<command>nasal</command>
|
||
|
<script>select(getprop("/sim/gui/dialogs/cam/select"))</script>
|
||
|
</binding>
|
||
|
</list>
|
||
|
</PropertyList>
|