diff --git a/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg b/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg index c4c3588f3..4cda77753 100644 --- a/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg +++ b/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg @@ -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" /> + 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" /> TOWER 119.875 + x="1001.9531" + y="556.37604">119.875 TOWER + x="713.1543" + y="580.66174">TOWER 119.875 TOWER 119.875 + x="1001.9531" + y="604.94751">119.875 TOWER + x="713.1543" + y="629.23322">TOWER 119.875 TOWER 119.875 + x="1001.9531" + y="677.80469">119.875 TOWER + x="713.1543" + y="653.51892">TOWER 119.875 - TOWER - 119.875 - TOWER - 119.875 O + + + TOWER + 119.875 diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas index e3427a5f9..2709c161b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas @@ -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); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas index 3a115cad3..8a319109e 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas @@ -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; }