airports vbox true hbox 1 1 setprop("/sim/gui/dialogs/airports/selected-airport/rwy", ""); setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", ""); setprop("/sim/gui/dialogs/airports/list", ""); var airport_id = getprop("/sim/presets/airport-id"); if (airport_id == nil) { airport_id = "KSFO"; } var dlg = props.globals.getNode("/sim/gui/dialogs/airports", 1); var avail_runways = dlg.getNode("available-runways", 1); var avail_parking = dlg.getNode("available-parking", 1); if (dlg.getNode("list") == nil) dlg.getNode("list", 1).setValue(""); var airportlist = dlg.getNode("list"); var mode = { runway: dlg.getNode("use_runway", 1), bestrunway: dlg.getNode("use_best_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("bestrunway"); } var update_info = func { var info = airportinfo(airport_id); setprop("/sim/gui/dialogs/airports/selected-airport/id", airport_id); setprop("/sim/gui/dialogs/airports/selected-airport/name", info.name ~ " (" ~ airport_id ~ ")"); setprop("/sim/gui/dialogs/airports/selected-airport/location", sprintf("%.3f / %.3f", info.lon, info.lat)); setprop("/sim/gui/dialogs/airports/selected-airport/lon", info.lon); setprop("/sim/gui/dialogs/airports/selected-airport/elevation-ft", 3.28 * info.elevation); setprop("/sim/gui/dialogs/airports/selected-airport/rwy", ""); setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", ""); var longest_runway = 0; var runway_string = ""; var runways = info.runways; avail_runways.removeChildren("value"); avail_parking.removeChildren("value"); var runway_keys = sort(keys(runways), string.icmp); var i = 0; foreach(var rwy; runway_keys) { runway_string = runway_string ~ rwy ~ " "; longest_runway = math.max(longest_runway, runways[rwy].length * 3.28); avail_runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy); i += 1; } i = 0; foreach (var park; info.parking()) { avail_parking.getNode("value[" ~ i ~ "]", 1).setValue(park.name); i += 1; } setprop("/sim/gui/dialogs/airports/selected-airport/longest-runway", longest_runway); gui.dialog_update("airports", "runway-list"); gui.dialog_update("airports", "parking-list"); } var listbox = func { airport_id = pop(split(" ", airportlist.getValue())); airport_id = substr(airport_id, 1, size(airport_id) - 2); # strip parentheses update_info(); } var apply = func { setprop("/sim/presets/airport-id", airport_id); 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-deg", 0); setprop("/sim/presets/glideslope-deg", 0); setprop("/sim/presets/heading-deg", 0); if (mode["bestrunway"].getBoolValue()) { setprop("/sim/presets/runway", ""); setprop("/sim/presets/parkpos", ""); } else if (mode["runway"].getBoolValue()) { setprop("/sim/presets/runway", getprop("/sim/gui/dialogs/airports/selected-airport/rwy")); setprop("/sim/presets/parkpos", ""); } else { setprop("/sim/presets/runway", ""); setprop("/sim/presets/parkpos", getprop("/sim/gui/dialogs/airports/selected-airport/parkpos")); } } update_info(); hbox 4 vbox hbox 4 input 200 fill true /sim/gui/dialogs/airports/list dialog-apply input dialog-update airport-list airport-list 300 260 fill fill true /sim/gui/dialogs/airports/list dialog-apply airport-list nasal table 0 0 200 right 0 1 3 left true /sim/gui/dialogs/airports/selected-airport/name 1 0 right 1 1 left true /sim/gui/dialogs/airports/selected-airport/location 1 3 right 1 4 left true %.0f /sim/gui/dialogs/airports/selected-airport/elevation-ft 2 0 right 2 1 left true %.0f /sim/gui/dialogs/airports/selected-airport/longest-runway table center 20 /sim/gui/dialogs/airports/use_best_runway true nasal 21 right /sim/gui/dialogs/airports/use_best_runway 22 right /sim/gui/dialogs/airports/use_best_runway 30 /sim/gui/dialogs/airports/use_runway true nasal 31 right /sim/gui/dialogs/airports/use_runway runway-list 32 85 /sim/gui/dialogs/airports/use_runway /sim/gui/dialogs/airports/selected-airport/rwy false sim/gui/dialogs/airports/available-runways dialog-apply runway-list 40 /sim/gui/dialogs/airports/use_parkpos true nasal 41 right /sim/gui/dialogs/airports/use_parkpos parking-list 42 85 /sim/gui/dialogs/airports/use_parkpos /sim/gui/dialogs/airports/selected-airport/parkpos false sim/gui/dialogs/airports/available-parking dialog-apply parking-list vbox map-dialog fill fill true 600 400 600 400 removelistener(aptlistener); removelistener(rwylistener); removelistener(parkposlistener); hbox Zoom %d /sim/gui/dialogs/airports/zoom true hbox 10 true true true