198 lines
4.3 KiB
XML
198 lines
4.3 KiB
XML
|
<?xml version="1.0"?>
|
||
|
|
||
|
<!--
|
||
|
command interface /autopilot/route-manager/input:
|
||
|
|
||
|
@clear ... clear route
|
||
|
@pop ... remove first entry
|
||
|
@delete3 ... delete 4th entry
|
||
|
@insert2:ksfo@900 ... insert "ksfo@900" as 3rd entry
|
||
|
ksfo@900 ... append "ksfo@900"
|
||
|
|
||
|
-->
|
||
|
|
||
|
<PropertyList>
|
||
|
<name>waypoints</name>
|
||
|
<layout>vbox</layout>
|
||
|
<default-padding>4</default-padding>
|
||
|
|
||
|
<text>
|
||
|
<label>Waypoint Manager</label>
|
||
|
</text>
|
||
|
|
||
|
<hrule><empty/></hrule>
|
||
|
|
||
|
<nasal>
|
||
|
<open>
|
||
|
var dlg = props.globals.getNode("/sim/gui/dialogs/waypoints", 1);
|
||
|
var selection = dlg.getNode("selection", 1);
|
||
|
var input = dlg.getNode("input", 1);
|
||
|
|
||
|
selection.setValue("");
|
||
|
input.setValue("");
|
||
|
|
||
|
var list = cmdarg().getNode("list");
|
||
|
var cmd = props.globals.getNode("/autopilot/route-manager/input", 1);
|
||
|
var routemgr = props.globals.getNode("/autopilot/route-manager/route", 1);
|
||
|
|
||
|
sel_index = func {
|
||
|
var s = selection.getValue();
|
||
|
selection.setValue("");
|
||
|
return s == "" ? -1 : split(':', s)[0] - 1;
|
||
|
}
|
||
|
|
||
|
clear = func {
|
||
|
cmd.setValue("@clear");
|
||
|
}
|
||
|
|
||
|
insert = func {
|
||
|
cmd.setValue("@insert" ~ sel_index() ~ ":" ~ input.getValue());
|
||
|
input.setValue("");
|
||
|
}
|
||
|
|
||
|
remove = func {
|
||
|
cmd.setValue("@delete" ~ sel_index())
|
||
|
}
|
||
|
|
||
|
listchanged = func {
|
||
|
list.removeChildren("value");
|
||
|
var wp = routemgr.getChildren("wp");
|
||
|
forindex (var i; wp) {
|
||
|
var id = wp[i].getNode("id").getValue();
|
||
|
var name = wp[i].getNode("name").getValue();
|
||
|
var lon = wp[i].getNode("longitude-deg").getValue();
|
||
|
var lat = wp[i].getNode("latitude-deg").getValue();
|
||
|
var alt = wp[i].getNode("altitude-ft").getValue();
|
||
|
var entry = sprintf("%d: %-5s %3.2f lon %3.2f lat %.0f ft",
|
||
|
i + 1, id, lon, lat, alt);
|
||
|
|
||
|
list.getChild("value", i, 1).setValue(entry);
|
||
|
}
|
||
|
|
||
|
fgcommand("dialog-update", props.Node.new({"object-name": "list",
|
||
|
"dialog-name": "waypoints"}));
|
||
|
}
|
||
|
|
||
|
var lst = setlistener("/autopilot/route-manager/route/num", listchanged, 1);
|
||
|
</open>
|
||
|
|
||
|
<close>
|
||
|
removelistener(lst);
|
||
|
</close>
|
||
|
</nasal>
|
||
|
|
||
|
<group>
|
||
|
<layout>hbox</layout>
|
||
|
<default-padding>2</default-padding>
|
||
|
|
||
|
<text>
|
||
|
<label>MMMMMMMMMMMMMMMM</label>
|
||
|
<format>Target: %s</format>
|
||
|
<property>/autopilot/route-manager/wp[0]/id</property>
|
||
|
<live>true</live>
|
||
|
</text>
|
||
|
|
||
|
<text>
|
||
|
<label>MMMMMMMMM</label>
|
||
|
<format>Dist: %.2f nm</format>
|
||
|
<property>/autopilot/route-manager/wp[0]/dist</property>
|
||
|
<live>true</live>
|
||
|
</text>
|
||
|
|
||
|
<text>
|
||
|
<label>MMMMMMMMM</label>
|
||
|
<format>ETA: %s</format>
|
||
|
<property>/autopilot/route-manager/wp[0]/eta</property>
|
||
|
<live>true</live>
|
||
|
</text>
|
||
|
</group>
|
||
|
|
||
|
<list>
|
||
|
<name>list</name>
|
||
|
<halign>fill</halign>
|
||
|
<pref-height>150</pref-height>
|
||
|
<property>/sim/gui/dialogs/waypoints/selection</property>
|
||
|
<binding>
|
||
|
<command>dialog-apply</command>
|
||
|
<object-name>list</object-name>
|
||
|
</binding>
|
||
|
</list>
|
||
|
|
||
|
<group>
|
||
|
<layout>hbox</layout>
|
||
|
<default-padding>4</default-padding>
|
||
|
|
||
|
<text>
|
||
|
<label>Waypoint:</label>
|
||
|
<pref-width>60</pref-width>
|
||
|
</text>
|
||
|
|
||
|
<input>
|
||
|
<name>input</name>
|
||
|
<pref-width>220</pref-width>
|
||
|
<property>/sim/gui/dialogs/waypoints/input</property>
|
||
|
</input>
|
||
|
|
||
|
<button>
|
||
|
<legend>Add</legend>
|
||
|
<default>true</default>
|
||
|
<pref-width>70</pref-width>
|
||
|
<binding>
|
||
|
<command>dialog-apply</command>
|
||
|
</binding>
|
||
|
<binding>
|
||
|
<command>nasal</command>
|
||
|
<script>insert()</script>
|
||
|
</binding>
|
||
|
<binding>
|
||
|
<command>dialog-update</command>
|
||
|
</binding>
|
||
|
</button>
|
||
|
</group>
|
||
|
|
||
|
<text>
|
||
|
<padding>1</padding>
|
||
|
<label>Format: (airport|fix|lon,lat)[@alt] -- e.g. "KSFO@900"</label>
|
||
|
<color>
|
||
|
<red>0.5</red>
|
||
|
<green>0.5</green>
|
||
|
<blue>0.5</blue>
|
||
|
</color>
|
||
|
</text>
|
||
|
|
||
|
<group>
|
||
|
<layout>hbox</layout>
|
||
|
<halign>fill</halign>
|
||
|
<default-padding>6</default-padding>
|
||
|
|
||
|
<button>
|
||
|
<legend>Clear List</legend>
|
||
|
<equal>true</equal>
|
||
|
<binding>
|
||
|
<command>nasal</command>
|
||
|
<script>clear()</script>
|
||
|
</binding>
|
||
|
</button>
|
||
|
|
||
|
<button>
|
||
|
<legend>Remove</legend>
|
||
|
<equal>true</equal>
|
||
|
<binding>
|
||
|
<command>nasal</command>
|
||
|
<script>remove()</script>
|
||
|
</binding>
|
||
|
</button>
|
||
|
|
||
|
<empty><stretch>true</stretch></empty>
|
||
|
|
||
|
<button>
|
||
|
<legend>Close</legend>
|
||
|
<equal>true</equal>
|
||
|
<key>Esc</key>
|
||
|
<binding>
|
||
|
<command>dialog-close</command>
|
||
|
</binding>
|
||
|
</button>
|
||
|
</group>
|
||
|
</PropertyList>
|