1
0
Fork 0
fgdata/gui/dialogs/location-on-ground.xml
fredb a9a4fc67e0 Csaba/Jester :
Reacting to a feature request,  attached patch adds support for
parkpos selection in the "location on ground" dialog, and clears any
parkpos preset in the "airports" dialog.
2008-12-12 20:09:55 +00:00

153 lines
3.9 KiB
XML

<?xml version="1.0"?>
<PropertyList>
<name>location-on-ground</name>
<layout>vbox</layout>
<text>
<label>Set New Location</label>
</text>
<hrule/>
<nasal>
<open>
var dlg = props.globals.getNode("/sim/gui/dialogs/location-on-ground", 1);
var apt = dlg.getNode("airport", 1);
apt.setValue("");
var rwy = dlg.getNode("runway", 1);
rwy.setValue("");
var parkpos = dlg.getNode("parkpos", 1);
parkpos.setValue("");
var mode = {
runway: dlg.getNode("use_runway", 1),
parkpos: dlg.getNode("use_parkpos", 1)
};
var set_radio = func(m) {
foreach (k; keys(mode)) {
mode[k].setBoolValue(m == k);
}
}
var initialized = 0;
foreach (k; keys(mode)) {
if (mode[k].getType() == "NONE" or initialized) {
mode[k].setBoolValue(0);
} else {
initialized += mode[k].getBoolValue();
}
}
if (!initialized) {
set_radio("runway");
}
</open>
</nasal>
<group>
<layout>table</layout>
<halign>center</halign>
<text>
<row>0</row><col>1</col>
<halign>right</halign>
<label>Airport:</label>
</text>
<input>
<row>0</row><col>2</col>
<property>/sim/gui/dialogs/location-on-ground/airport</property>
</input>
<radio>
<row>1</row><col>0</col>
<property>/sim/gui/dialogs/location-on-ground/use_runway</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("runway")</script>
</binding>
</radio>
<text>
<row>1</row><col>1</col>
<halign>right</halign>
<label>Runway:</label>
</text>
<input>
<row>1</row><col>2</col>
<property>/sim/gui/dialogs/location-on-ground/runway</property>
</input>
<radio>
<row>2</row><col>0</col>
<property>/sim/gui/dialogs/location-on-ground/use_parkpos</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("parkpos")</script>
</binding>
</radio>
<text>
<row>2</row><col>1</col>
<halign>right</halign>
<label>Parking:</label>
</text>
<input>
<row>2</row><col>2</col>
<property>/sim/gui/dialogs/location-on-ground/parkpos</property>
</input>
</group>
<group>
<layout>hbox</layout>
<default-padding>10</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>OK</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>
setprop("/sim/presets/airport-id", apt.getValue());
if (mode["runway"].getBoolValue()) {
setprop("/sim/presets/runway", rwy.getValue());
setprop("/sim/presets/parkpos", "");
} else {
setprop("/sim/presets/runway", "");
setprop("/sim/presets/parkpos", parkpos.getValue());
}
setprop("/sim/presets/longitude-deg", -9999);
setprop("/sim/presets/latitude-deg", -9999);
setprop("/sim/presets/altitude-ft", -9999);
setprop("/sim/presets/airspeed-kt", 0);
setprop("/sim/presets/offset-distance-nm", 0);
setprop("/sim/presets/offset-azimuth-nm", 0);
setprop("/sim/presets/glideslope-deg", 0);
setprop("/sim/presets/heading-deg", 9999);
</script>
</binding>
<binding>
<command>presets-commit</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
<button>
<legend>Cancel</legend>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
</group>
</PropertyList>