1
0
Fork 0

Remove C++ ATC Dialog

This commit is contained in:
portree_kid 2021-12-25 21:50:29 +01:00
parent d240a9b138
commit fe894466bf
3 changed files with 72 additions and 9 deletions

View file

@ -1,5 +1,33 @@
<?xml version="1.0"?>
<PropertyList>
<nasal>
<open>
<![CDATA[
var self = cmdarg();
var icao = self.getNode("nasal/params/param/icao");
if (props.getNode("/sim/atc/freq-airport")!=nil) {
icao = props.getNode("/sim/atc/freq-airport");
}
var dialogTitle = sprintf("Airportfrequencies %s", icao.getValue());
self.getNode("text/label").setValue(dialogTitle);
var apt = airportinfo(icao.getValue());
var frequencies = apt.comms();
var textgroup = self.getNode("group").getNode("group-template");
var i = 0;
foreach (var c; frequencies) {
var target = self.getNode("group").getChild("group", i, 1);
props.copy(textgroup, target);
i = i + 1;
target.getNode("text/label").setValue(c.ident);
var formattedFreq = sprintf("%.3f MHz", c.frequency);
target.getNode("text[1]/label").setValue(formattedFreq);
target.getNode("button/binding/value").setValue(c.frequency);
target.getNode("button[1]/binding/value").setValue(c.frequency);
target.getNode("enabled").setValue(1);
}
]]>
</open>
</nasal>
<name>atc-freq-display</name>
<layout>vbox</layout>

View file

@ -1,12 +1,37 @@
<?xml version="1.0"?>
<PropertyList>
<nasal>
<open>
<![CDATA[
var self = cmdarg();
var dlgname = self.getNode("name").getValue();
self.getNode("group").removeChildren("button");
var textgroup = self.getNode("group").getNode("button-template");
var apts = findAirportsWithinRange(50);
if (size(apts) > 0) {
forindex (var i; apts) {
var target = self.getNode("group").getChild("button", i, 1);
props.copy(textgroup, target);
target.getNode("legend").setValue(apts[i].id);
target.getNode("binding/value").setValue(apts[i].id);
target.getNode("enabled").setValue(1);
}
props.dump(target);
} else {
self.getNode("text/enabled").setValue(1);
}
]]>
</open>
</nasal>
<name>atc-freq-search</name>
<layout>vbox</layout>
<text>
<label>Display Airport Frequencies</label>
<label>Display Nearest Airport Frequencies</label>
</text>
<hrule/>
<group>
@ -17,8 +42,13 @@
<enabled>false</enabled>
<legend>ICAO</legend>
<binding>
<command>ATC-freq-display</command>
<icao type="string">ICAO</icao>
<command>property-assign</command>
<property>/sim/atc/freq-airport</property>
<value type="string">ICAO</value>
</binding>
<binding>
<command>dialog-show</command>
<dialog-name>atc-freq-display</dialog-name>
</binding>
<binding>
<command>dialog-close</command>
@ -53,14 +83,20 @@
<empty><stretch>true</stretch></empty>
<button>
<legend>OK</legend>
<legend>Search</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>ATC-freq-display</command>
<command>dialog-show</command>
<dialog-name>atc-freq-display</dialog-name>
<!--
<params>
<icao type="string">ICAO</icao>
</params>
-->
</binding>
<binding>
<command>dialog-close</command>
@ -77,8 +113,6 @@
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
</group>
</PropertyList>

View file

@ -592,7 +592,8 @@
<item>
<name>atc-in-range</name>
<binding>
<command>ATC-freq-search</command>
<command>dialog-show</command>
<dialog-name>atc-freq-search</dialog-name>
</binding>
</item>