1
0
Fork 0

Update AirportInfo to use GroupElement

This commit is contained in:
Stuart Buchanan 2018-01-13 23:08:30 +00:00
parent 42c0dd0b43
commit d79ef2df0f
3 changed files with 187 additions and 198 deletions

View file

@ -24,8 +24,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.6236979"
inkscape:cx="512"
inkscape:cy="384"
inkscape:cx="979.57659"
inkscape:cy="162.09296"
inkscape:document-units="px"
inkscape:current-layer="AirportInfoGroup"
showgrid="true"
@ -91,12 +91,12 @@
x="705.0351"
y="333.5351" />
<rect
y="498.64822"
x="705.14819"
height="218.70358"
width="314.70358"
y="498.60236"
x="705.10236"
height="188.79529"
width="314.79532"
id="rect9747"
style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.29643822;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.2047106;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="67.950417"
x="719.95044"
@ -323,195 +323,147 @@
<text
sodipodi:linespacing="125%"
id="AirportInfoFreqLabel1"
y="537.80463"
x="709.98047"
y="556.37604"
x="713.1543"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="537.80463"
x="709.98047"
y="556.37604"
x="713.1543"
id="tspan4254"
sodipodi:role="line">TOWER</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="998.7793"
y="537.80463"
x="1001.9531"
y="556.37604"
id="AirportInfoFreq1"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4258"
x="998.7793"
y="537.80463">119.875</tspan></text>
x="1001.9531"
y="556.37604">119.875</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="709.98047"
y="562.09033"
x="713.1543"
y="580.66174"
id="AirportInfoFreqLabel2"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4262"
x="709.98047"
y="562.09033">TOWER</tspan></text>
x="713.1543"
y="580.66174">TOWER</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreq2"
y="562.09033"
x="998.7793"
y="580.66174"
x="1001.9531"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="562.09033"
x="998.7793"
y="580.66174"
x="1001.9531"
id="tspan4266"
sodipodi:role="line">119.875</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreqLabel3"
y="586.3761"
x="709.98047"
y="604.94751"
x="713.1543"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="586.3761"
x="709.98047"
y="604.94751"
x="713.1543"
id="tspan4270"
sodipodi:role="line">TOWER</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="998.7793"
y="586.3761"
x="1001.9531"
y="604.94751"
id="AirportInfoFreq3"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4274"
x="998.7793"
y="586.3761">119.875</tspan></text>
x="1001.9531"
y="604.94751">119.875</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="709.98047"
y="610.6618"
x="713.1543"
y="629.23322"
id="AirportInfoFreqLabel4"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4278"
x="709.98047"
y="610.6618">TOWER</tspan></text>
x="713.1543"
y="629.23322">TOWER</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreq4"
y="610.6618"
x="998.7793"
y="629.23322"
x="1001.9531"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="610.6618"
x="998.7793"
y="629.23322"
x="1001.9531"
id="tspan4282"
sodipodi:role="line">119.875</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreqLabel6"
y="659.23328"
x="709.98047"
y="677.80469"
x="713.1543"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="659.23328"
x="709.98047"
y="677.80469"
x="713.1543"
id="tspan4286"
sodipodi:role="line">TOWER</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="998.7793"
y="659.23328"
x="1001.9531"
y="677.80469"
id="AirportInfoFreq6"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4290"
x="998.7793"
y="659.23328">119.875</tspan></text>
x="1001.9531"
y="677.80469">119.875</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="709.98047"
y="634.94751"
x="713.1543"
y="653.51892"
id="AirportInfoFreqLabel5"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4294"
x="709.98047"
y="634.94751">TOWER</tspan></text>
x="713.1543"
y="653.51892">TOWER</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreq5"
y="634.94751"
x="998.7793"
y="653.51892"
x="1001.9531"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="634.94751"
x="998.7793"
y="653.51892"
x="1001.9531"
id="tspan4298"
sodipodi:role="line">119.875</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreqLabel7"
y="683.51898"
x="709.98047"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="683.51898"
x="709.98047"
id="tspan4302"
sodipodi:role="line">TOWER</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="998.7793"
y="683.51898"
id="AirportInfoFreq7"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4306"
x="998.7793"
y="683.51898">119.875</tspan></text>
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="710.71289"
y="707.80469"
id="AirportInfoFreqLabel8"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4310"
x="710.71289"
y="707.80469">TOWER</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreq8"
y="707.80469"
x="998.7793"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="707.80469"
x="998.7793"
id="tspan4314"
sodipodi:role="line">119.875</tspan></text>
<rect
style="opacity:1;fill:#1a3030;fill-opacity:1;fill-rule:nonzero;stroke:#fffcfa;stroke-width:0.96484423;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4216"
@ -613,6 +565,46 @@
id="tspan4240"
x="743.24805"
y="111.96484">O</tspan></text>
<rect
inkscape:label="#rect4231"
y="503.58014"
x="1009.6064"
height="173.83977"
width="4.8397632"
id="AirportInfoFreqScrollBar"
style="opacity:1;fill:#c0c0c0;fill-opacity:1;fill-rule:nonzero;stroke:#c0c0c0;stroke-width:1.16023684;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:#808080;stroke-width:0.46607634;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="AirportInfoFreqScroll"
width="5.5338984"
height="24.533924"
x="1009.2331"
y="503.23303"
inkscape:label="#rect4231" />
<text
inkscape:label="#text4232"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="713.1543"
y="531.96484"
id="AirportInfoFreqLabel0"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan8284"
x="713.1543"
y="531.96484">TOWER</tspan></text>
<text
sodipodi:linespacing="125%"
id="AirportInfoFreq0"
y="531.96484"
x="1001.9531"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:20px;line-height:125%;font-family:'Liberation Sans Narrow';-inkscape-font-specification:'Liberation Sans Narrow Condensed';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#80ffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
inkscape:label="#text4232"><tspan
y="531.96484"
x="1001.9531"
id="tspan8288"
sodipodi:role="line">119.875</tspan></text>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -27,14 +27,6 @@ var AirportInfo =
"RwyDimensions",
"RwySurface",
"RwyLighting",
"FreqLabel1", "Freq1",
"FreqLabel2", "Freq2",
"FreqLabel3", "Freq3",
"FreqLabel4", "Freq4",
"FreqLabel5", "Freq5",
"FreqLabel6", "Freq6",
"FreqLabel7", "Freq7",
"FreqLabel8", "Freq8",
"Zoom"
];
@ -55,19 +47,17 @@ var AirportInfo =
obj.runwaySelect = PFD.ScrollElement.new(obj.pageName, svg, "Runway", ["36","18"]); # Dummy values
obj.cursorElements = [
obj.airportEntry,
# obj.getTextElement("Name"),
obj.runwaySelect,
obj.getTextElement("Freq1"),
obj.getTextElement("Freq2"),
obj.getTextElement("Freq3"),
obj.getTextElement("Freq4"),
obj.getTextElement("Freq5"),
obj.getTextElement("Freq6"),
obj.getTextElement("Freq7"),
obj.getTextElement("Freq8")
];
obj.freqSelect = PFD.GroupElement.new(
obj.pageName,
svg,
["FreqLabel", "Freq"],
7,
"Freq",
0,
"FreqScrollBar",
"FreqScroll",
150
);
# The Airport Chart
obj.AirportChart = obj._group.createChild("map");
@ -149,7 +139,7 @@ var AirportInfo =
}
# Display the comms frequencies for this airport
var fcount = 1;
var freqarray = [];
if (size(apt_info.comms()) > 0) {
# Airport has one or more frequencies assigned to it.
@ -161,9 +151,7 @@ var AirportInfo =
}
foreach (var c; sort(keys(freqs), string.icmp)) {
me.setTextElement("FreqLabel" ~ fcount, c);
me.setTextElement("Freq" ~ fcount, freqs[c]);
fcount += 1;
append(freqarray, {FreqLabel: c, Freq: freqs[c]});
}
}
@ -173,19 +161,12 @@ var AirportInfo =
if (rwy_info.ils_frequency_mhz != nil) {
var label = "ILS " ~ rwy_info.id;
var freq = sprintf("%.3f", rwy_info.ils_frequency_mhz);
me.setTextElement("FreqLabel" ~ fcount, label);
me.setTextElement("Freq" ~ fcount, freq);
fcount += 1;
append(freqarray, {FreqLabel: label, Freq: freq});
}
}
while (fcount < 9) {
# zero remaining comms channels
me.setTextElement("FreqLabel" ~ fcount, "");
me.setTextElement("Freq" ~ fcount, "");
fcount += 1;
}
me.freqSelect.setValues(freqarray);
},
displayRunway : func(rwy_info) {
if (rwy_info == nil) {
@ -204,50 +185,14 @@ var AirportInfo =
me.AirportChart.setScreenRange(zoom);
me.setTextElement("Zoom", label);
},
moveCRSR : func(val) {
var incr_or_decr = (val > 0) ? 1 : -1;
if (me.cursorElements[me.crsrIdx].isInEdit()) {
# We're editing an element, so let the element handle the movement itself
me.cursorElements[me.crsrIdx].incrLarge(val);
} else {
# We're not currently editing an element, so move to the next cursor position.
me.cursorElements[me.crsrIdx].unhighlightElement();
me.crsrIdx = math.mod(me.crsrIdx + incr_or_decr, size(me.cursorElements));
# Clear any cursor, highlights. Used when exiting from CRSR mode
resetCRSR : func() {
me.airportEntry.unhighlightElement();
me.runwaySelect.unhighlightElement();
me.freqSelect.hideCRSR();
},
while ((me.cursorElements[me.crsrIdx].getValue() == nil) or
(me.cursorElements[me.crsrIdx].getValue() == "" )) {
# Handle case where we have blank frequencies by skipping them.
me.crsrIdx = math.mod(me.crsrIdx + incr_or_decr, size(me.cursorElements));
}
me.cursorElements[me.crsrIdx].highlightElement();
}
},
incrSmall : func(val) {
me.cursorElements[me.crsrIdx].incrSmall(val);
var ret = {};
ret.name = me.cursorElements[me.crsrIdx].getName();
ret.value = me.cursorElements[me.crsrIdx].getValue();
return ret;
},
handleEnter : func() {
me.cursorElements[me.crsrIdx].enterElement();
var ret = {};
ret.name = me.cursorElements[me.crsrIdx].getName();
ret.value = me.cursorElements[me.crsrIdx].getValue();
return ret;
},
handleClear : func() {
me.cursorElements[me.crsrIdx].clearElement();
},
showCRSR : func() {
me.cursorElements[me.crsrIdx].highlightElement();
},
hideCRSR : func() {
me.cursorElements[me.crsrIdx].unhighlightElement();
me.crsrIdx = 0;
},
offdisplay : func() {
me._group.setVisible(0);

View file

@ -22,6 +22,12 @@ var AirportInfoController =
{range: 0.5, label: "8nm"},
{range: 0.4, label: "10nm"} ],
UIGROUP : {
APT : 0,
RNWY : 1,
FREQ : 2,
},
new : func (page, svg)
{
var obj = { parents : [ AirportInfoController, MFDPageController.new(page)] };
@ -31,12 +37,34 @@ var AirportInfoController =
obj.info = nil;
obj.page = page;
obj.crsrToggle = 0;
obj._currentGroup = AirportInfoController.UIGROUP.APT;
obj.current_zoom = 7;
obj.setZoom(obj.current_zoom);
return obj;
},
selectAirport : func() {
me.selectGroup(AirportInfoController.UIGROUP.APT)
},
selectRunways : func() {
me.selectGroup(AirportInfoController.UIGROUP.RNWY);
},
selectFrequencies : func() {
me.selectGroup(AirportInfoController.UIGROUP.FREQ);
},
getSelectedGroup : func() {
return me._currentGroup;
},
selectGroup : func(grp) {
me._currentGroup = grp;
if (grp == AirportInfoController.UIGROUP.APT) me.page.airportEntry.highlightElement() else me.page.airportEntry.unhighlightElement();
if (grp == AirportInfoController.UIGROUP.RNWY) me.page.runwaySelect.highlightElement() else me.page.runwaySelect.unhighlightElement();
if (grp == AirportInfoController.UIGROUP.FREQ) me.page.freqSelect.showCRSR() else me.page.freqSelect.hideCRSR();
me._crsrToggle = 1;
},
setAirport : func(id)
{
if (id == me.airport) return;
@ -76,25 +104,36 @@ var AirportInfoController =
handleCRSR : func() {
me.crsrToggle = (! me.crsrToggle);
if (me.crsrToggle) {
me.page.showCRSR();
me.selectAirport();
} else {
me.page.hideCRSR();
me.page.resetCRSR();
}
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleFMSInner : func(value) {
if (me.crsrToggle == 1) {
var select = me.page.incrSmall(value);
if ((select.name == "AirportInfoRunway") and (select.value != nil)) {
# Selection values are of the form "06L-12R". We need to set the
# runway to the left half.
var idx = find("-", select.value);
if (idx != -1) {
var rwy = substr(select.value, 0, idx);
me.setRunway(rwy);
if (me._currentGroup == AirportInfoController.UIGROUP.APT) {
me.page.airportEntry.incrSmall(value);
}
if (me._currentGroup == AirportInfoController.UIGROUP.RNWY) {
me.page.runwaySelect.incrSmall(value);
var val = me.page.runwaySelect.getValue();
if (val != nil) {
# Selection values are of the form "06L-12R". We need to set the
# runway to the left half.
var idx = find("-", val);
if (idx != -1) {
var rwy = substr(val, 0, idx);
me.setRunway(rwy);
}
}
}
if (me._currentGroup == AirportInfoController.UIGROUP.FREQ) {
me.page.freqSelect.incrSmall(value);
}
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd.SurroundController.handleFMSInner(value);
@ -102,7 +141,14 @@ var AirportInfoController =
},
handleFMSOuter : func(value) {
if (me.crsrToggle == 1) {
me.page.moveCRSR(value);
if ((me._currentGroup == AirportInfoController.UIGROUP.APT) and me.page.airportEntry.isInEdit()) {
me.page.airportEntry.incrLarge(value);
} else {
var incr_or_decr = (value > 0) ? 1 : -1;
var idx = math.mod(me._currentGroup + incr_or_decr, size(AirportInfoController.UIGROUP));
me.selectGroup(idx);
}
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd.SurroundController.handleFMSOuter(value);
@ -110,21 +156,27 @@ var AirportInfoController =
},
handleEnter : func(value) {
if (me.crsrToggle == 1) {
var select = me.page.handleEnter();
if (select.name == "AirportInfoID") me.setAirport(select.value);
if (substr(select.name, 0, 15) == "AirportInfoFreq") {
me.page.mfd.SurroundController.setStandbyNavComFreq(select.value);
if ((me._currentGroup == AirportInfoController.UIGROUP.APT) and me.page.airportEntry.isInEdit()) {
var aptname = me.page.airportEntry.enterElement();
me.setAirport(aptname);
}
if (me._currentGroup == AirportInfoController.UIGROUP.FREQ) {
me.page.mfd.SurroundController.setStandbyNavComFreq(me.page.freqSelect.getValue());
}
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
handleClear : func(value) {
if (me.crsrToggle == 1) {
# Cancel any data entry
me.page.handleClear();
if ((me.crsrToggle == 1) and
(me._currentGroup == AirportInfoController.UIGROUP.APT) and
me.page.airportEntry.isInEdit()) {
me.page.airportEntry.clearElement();
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}