From 78e9eff4335d328c7fac8e84b0f7e1b128b3e5a4 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Tue, 7 Jul 2020 13:28:32 +0100 Subject: [PATCH] FG1000: Keyboard input for GCU 47X From Julio Santa Cruz --- .../AirportInfo/AirportInfoController.nas | 7 +++++ .../MFDPages/DirectTo/DirectToController.nas | 11 ++++++++ .../IntersectionInfoController.nas | 5 +++- .../MFDPages/NDBInfo/NDBInfoController.nas | 6 ++++- .../MFDPages/VORInfo/VORInfoController.nas | 4 +++ .../WaypointEntry/WaypointEntryController.nas | 6 +++++ Nasal/canvas/PFD/DataEntryElement.nas | 26 +++++++++++++++---- 7 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/AirportInfo/AirportInfoController.nas index 03468dc6f..ff5cb9c58 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/AirportInfo/AirportInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/AirportInfo/AirportInfoController.nas @@ -129,6 +129,13 @@ var AirportInfoController = } return emesary.Transmitter.ReceiptStatus_Finished; }, + handleKeyInput : func (value) { + if (me._currentGroup == AirportInfoController.UIGROUP.APT) { + me.page.airportEntry.keyPress(value); + return emesary.Transmitter.ReceiptStatus_Finished; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }, handleFMSInner : func(value) { if (me.crsrToggle == 1) { if (me._currentGroup == AirportInfoController.UIGROUP.APT) { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/DirectTo/DirectToController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/DirectTo/DirectToController.nas index 29a9312ea..72a04be99 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/DirectTo/DirectToController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/DirectTo/DirectToController.nas @@ -320,6 +320,17 @@ var DirectToController = return emesary.Transmitter.ReceiptStatus_Finished; }, + handleKeyInput : func (value) { + if (! me.dto_displayed) return emesary.Transmitter.ReceiptStatus_NotProcessed; + if (me._waypointSubmenuVisible) return emesary.Transmitter.ReceiptStatus_NotProcessed; + + if (me._cursorElements[me._selectedElement].isEditable()) { + me._cursorElements[me._selectedElement].keyPress(value); + } + + return emesary.Transmitter.ReceiptStatus_Finished; + }, + # Reset controller if required when the page is displayed or hidden # Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary! diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/IntersectionInfo/IntersectionInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/IntersectionInfo/IntersectionInfoController.nas index fe3de2bad..ac2e746a7 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/IntersectionInfo/IntersectionInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/IntersectionInfo/IntersectionInfoController.nas @@ -132,7 +132,10 @@ var IntersectionInfoController = me._page.dataEntry.unhighlightElement(); return emesary.Transmitter.ReceiptStatus_Finished; }, - + handleKeyInput : func (value) { + me._page.dataEntry.keyPress(value); + return emesary.Transmitter.ReceiptStatus_Finished; + }, # Reset controller if required when the page is displayed or hidden ondisplay : func() { me.RegisterWithEmesary(); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/NDBInfo/NDBInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/NDBInfo/NDBInfoController.nas index a8699f575..b726c45a2 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/NDBInfo/NDBInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/NDBInfo/NDBInfoController.nas @@ -134,7 +134,11 @@ var NDBInfoController = me._page.dataEntry.unhighlightElement(); return emesary.Transmitter.ReceiptStatus_Finished; }, - + handleKeyInput : func (value) { + me._page.dataEntry.keyPress(value); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + # Reset controller if required when the page is displayed or hidden ondisplay : func() { me.RegisterWithEmesary(); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/VORInfo/VORInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/VORInfo/VORInfoController.nas index 3ee89b674..38b677ae1 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/VORInfo/VORInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/VORInfo/VORInfoController.nas @@ -39,6 +39,10 @@ var VORInfoController = } return emesary.Transmitter.ReceiptStatus_Finished; }, + handleKeyInput : func (value) { + me._page.dataEntry.keyPress(value); + return emesary.Transmitter.ReceiptStatus_Finished; + }, handleFMSInner : func(value) { if (me._crsrToggle == 1) { me._page.dataEntry.incrSmall(value); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/WaypointEntry/WaypointEntryController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/WaypointEntry/WaypointEntryController.nas index 9fe6351a5..0dfd8ee0a 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/WaypointEntry/WaypointEntryController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/WaypointEntry/WaypointEntryController.nas @@ -266,6 +266,12 @@ var WaypointEntryController = me.loadDestination(me.page.IDEntry.getValue()); return emesary.Transmitter.ReceiptStatus_Finished; }, + handleKeyInput : func (value) { + if (! me._wpentry_displayed) return emesary.Transmitter.ReceiptStatus_NotProcessed; + if (me._selectedElement == 0) return emesary.Transmitter.ReceiptStatus_NotProcessed; + me._cursorElements[me._selectedElement].keyPress(value); + return emesary.Transmitter.ReceiptStatus_Finished; + }, # Reset controller if required when the page is displayed or hidden # Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary! diff --git a/Nasal/canvas/PFD/DataEntryElement.nas b/Nasal/canvas/PFD/DataEntryElement.nas index 96dee8600..309f7d5af 100644 --- a/Nasal/canvas/PFD/DataEntryElement.nas +++ b/Nasal/canvas/PFD/DataEntryElement.nas @@ -144,11 +144,7 @@ var DataEntryElement = me.highlightElement(); me._dataEntryPos = -1; }, - incrSmall : func(value) { - # Change the value of this element, or start editing it if we're not already - # doing so. - - if (me._dataEntryPos == -1) { + _startEdit: func() { # Start editing by hiding the top level element, and displaying and # resetting the character entry fields. me._dataEntryPos = 0; @@ -162,6 +158,26 @@ var DataEntryElement = # Highlight the first character element to indicate we're editing it me._highlightCharElement(); + }, + keyPress: func(value) { + if (me._dataEntryPos == -1) { + me._startEdit(); + } + var charSym = me._dataEntrySymbol[me._dataEntryPos]; + charSym.setText(value); + + if ( me._dataEntryPos == me._size -1 ) return; + + me._unhighlightCharElement(); + me._dataEntryPos = me._dataEntryPos + 1; + me._highlightCharElement(); + }, + incrSmall : func(value) { + # Change the value of this element, or start editing it if we're not already + # doing so. + + if (me._dataEntryPos == -1) { + me._startEdit(); } else { var charSym = me._dataEntrySymbol[me._dataEntryPos]; var incr_or_decr = (value > 0) ? 1 : -1;