Airport-list: allow filtering by type for helipads
Patch by Daniel Wickstrom, requires a corresponding FLightGear change to extend the special search function used by this dialog to add support for a type-prefix.
This commit is contained in:
parent
3e4234717b
commit
baa33f40b3
1 changed files with 46 additions and 5 deletions
|
@ -70,6 +70,10 @@
|
||||||
setprop("/sim/gui/dialogs/airports/display-tower", "1");
|
setprop("/sim/gui/dialogs/airports/display-tower", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getprop("/sim/gui/dialogs/airports/show-helipads") == "") {
|
||||||
|
setprop("/sim/gui/dialogs/airports/show-helipads", "1");
|
||||||
|
}
|
||||||
|
|
||||||
# Start with the closest airport
|
# Start with the closest airport
|
||||||
var airport_id = airportinfo().id;
|
var airport_id = airportinfo().id;
|
||||||
|
|
||||||
|
@ -288,10 +292,6 @@
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
<object-name>input</object-name>
|
<object-name>input</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
|
||||||
<command>dialog-update</command>
|
|
||||||
<object-name>airport-list</object-name>
|
|
||||||
</binding>
|
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -330,6 +330,32 @@
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
<object-name>input</object-name>
|
<object-name>input</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
var apt_type = "airport:";
|
||||||
|
var heli_type = "heliport:";
|
||||||
|
var search_term = getprop("/sim/gui/dialogs/airports/list");
|
||||||
|
|
||||||
|
# strip off airport type prefix
|
||||||
|
if (string.match(search_term,heli_type)) {
|
||||||
|
search_term = string.substr(search_term,size(heli_type));
|
||||||
|
}
|
||||||
|
else if (string.match(search_term,apt_type)) {
|
||||||
|
search_term = string.substr(search_term,size(apt_type));
|
||||||
|
}
|
||||||
|
var new_value = "";
|
||||||
|
|
||||||
|
# add new airport type prefix based off helipad checkbox
|
||||||
|
if (getprop("/sim/gui/dialogs/airports/show-helipads")) {
|
||||||
|
new_value = heli_type ~ search_term;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new_value = apt_type ~ search_term;
|
||||||
|
}
|
||||||
|
setprop("/sim/gui/dialogs/airports/list", new_value);
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-update</command>
|
<command>dialog-update</command>
|
||||||
<object-name>airport-list</object-name>
|
<object-name>airport-list</object-name>
|
||||||
|
@ -346,7 +372,12 @@
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
var airports = findAirportsWithinRange(100);
|
# change airport type to heliport if checkbox is set
|
||||||
|
var apt_type = "airport";
|
||||||
|
if (getprop("/sim/gui/dialogs/airports/show-helipads")) {
|
||||||
|
apt_type = "heliport";
|
||||||
|
}
|
||||||
|
var airports = findAirportsWithinRange(100,apt_type);
|
||||||
|
|
||||||
var list = dlg.getNode("close-airports", 1);
|
var list = dlg.getNode("close-airports", 1);
|
||||||
|
|
||||||
|
@ -363,6 +394,16 @@
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<checkbox>
|
||||||
|
<name>show-helipads</name>
|
||||||
|
<label>Helipads</label>
|
||||||
|
<property>/sim/gui/dialogs/airports/show-helipads</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>show-helipads</object-name>
|
||||||
|
</binding>
|
||||||
|
</checkbox>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
|
|
Loading…
Reference in a new issue