From d3b4d03b80c82eed6b03c59c5165b3a6b4f60968 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Thu, 8 Jun 2017 22:08:08 +0100 Subject: [PATCH] Handle more than 10 runways in Select Airport dialog Replace fixed table of 10 entries with textbox, patch courtesy of Florent ROUGON. --- gui/dialogs/airports.xml | 306 +++------------------------------------ 1 file changed, 23 insertions(+), 283 deletions(-) diff --git a/gui/dialogs/airports.xml b/gui/dialogs/airports.xml index a80d6d94d..d73aa9714 100644 --- a/gui/dialogs/airports.xml +++ b/gui/dialogs/airports.xml @@ -163,6 +163,7 @@ var longest_runway = 0; var runways = info.runways; + var infoAboutRunways = []; # list of strings for display avail_runways.removeChildren("value"); var runway_keys = sort(keys(runways), string.icmp); @@ -172,29 +173,24 @@ var r = runways[rwy]; longest_runway = math.max(longest_runway, r.length * 3.28); avail_runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy); - - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/label", rwy); - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/length-hdg", - sprintf("%d'/%03d deg", r.length * 3.28, r.heading)); + var rwyInfo = sprintf("%5s %12d' / %03d deg", rwy, r.length * 3.28, + r.heading); if (r.ils != nil) { - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", sprintf("%.3fMhz", r.ils.frequency / 100)); - } else { - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", ""); + rwyInfo = sprintf("%s %20.3f Mhz", rwyInfo, + r.ils.frequency / 100); } + append(infoAboutRunways, rwyInfo); + i += 1; if (i == MAX_RUNWAYS) break; } - while (i < MAX_RUNWAYS) { - # zero remaining runway data - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/label", ""); - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/length-hdg", ""); - setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", ""); - i += 1; - } + var runwayInfoNode = dlg.getNode("selected-airport/runways-info", 1); + runwayInfoNode.setValue(string.join("\n", infoAboutRunways)); + fgcommand("dialog-update", props.Node.new({"object-name": "runways-info", "dialog-name": "airports"})); # Update the list of available parking positions avail_parking = {}; @@ -1148,7 +1144,6 @@ fill 0 0 - 4 @@ -1157,276 +1152,21 @@ 1 - + 1 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[0]/label - - - - 1 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[0]/length-hdg - - - - 1 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[0]/ils - - - - 2 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[1]/label - - - - 2 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[1]/length-hdg - - - - 2 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[1]/ils - - - - 3 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[2]/label - - - - 3 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[2]/length-hdg - - - - 3 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[2]/ils - - - - 4 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[3]/label - - - - 4 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[3]/length-hdg - - - - 4 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[3]/ils - - - - 5 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[4]/label - - - - 5 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[4]/length-hdg - - - - 5 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[4]/ils - - - - 6 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[5]/label - - - - 6 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[5]/length-hdg - - - - 6 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[5]/ils - - - - 7 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[6]/label - - - - 7 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[6]/length-hdg - - - - 7 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[6]/ils - - - - 8 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[7]/label - - - - 8 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[7]/length-hdg - - - - 8 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[7]/ils - - - - 9 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[8]/label - - - - 9 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[8]/length-hdg - - - - 9 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[8]/ils - - - - 10 - 0 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[9]/label - - - - 10 - 1 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[9]/length-hdg - - - - 10 - 2 - left - true - - /sim/gui/dialogs/airports/selected-airport/runway[9]/ils - - + runways-info + runways-info + fill + true + 260 + 250 + 15 + false + false + /sim/gui/dialogs/airports/selected-airport/runways-info + +