From d0203549e833b32b719697b3a2c2a63e16fcef16 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sun, 10 Dec 2017 22:15:21 +0000 Subject: [PATCH] Add AirportInfo and template pages for FG1000 --- .../FG1000/Models/AirportInfo.svg | 570 ++++++++++++++++++ Aircraft/Instruments-3d/FG1000/Models/MFD.svg | 274 +-------- .../Instruments-3d/FG1000/Models/MFD2.svg | 65 +- .../Instruments-3d/FG1000/Models/NavMap.svg | 102 ++++ .../FG1000/Models/TrafficMap.svg | 264 ++++++++ .../ActiveFlightPlanNarrow.nas | 78 +++ .../ActiveFlightPlanNarrowController.nas | 9 + .../ActiveFlightPlanNarrowOptions.nas | 28 + .../ActiveFlightPlanNarrowStyles.nas | 28 + .../ActiveFlightPlanWide.nas | 78 +++ .../ActiveFlightPlanWideController.nas | 9 + .../ActiveFlightPlanWideOptions.nas | 28 + .../ActiveFlightPlanWideStyles.nas | 28 + .../Nasal/AirportApproach/AirportApproach.nas | 78 +++ .../AirportApproachController.nas | 9 + .../AirportApproachOptions.nas | 28 + .../AirportApproach/AirportApproachStyles.nas | 28 + .../Nasal/AirportArrival/AirportArrival.nas | 78 +++ .../AirportArrivalController.nas | 9 + .../AirportArrival/AirportArrivalOptions.nas | 28 + .../AirportArrival/AirportArrivalStyles.nas | 28 + .../AirportDeparture/AirportDeparture.nas | 78 +++ .../AirportDepartureController.nas | 9 + .../AirportDepartureOptions.nas | 28 + .../AirportDepartureStyles.nas | 28 + .../AirportDirectory/AirportDirectory.nas | 78 +++ .../AirportDirectoryController.nas | 9 + .../AirportDirectoryOptions.nas | 28 + .../AirportDirectoryStyles.nas | 28 + .../FG1000/Nasal/AirportInfo/AirportInfo.nas | 229 +++++++ .../AirportInfo/AirportInfoController.nas | 212 +++++++ .../Nasal/AirportInfo/AirportInfoOptions.nas | 28 + .../Nasal/AirportInfo/AirportInfoStyles.nas | 28 + .../Nasal/AirportWeather/AirportWeather.nas | 78 +++ .../AirportWeatherController.nas | 9 + .../AirportWeather/AirportWeatherOptions.nas | 28 + .../AirportWeather/AirportWeatherStyles.nas | 28 + .../FG1000/Nasal/Checklist1/Checklist1.nas | 78 +++ .../Nasal/Checklist1/Checklist1Controller.nas | 9 + .../Nasal/Checklist1/Checklist1Options.nas | 28 + .../Nasal/Checklist1/Checklist1Styles.nas | 28 + .../FG1000/Nasal/Checklist2/Checklist2.nas | 78 +++ .../Nasal/Checklist2/Checklist2Controller.nas | 9 + .../Nasal/Checklist2/Checklist2Options.nas | 28 + .../Nasal/Checklist2/Checklist2Styles.nas | 28 + .../FG1000/Nasal/Checklist3/Checklist3.nas | 78 +++ .../Nasal/Checklist3/Checklist3Controller.nas | 9 + .../Nasal/Checklist3/Checklist3Options.nas | 28 + .../Nasal/Checklist3/Checklist3Styles.nas | 28 + .../FG1000/Nasal/Checklist4/Checklist4.nas | 78 +++ .../Nasal/Checklist4/Checklist4Controller.nas | 9 + .../Nasal/Checklist4/Checklist4Options.nas | 28 + .../Nasal/Checklist4/Checklist4Styles.nas | 28 + .../FG1000/Nasal/Checklist5/Checklist5.nas | 78 +++ .../Nasal/Checklist5/Checklist5Controller.nas | 9 + .../Nasal/Checklist5/Checklist5Options.nas | 28 + .../Nasal/Checklist5/Checklist5Styles.nas | 28 + .../FlightPlanCatalog/FlightPlanCatalog.nas | 78 +++ .../FlightPlanCatalogController.nas | 9 + .../FlightPlanCatalogOptions.nas | 28 + .../FlightPlanCatalogStyles.nas | 28 + .../FG1000/Nasal/GPSStatus/GPSStatus.nas | 78 +++ .../Nasal/GPSStatus/GPSStatusController.nas | 9 + .../Nasal/GPSStatus/GPSStatusOptions.nas | 28 + .../Nasal/GPSStatus/GPSStatusStyles.nas | 28 + .../IntersectionInfo/IntersectionInfo.nas | 78 +++ .../IntersectionInfoController.nas | 9 + .../IntersectionInfoOptions.nas | 28 + .../IntersectionInfoStyles.nas | 28 + Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas | 145 ++++- .../FG1000/Nasal/NDBInfo/NDBInfo.nas | 78 +++ .../Nasal/NDBInfo/NDBInfoController.nas | 9 + .../FG1000/Nasal/NDBInfo/NDBInfoOptions.nas | 28 + .../FG1000/Nasal/NDBInfo/NDBInfoStyles.nas | 28 + .../FG1000/Nasal/NavMap/NavMap.nas | 13 +- .../FG1000/Nasal/NavMap/NavMapController.nas | 69 ++- .../Nasal/NearestAirports/NearestAirports.nas | 78 +++ .../NearestAirportsController.nas | 9 + .../NearestAirportsOptions.nas | 28 + .../NearestAirports/NearestAirportsStyles.nas | 28 + .../NearestAirspaces/NearestAirspaces.nas | 78 +++ .../NearestAirspacesController.nas | 9 + .../NearestAirspacesOptions.nas | 28 + .../NearestAirspacesStyles.nas | 28 + .../NearestFrequencies/NearestFrequencies.nas | 78 +++ .../NearestFrequenciesController.nas | 9 + .../NearestFrequenciesOptions.nas | 28 + .../NearestFrequenciesStyles.nas | 28 + .../NearestIntersections.nas | 78 +++ .../NearestIntersectionsController.nas | 9 + .../NearestIntersectionsOptions.nas | 28 + .../NearestIntersectionsStyles.nas | 28 + .../FG1000/Nasal/NearestNDB/NearestNDB.nas | 78 +++ .../Nasal/NearestNDB/NearestNDBController.nas | 9 + .../Nasal/NearestNDB/NearestNDBOptions.nas | 28 + .../Nasal/NearestNDB/NearestNDBStyles.nas | 28 + .../Nasal/NearestUserWPT/NearestUserWPT.nas | 78 +++ .../NearestUserWPTController.nas | 9 + .../NearestUserWPT/NearestUserWPTOptions.nas | 28 + .../NearestUserWPT/NearestUserWPTStyles.nas | 28 + .../FG1000/Nasal/NearestVOR/NearestVOR.nas | 78 +++ .../Nasal/NearestVOR/NearestVORController.nas | 9 + .../Nasal/NearestVOR/NearestVOROptions.nas | 28 + .../Nasal/NearestVOR/NearestVORStyles.nas | 28 + .../FG1000/Nasal/PageGroupController.nas | 58 +- .../StoredFlightPlan/StoredFlightPlan.nas | 78 +++ .../StoredFlightPlanController.nas | 9 + .../StoredFlightPlanOptions.nas | 28 + .../StoredFlightPlanStyles.nas | 28 + .../FG1000/Nasal/Stormscope/Stormscope.nas | 78 +++ .../Nasal/Stormscope/StormscopeController.nas | 9 + .../Nasal/Stormscope/StormscopeOptions.nas | 28 + .../Nasal/Stormscope/StormscopeStyles.nas | 28 + .../Nasal/SystemStatus/SystemStatus.nas | 78 +++ .../SystemStatus/SystemStatusController.nas | 9 + .../SystemStatus/SystemStatusOptions.nas | 28 + .../Nasal/SystemStatus/SystemStatusStyles.nas | 28 + .../Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas | 78 +++ .../FG1000/Nasal/TAWS/TAWSController.nas | 9 + .../FG1000/Nasal/TAWS/TAWSOptions.nas | 28 + .../FG1000/Nasal/TAWS/TAWSStyles.nas | 28 + .../FG1000/Nasal/TemplatePage/Controller.nas | 9 + .../FG1000/Nasal/TemplatePage/Options.nas | 28 + .../FG1000/Nasal/TemplatePage/Styles.nas | 28 + .../Nasal/TemplatePage/TemplatePage.nas | 79 +++ .../FG1000/Nasal/TrafficMap/TrafficMap.nas | 11 +- .../Nasal/TrafficMap/TrafficMapController.nas | 82 ++- .../Nasal/TripPlanning/TripPlanning.nas | 78 +++ .../TripPlanning/TripPlanningController.nas | 9 + .../TripPlanning/TripPlanningOptions.nas | 28 + .../Nasal/TripPlanning/TripPlanningStyles.nas | 28 + .../FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas | 78 +++ .../UserWPTInfo/UserWPTInfoController.nas | 9 + .../Nasal/UserWPTInfo/UserWPTInfoOptions.nas | 28 + .../Nasal/UserWPTInfo/UserWPTInfoStyles.nas | 28 + .../FG1000/Nasal/Utility/Utility.nas | 78 +++ .../Nasal/Utility/UtilityController.nas | 9 + .../FG1000/Nasal/Utility/UtilityOptions.nas | 28 + .../FG1000/Nasal/Utility/UtilityStyles.nas | 28 + .../FG1000/Nasal/VORInfo/VORInfo.nas | 78 +++ .../Nasal/VORInfo/VORInfoController.nas | 9 + .../FG1000/Nasal/VORInfo/VORInfoOptions.nas | 28 + .../FG1000/Nasal/VORInfo/VORInfoStyles.nas | 28 + .../Nasal/WeatherDataLink/WeatherDataLink.nas | 78 +++ .../WeatherDataLinkController.nas | 9 + .../WeatherDataLinkOptions.nas | 28 + .../WeatherDataLink/WeatherDataLinkStyles.nas | 28 + .../FG1000/Nasal/XMInfo/XMInfo.nas | 78 +++ .../FG1000/Nasal/XMInfo/XMInfoController.nas | 9 + .../FG1000/Nasal/XMInfo/XMInfoOptions.nas | 28 + .../FG1000/Nasal/XMInfo/XMInfoStyles.nas | 28 + .../FG1000/Nasal/XMRadio/XMRadio.nas | 78 +++ .../Nasal/XMRadio/XMRadioController.nas | 9 + .../FG1000/Nasal/XMRadio/XMRadioOptions.nas | 28 + .../FG1000/Nasal/XMRadio/XMRadioStyles.nas | 28 + .../Instruments-3d/FG1000/Nasal/createpgs.pl | 57 ++ gui/dialogs/fg1000.xml | 12 + 157 files changed, 6853 insertions(+), 372 deletions(-) create mode 100644 Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg create mode 100644 Aircraft/Instruments-3d/FG1000/Models/NavMap.svg create mode 100644 Aircraft/Instruments-3d/FG1000/Models/TrafficMap.svg create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOROptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Options.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Styles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioOptions.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioStyles.nas create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl diff --git a/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg b/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg new file mode 100644 index 000000000..4b1232c3d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Models/AirportInfo.svg @@ -0,0 +1,570 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + AIRPORT + + RUNWAYS + + FREQUENCIES + KSFO + SAN FRANCISCO INTERNATIONAL + CITY + PUBLIC + REGION + N 39002 + W 994499 + 2000ft + AVGAS + UTC-6 + 17-35 + 5000FT x 75FT + HARD SURFACE + PCL FREQUENCY - 122.90 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + TOWER + 119.875 + + NORTH UP + + + + 2nm + + + diff --git a/Aircraft/Instruments-3d/FG1000/Models/MFD.svg b/Aircraft/Instruments-3d/FG1000/Models/MFD.svg index b2660a6ae..e28469a7a 100644 --- a/Aircraft/Instruments-3d/FG1000/Models/MFD.svg +++ b/Aircraft/Instruments-3d/FG1000/Models/MFD.svg @@ -23,11 +23,11 @@ borderopacity="0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.8284271" - inkscape:cx="682.99213" - inkscape:cy="387.36197" + inkscape:zoom="0.70710678" + inkscape:cx="558.90157" + inkscape:cy="71.595861" inkscape:document-units="px" - inkscape:current-layer="TrafficMapGroup" + inkscape:current-layer="layer2" showgrid="true" inkscape:window-width="2495" inkscape:window-height="1416" @@ -150,6 +150,18 @@ d="m 760.00391,55.494139 0,-55.49413968969723 0,0" id="path4085" inkscape:connector-curvature="0" /> + PAGE TITLE SoftKey0 - - - - - Zoom nm - - - - - - OPERATING - OPERATING - - UNRESTRICTED - - - - - - 8NM - - - - - - - - - - - - 8NM - - + style="display:inline"> + style="display:inline"> + PAGE TITLE + style="display:inline" + sodipodi:insensitive="true"> @@ -1032,18 +1043,18 @@ id="tspan5673" x="225.26074" y="97.84375">UNRESTRICTED - - + + inkscape:connector-curvature="0" + sodipodi:nodetypes="sssss" /> - - + + d="m 687.35117,398 c -0.64564,62.68991 -50.82291,113.51615 -113.51615,113.51614 -62.69323,0 -113.51614,-50.82291 -113.51614,-113.51614 0,-62.69323 50.82291,-113.51614 113.51614,-113.51614 C 636.52826,284.48385 688,335 687.35117,398 Z" + id="circle5714" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sssss" /> + + + + + + + + + + + image/svg+xml + + + + + + + + + + Zoom nm + + + diff --git a/Aircraft/Instruments-3d/FG1000/Models/TrafficMap.svg b/Aircraft/Instruments-3d/FG1000/Models/TrafficMap.svg new file mode 100644 index 000000000..150d2e411 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Models/TrafficMap.svg @@ -0,0 +1,264 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + OPERATING + OPERATING + + UNRESTRICTED + + + + + + 8NM + + + + + + + + + + + + 8NM + + + diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas new file mode 100644 index 000000000..9daf521b3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas @@ -0,0 +1,78 @@ +# ActiveFlightPlanNarrow +var ActiveFlightPlanNarrow = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "FPL - ACTIVE FLIGHT PLAN", + _group : myCanvas.createGroup("ActiveFlightPlanNarrowLayer"), + parents : [ NavMap, device.addPage("ActiveFlightPlanNarrow", "ActiveFlightPlanNarrowGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.ActiveFlightPlanNarrowStyles.new(); + obj.Options = fg1000.ActiveFlightPlanNarrowOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.ActiveFlightPlanNarrowController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas new file mode 100644 index 000000000..d9d991b80 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas @@ -0,0 +1,9 @@ +# ActiveFlightPlanNarrow Controller +var ActiveFlightPlanNarrowController = +{ + new : func (page, svg) + { + var obj = { parents : [ ActiveFlightPlanNarrowController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowOptions.nas new file mode 100644 index 000000000..d6a1d588d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowOptions.nas @@ -0,0 +1,28 @@ +# ActiveFlightPlanNarrow Options +var ActiveFlightPlanNarrowOptions = +{ + new : func() { + var obj = { parents : [ActiveFlightPlanNarrowOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowStyles.nas new file mode 100644 index 000000000..ff20bc58a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowStyles.nas @@ -0,0 +1,28 @@ +# ActiveFlightPlanNarrow Styles +var ActiveFlightPlanNarrowStyles = +{ + new : func() { + var obj = { parents : [ ActiveFlightPlanNarrowStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas new file mode 100644 index 000000000..363020b98 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas @@ -0,0 +1,78 @@ +# ActiveFlightPlanWide +var ActiveFlightPlanWide = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "FPL - ACTIVE FLIGHT PLAN", + _group : myCanvas.createGroup("ActiveFlightPlanWideLayer"), + parents : [ NavMap, device.addPage("ActiveFlightPlanWide", "ActiveFlightPlanWideGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.ActiveFlightPlanWideStyles.new(); + obj.Options = fg1000.ActiveFlightPlanWideOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.ActiveFlightPlanWideController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas new file mode 100644 index 000000000..69be6527f --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas @@ -0,0 +1,9 @@ +# ActiveFlightPlanWide Controller +var ActiveFlightPlanWideController = +{ + new : func (page, svg) + { + var obj = { parents : [ ActiveFlightPlanWideController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideOptions.nas new file mode 100644 index 000000000..fe404ef3b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideOptions.nas @@ -0,0 +1,28 @@ +# ActiveFlightPlanWide Options +var ActiveFlightPlanWideOptions = +{ + new : func() { + var obj = { parents : [ActiveFlightPlanWideOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideStyles.nas new file mode 100644 index 000000000..8ade8b736 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideStyles.nas @@ -0,0 +1,28 @@ +# ActiveFlightPlanWide Styles +var ActiveFlightPlanWideStyles = +{ + new : func() { + var obj = { parents : [ ActiveFlightPlanWideStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas new file mode 100644 index 000000000..1ab860d98 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas @@ -0,0 +1,78 @@ +# AirportApproach +var AirportApproach = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - AIRPORT APPROACH INFORMATION", + _group : myCanvas.createGroup("AirportApproachLayer"), + parents : [ NavMap, device.addPage("AirportApproach", "AirportApproachGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportApproachStyles.new(); + obj.Options = fg1000.AirportApproachOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.AirportApproachController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas new file mode 100644 index 000000000..89fd7a273 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas @@ -0,0 +1,9 @@ +# AirportApproach Controller +var AirportApproachController = +{ + new : func (page, svg) + { + var obj = { parents : [ AirportApproachController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachOptions.nas new file mode 100644 index 000000000..5fdf3e98b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachOptions.nas @@ -0,0 +1,28 @@ +# AirportApproach Options +var AirportApproachOptions = +{ + new : func() { + var obj = { parents : [AirportApproachOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachStyles.nas new file mode 100644 index 000000000..db67a195c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachStyles.nas @@ -0,0 +1,28 @@ +# AirportApproach Styles +var AirportApproachStyles = +{ + new : func() { + var obj = { parents : [ AirportApproachStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas new file mode 100644 index 000000000..ce905c057 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas @@ -0,0 +1,78 @@ +# AirportArrival +var AirportArrival = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - AIRPORT ARRIVAL INFORMATION", + _group : myCanvas.createGroup("AirportArrivalLayer"), + parents : [ NavMap, device.addPage("AirportArrival", "AirportArrivalGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportArrivalStyles.new(); + obj.Options = fg1000.AirportArrivalOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.AirportArrivalController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas new file mode 100644 index 000000000..734c6ca85 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas @@ -0,0 +1,9 @@ +# AirportArrival Controller +var AirportArrivalController = +{ + new : func (page, svg) + { + var obj = { parents : [ AirportArrivalController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalOptions.nas new file mode 100644 index 000000000..8fc0d5e2b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalOptions.nas @@ -0,0 +1,28 @@ +# AirportArrival Options +var AirportArrivalOptions = +{ + new : func() { + var obj = { parents : [AirportArrivalOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalStyles.nas new file mode 100644 index 000000000..020660c9d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalStyles.nas @@ -0,0 +1,28 @@ +# AirportArrival Styles +var AirportArrivalStyles = +{ + new : func() { + var obj = { parents : [ AirportArrivalStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas new file mode 100644 index 000000000..327a145bf --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas @@ -0,0 +1,78 @@ +# AirportDeparture +var AirportDeparture = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - AIRPORT DEPARTURE INFORMATION", + _group : myCanvas.createGroup("AirportDepartureLayer"), + parents : [ NavMap, device.addPage("AirportDeparture", "AirportDepartureGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportDepartureStyles.new(); + obj.Options = fg1000.AirportDepartureOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.AirportDepartureController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas new file mode 100644 index 000000000..6a249fe8a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas @@ -0,0 +1,9 @@ +# AirportDeparture Controller +var AirportDepartureController = +{ + new : func (page, svg) + { + var obj = { parents : [ AirportDepartureController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureOptions.nas new file mode 100644 index 000000000..57fb3be13 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureOptions.nas @@ -0,0 +1,28 @@ +# AirportDeparture Options +var AirportDepartureOptions = +{ + new : func() { + var obj = { parents : [AirportDepartureOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureStyles.nas new file mode 100644 index 000000000..bb12f31c9 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureStyles.nas @@ -0,0 +1,28 @@ +# AirportDeparture Styles +var AirportDepartureStyles = +{ + new : func() { + var obj = { parents : [ AirportDepartureStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas new file mode 100644 index 000000000..1b47d8f04 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas @@ -0,0 +1,78 @@ +# AirportDirectory +var AirportDirectory = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - AIRPORT DIRECTORY", + _group : myCanvas.createGroup("AirportDirectoryLayer"), + parents : [ NavMap, device.addPage("AirportDirectory", "AirportDirectoryGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportDirectoryStyles.new(); + obj.Options = fg1000.AirportDirectoryOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.AirportDirectoryController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas new file mode 100644 index 000000000..ee28f4935 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas @@ -0,0 +1,9 @@ +# AirportDirectory Controller +var AirportDirectoryController = +{ + new : func (page, svg) + { + var obj = { parents : [ AirportDirectoryController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryOptions.nas new file mode 100644 index 000000000..3105924d8 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryOptions.nas @@ -0,0 +1,28 @@ +# AirportDirectory Options +var AirportDirectoryOptions = +{ + new : func() { + var obj = { parents : [AirportDirectoryOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryStyles.nas new file mode 100644 index 000000000..43d404589 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryStyles.nas @@ -0,0 +1,28 @@ +# AirportDirectory Styles +var AirportDirectoryStyles = +{ + new : func() { + var obj = { parents : [ AirportDirectoryStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas new file mode 100644 index 000000000..4afc03b03 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas @@ -0,0 +1,229 @@ +# AirportInfo +var AirportInfo = +{ + SURFACE_TYPES : { + 1 : "HARD SURFACE", # Asphalt + 2 : "HARD SURFACE", # Concrete + 3 : "TURF", + 4 : "DIRT", + 5 : "GRAVEL", + # Helipads + 6 : "HARD SURFACE", # Asphalt + 7 : "HARD SURFACE", # Concrete + 8 : "TURF", + 9 : "DIRT", + 0 : "GRAVEL", + }, + + + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - AIRPORT INFORMATION", + _group : myCanvas.createGroup("AirportInfoLayer"), + parents : [ AirportInfo, device.addPage("AirportInfo", "AirportInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportInfoStyles.new(); + obj.Options = fg1000.AirportInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + # Need to display this underneath the softkeys, EIS, header. + obj._group.set("z-index", -10.0); + obj._group.setVisible(0); + + # Dynamic text elements in the SVG file. In the SVG these have an "AirportInfo" prefix. + var textelements = [ + "ID", + "Usage", + "Name", + "City", + "Region", + "Alt", + "Lat", + "Lon", + "Fuel", + "TZ", + "Runway", + "RwyDimensions", + "RwySurface", + "RwyLighting", + "FreqLabel1", "Freq1", + "FreqLabel2", "Freq2", + "FreqLabel3", "Freq3", + "FreqLabel4", "Freq4", + "FreqLabel5", "Freq5", + "FreqLabel6", "Freq6", + "FreqLabel7", "Freq7", + "FreqLabel8", "Freq8", + "Zoom" + ]; + + foreach (var element; textelements) { + obj.symbols[element] = svg.getElementById("AirportInfo" ~ element); + obj.symbols[element].setText(""); + } + + # The Airport Chart + obj.AirportChart = obj._group.createChild("map"); + obj.AirportChart.setController("Static position", "main"); + var controller = obj.AirportChart.getController(); + + # Initialize a range and screen resolution. Setting a range + # to 4nm means we pick up a good set of surrounding fixes + # We will use the screen range for zooming. If we use range + # then as we zoom in the airport center goes out of range + # and all the runways disappear. + obj.AirportChart.setRange(4.0); + obj.AirportChart.setScreenRange(fg1000.MAP_PARTIAL.HEIGHT); + obj.AirportChart.setTranslation( + fg1000.MAP_PARTIAL.CENTER.X, + fg1000.MAP_PARTIAL.CENTER.Y + ); + + var r = func(name,vis=1,zindex=nil) return caller(0)[0]; + foreach(var type; [r('TAXI'),r('RWY')] ) { + obj.AirportChart.addLayer(canvas.SymbolLayer, + type.name, + 4, + obj.Styles.getStyle(type.name), + obj.Options.getOption(type.name), + type.vis ); + } + + + obj.controller = fg1000.AirportInfoController.new(obj, svg); + + # Softkey menus + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + me.controller.offdisplay(); + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + me.controller.ondisplay(); + }, + displayAirport : func(apt_info) { + # Display a given airport + me.AirportChart.getController().setPosition(apt_info.lat,apt_info.lon); + me.symbols["ID"].setText(apt_info.id); + me.symbols["Usage"].setText("PUBLIC"); + me.symbols["Name"].setText(string.uc(apt_info.name)); + me.symbols["City"].setText("CITY"); + me.symbols["Region"].setText("REGION"); + me.symbols["Alt"].setText(sprintf("%ift", 3.28 * apt_info.elevation)); + + if (apt_info.lat < 0.0) { + me.symbols["Lat"].setText(sprintf("S %.4f", -apt_info.lat)); + } else { + me.symbols["Lat"].setText(sprintf("N %.4f", apt_info.lat)); + } + + if (apt_info.lon < 0.0) { + me.symbols["Lon"].setText(sprintf("W%3.4f", -apt_info.lon)); + } else { + me.symbols["Lon"].setText(sprintf("E%3.4f", apt_info.lon)); + } + + me.symbols["Fuel"].setText("AVGAS"); + me.symbols["TZ"].setText("UTC-6"); + + # Display the comms frequencies for this airport + var fcount = 1; + + if (size(apt_info.comms()) > 0) { + # Airport has one or more frequencies assigned to it. + var freqs = {}; + var comms = apt_info.comms(); + + foreach (var c; comms) { + freqs[c.ident] = sprintf("%.3f", c.frequency);; + } + + foreach (var c; sort(keys(freqs), string.icmp)) { + me.symbols["FreqLabel" ~ fcount].setText(c); + me.symbols["Freq" ~ fcount].setText(freqs[c]); + fcount += 1; + } + } + + while (fcount < 9) { + # zero remaining comms channels + me.symbols["FreqLabel" ~ fcount].setText(""); + me.symbols["Freq" ~ fcount].setText(""); + fcount += 1; + } + }, + displayRunway : func(rwy_info) { + var lbl = rwy_info.id ~ "-" ~ rwy_info.reciprocal.id; + me.symbols["Runway"].setText(lbl); + + var dim = sprintf("%ift x %ift", 3.28 * rwy_info.length, 3.28 * rwy_info.width); + me.symbols["RwyDimensions"].setText(dim); + + me.symbols["RwySurface"].setText(me.SURFACE_TYPES[rwy_info.surface]); + #me.symbols["RwyLighting"].setText(rwy_info.surface); + }, + setZoom : func(zoom, label) { + # Set the zoom level for the airport chart display + me.AirportChart.setScreenRange(zoom); + me.symbols["Zoom"].setText(label); + }, + highlightElement : func(element) { + var sym = me.symbols[element]; + sym.setDrawMode(canvas.Text.TEXT + canvas.Text.FILLEDBOUNDINGBOX); + sym.setColorFill(fg1000.HIGHLIGHT_COLOR); + sym.setColor(fg1000.HIGHLIGHT_TEXT_COLOR); + }, + unhighlightElement : func(element) { + var sym = me.symbols[element]; + sym.setDrawMode(canvas.Text.TEXT); + sym.setColor(fg1000.NORMAL_TEXT_COLOR); + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas new file mode 100644 index 000000000..726026584 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas @@ -0,0 +1,212 @@ +# AirportInfo Controller +var AirportInfoController = +{ + # Vertical ranges, and labels. + # Unlike some other map displays, we keep the range constant at 4nm an change + # the ScreenRange to zoom in. Otherwise as we zoom in, the center of the + # runways moves out of the range of the display and they are not drawn. + # Ranges are scaled to the display height with range 1 displaying 4nm vertically. + # 2000nm = 12,152,000ft. + RANGES : [{range: 4/500/6076.12, label: "500ft"}, + {range: 4/750/6076.12, label: "750ft"}, + {range: 4/1000/6076.12, label: "1000ft"}, + {range: 4/1500/6076.12, label: "1500ft"}, + {range: 4/2000/6076.12, label: "2000ft"}, + {range: 8, label: "0.5nm"}, + {range: 5.33, label: "0.75nm"}, + {range: 4, label: "1nm"}, + {range: 2, label: "2nm"}, + {range: 1.33, label: "3nm"}, + {range: 1, label: "4nm"}, + {range: 0.66, label: "6nm"}, + {range: 0.5, label: "8nm"}, + {range: 0.4, label: "10nm"} ], + + CRSR_ELEMENTS : [ + "ID", + "Name", + "Runway", + "Freq1", + "Freq2", + "Freq3", + "Freq4", + "Freq5", + "Freq6", + "Freq7", + "Freq8", + ], + + new : func (page, svg) + { + var obj = { parents : [ AirportInfoController ] }; + obj.airport = ""; + obj.runway = ""; + obj.runway_index = -1; + obj.info = nil; + obj.page = page; + obj.crsr_toggle = 0; + obj.crsrIdx = 0; + obj.current_zoom = 7; + obj.current_id_entry = ""; + + + # Emesary + obj._recipient = nil; + + # Initial airport is our current location. + var current_apt = airportinfo("airport"); + obj.setAirport(current_apt.id); + obj.setZoom(7); + + return obj; + }, + setAirport : func(id) + { + if (id == me.airport) return; + me.airport = id; + me.info= airportinfo(id); + me.page.displayAirport(me.info); + + # Display the first runway. + me.setRunway(0); + }, + setRunway : func(runway_index) + { + if (runway_index == me.runway_index) return; + var rwys = keys(me.info.runways); + if (runway_index < 0) runway_index = 0; + if (runway_index > (size(rwys) - 1)) runway_index = size(rwys) - 1; + me.runway_index = runway_index; + me.page.displayRunway(me.info.runways[rwys[runway_index]]); + }, + incrRunway : func(value) + { + var incr_or_decr = (value > 0) ? 1 : -1; + me.setRunway(me.runway_index + incr_or_decr); + }, + + # Control functions for Input + incrAirportID : func(value) + { + var incr_or_decr = (value > 0) ? 1 : -1; + if (me.current_id_entry == "") { + me.current_id_entry = "A"; + } else { + var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + var fixed = substr(me.current_id_entry, 0, size(current_id_entry) - 2); + var lastchar = substr(me.current_id_entry, -1); + var char = math.mod(find(lastchar, alphabet) + incr_or_decr, 26); + var nextchar = substr(alphabet, char, 1); + me.current_id_entry = fixed + nextchar; + } + }, + + + zoomIn : func() { + me.setZoom(me.current_zoom -1); + }, + zoomOut : func() { + me.setZoom(me.current_zoom +1); + }, + zoom : func(val) + { + var incr_or_decr = (val > 0) ? 1 : -1; + me.setZoom(me.current_zoom + incr_or_decr); + }, + setZoom : func(zoom) { + if ((zoom < 0) or (zoom > (size(me.RANGES) - 1))) return; + me.current_zoom = zoom; + me.page.setZoom(me.RANGES[zoom].range * fg1000.MAP_PARTIAL.HEIGHT, me.RANGES[zoom].label); + }, + showCRSR : func() { + me.page.highlightElement(me.CRSR_ELEMENTS[me.crsrIdx]); + }, + hideCRSR : func() { + me.page.unhighlightElement(me.CRSR_ELEMENTS[me.crsrIdx]); + me.crsrIdx = 0; + }, + moveCRSR : func(val) { + var incr_or_decr = (val > 0) ? 1 : -1; + + me.page.unhighlightElement(me.CRSR_ELEMENTS[me.crsrIdx]); + me.crsrIdx = math.mod(me.crsrIdx + incr_or_decr, size(me.CRSR_ELEMENTS) -1); + me.page.highlightElement(me.CRSR_ELEMENTS[me.crsrIdx]); + }, + handleCRSR : func() { + me.crsr_toggle = (! me.crsr_toggle); + print("CRSR pressed " ~ me.crsr_toggle); + if (me.crsr_toggle) { + me.showCRSR(); + } else { + me.hideCRSR(); + } + return emesary.Transmitter.ReceiptStatus_Finished; + }, + handleFMSInner : func(value) { + if (me.crsr_toggle == 1) { + print("FMSInner for AirportInfoController called " ~ me.crsr_toggle); + if (me.CRSR_ELEMENTS[me.crsrIdx] == "Runway") { + me.incrRunway(value); + } + if (me.CRSR_ELEMENTS[me.crsrIdx] == "ID") { + me.incrAirportID(value); + } + return emesary.Transmitter.ReceiptStatus_Finished; + } else { + return me.page.mfd._pageGroupController.handleFMSInner(value); + } + }, + handleFMSOuter : func(value) { + if (me.crsr_toggle == 1) { + print("FMSOuter for AirportInfoController called " ~ me.crsr_toggle); + me.moveCRSR(value); + return emesary.Transmitter.ReceiptStatus_Finished; + } else { + return me.page.mfd._pageGroupController.handleFMSOuter(value); + } + }, + RegisterWithEmesary : func(transmitter = nil){ + if (transmitter == nil) + transmitter = emesary.GlobalTransmitter; + + if (me._recipient == nil){ + me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me.page.device.designation); + var pfd_obj = me.page.device; + var controller = me; + me._recipient.Receive = func(notification) + { + if (notification.Device_Id == pfd_obj.device_id + and notification.NotificationType == notifications.PFDEventNotification.DefaultType) { + if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed + and notification.EventParameter != nil) + { + var id = notification.EventParameter.Id; + var value = notification.EventParameter.Value; + #printf("Button pressed " ~ id ~ " " ~ value); + if (id == fg1000.MFD.FASCIA.FMS_CRSR) return controller.handleCRSR(); + if (id == fg1000.MFD.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); + if (id == fg1000.MFD.FASCIA.FMS_INNER) return controller.handleFMSInner(value); + if (id == fg1000.MFD.FASCIA.RANGE) return controller.zoom(value); + } + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + } + transmitter.Register(me._recipient); + me.transmitter = transmitter; + }, + DeRegisterWithEmesary : func(transmitter = nil){ + # remove registration from transmitter; but keep the recipient once it is created. + if (me.transmitter != nil) + me.transmitter.DeRegister(me._recipient); + me.transmitter = nil; + }, + + # Reset controller if required when the page is displayed or hidden + ondisplay : func() { + me.RegisterWithEmesary(); + }, + offdisplay : func() { + me.DeRegisterWithEmesary(); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoOptions.nas new file mode 100644 index 000000000..fc4c6cf8c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoOptions.nas @@ -0,0 +1,28 @@ +# AirportInfo Options +var AirportInfoOptions = +{ + new : func() { + var obj = { parents : [AirportInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoStyles.nas new file mode 100644 index 000000000..e55783c3b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoStyles.nas @@ -0,0 +1,28 @@ +# AirportInfo Styles +var AirportInfoStyles = +{ + new : func() { + var obj = { parents : [ AirportInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas new file mode 100644 index 000000000..bac4635dc --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas @@ -0,0 +1,78 @@ +# AirportWeather +var AirportWeather = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - WEATHER INFORMATION", + _group : myCanvas.createGroup("AirportWeatherLayer"), + parents : [ NavMap, device.addPage("AirportWeather", "AirportWeatherGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.AirportWeatherStyles.new(); + obj.Options = fg1000.AirportWeatherOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.AirportWeatherController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas new file mode 100644 index 000000000..34f8064c7 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas @@ -0,0 +1,9 @@ +# AirportWeather Controller +var AirportWeatherController = +{ + new : func (page, svg) + { + var obj = { parents : [ AirportWeatherController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherOptions.nas new file mode 100644 index 000000000..608ff0abd --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherOptions.nas @@ -0,0 +1,28 @@ +# AirportWeather Options +var AirportWeatherOptions = +{ + new : func() { + var obj = { parents : [AirportWeatherOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherStyles.nas new file mode 100644 index 000000000..1d54a1e2b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherStyles.nas @@ -0,0 +1,28 @@ +# AirportWeather Styles +var AirportWeatherStyles = +{ + new : func() { + var obj = { parents : [ AirportWeatherStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas new file mode 100644 index 000000000..6bb899fbd --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas @@ -0,0 +1,78 @@ +# Checklist1 +var Checklist1 = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "LST - CHECKLIST 1", + _group : myCanvas.createGroup("Checklist1Layer"), + parents : [ NavMap, device.addPage("Checklist1", "Checklist1Group") ], + symbols : {}, + }; + + obj.Styles = fg1000.Checklist1Styles.new(); + obj.Options = fg1000.Checklist1Options.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.Checklist1Controller.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas new file mode 100644 index 000000000..689af50f3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas @@ -0,0 +1,9 @@ +# Checklist1 Controller +var Checklist1Controller = +{ + new : func (page, svg) + { + var obj = { parents : [ Checklist1Controller ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Options.nas new file mode 100644 index 000000000..31abd5813 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Options.nas @@ -0,0 +1,28 @@ +# Checklist1 Options +var Checklist1Options = +{ + new : func() { + var obj = { parents : [Checklist1Options] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Styles.nas new file mode 100644 index 000000000..88d5d356f --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Styles.nas @@ -0,0 +1,28 @@ +# Checklist1 Styles +var Checklist1Styles = +{ + new : func() { + var obj = { parents : [ Checklist1Styles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas new file mode 100644 index 000000000..11a8a99de --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas @@ -0,0 +1,78 @@ +# Checklist2 +var Checklist2 = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "LST - CHECKLIST 2", + _group : myCanvas.createGroup("Checklist2Layer"), + parents : [ NavMap, device.addPage("Checklist2", "Checklist2Group") ], + symbols : {}, + }; + + obj.Styles = fg1000.Checklist2Styles.new(); + obj.Options = fg1000.Checklist2Options.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.Checklist2Controller.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas new file mode 100644 index 000000000..d12198607 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas @@ -0,0 +1,9 @@ +# Checklist2 Controller +var Checklist2Controller = +{ + new : func (page, svg) + { + var obj = { parents : [ Checklist2Controller ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Options.nas new file mode 100644 index 000000000..33e566035 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Options.nas @@ -0,0 +1,28 @@ +# Checklist2 Options +var Checklist2Options = +{ + new : func() { + var obj = { parents : [Checklist2Options] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Styles.nas new file mode 100644 index 000000000..135492481 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Styles.nas @@ -0,0 +1,28 @@ +# Checklist2 Styles +var Checklist2Styles = +{ + new : func() { + var obj = { parents : [ Checklist2Styles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas new file mode 100644 index 000000000..c8ceb6642 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas @@ -0,0 +1,78 @@ +# Checklist3 +var Checklist3 = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "LST - CHECKLIST 3", + _group : myCanvas.createGroup("Checklist3Layer"), + parents : [ NavMap, device.addPage("Checklist3", "Checklist3Group") ], + symbols : {}, + }; + + obj.Styles = fg1000.Checklist3Styles.new(); + obj.Options = fg1000.Checklist3Options.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.Checklist3Controller.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas new file mode 100644 index 000000000..51058021e --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas @@ -0,0 +1,9 @@ +# Checklist3 Controller +var Checklist3Controller = +{ + new : func (page, svg) + { + var obj = { parents : [ Checklist3Controller ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Options.nas new file mode 100644 index 000000000..f9baebcfc --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Options.nas @@ -0,0 +1,28 @@ +# Checklist3 Options +var Checklist3Options = +{ + new : func() { + var obj = { parents : [Checklist3Options] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Styles.nas new file mode 100644 index 000000000..30433ff48 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Styles.nas @@ -0,0 +1,28 @@ +# Checklist3 Styles +var Checklist3Styles = +{ + new : func() { + var obj = { parents : [ Checklist3Styles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas new file mode 100644 index 000000000..47b91a160 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas @@ -0,0 +1,78 @@ +# Checklist4 +var Checklist4 = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "LST - CHECKLIST 4", + _group : myCanvas.createGroup("Checklist4Layer"), + parents : [ NavMap, device.addPage("Checklist4", "Checklist4Group") ], + symbols : {}, + }; + + obj.Styles = fg1000.Checklist4Styles.new(); + obj.Options = fg1000.Checklist4Options.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.Checklist4Controller.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas new file mode 100644 index 000000000..1eb3fc358 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas @@ -0,0 +1,9 @@ +# Checklist4 Controller +var Checklist4Controller = +{ + new : func (page, svg) + { + var obj = { parents : [ Checklist4Controller ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Options.nas new file mode 100644 index 000000000..b9cff10b7 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Options.nas @@ -0,0 +1,28 @@ +# Checklist4 Options +var Checklist4Options = +{ + new : func() { + var obj = { parents : [Checklist4Options] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Styles.nas new file mode 100644 index 000000000..626a65805 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Styles.nas @@ -0,0 +1,28 @@ +# Checklist4 Styles +var Checklist4Styles = +{ + new : func() { + var obj = { parents : [ Checklist4Styles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas new file mode 100644 index 000000000..d3579dce5 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas @@ -0,0 +1,78 @@ +# Checklist5 +var Checklist5 = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "LST - CHECKLIST 5", + _group : myCanvas.createGroup("Checklist5Layer"), + parents : [ NavMap, device.addPage("Checklist5", "Checklist5Group") ], + symbols : {}, + }; + + obj.Styles = fg1000.Checklist5Styles.new(); + obj.Options = fg1000.Checklist5Options.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.Checklist5Controller.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas new file mode 100644 index 000000000..21686874c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas @@ -0,0 +1,9 @@ +# Checklist5 Controller +var Checklist5Controller = +{ + new : func (page, svg) + { + var obj = { parents : [ Checklist5Controller ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Options.nas new file mode 100644 index 000000000..057344c17 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Options.nas @@ -0,0 +1,28 @@ +# Checklist5 Options +var Checklist5Options = +{ + new : func() { + var obj = { parents : [Checklist5Options] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Styles.nas new file mode 100644 index 000000000..a5cdd2850 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Styles.nas @@ -0,0 +1,28 @@ +# Checklist5 Styles +var Checklist5Styles = +{ + new : func() { + var obj = { parents : [ Checklist5Styles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas new file mode 100644 index 000000000..5dafc933a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas @@ -0,0 +1,78 @@ +# FlightPlanCatalog +var FlightPlanCatalog = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "FPL - FLIGHT PLAN CATALOG", + _group : myCanvas.createGroup("FlightPlanCatalogLayer"), + parents : [ NavMap, device.addPage("FlightPlanCatalog", "FlightPlanCatalogGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.FlightPlanCatalogStyles.new(); + obj.Options = fg1000.FlightPlanCatalogOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.FlightPlanCatalogController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas new file mode 100644 index 000000000..1d22d9b64 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas @@ -0,0 +1,9 @@ +# FlightPlanCatalog Controller +var FlightPlanCatalogController = +{ + new : func (page, svg) + { + var obj = { parents : [ FlightPlanCatalogController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogOptions.nas new file mode 100644 index 000000000..aa51f5c3c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogOptions.nas @@ -0,0 +1,28 @@ +# FlightPlanCatalog Options +var FlightPlanCatalogOptions = +{ + new : func() { + var obj = { parents : [FlightPlanCatalogOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogStyles.nas new file mode 100644 index 000000000..c64177d8e --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogStyles.nas @@ -0,0 +1,28 @@ +# FlightPlanCatalog Styles +var FlightPlanCatalogStyles = +{ + new : func() { + var obj = { parents : [ FlightPlanCatalogStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas new file mode 100644 index 000000000..59d8d788f --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas @@ -0,0 +1,78 @@ +# GPSStatus +var GPSStatus = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - GPS STATUS", + _group : myCanvas.createGroup("GPSStatusLayer"), + parents : [ NavMap, device.addPage("GPSStatus", "GPSStatusGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.GPSStatusStyles.new(); + obj.Options = fg1000.GPSStatusOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.GPSStatusController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas new file mode 100644 index 000000000..252c3b059 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas @@ -0,0 +1,9 @@ +# GPSStatus Controller +var GPSStatusController = +{ + new : func (page, svg) + { + var obj = { parents : [ GPSStatusController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusOptions.nas new file mode 100644 index 000000000..cf28937ea --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusOptions.nas @@ -0,0 +1,28 @@ +# GPSStatus Options +var GPSStatusOptions = +{ + new : func() { + var obj = { parents : [GPSStatusOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusStyles.nas new file mode 100644 index 000000000..6c380e0c1 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusStyles.nas @@ -0,0 +1,28 @@ +# GPSStatus Styles +var GPSStatusStyles = +{ + new : func() { + var obj = { parents : [ GPSStatusStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas new file mode 100644 index 000000000..825d023e0 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas @@ -0,0 +1,78 @@ +# IntersectionInfo +var IntersectionInfo = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - INTERSECTION INFORMATION", + _group : myCanvas.createGroup("IntersectionInfoLayer"), + parents : [ NavMap, device.addPage("IntersectionInfo", "IntersectionInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.IntersectionInfoStyles.new(); + obj.Options = fg1000.IntersectionInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.IntersectionInfoController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas new file mode 100644 index 000000000..6046bc92b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas @@ -0,0 +1,9 @@ +# IntersectionInfo Controller +var IntersectionInfoController = +{ + new : func (page, svg) + { + var obj = { parents : [ IntersectionInfoController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoOptions.nas new file mode 100644 index 000000000..9ad7e8069 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoOptions.nas @@ -0,0 +1,28 @@ +# IntersectionInfo Options +var IntersectionInfoOptions = +{ + new : func() { + var obj = { parents : [IntersectionInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoStyles.nas new file mode 100644 index 000000000..5972d5035 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoStyles.nas @@ -0,0 +1,28 @@ +# IntersectionInfo Styles +var IntersectionInfoStyles = +{ + new : func() { + var obj = { parents : [ IntersectionInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas index 3d7141927..986cdd03c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas @@ -1,48 +1,143 @@ # FG1000 MFD var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/"; -io.load_nasal(nasal_dir ~ 'NavMap/NavMap.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'NavMap/NavMapStyles.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'NavMap/NavMapOptions.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'NavMap/NavMapController.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'TrafficMap/TrafficMap.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'TrafficMap/TrafficMapStyles.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'TrafficMap/TrafficMapOptions.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'TrafficMap/TrafficMapController.nas', "fg1000"); +var MFDPages = [ + "NavMap", + "TrafficMap", + "Stormscope", + "WeatherDataLink", + "TAWS", + "AirportInfo", + "AirportDirectory", + "AirportDeparture", + "AirportArrival", + "AirportApproach", + "AirportWeather", + "IntersectionInfo", + "NDBInfo", + "VORInfo", + "UserWPTInfo", + "TripPlanning", + "Utility", + "GPSStatus", + "XMRadio", + "XMInfo", + "SystemStatus", + "ActiveFlightPlanWide", + "ActiveFlightPlanNarrow", + "FlightPlanCatalog", + "StoredFlightPlan", + "Checklist1", + "Checklist2", + "Checklist3", + "Checklist4", + "Checklist5", + "NearestAirports", + "NearestIntersections", + "NearestNDB", + "NearestVOR", + "NearestUserWPT", + "NearestFrequencies", + "NearestAirspaces" +]; + +foreach (var page; MFDPages) { + io.load_nasal(nasal_dir ~ page ~ '/' ~ page ~ '.nas', "fg1000"); + io.load_nasal(nasal_dir ~ page ~ '/' ~ page ~ 'Styles.nas', "fg1000"); + io.load_nasal(nasal_dir ~ page ~ '/' ~ page ~ 'Options.nas', "fg1000"); + io.load_nasal(nasal_dir ~ page ~ '/' ~ page ~ 'Controller.nas', "fg1000"); +} io.load_nasal(nasal_dir ~ 'EIS.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Drivers/EISDriver.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'PageGroupController.nas', "fg1000"); +# Constants to define the display area, for placement of elements. We +# could try to do something with a layout, but the position and size of +# elements is fixed. Can't be member variables of MFD as they are +# self-referential. + +var DISPLAY = { WIDTH : 1024, HEIGHT : 768 }; +var HEADER_HEIGHT = 56; +var FOOTER_HEIGHT = 25; +var EIS_WIDTH = 150; + +# Size of data display on the right hand side of the MFD +var DATA_DISPLAY = { + WIDTH : 300, + HEIGHT : DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT, + X : DISPLAY.WIDTH - 300, + Y : HEADER_HEIGHT, +}; + +# Map dimensions when the data display is not present +var MAP_FULL = { + CENTER : { X : ((DISPLAY.WIDTH - EIS_WIDTH) / 2 + EIS_WIDTH), + Y : ((DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT) / 2 + HEADER_HEIGHT), }, + X : EIS_WIDTH, + Y : HEADER_HEIGHT, + WIDTH : DISPLAY.WIDTH - EIS_WIDTH, + HEIGHT : DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT, +}; + +# Map dimensions when the data display is present +var MAP_PARTIAL = { + X : EIS_WIDTH, + Y : HEADER_HEIGHT, + WIDTH : DISPLAY.WIDTH - EIS_WIDTH - DATA_DISPLAY.WIDTH, + HEIGHT : DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT, + CENTER : { X : ((DISPLAY.WIDTH - EIS_WIDTH - DATA_DISPLAY.WIDTH) / 2 + EIS_WIDTH), + Y : ((DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT) / 2 + HEADER_HEIGHT), }, +}; + +var HIGHLIGHT_COLOR = "#80ffff"; +var HIGHLIGHT_TEXT_COLOR = "#000000"; +var NORMAL_TEXT_COLOR = "#80ffff"; var MFD = { - # Center of any maps - MAP_CENTER : { - X: (1024/2 + 60), - Y: (768/2 + 20) - }, - # Constants for the hard-buttons on the fascia FASCIA : { FMS_OUTER : 0, FMS_INNER : 1, RANGE : 2, + FMS_CRSR : 3, }, - - new : func (myCanvas) { var obj = { parents : [ MFD ] }; obj._svg = myCanvas.createGroup("softkeys"); - canvas.parsesvg(obj._svg, '/Aircraft/Instruments-3d/FG1000/Models/MFD.svg'); + + var fontmapper = func (family, weight) { + #if( family == "Liberation Sans" and weight == "narrow" ) { + return "LiberationFonts/LiberationSansNarrow-Regular.ttf"; + #} + # If we don't return anything the default font is used + }; + + foreach (var page; MFDPages) { + var svg_file ='/Aircraft/Instruments-3d/FG1000/Models/' ~ page ~ '.svg'; + if (resolvepath(svg_file) != "") { + # Load an SVG file if available. + canvas.parsesvg(obj._svg, + svg_file, + {'font-mapper': fontmapper}); + } + } + + canvas.parsesvg(obj._svg, + '/Aircraft/Instruments-3d/FG1000/Models/MFD.svg', + {'font-mapper': fontmapper}); obj._MFDDevice = canvas.PFD_Device.new(obj._svg, 12, "SoftKey", myCanvas, "MFD"); obj._MFDDevice.RegisterWithEmesary(); + # Surround dynamic elements + obj._pageTitle = obj._svg.getElementById("PageTitle"); + # Engine Information System obj._eisDriver = fg1000.EISDriver.new(); obj._eis = fg1000.EIS.new(myCanvas, obj._eisDriver); @@ -50,13 +145,15 @@ var MFD = # Controller for the display on the bottom left which allows selection # of page groups and individual pages using the FMS controller. obj._pageGroupController = fg1000.PageGroupController.new(myCanvas, obj._svg, obj._MFDDevice); - obj._pageGroupController.RegisterWithEmesary(); - obj._pageGroupController.addPage("NavigationMap", fg1000.NavMap.new(myCanvas, obj._MFDDevice, obj._svg)); - obj._pageGroupController.addPage("TrafficMap", fg1000.TrafficMap.new(myCanvas, obj._MFDDevice, obj._svg)); + foreach (var page; MFDPages) { + var code = "obj._pageGroupController.addPage(\"" ~ page ~ "\", fg1000." ~ page ~ ".new(obj, myCanvas, obj._MFDDevice, obj._svg));"; + var addPageFn = compile(code); + addPageFn(); + } # Display the NavMap and the appropriate top level on startup. - obj._MFDDevice.selectPage(obj._pageGroupController.getPage("NavigationMap")); + obj._MFDDevice.selectPage(obj._pageGroupController.getPage("NavMap")); # Add a wheel controller., which we will attach to the zoom. myCanvas.addEventListener("wheel", func(e) @@ -80,6 +177,10 @@ var MFD = }, del: func() { - me._pageGroupController.DeRegisterWithEmesary(); + me.getCurrentPage().DeRegisterWithEmesary(); + }, + setPageTitle: func(title) + { + me._pageTitle.setText(title); } }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas new file mode 100644 index 000000000..4e46f96dc --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas @@ -0,0 +1,78 @@ +# NDBInfo +var NDBInfo = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - NDB INFORMATION", + _group : myCanvas.createGroup("NDBInfoLayer"), + parents : [ NavMap, device.addPage("NDBInfo", "NDBInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NDBInfoStyles.new(); + obj.Options = fg1000.NDBInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NDBInfoController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas new file mode 100644 index 000000000..12370b4ba --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas @@ -0,0 +1,9 @@ +# NDBInfo Controller +var NDBInfoController = +{ + new : func (page, svg) + { + var obj = { parents : [ NDBInfoController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoOptions.nas new file mode 100644 index 000000000..0a03e94fa --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoOptions.nas @@ -0,0 +1,28 @@ +# NDBInfo Options +var NDBInfoOptions = +{ + new : func() { + var obj = { parents : [NDBInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoStyles.nas new file mode 100644 index 000000000..11536135a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoStyles.nas @@ -0,0 +1,28 @@ +# NDBInfo Styles +var NDBInfoStyles = +{ + new : func() { + var obj = { parents : [ NDBInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMap.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMap.nas index 20e6a9512..6378ddc6b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMap.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMap.nas @@ -1,9 +1,10 @@ # Navigation Map var NavMap = { - new : func (myCanvas, device, svg) + new : func (mfd, myCanvas, device, svg) { var obj = { + title : "MAP - NAVIGATION MAP", _group : myCanvas.createGroup("NavigationMapLayer"), parents : [ NavMap, device.addPage("NavigationMap", "NavigationMapGroup") ] }; @@ -11,12 +12,13 @@ var NavMap = obj.Styles = fg1000.NavMapStyles.new(); obj.Options = fg1000.NavMapOptions.new(); obj.MFDMap = obj._group.createChild("map"); + obj.device = device; + obj.mfd = mfd; # Need to display this underneath the softkeys, EIS, header. obj._group.set("z-index", -10.0); obj._group.setVisible(0); - obj.device = device; # Initialize the controller: var ctrl_ns = canvas.Map.Controller.get("Aircraft position"); @@ -42,8 +44,8 @@ var NavMap = # Center the map's origin, modified to take into account the surround. obj.MFDMap.setTranslation( - fg1000.MFD.MAP_CENTER.X, - fg1000.MFD.MAP_CENTER.Y + fg1000.MAP_FULL.CENTER.X, + fg1000.MAP_FULL.CENTER.Y ); var r = func(name,vis=1,zindex=nil) return caller(0)[0]; @@ -204,8 +206,11 @@ var NavMap = me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); } + me.controller.offdisplay(); }, ondisplay : func() { me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + me.controller.ondisplay(); }, }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMapController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMapController.nas index 6a339a974..9dda952e9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMapController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NavMap/NavMapController.nas @@ -71,16 +71,20 @@ var NavMapController = # Airways levels. AIRWAYS : [ "AIRWAYS", "AIRWY ON", "AIRWY LO", "AIRWY HI"], - new : func (navmap, svg, zoom_label, current_zoom) + new : func (page, svg, zoom_label, current_zoom) { var obj = { parents : [ NavMapController ] }; obj.current_zoom = current_zoom; obj.declutter = 0; obj.airways = 0; - obj.navmap = navmap; - obj.navmap.setScreenRange(689/2.0); + obj.page = page; + obj.page.setScreenRange(689/2.0); obj.label = svg.getElementById(zoom_label); obj.setZoom(obj.current_zoom); + + # Emesary + obj._recipient = nil; + return obj; }, zoomIn : func() { @@ -100,7 +104,7 @@ var NavMapController = # Ranges above represent vertical ranges, but the display is a rectangle, so # we need to use the diagonal range of the 1024 x 689, which is 617px. # 617px is 1.8 x 689/2, so we need to increase the range values by x1.8 - me.navmap.setRange(me.RANGES[zoom].range); + me.page.setRange(me.RANGES[zoom].range); me.label.setText(me.RANGES[zoom].label); me.updateVisibility(); }, @@ -112,9 +116,9 @@ var NavMapController = (me.RANGES[me.current_zoom].range <= layer.range) and (me.declutter <= layer.declutter) ) { - me.navmap.MFDMap.getLayer(layer_name).setVisible(1); + me.page.MFDMap.getLayer(layer_name).setVisible(1); } else { - me.navmap.MFDMap.getLayer(layer_name).setVisible(0); + me.page.MFDMap.getLayer(layer_name).setVisible(0); } } }, @@ -148,5 +152,58 @@ var NavMapController = device.updateMenus(); me.updateVisibility(); }, + handleFMSInner : func(value) { + # This page has no use for the FMS knob, so we pass all such + # events to the pageGroupController which displays the page menu in the + # bottom right of the screen + return me.page.mfd._pageGroupController.handleFMSInner(value); + }, + handleFMSOuter : func(value) { + # This page has no use for the FMS knob, so we pass all such + # events to the pageGroupController which displays the page menu in the + # bottom right of the screen + return me.page.mfd._pageGroupController.handleFMSOuter(value); + }, + RegisterWithEmesary : func(transmitter = nil){ + if (transmitter == nil) + transmitter = emesary.GlobalTransmitter; + if (me._recipient == nil){ + me._recipient = emesary.Recipient.new("NavMapController_" ~ me.page.device.designation); + var pfd_obj = me.page.device; + var controller = me; + me._recipient.Receive = func(notification) + { + if (notification.Device_Id == pfd_obj.device_id + and notification.NotificationType == notifications.PFDEventNotification.DefaultType) { + if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed + and notification.EventParameter != nil) + { + var id = notification.EventParameter.Id; + var value = notification.EventParameter.Value; + #printf("Button pressed " ~ id ~ " " ~ value); + if (id == fg1000.MFD.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); + if (id == fg1000.MFD.FASCIA.FMS_INNER) return controller.handleFMSInner(value); + if (id == fg1000.MFD.FASCIA.RANGE) return controller.zoom(value); + } + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + } + transmitter.Register(me._recipient); + me.transmitter = transmitter; + }, + DeRegisterWithEmesary : func(transmitter = nil){ + # remove registration from transmitter; but keep the recipient once it is created. + if (me.transmitter != nil) + me.transmitter.DeRegister(me._recipient); + me.transmitter = nil; + }, + # Reset controller if required when the page is displayed or hidden + ondisplay : func() { + me.RegisterWithEmesary(); + }, + offdisplay : func() { + me.DeRegisterWithEmesary(); + }, }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas new file mode 100644 index 000000000..c9a88e451 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas @@ -0,0 +1,78 @@ +# NearestAirports +var NearestAirports = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST AIRPORTS", + _group : myCanvas.createGroup("NearestAirportsLayer"), + parents : [ NavMap, device.addPage("NearestAirports", "NearestAirportsGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestAirportsStyles.new(); + obj.Options = fg1000.NearestAirportsOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestAirportsController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas new file mode 100644 index 000000000..ec1e2c56c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas @@ -0,0 +1,9 @@ +# NearestAirports Controller +var NearestAirportsController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestAirportsController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsOptions.nas new file mode 100644 index 000000000..2f540e86f --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsOptions.nas @@ -0,0 +1,28 @@ +# NearestAirports Options +var NearestAirportsOptions = +{ + new : func() { + var obj = { parents : [NearestAirportsOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsStyles.nas new file mode 100644 index 000000000..8237f94fa --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsStyles.nas @@ -0,0 +1,28 @@ +# NearestAirports Styles +var NearestAirportsStyles = +{ + new : func() { + var obj = { parents : [ NearestAirportsStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas new file mode 100644 index 000000000..a98a251a3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas @@ -0,0 +1,78 @@ +# NearestAirspaces +var NearestAirspaces = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST AIRSPACES", + _group : myCanvas.createGroup("NearestAirspacesLayer"), + parents : [ NavMap, device.addPage("NearestAirspaces", "NearestAirspacesGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestAirspacesStyles.new(); + obj.Options = fg1000.NearestAirspacesOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestAirspacesController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas new file mode 100644 index 000000000..ef3d757f8 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas @@ -0,0 +1,9 @@ +# NearestAirspaces Controller +var NearestAirspacesController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestAirspacesController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesOptions.nas new file mode 100644 index 000000000..b35b28a63 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesOptions.nas @@ -0,0 +1,28 @@ +# NearestAirspaces Options +var NearestAirspacesOptions = +{ + new : func() { + var obj = { parents : [NearestAirspacesOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesStyles.nas new file mode 100644 index 000000000..021a211b7 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesStyles.nas @@ -0,0 +1,28 @@ +# NearestAirspaces Styles +var NearestAirspacesStyles = +{ + new : func() { + var obj = { parents : [ NearestAirspacesStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas new file mode 100644 index 000000000..66dfb2616 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas @@ -0,0 +1,78 @@ +# NearestFrequencies +var NearestFrequencies = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST FREQUENCIES", + _group : myCanvas.createGroup("NearestFrequenciesLayer"), + parents : [ NavMap, device.addPage("NearestFrequencies", "NearestFrequenciesGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestFrequenciesStyles.new(); + obj.Options = fg1000.NearestFrequenciesOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestFrequenciesController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas new file mode 100644 index 000000000..da8f498da --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas @@ -0,0 +1,9 @@ +# NearestFrequencies Controller +var NearestFrequenciesController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestFrequenciesController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesOptions.nas new file mode 100644 index 000000000..72249d8b6 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesOptions.nas @@ -0,0 +1,28 @@ +# NearestFrequencies Options +var NearestFrequenciesOptions = +{ + new : func() { + var obj = { parents : [NearestFrequenciesOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesStyles.nas new file mode 100644 index 000000000..90447bed0 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesStyles.nas @@ -0,0 +1,28 @@ +# NearestFrequencies Styles +var NearestFrequenciesStyles = +{ + new : func() { + var obj = { parents : [ NearestFrequenciesStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas new file mode 100644 index 000000000..528735a24 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas @@ -0,0 +1,78 @@ +# NearestIntersections +var NearestIntersections = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST INTERSECTIONS", + _group : myCanvas.createGroup("NearestIntersectionsLayer"), + parents : [ NavMap, device.addPage("NearestIntersections", "NearestIntersectionsGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestIntersectionsStyles.new(); + obj.Options = fg1000.NearestIntersectionsOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestIntersectionsController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas new file mode 100644 index 000000000..9036318d1 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas @@ -0,0 +1,9 @@ +# NearestIntersections Controller +var NearestIntersectionsController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestIntersectionsController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsOptions.nas new file mode 100644 index 000000000..cbfabe9ad --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsOptions.nas @@ -0,0 +1,28 @@ +# NearestIntersections Options +var NearestIntersectionsOptions = +{ + new : func() { + var obj = { parents : [NearestIntersectionsOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsStyles.nas new file mode 100644 index 000000000..5cdb577fd --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsStyles.nas @@ -0,0 +1,28 @@ +# NearestIntersections Styles +var NearestIntersectionsStyles = +{ + new : func() { + var obj = { parents : [ NearestIntersectionsStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas new file mode 100644 index 000000000..8bfd7b5da --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas @@ -0,0 +1,78 @@ +# NearestNDB +var NearestNDB = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST NDB", + _group : myCanvas.createGroup("NearestNDBLayer"), + parents : [ NavMap, device.addPage("NearestNDB", "NearestNDBGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestNDBStyles.new(); + obj.Options = fg1000.NearestNDBOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestNDBController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas new file mode 100644 index 000000000..398f81406 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas @@ -0,0 +1,9 @@ +# NearestNDB Controller +var NearestNDBController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestNDBController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBOptions.nas new file mode 100644 index 000000000..5334a4cbe --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBOptions.nas @@ -0,0 +1,28 @@ +# NearestNDB Options +var NearestNDBOptions = +{ + new : func() { + var obj = { parents : [NearestNDBOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBStyles.nas new file mode 100644 index 000000000..b59988c30 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBStyles.nas @@ -0,0 +1,28 @@ +# NearestNDB Styles +var NearestNDBStyles = +{ + new : func() { + var obj = { parents : [ NearestNDBStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas new file mode 100644 index 000000000..b4b65b264 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas @@ -0,0 +1,78 @@ +# NearestUserWPT +var NearestUserWPT = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST USER WPTS", + _group : myCanvas.createGroup("NearestUserWPTLayer"), + parents : [ NavMap, device.addPage("NearestUserWPT", "NearestUserWPTGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestUserWPTStyles.new(); + obj.Options = fg1000.NearestUserWPTOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestUserWPTController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas new file mode 100644 index 000000000..db81ba472 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas @@ -0,0 +1,9 @@ +# NearestUserWPT Controller +var NearestUserWPTController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestUserWPTController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTOptions.nas new file mode 100644 index 000000000..296ef2e1d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTOptions.nas @@ -0,0 +1,28 @@ +# NearestUserWPT Options +var NearestUserWPTOptions = +{ + new : func() { + var obj = { parents : [NearestUserWPTOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTStyles.nas new file mode 100644 index 000000000..91c7c6674 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTStyles.nas @@ -0,0 +1,28 @@ +# NearestUserWPT Styles +var NearestUserWPTStyles = +{ + new : func() { + var obj = { parents : [ NearestUserWPTStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas new file mode 100644 index 000000000..c3be32294 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas @@ -0,0 +1,78 @@ +# NearestVOR +var NearestVOR = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "NRST - NEAREST VOR", + _group : myCanvas.createGroup("NearestVORLayer"), + parents : [ NavMap, device.addPage("NearestVOR", "NearestVORGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.NearestVORStyles.new(); + obj.Options = fg1000.NearestVOROptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.NearestVORController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas new file mode 100644 index 000000000..ce5a4eac3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas @@ -0,0 +1,9 @@ +# NearestVOR Controller +var NearestVORController = +{ + new : func (page, svg) + { + var obj = { parents : [ NearestVORController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOROptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOROptions.nas new file mode 100644 index 000000000..602f1f7c9 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOROptions.nas @@ -0,0 +1,28 @@ +# NearestVOR Options +var NearestVOROptions = +{ + new : func() { + var obj = { parents : [NearestVOROptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORStyles.nas new file mode 100644 index 000000000..b0010db73 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORStyles.nas @@ -0,0 +1,28 @@ +# NearestVOR Styles +var NearestVORStyles = +{ + new : func() { + var obj = { parents : [ NearestVORStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/PageGroupController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/PageGroupController.nas index 5a25ea714..1bf407cd5 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/PageGroupController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/PageGroupController.nas @@ -6,11 +6,11 @@ var PAGE_GROUPS = [ { label: "MapPageGroupLabel", group: "MapPageGroup", - pages: [ "NavigationMap", "TrafficMap", "Stormscope", "WeatherDataLink", "TAWSB"], + pages: [ "NavMap", "TrafficMap", "Stormscope", "WeatherDataLink", "TAWSB"], }, { label: "WPTGroupLabel", group: "WPTPageGroup", - pages: [ "AirportInformation", "IntersectionInformation", "NDBInformation", "VORInformation", "UserWPTInformation"], + pages: [ "AirportInfo", "IntersectionInfo", "NDBInfo", "VORInfo", "UserWPTInfo"], }, { label: "AuxGroupLabel", @@ -20,7 +20,7 @@ var PAGE_GROUPS = [ { label: "FPLGroupLabel", group: "FPLPageGroup", - pages: [ "ActiveFlightPlan", "FlightPlanCatalog", "StoredFlightPlan"], + pages: [ "ActiveFlightPlanWide", "FlightPlanCatalog", "StoredFlightPlan"], }, { label: "LstGroupLabel", @@ -49,17 +49,14 @@ var PageGroupController = # List of pages to be controllers. Keys are the pages in PAGE_GROUPS; obj._pageList = {}; - # Timers to controll when to hide the menu after inactivity, and when to load + # Timers to control when to hide the menu after inactivity, and when to load # a new page. - obj._hideMenuTimer = maketimer(5, obj, obj.hideMenu); + obj._hideMenuTimer = maketimer(3, obj, obj.hideMenu); obj._hideMenuTimer.singleShot = 1; obj._loadPageTimer = maketimer(0.5, obj, obj.loadPage); obj._loadPageTimer.singleShot = 1; - # Emesary - obj._recipient = nil; - obj.hideMenu(); return obj; }, @@ -128,13 +125,13 @@ var PageGroupController = } me._menuVisible = 1; me._hideMenuTimer.stop(); - me._hideMenuTimer.restart(5); + me._hideMenuTimer.restart(3); me._loadPageTimer.stop(); me._loadPageTimer.restart(0.5); }, - FMSOuter : func(val) + handleFMSOuter : func(val) { if (me._menuVisible == 1) { # Change page group @@ -143,9 +140,10 @@ var PageGroupController = me._selectedPage = 0; } me.showMenu(); + return emesary.Transmitter.ReceiptStatus_Finished; }, - FMSInner : func(val) + handleFMSInner : func(val) { if (me._menuVisible == 1) { # Change page group @@ -153,43 +151,7 @@ var PageGroupController = me._selectedPage = math.mod(me._selectedPage + incr_or_decr, size(PAGE_GROUPS[me._selectedPageGroup].pages)); } me.showMenu(); - }, - RegisterWithEmesary : func(transmitter = nil){ - if (transmitter == nil) - transmitter = emesary.GlobalTransmitter; + return emesary.Transmitter.ReceiptStatus_Finished; - if (me._recipient == nil){ - me._recipient = emesary.Recipient.new("PageController_" ~ me._device.designation); - var pfd_obj = me._device; - var controller = me; - me._recipient.Receive = func(notification) - { - if (notification.Device_Id == pfd_obj.device_id - and notification.NotificationType == notifications.PFDEventNotification.DefaultType) { - if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed - and notification.EventParameter != nil) - { - var id = notification.EventParameter.Id; - var value = notification.EventParameter.Value; - #printf("Button pressed " ~ id ~ " " ~ value); - if (id == fg1000.MFD.FASCIA.FMS_OUTER) controller.FMSOuter(value); - if (id == fg1000.MFD.FASCIA.FMS_INNER) controller.FMSInner(value); - if (id == fg1000.MFD.FASCIA.RANGE) { if (pfd_obj.current_page.controller.zoom != nil) pfd_obj.current_page.controller.zoom(value); } - } - - return emesary.Transmitter.ReceiptStatus_OK; - } - return emesary.Transmitter.ReceiptStatus_NotProcessed; - }; - transmitter.Register(me._recipient); - me.transmitter = transmitter; - } }, - DeRegisterWithEmesary : func(transmitter = nil){ - # remove registration from transmitter; but keep the recipient once it is created. - if (me.transmitter != nil) - me.transmitter.DeRegister(me._recipient); - me.transmitter = nil; - }, - }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas new file mode 100644 index 000000000..e876f0fd9 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas @@ -0,0 +1,78 @@ +# StoredFlightPlan +var StoredFlightPlan = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "FPL - STORED FLIGHT PLAN", + _group : myCanvas.createGroup("StoredFlightPlanLayer"), + parents : [ NavMap, device.addPage("StoredFlightPlan", "StoredFlightPlanGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.StoredFlightPlanStyles.new(); + obj.Options = fg1000.StoredFlightPlanOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.StoredFlightPlanController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas new file mode 100644 index 000000000..ec900e42b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas @@ -0,0 +1,9 @@ +# StoredFlightPlan Controller +var StoredFlightPlanController = +{ + new : func (page, svg) + { + var obj = { parents : [ StoredFlightPlanController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanOptions.nas new file mode 100644 index 000000000..1ceb6526c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanOptions.nas @@ -0,0 +1,28 @@ +# StoredFlightPlan Options +var StoredFlightPlanOptions = +{ + new : func() { + var obj = { parents : [StoredFlightPlanOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanStyles.nas new file mode 100644 index 000000000..2f7858d98 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanStyles.nas @@ -0,0 +1,28 @@ +# StoredFlightPlan Styles +var StoredFlightPlanStyles = +{ + new : func() { + var obj = { parents : [ StoredFlightPlanStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas new file mode 100644 index 000000000..7970ef55b --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas @@ -0,0 +1,78 @@ +# Stormscope +var Stormscope = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "MAP - STORMSCOPE", + _group : myCanvas.createGroup("StormscopeLayer"), + parents : [ NavMap, device.addPage("Stormscope", "StormscopeGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.StormscopeStyles.new(); + obj.Options = fg1000.StormscopeOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.StormscopeController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas new file mode 100644 index 000000000..2adfd6bf2 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas @@ -0,0 +1,9 @@ +# Stormscope Controller +var StormscopeController = +{ + new : func (page, svg) + { + var obj = { parents : [ StormscopeController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeOptions.nas new file mode 100644 index 000000000..116ee0169 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeOptions.nas @@ -0,0 +1,28 @@ +# Stormscope Options +var StormscopeOptions = +{ + new : func() { + var obj = { parents : [StormscopeOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeStyles.nas new file mode 100644 index 000000000..982e1eb1d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeStyles.nas @@ -0,0 +1,28 @@ +# Stormscope Styles +var StormscopeStyles = +{ + new : func() { + var obj = { parents : [ StormscopeStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas new file mode 100644 index 000000000..fdb751b92 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas @@ -0,0 +1,78 @@ +# SystemStatus +var SystemStatus = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - SYSTEM STATUS", + _group : myCanvas.createGroup("SystemStatusLayer"), + parents : [ NavMap, device.addPage("SystemStatus", "SystemStatusGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.SystemStatusStyles.new(); + obj.Options = fg1000.SystemStatusOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.SystemStatusController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas new file mode 100644 index 000000000..3dcf15cab --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas @@ -0,0 +1,9 @@ +# SystemStatus Controller +var SystemStatusController = +{ + new : func (page, svg) + { + var obj = { parents : [ SystemStatusController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusOptions.nas new file mode 100644 index 000000000..a70840baf --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusOptions.nas @@ -0,0 +1,28 @@ +# SystemStatus Options +var SystemStatusOptions = +{ + new : func() { + var obj = { parents : [SystemStatusOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusStyles.nas new file mode 100644 index 000000000..05505d52a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusStyles.nas @@ -0,0 +1,28 @@ +# SystemStatus Styles +var SystemStatusStyles = +{ + new : func() { + var obj = { parents : [ SystemStatusStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas new file mode 100644 index 000000000..7b6fa2cb7 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas @@ -0,0 +1,78 @@ +# TAWS +var TAWS = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "MAP - TAWS", + _group : myCanvas.createGroup("TAWSLayer"), + parents : [ NavMap, device.addPage("TAWS", "TAWSGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.TAWSStyles.new(); + obj.Options = fg1000.TAWSOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.TAWSController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas new file mode 100644 index 000000000..b024bb532 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas @@ -0,0 +1,9 @@ +# TAWS Controller +var TAWSController = +{ + new : func (page, svg) + { + var obj = { parents : [ TAWSController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas new file mode 100644 index 000000000..2cafd352a --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas @@ -0,0 +1,28 @@ +# TAWS Options +var TAWSOptions = +{ + new : func() { + var obj = { parents : [TAWSOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas new file mode 100644 index 000000000..55c54ffea --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas @@ -0,0 +1,28 @@ +# TAWS Styles +var TAWSStyles = +{ + new : func() { + var obj = { parents : [ TAWSStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas new file mode 100644 index 000000000..17a9647b2 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas @@ -0,0 +1,9 @@ +# Template Controller +var TemplateController = +{ + new : func (page, svg) + { + var obj = { parents : [ TemplateController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Options.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Options.nas new file mode 100644 index 000000000..a24dd023e --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Options.nas @@ -0,0 +1,28 @@ +# Template Options +var TemplateOptions = +{ + new : func() { + var obj = { parents : [TemplateOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Styles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Styles.nas new file mode 100644 index 000000000..57f4b482c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Styles.nas @@ -0,0 +1,28 @@ +# Template Styles +var TemplateStyles = +{ + new : func() { + var obj = { parents : [ TemplateStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas new file mode 100644 index 000000000..787b78c52 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas @@ -0,0 +1,79 @@ +# Template +var Template = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "TemplateTitle", + _group : myCanvas.createGroup("TemplateLayer"), + parents : [ Template, device.addPage("Template", "TemplateGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.TemplateStyles.new(); + obj.Options = fg1000.TemplateOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.TemplateController.new(obj, svg); + + # Dynamic text elements in the SVG file. In the SVG these have an "AirportInfo" prefix. + var textelements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + obj.symbols[element].setText(""); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMap.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMap.nas index 3d9a07df5..0dc0c6e69 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMap.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMap.nas @@ -4,9 +4,10 @@ # var TrafficMap = { - new : func (myCanvas, device, svg) + new : func (mfd, myCanvas, device, svg) { var obj = { + title : "MAP - TRAFFIC MAP", _group : myCanvas.createGroup("TrafficMapLayer"), parents : [ TrafficMap, device.addPage("TrafficMap", "TrafficMapGroup") ] }; @@ -15,6 +16,7 @@ var TrafficMap = obj.Options = fg1000.TrafficMapOptions.new(); obj.mapgroup = obj._group.createChild("map"); obj.device = device; + obj.mfd = mfd; # Dynamic text elements obj.op_label = svg.getElementById("TrafficMapOpMode"); @@ -50,8 +52,8 @@ var TrafficMap = # Center the map's origin, modified to take into account the surround. obj.mapgroup.setTranslation( - fg1000.MFD.MAP_CENTER.X, - fg1000.MFD.MAP_CENTER.Y + fg1000.MAP_FULL.CENTER.X, + fg1000.MAP_FULL.CENTER.Y ); var r = func(name,vis=1,zindex=nil) return caller(0)[0]; @@ -165,8 +167,11 @@ var TrafficMap = me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); } + me.controller.offdisplay(); }, ondisplay : func() { me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + me.controller.ondisplay(); }, }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMapController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMapController.nas index c652cc81d..6b56b565a 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMapController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TrafficMap/TrafficMapController.nas @@ -21,16 +21,19 @@ var TrafficMapController = {range: 12, inner_label: "4nm", outer_label: "12nm"} ], - new : func (trafficmap, svg) + new : func (page, svg) { var obj = { parents : [ TrafficMapController ] }; obj.range = 1; obj.alt = "NORMAL"; obj.operating = 0; obj.flight_id = 0; - obj.trafficmap = trafficmap; - obj.trafficmap.setScreenRange(689/2.0); + obj.page = page; + obj.page.setScreenRange(689/2.0); + # Emesary + obj._recipient = nil; + obj.setZoom(obj.range); return obj; }, @@ -48,33 +51,33 @@ var TrafficMapController = setZoom : func(zoom) { if ((zoom < 0) or (zoom > (size(me.RANGES) - 1))) return; me.current_zoom = zoom; - me.trafficmap.setRange( + me.page.setRange( me.RANGES[zoom].range, me.RANGES[zoom].inner_label, me.RANGES[zoom].outer_label); }, setAlt : func(alt) { if (me.ALTS[alt] == nil) return; - me.trafficmap.alt_label.setText(me.ALTS[alt].label); + me.page.alt_label.setText(me.ALTS[alt].label); me.alt = alt; # Update the TFC controller to filter out the correct targets - me.trafficmap.mapgroup.getLayer("TFC").options.ceiling_ft = me.ALTS[alt].ceiling_ft; - me.trafficmap.mapgroup.getLayer("TFC").options.floor_ft = me.ALTS[alt].floor_ft; + me.page.mapgroup.getLayer("TFC").options.ceiling_ft = me.ALTS[alt].ceiling_ft; + me.page.mapgroup.getLayer("TFC").options.floor_ft = me.ALTS[alt].floor_ft; }, setOperate : func(enabled) { if (enabled) { - me.trafficmap.op_label.setText("OPERATING"); - me.trafficmap.setLayerVisible("TFC", 1); + me.page.op_label.setText("OPERATING"); + me.page.setLayerVisible("TFC", 1); me.operating = 1; } else { - me.trafficmap.op_label.setText("STANDBY"); - me.trafficmap.setLayerVisible("TFC", 0); + me.page.op_label.setText("STANDBY"); + me.page.setLayerVisible("TFC", 0); me.operating = 0; } }, setFlightID : func(enabled) { me.flight_id = enabled; - me.trafficmap.Options.setOption("TFC", "display_id", enabled); + me.page.Options.setOption("TFC", "display_id", enabled); }, toggleFlightID : func() { me.setFlightID(! me.flight_id); @@ -88,4 +91,59 @@ var TrafficMapController = if (me.flight_id == 1 and label == "FLT ID") return 1; return 0; }, + handleFMSInner : func(value) { + # This page has no use for the FMS knob, so we pass all such + # events to the pageGroupController which displays the page menu in the + # bottom right of the screen + return me.page.mfd._pageGroupController.handleFMSInner(value); + }, + handleFMSOuter : func(value) { + # This page has no use for the FMS knob, so we pass all such + # events to the pageGroupController which displays the page menu in the + # bottom right of the screen + return me.page.mfd._pageGroupController.handleFMSOuter(value); + }, + RegisterWithEmesary : func(transmitter = nil){ + if (transmitter == nil) + transmitter = emesary.GlobalTransmitter; + + if (me._recipient == nil){ + me._recipient = emesary.Recipient.new("TrafficMapController_" ~ me.page.device.designation); + var pfd_obj = me.page.device; + var controller = me; + me._recipient.Receive = func(notification) + { + if (notification.Device_Id == pfd_obj.device_id + and notification.NotificationType == notifications.PFDEventNotification.DefaultType) { + if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed + and notification.EventParameter != nil) + { + var id = notification.EventParameter.Id; + var value = notification.EventParameter.Value; + #printf("Button pressed " ~ id ~ " " ~ value); + if (id == fg1000.MFD.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); + if (id == fg1000.MFD.FASCIA.FMS_INNER) return controller.handleFMSInner(value); + if (id == fg1000.MFD.FASCIA.RANGE) return controller.zoom(value); + } + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + } + transmitter.Register(me._recipient); + me.transmitter = transmitter; + }, + DeRegisterWithEmesary : func(transmitter = nil){ + # remove registration from transmitter; but keep the recipient once it is created. + if (me.transmitter != nil) + me.transmitter.DeRegister(me._recipient); + me.transmitter = nil; + }, + + # Reset controller if required when the page is displayed or hidden + ondisplay : func() { + me.RegisterWithEmesary(); + }, + offdisplay : func() { + me.DeRegisterWithEmesary(); + }, }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas new file mode 100644 index 000000000..3da8870b4 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas @@ -0,0 +1,78 @@ +# TripPlanning +var TripPlanning = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - TRIP PLANNING", + _group : myCanvas.createGroup("TripPlanningLayer"), + parents : [ NavMap, device.addPage("TripPlanning", "TripPlanningGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.TripPlanningStyles.new(); + obj.Options = fg1000.TripPlanningOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.TripPlanningController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas new file mode 100644 index 000000000..86bade2d5 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas @@ -0,0 +1,9 @@ +# TripPlanning Controller +var TripPlanningController = +{ + new : func (page, svg) + { + var obj = { parents : [ TripPlanningController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningOptions.nas new file mode 100644 index 000000000..be8b954d3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningOptions.nas @@ -0,0 +1,28 @@ +# TripPlanning Options +var TripPlanningOptions = +{ + new : func() { + var obj = { parents : [TripPlanningOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningStyles.nas new file mode 100644 index 000000000..147484c23 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningStyles.nas @@ -0,0 +1,28 @@ +# TripPlanning Styles +var TripPlanningStyles = +{ + new : func() { + var obj = { parents : [ TripPlanningStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas new file mode 100644 index 000000000..f6e7d08df --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas @@ -0,0 +1,78 @@ +# UserWPTInfo +var UserWPTInfo = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - USER WPT INFORMATION", + _group : myCanvas.createGroup("UserWPTInfoLayer"), + parents : [ NavMap, device.addPage("UserWPTInfo", "UserWPTInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.UserWPTInfoStyles.new(); + obj.Options = fg1000.UserWPTInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.UserWPTInfoController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas new file mode 100644 index 000000000..d94d599fc --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas @@ -0,0 +1,9 @@ +# UserWPTInfo Controller +var UserWPTInfoController = +{ + new : func (page, svg) + { + var obj = { parents : [ UserWPTInfoController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoOptions.nas new file mode 100644 index 000000000..15028332c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoOptions.nas @@ -0,0 +1,28 @@ +# UserWPTInfo Options +var UserWPTInfoOptions = +{ + new : func() { + var obj = { parents : [UserWPTInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoStyles.nas new file mode 100644 index 000000000..0fb937060 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoStyles.nas @@ -0,0 +1,28 @@ +# UserWPTInfo Styles +var UserWPTInfoStyles = +{ + new : func() { + var obj = { parents : [ UserWPTInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas new file mode 100644 index 000000000..fac7f5830 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas @@ -0,0 +1,78 @@ +# Utility +var Utility = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - UTILITY", + _group : myCanvas.createGroup("UtilityLayer"), + parents : [ NavMap, device.addPage("Utility", "UtilityGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.UtilityStyles.new(); + obj.Options = fg1000.UtilityOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.UtilityController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas new file mode 100644 index 000000000..463fd0730 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas @@ -0,0 +1,9 @@ +# Utility Controller +var UtilityController = +{ + new : func (page, svg) + { + var obj = { parents : [ UtilityController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityOptions.nas new file mode 100644 index 000000000..8ccf74b96 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityOptions.nas @@ -0,0 +1,28 @@ +# Utility Options +var UtilityOptions = +{ + new : func() { + var obj = { parents : [UtilityOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityStyles.nas new file mode 100644 index 000000000..4abadc77e --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityStyles.nas @@ -0,0 +1,28 @@ +# Utility Styles +var UtilityStyles = +{ + new : func() { + var obj = { parents : [ UtilityStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas new file mode 100644 index 000000000..630b89e3f --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas @@ -0,0 +1,78 @@ +# VORInfo +var VORInfo = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "WPT - VOR INFORMATION", + _group : myCanvas.createGroup("VORInfoLayer"), + parents : [ NavMap, device.addPage("VORInfo", "VORInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.VORInfoStyles.new(); + obj.Options = fg1000.VORInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.VORInfoController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas new file mode 100644 index 000000000..e7c9b4eff --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas @@ -0,0 +1,9 @@ +# VORInfo Controller +var VORInfoController = +{ + new : func (page, svg) + { + var obj = { parents : [ VORInfoController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoOptions.nas new file mode 100644 index 000000000..8c8765473 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoOptions.nas @@ -0,0 +1,28 @@ +# VORInfo Options +var VORInfoOptions = +{ + new : func() { + var obj = { parents : [VORInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoStyles.nas new file mode 100644 index 000000000..bf6d68880 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoStyles.nas @@ -0,0 +1,28 @@ +# VORInfo Styles +var VORInfoStyles = +{ + new : func() { + var obj = { parents : [ VORInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas new file mode 100644 index 000000000..347c31c21 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas @@ -0,0 +1,78 @@ +# WeatherDataLink +var WeatherDataLink = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "MAP - WEATHER DATA LINK", + _group : myCanvas.createGroup("WeatherDataLinkLayer"), + parents : [ NavMap, device.addPage("WeatherDataLink", "WeatherDataLinkGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.WeatherDataLinkStyles.new(); + obj.Options = fg1000.WeatherDataLinkOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.WeatherDataLinkController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas new file mode 100644 index 000000000..3e99749b6 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas @@ -0,0 +1,9 @@ +# WeatherDataLink Controller +var WeatherDataLinkController = +{ + new : func (page, svg) + { + var obj = { parents : [ WeatherDataLinkController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkOptions.nas new file mode 100644 index 000000000..015131fd2 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkOptions.nas @@ -0,0 +1,28 @@ +# WeatherDataLink Options +var WeatherDataLinkOptions = +{ + new : func() { + var obj = { parents : [WeatherDataLinkOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkStyles.nas new file mode 100644 index 000000000..85ebc2fb7 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkStyles.nas @@ -0,0 +1,28 @@ +# WeatherDataLink Styles +var WeatherDataLinkStyles = +{ + new : func() { + var obj = { parents : [ WeatherDataLinkStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas new file mode 100644 index 000000000..69a442bd1 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas @@ -0,0 +1,78 @@ +# XMInfo +var XMInfo = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - XM INFORMATION", + _group : myCanvas.createGroup("XMInfoLayer"), + parents : [ NavMap, device.addPage("XMInfo", "XMInfoGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.XMInfoStyles.new(); + obj.Options = fg1000.XMInfoOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.XMInfoController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas new file mode 100644 index 000000000..109a86a74 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas @@ -0,0 +1,9 @@ +# XMInfo Controller +var XMInfoController = +{ + new : func (page, svg) + { + var obj = { parents : [ XMInfoController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoOptions.nas new file mode 100644 index 000000000..40f52f9fe --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoOptions.nas @@ -0,0 +1,28 @@ +# XMInfo Options +var XMInfoOptions = +{ + new : func() { + var obj = { parents : [XMInfoOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoStyles.nas new file mode 100644 index 000000000..a4d0cf2c3 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoStyles.nas @@ -0,0 +1,28 @@ +# XMInfo Styles +var XMInfoStyles = +{ + new : func() { + var obj = { parents : [ XMInfoStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas new file mode 100644 index 000000000..810498291 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas @@ -0,0 +1,78 @@ +# XMRadio +var XMRadio = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + title : "AUX - XM RADIO", + _group : myCanvas.createGroup("XMRadioLayer"), + parents : [ NavMap, device.addPage("XMRadio", "XMRadioGroup") ], + symbols : {}, + }; + + obj.Styles = fg1000.XMRadioStyles.new(); + obj.Options = fg1000.XMRadioOptions.new(); + obj.device = device; + obj.mfd = mfd; + + obj.controller = fg1000.XMRadioController.new(obj, svg); + + # Dynamic elements + var elements = [ + + ]; + + foreach (var element; elements) { + obj.symbols[element] = svg.getElementById(element); + } + + var topMenu = func(device, pg, menuitem) { + pg.clearMenu(); + resetMenuColors(device); + device.updateMenus(); + }; + + # Display map toggle softkeys which change color depending + # on whether a particular layer is enabled or not. + var display_toggle = func(device, svg, mi, layer) { + var bg_name = sprintf("SoftKey%d-bg",mi.menu_id); + if (obj.controller.isEnabled(layer)) { + device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5); + svg.setColor(0.0,0.0,0.0); + } else { + device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0); + svg.setColor(1.0,1.0,1.0); + } + svg.setText(mi.title); + svg.setVisible(1); # display function + }; + + # Function to undo any colors set by display_toggle when loading a new menu + var resetMenuColors = func(device) { + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + } + + topMenu(device, obj, nil); + + return obj; + }, + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + }, + ondisplay : func() { + me._group.setVisible(1); + me.mfd.setPageTitle(me.title); + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas new file mode 100644 index 000000000..0a84b239c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas @@ -0,0 +1,9 @@ +# XMRadio Controller +var XMRadioController = +{ + new : func (page, svg) + { + var obj = { parents : [ XMRadioController ] }; + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioOptions.nas new file mode 100644 index 000000000..e24979793 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioOptions.nas @@ -0,0 +1,28 @@ +# XMRadio Options +var XMRadioOptions = +{ + new : func() { + var obj = { parents : [XMRadioOptions] }; + obj.Options= {}; + obj.loadOptions(); + return obj; + }, + + getOption : func(type) { + return me.Options[type]; + }, + + setOption : func(type, name, value) { + me.Options[type][name] = value; + }, + + loadOptions : func() { + me.clearOptions(); + me.Options.APS = {}; + }, + + clearOptions : func() { + me.Options = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioStyles.nas new file mode 100644 index 000000000..5c87bb6b0 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioStyles.nas @@ -0,0 +1,28 @@ +# XMRadio Styles +var XMRadioStyles = +{ + new : func() { + var obj = { parents : [ XMRadioStyles ]}; + obj.Styles = {}; + obj.loadStyles(); + return obj; + }, + + getStyle : func(type) { + return me.Styles[type]; + }, + + setStyle : func(type, name, value) { + me.Styles[type][name] = value; + }, + + loadStyles : func() { + me. clearStyles(); + me.Styles.XXX = {}; + }, + + clearStyles : func() { + me.Styles = {}; + }, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl b/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl new file mode 100644 index 000000000..584163af0 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w +use strict; +use warnings; + +my %pages = ("Stormscope" => "MAP - STORMSCOPE", +"WeatherDataLink" => "MAP - WEATHER DATA LINK", +"TAWS" => "MAP - TAWS", +"AirportInfo" => "WPT - AIRPORT INFORMATION", +"AirportDirectory" => "WPT - AIRPORT DIRECTORY", +"AirportDeparture" => "WPT - AIRPORT DEPARTURE INFORMATION", +"AirportArrival" => "WPT - AIRPORT ARRIVAL INFORMATION", +"AirportApproach" => "WPT - AIRPORT APPROACH INFORMATION", +"AirportWeather" => "WPT - WEATHER INFORMATION", +"IntersectionInfo" => "WPT - INTERSECTION INFORMATION", +"NDBInfo" => "WPT - NDB INFORMATION", +"VORInfo" => "WPT - VOR INFORMATION", +"UserWPTInfo" => "WPT - USER WPT INFORMATION", +"TripPlanning" => "AUX - TRIP PLANNING", +"Utility" => "AUX - UTILITY", +"GPSStatus" => "AUX - GPS STATUS", +"XMRadio" => "AUX - XM RADIO", +"XMInfo" => "AUX - XM INFORMATION", +"SystemStatus" => "AUX - SYSTEM STATUS", +"ActiveFlightPlanWide" => "FPL - ACTIVE FLIGHT PLAN", +"ActiveFlightPlanNarrow" => "FPL - ACTIVE FLIGHT PLAN", +"FlightPlanCatalog" => "FPL - FLIGHT PLAN CATALOG", +"StoredFlightPlan" => "FPL - STORED FLIGHT PLAN", +"Checklist1" => "LST - CHECKLIST 1", +"Checklist2" => "LST - CHECKLIST 2", +"Checklist3" => "LST - CHECKLIST 3", +"Checklist4" => "LST - CHECKLIST 4", +"Checklist5" => "LST - CHECKLIST 5", +"NearestAirports" => "NRST - NEAREST AIRPORTS", +"NearestIntersections" => "NRST - NEAREST INTERSECTIONS", +"NearestNDB" => "NRST - NEAREST NDB", +"NearestVOR" => "NRST - NEAREST VOR", +"NearestUserWPT" => "NRST - NEAREST USER WPTS", +"NearestFrequencies" => "NRST - NEAREST FREQUENCIES", +"NearestAirspaces" => "NRST - NEAREST AIRSPACES" +); + +foreach my $page (sort(keys(%pages))) { + my $pageTitle = $pages{$page}; + #print "$page : $pageTitle\n"; + if (! -d $page) { mkdir($page) }; + chdir("~/FlightGear/fgdata/Aircraft/Instruments-3d/FG1000/Nasal/$page"); + system("cp ./TemplatePage/TemplatePage.nas ${page}/${page}.nas"); + system("cp ./TemplatePage/Options.nas ${page}/${page}Options.nas"); + system("cp ./TemplatePage/Controller.nas ${page}/${page}Controller.nas"); + system("cp ./TemplatePage/Styles.nas ${page}/${page}Styles.nas"); + foreach my $f (glob("${page}/*.nas")) { + #print("Substituting on $f\n"); + system("perl -pi -e \"s/TemplateTitle/$pageTitle/g\" $f"); + system("perl -pi -e \"s/Template/$page/g\" $f"); + } + #print("obj._pageGroupController.addPage(\"${page}\", fg1000.${page}.new(obj, myCanvas, obj._MFDDevice, obj._svg));\n") +} diff --git a/gui/dialogs/fg1000.xml b/gui/dialogs/fg1000.xml index 41684afd8..4bd9e9611 100644 --- a/gui/dialogs/fg1000.xml +++ b/gui/dialogs/fg1000.xml @@ -418,6 +418,13 @@ emesary.GlobalTransmitter.NotifyAll(notification); } )); + append(listeners, setlistener("/sim/gui/dialogs/fg1000/crsr-pressed", func(v) { + var notification = notifications.PFDEventNotification.new("MFD", 1, notifications.PFDEventNotification.HardKeyPushed, { Id: fg1000.MFD.FASCIA.FMS_CRSR, Value: 1.0 }); + emesary.GlobalTransmitter.NotifyAll(notification); + } )); + + + ]]> @@ -885,6 +892,11 @@ CRSR 50 25 + + property-assign + /sim/gui/dialogs/fg1000/crsr-pressed + 1 +