diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas index 5c5467792..c269e56c6 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrow.nas @@ -10,37 +10,7 @@ var ActiveFlightPlanNarrow = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.ActiveFlightPlanNarrowController.new(obj, svg); @@ -63,4 +33,11 @@ var ActiveFlightPlanNarrow = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas index 3a0e6346e..f92212ff9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanNarrow/ActiveFlightPlanNarrowController.nas @@ -4,7 +4,7 @@ var ActiveFlightPlanNarrowController = new : func (page, svg) { var obj = { - parents : [ ActiveFlightPlanNarrowController ], + parents : [ ActiveFlightPlanNarrowController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var ActiveFlightPlanNarrowController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var ActiveFlightPlanNarrowController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var ActiveFlightPlanNarrowController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas index f831746ae..5ee89ef24 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWide.nas @@ -10,37 +10,7 @@ var ActiveFlightPlanWide = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.ActiveFlightPlanWideController.new(obj, svg); @@ -63,4 +33,11 @@ var ActiveFlightPlanWide = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas index f414135b1..26579f607 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ActiveFlightPlanWide/ActiveFlightPlanWideController.nas @@ -4,7 +4,7 @@ var ActiveFlightPlanWideController = new : func (page, svg) { var obj = { - parents : [ ActiveFlightPlanWideController ], + parents : [ ActiveFlightPlanWideController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var ActiveFlightPlanWideController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var ActiveFlightPlanWideController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var ActiveFlightPlanWideController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas index 2a7567983..a710ae3ad 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproach.nas @@ -10,37 +10,7 @@ var AirportApproach = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.AirportApproachController.new(obj, svg); @@ -63,4 +33,11 @@ var AirportApproach = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas index 340fe430c..38a70f4e7 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportApproach/AirportApproachController.nas @@ -4,7 +4,7 @@ var AirportApproachController = new : func (page, svg) { var obj = { - parents : [ AirportApproachController ], + parents : [ AirportApproachController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var AirportApproachController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var AirportApproachController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var AirportApproachController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas index f3d9174f8..2a399b6c4 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrival.nas @@ -10,37 +10,7 @@ var AirportArrival = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.AirportArrivalController.new(obj, svg); @@ -63,4 +33,11 @@ var AirportArrival = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas index 94beb3302..60b65bd15 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportArrival/AirportArrivalController.nas @@ -4,7 +4,7 @@ var AirportArrivalController = new : func (page, svg) { var obj = { - parents : [ AirportArrivalController ], + parents : [ AirportArrivalController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var AirportArrivalController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var AirportArrivalController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var AirportArrivalController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas index ee0c25cec..0e7e4efbf 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDeparture.nas @@ -10,37 +10,7 @@ var AirportDeparture = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.AirportDepartureController.new(obj, svg); @@ -63,4 +33,11 @@ var AirportDeparture = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas index 5490a5c1f..9b8d6cc41 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDeparture/AirportDepartureController.nas @@ -4,7 +4,7 @@ var AirportDepartureController = new : func (page, svg) { var obj = { - parents : [ AirportDepartureController ], + parents : [ AirportDepartureController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var AirportDepartureController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var AirportDepartureController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var AirportDepartureController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas index 31eb9927e..59bfc10fc 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectory.nas @@ -10,37 +10,7 @@ var AirportDirectory = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.AirportDirectoryController.new(obj, svg); @@ -63,4 +33,11 @@ var AirportDirectory = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas index 967a6c644..ecbfe7be1 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportDirectory/AirportDirectoryController.nas @@ -4,7 +4,7 @@ var AirportDirectoryController = new : func (page, svg) { var obj = { - parents : [ AirportDirectoryController ], + parents : [ AirportDirectoryController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var AirportDirectoryController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var AirportDirectoryController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var AirportDirectoryController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas index bd26c983c..a46cbeb61 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas @@ -99,38 +99,7 @@ var AirportInfo = 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); + obj.topMenu(device, obj, nil); return obj; }, @@ -285,4 +254,10 @@ var AirportInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + # Softkey menus + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas index 1c315cf4a..40022d26f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas @@ -33,9 +33,6 @@ var AirportInfoController = obj.crsrToggle = 0; obj.current_zoom = 7; - # Emesary - obj._recipient = nil; - # Initial airport is our current location. var current_apt = airportinfo("airport"); obj.setAirport(current_apt.id); @@ -103,7 +100,7 @@ var AirportInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { - return me.page.mfd._pageGroupController.handleFMSInner(value); + return me.page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -111,7 +108,7 @@ var AirportInfoController = me.page.moveCRSR(value); return emesary.Transmitter.ReceiptStatus_Finished; } else { - return me.page.mfd._pageGroupController.handleFMSOuter(value); + return me.page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas index 75aadf0aa..66596a61f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeather.nas @@ -10,37 +10,7 @@ var AirportWeather = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.AirportWeatherController.new(obj, svg); @@ -63,4 +33,11 @@ var AirportWeather = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas index d8fd19877..b5df57314 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportWeather/AirportWeatherController.nas @@ -4,7 +4,7 @@ var AirportWeatherController = new : func (page, svg) { var obj = { - parents : [ AirportWeatherController ], + parents : [ AirportWeatherController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var AirportWeatherController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var AirportWeatherController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var AirportWeatherController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas index c886838e4..314b8ed9c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1.nas @@ -10,37 +10,7 @@ var Checklist1 = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.Checklist1Controller.new(obj, svg); @@ -63,4 +33,11 @@ var Checklist1 = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas index eb67639d0..6d212905c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist1/Checklist1Controller.nas @@ -4,7 +4,7 @@ var Checklist1Controller = new : func (page, svg) { var obj = { - parents : [ Checklist1Controller ], + parents : [ Checklist1Controller, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var Checklist1Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var Checklist1Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var Checklist1Controller = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas index d4fb64b6c..58d6cbfb8 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2.nas @@ -10,37 +10,7 @@ var Checklist2 = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.Checklist2Controller.new(obj, svg); @@ -63,4 +33,11 @@ var Checklist2 = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas index 9ef02fe7b..81bf9bbbe 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist2/Checklist2Controller.nas @@ -4,7 +4,7 @@ var Checklist2Controller = new : func (page, svg) { var obj = { - parents : [ Checklist2Controller ], + parents : [ Checklist2Controller, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var Checklist2Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var Checklist2Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var Checklist2Controller = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas index 848b292a1..fb7eb61f1 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3.nas @@ -10,37 +10,7 @@ var Checklist3 = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.Checklist3Controller.new(obj, svg); @@ -63,4 +33,11 @@ var Checklist3 = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas index 187d22f81..cec1564ac 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist3/Checklist3Controller.nas @@ -4,7 +4,7 @@ var Checklist3Controller = new : func (page, svg) { var obj = { - parents : [ Checklist3Controller ], + parents : [ Checklist3Controller, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var Checklist3Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var Checklist3Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var Checklist3Controller = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas index f86d89d82..c935fd6bd 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4.nas @@ -10,37 +10,7 @@ var Checklist4 = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.Checklist4Controller.new(obj, svg); @@ -63,4 +33,11 @@ var Checklist4 = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas index f791bf389..1a7ecb3f2 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist4/Checklist4Controller.nas @@ -4,7 +4,7 @@ var Checklist4Controller = new : func (page, svg) { var obj = { - parents : [ Checklist4Controller ], + parents : [ Checklist4Controller, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var Checklist4Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var Checklist4Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var Checklist4Controller = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas index 049f8d443..002f096d7 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5.nas @@ -10,37 +10,7 @@ var Checklist5 = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.Checklist5Controller.new(obj, svg); @@ -63,4 +33,11 @@ var Checklist5 = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas index e68042966..fb70707a8 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Checklist5/Checklist5Controller.nas @@ -4,7 +4,7 @@ var Checklist5Controller = new : func (page, svg) { var obj = { - parents : [ Checklist5Controller ], + parents : [ Checklist5Controller, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var Checklist5Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var Checklist5Controller = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var Checklist5Controller = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas index 41305b4ab..0b47192f8 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalog.nas @@ -10,37 +10,7 @@ var FlightPlanCatalog = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.FlightPlanCatalogController.new(obj, svg); @@ -63,4 +33,11 @@ var FlightPlanCatalog = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas index 05809854e..10c2ded65 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FlightPlanCatalog/FlightPlanCatalogController.nas @@ -4,7 +4,7 @@ var FlightPlanCatalogController = new : func (page, svg) { var obj = { - parents : [ FlightPlanCatalogController ], + parents : [ FlightPlanCatalogController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var FlightPlanCatalogController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var FlightPlanCatalogController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var FlightPlanCatalogController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas index b78411e28..d050a87e2 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatus.nas @@ -10,37 +10,7 @@ var GPSStatus = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.GPSStatusController.new(obj, svg); @@ -63,4 +33,11 @@ var GPSStatus = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas index dc326fa82..73d31d24a 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/GPSStatus/GPSStatusController.nas @@ -4,7 +4,7 @@ var GPSStatusController = new : func (page, svg) { var obj = { - parents : [ GPSStatusController ], + parents : [ GPSStatusController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var GPSStatusController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var GPSStatusController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var GPSStatusController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas index f0a24afa2..686e430d9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas @@ -1,4 +1,9 @@ # NavCom Interface using Emesary for a simple dual Nav/Com system using standard properties +# +# This maps properties to Emesary Messages that will be publishes using the +# +# notifications.PFDEventNotification.NavComData +# var GenericNavComPublisher = { new : func () { @@ -9,7 +14,7 @@ var GenericNavComPublisher = ], }; - # Hack to handle cases where there is no selected COMM or NAV frequency + # Hack to handle cases where there is no selected Com or NAV frequency if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1); if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1); @@ -34,12 +39,16 @@ var GenericNavComPublisher = obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz"); obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz"); obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id"); - obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/serviceable"); + obj.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume"); + obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn"); + obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable"); obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz"); obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz"); obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id"); - obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/serviceable"); + obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume"); + obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn"); + obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable"); obj.addPropMap("NavSelected", "/instrumentation/nav-selected"); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComUpdater.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComUpdater.nas new file mode 100644 index 000000000..47804ba9c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComUpdater.nas @@ -0,0 +1,59 @@ +# NavCom Interface using Emesary for a simple dual Nav/Com system using standard properties +# This updates the properties from Emesary messages. + +var GenericNavComUpdater = +{ + new : func (device) { + var obj = { + parents : [ + GenericNavComUpdater, + PropertyUpdater.new( + device, + notifications.PFDEventNotification.DefaultType, + notifications.PFDEventNotification.NavComData + ) + ], + }; + + # Hack to handle cases where there is no selected COMM or NAV frequency + if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1); + if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1); + + obj.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz"); + obj.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz"); + obj.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id"); + obj.addPropMap("Comm1StationName", "/instrumentation/comm/station-name"); + obj.addPropMap("Comm1StationType", "/instrumentation/comm/station-type"); + obj.addPropMap("Comm1Volume", "/instrumentation/comm/volume"); + obj.addPropMap("Comm1Serviceable", "/instrumentation/comm/serviceable"); + + obj.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz"); + obj.addPropMap("Comm2StandbyFreq", "/instrumentation/comm[1]/frequencies/standby-mhz"); + obj.addPropMap("Comm2AirportID", "/instrumentation/comm[1]/airport-id"); + obj.addPropMap("Comm2StationName", "/instrumentation/comm[1]/station-name"); + obj.addPropMap("Comm2StationType", "/instrumentation/comm[1]/station-type"); + obj.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume"); + obj.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable"); + + obj.addPropMap("CommSelected", "/instrumentation/com-selected"); + + obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz"); + obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz"); + obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id"); + obj.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume"); + obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn"); + obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable"); + + obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz"); + obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz"); + obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id"); + obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume"); + obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn"); + obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable"); + + obj.addPropMap("NavSelected", "/instrumentation/nav-selected"); + + + return obj; + }, +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/PropertyUpdater.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/PropertyUpdater.nas index 12984f8be..5a01fa38b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/PropertyUpdater.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/PropertyUpdater.nas @@ -8,7 +8,6 @@ var PropertyUpdater = { - PropMap : { new : func(name, property) { @@ -18,35 +17,44 @@ var PropertyUpdater = return obj; }, - getName : func() { return me._name; }, - getValue : func() { return me._prop.getValue(); }, + getName : func() { return me._name; }, + getValue : func() { return me._prop.getValue(); }, + setValue : func(val) { me._prop.setValue(val); }, }, - new : func (device, notificationType, eventID, transmitter = nil) { + new : func (device, notificationType, eventID) { var obj = { - parents : [ Interface ], + parents : [ PropertyUpdater ], _device : device, _notificationType : notificationType, - _transmitter : transmitter, - _recipient : recipient, + _eventID : eventID, + _recipient : nil, + _transmitter : nil, + _registered : 0, _propmaps : {}, }; - if (obj._transmitter == nil) obj._transmitter = emesary.GlobalTransmitter; + obj._transmitter = emesary.GlobalTransmitter; return obj; }, addPropMap : func(name, prop) { - me._propmaps[name] = PropertyPublisher.PropMap.new(name, prop); + me._propmaps[name] = PropertyUpdater.PropMap.new(name, prop); }, - handleNotificationEvent : func(eventParameter) { + handleNotificationEvent : func(eventParameters) { var retval = emesary.Transmitter.ReceiptStatus_NotProcessed; foreach(var name; keys(eventParameters)) { + var value = eventParameters[name]; if (me._propmaps[name] != nil) { - me._propmaps[name].setValue(eventParameters[name]) + if (me._propmaps[name].getValue() != value) { + # Only update on a true change. Otherwise if there is a Publisher + # on this property, we risk creating a never ending loop between + # the Publisher and this Updater + me._propmaps[name].setValue(value); + } retval = emesary.Transmitter.ReceiptStatus_OK; } } @@ -57,30 +65,30 @@ var PropertyUpdater = RegisterWithEmesary : func(){ if (me._recipient == nil){ - me._recipient = emesary.Recipient.new("PropertyUpdater_" ~ me._page.device.designation); + me._recipient = emesary.Recipient.new("PropertyUpdater"); var pfd_obj = me._device; + var notificationtype = me._notificationType; + var eventID = me._eventID; var controller = me; me._recipient.Receive = func(notification) { if (notification.Device_Id == pfd_obj.device_id - and notification.NotificationType == me._notificationType) { - if (notification.Event_Id == me._eventID + and notification.NotificationType == notificationtype) { + if (notification.Event_Id == eventID and notification.EventParameter != nil) { - return me.handleNotificationEvent(notification.EventParameter); + return controller.handleNotificationEvent(notification.EventParameter); } } return emesary.Transmitter.ReceiptStatus_NotProcessed; }; } - transmitter.Register(me._recipient); - me.transmitter = transmitter; + me._transmitter.Register(me._recipient); + me._registered = 1; }, 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; + if (me._registered == 1) me._transmitter.DeRegister(me._recipient); + me._registered = 0; }, start : func() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas index 31dc5594d..d14a31e7b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfo.nas @@ -10,37 +10,7 @@ var IntersectionInfo = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.IntersectionInfoController.new(obj, svg); @@ -63,4 +33,11 @@ var IntersectionInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas index c119c0606..1b58f248d 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/IntersectionInfo/IntersectionInfoController.nas @@ -4,7 +4,7 @@ var IntersectionInfoController = new : func (page, svg) { var obj = { - parents : [ IntersectionInfoController ], + parents : [ IntersectionInfoController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var IntersectionInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var IntersectionInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var IntersectionInfoController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas index fd5c8091a..6f6470383 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFD.nas @@ -18,7 +18,7 @@ var MFDPages = [ "TrafficMap", "Stormscope", "WeatherDataLink", - "TAWS", + "TAWSB", "AirportInfo", "AirportDirectory", "AirportDeparture", @@ -103,7 +103,7 @@ var MFD = # Controller for the header and display on the bottom left which allows selection # of page groups and individual pages using the FMS controller. obj.Surround = fg1000.Surround.new(obj, myCanvas, obj._MFDDevice, obj._svg); - obj._pageGroupController = obj.Surround.controller; + obj.SurroundController = obj.Surround.controller; # Engine Information System. A special case as it's always displayed on the MFD. obj.EIS = obj.Surround.addPage("EIS", fg1000.EIS.new(obj, myCanvas, obj._MFDDevice, obj._svg)); @@ -139,11 +139,14 @@ var MFD = return obj; }, + getDevice : func () { + return me._MFDDevice; + }, del: func() { me._MFDDevice.current_page.offdisplay(); me._MFDDevice.DeRegisterWithEmesary(); - me._pageGroupController.del(); + me.SurroundController.del(); }, setPageTitle: func(title) diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPageController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPageController.nas index 8ef19b4a0..3d803bf33 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPageController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPageController.nas @@ -22,12 +22,13 @@ new : func (page) # Default handlers for all the Fascia hardkeys. These should be over-ridden # as required by specific page function. -handleNavVol : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleNavVolToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleNavFreqTransfer : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleNavOuter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleNavInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, +# +handleNavVol : func (value) { return me.page.mfd.SurroundController.handleNavVol(value); }, +handleNavVolToggle : func (value) { return me.page.mfd.SurroundController.handleNavVolToggle(value); }, +handleNavFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleNavFreqTransfer(value); }, +handleNavOuter : func (value) { return me.page.mfd.SurroundController.handleNavOuter(value); }, +handleNavInner : func (value) { return me.page.mfd.SurroundController.handleNavInner(value); }, +handleNavToggle : func (value) { return me.page.mfd.SurroundController.handleNavToggle(value); }, handleHeading : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, handleHeadingPress : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, @@ -41,15 +42,15 @@ handleBaro : func (value) { return emesary.Transmitter.ReceiptStatus_NotPro handleCRS : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, handleCRSCenter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleComOuter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleComInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleComToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, +handleComOuter : func (value) { return me.page.mfd.SurroundController.handleComOuter(value); }, +handleComInner : func (value) { return me.page.mfd.SurroundController.handleComInner(value); }, +handleComToggle : func (value) { return me.page.mfd.SurroundController.handleComToggle(value); }, -handleFreqTransfer : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleFreqTransferHold : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Auto-tunes to 121.2 when pressed for 2 seconds +handleComFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleComFreqTransfer(value); }, +handleComFreqTransferHold : func (value) { return me.page.mfd.SurroundController.handleComFreqTransferHold(value); }, # Auto-tunes to 121.2 when pressed for 2 seconds -handleComVol : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, -handleComVolToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },, +handleComVol : func (value) { return me.page.mfd.SurroundController.handleComVol(value); }, +handleComVolToggle : func (value) { return me.page.mfd.SurroundController.handleComVolToggle(value); }, handleDTO : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, handleFPL : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, @@ -57,8 +58,8 @@ handleClear : func (value) { return emesary.Transmitter.ReceiptStatus_NotPro handleClearHold : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # By default, the FMS knobs will select a new page. -handleFMSOuter : func (value) { return me.page.mfd._pageGroupController.handleFMSOuter(value); }, -handleFMSOuter : func (value) { return me.page.mfd._pageGroupController.handleFMSInner(value); }, +handleFMSOuter : func (value) { return me.page.mfd.SurroundController.handleFMSOuter(value); }, +handleFMSInner : func (value) { return me.page.mfd.SurroundController.handleFMSInner(value); }, handleCRSR : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, handleMenu : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, @@ -71,8 +72,8 @@ handleAltInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProc RegisterWithEmesary : func() { if (me._recipient == nil){ - me._recipient = emesary.Recipient.new(me.page.pageName ~ "Controller_" ~ me.page.device.designation); - var pfd_obj = me.page.device; + me._recipient = emesary.Recipient.new(me._page.pageName ~ "Controller_" ~ me._page.device.designation); + var pfd_obj = me._page.device; var controller = me; me._recipient.Receive = func(notification) { @@ -91,7 +92,7 @@ RegisterWithEmesary : func() if (id == fg1000.FASCIA.NAV_FREQ_TRANSFER) return controller.handleNavFreqTransfer(value); if (id == fg1000.FASCIA.NAV_OUTER) return controller.handleNavOuter(value); if (id == fg1000.FASCIA.NAV_INNER) return controller.handleNavInner(value); - if (id == fg1000.FASCIA.NAV_TOGGLE) return controller.handleToggle(value); + if (id == fg1000.FASCIA.NAV_TOGGLE) return controller.handleNavToggle(value); if (id == fg1000.FASCIA.HEADING) return controller.handleHeading(value); if (id == fg1000.FASCIA.HEADING_PRESS) return controller.handleHeadingPress(value); @@ -109,8 +110,8 @@ RegisterWithEmesary : func() if (id == fg1000.FASCIA.COM_INNER) return controller.handleComInner(value); if (id == fg1000.FASCIA.COM_TOGGLE) return controller.handleComToggle(value); - if (id == fg1000.FASCIA.COM_FREQ_TRANSFER) return controller.handleFreqTransfer(value); - if (id == fg1000.FASCIA.COM_FREQ_TRANSFER_HOLD) return controller.handleFreqTransferHold(value); # Auto-tunes to 121.2 when pressed for 2 seconds + if (id == fg1000.FASCIA.COM_FREQ_TRANSFER) return controller.handleComFreqTransfer(value); + if (id == fg1000.FASCIA.COM_FREQ_TRANSFER_HOLD) return controller.handleComFreqTransferHold(value); # Auto-tunes to 121.2 when pressed for 2 seconds if (id == fg1000.FASCIA.COM_VOL) return controller.handleComVol(value); if (id == fg1000.FASCIA.COM_VOL_TOGGLE) return controller.handleComVolToggle(value); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas index 29776992c..c0b17c46f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfo.nas @@ -10,37 +10,7 @@ var NDBInfo = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NDBInfoController.new(obj, svg); @@ -63,4 +33,11 @@ var NDBInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas index 20dfc8609..aacc4e9ea 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NDBInfo/NDBInfoController.nas @@ -4,7 +4,7 @@ var NDBInfoController = new : func (page, svg) { var obj = { - parents : [ NDBInfoController ], + parents : [ NDBInfoController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NDBInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NDBInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NDBInfoController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NavigationMap/NavigationMapController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NavigationMap/NavigationMapController.nas index f72d721c2..9355ed6ab 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NavigationMap/NavigationMapController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NavigationMap/NavigationMapController.nas @@ -165,18 +165,6 @@ var NavigationMapController = 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); - }, handleRange : func(val) { var incr_or_decr = (val > 0) ? 1 : -1; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas index 3650d0896..133d6a791 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas @@ -124,7 +124,7 @@ var NearestAirportsController = return emesary.Transmitter.ReceiptStatus_Finished; } else { - return me.page.mfd._pageGroupController.handleFMSInner(value); + return me.page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -144,7 +144,7 @@ var NearestAirportsController = return emesary.Transmitter.ReceiptStatus_Finished; } else { - return me.page.mfd._pageGroupController.handleFMSOuter(value); + return me.page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas index 93b3fe0b5..8d23f4657 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspaces.nas @@ -10,37 +10,7 @@ var NearestAirspaces = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestAirspacesController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestAirspaces = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas index 420966e7c..00e897574 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirspaces/NearestAirspacesController.nas @@ -4,7 +4,7 @@ var NearestAirspacesController = new : func (page, svg) { var obj = { - parents : [ NearestAirspacesController ], + parents : [ NearestAirspacesController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestAirspacesController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestAirspacesController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestAirspacesController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas index 2b884e648..6fe93fb27 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequencies.nas @@ -10,37 +10,7 @@ var NearestFrequencies = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestFrequenciesController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestFrequencies = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas index cf62534cc..9ca43e327 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestFrequencies/NearestFrequenciesController.nas @@ -4,7 +4,7 @@ var NearestFrequenciesController = new : func (page, svg) { var obj = { - parents : [ NearestFrequenciesController ], + parents : [ NearestFrequenciesController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestFrequenciesController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestFrequenciesController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestFrequenciesController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas index b34da927c..8cc203b35 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersections.nas @@ -10,37 +10,7 @@ var NearestIntersections = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestIntersectionsController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestIntersections = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas index d1611a18b..8d73e13bf 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestIntersections/NearestIntersectionsController.nas @@ -4,7 +4,7 @@ var NearestIntersectionsController = new : func (page, svg) { var obj = { - parents : [ NearestIntersectionsController ], + parents : [ NearestIntersectionsController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestIntersectionsController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestIntersectionsController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestIntersectionsController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas index 7997616d1..1d5defba2 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDB.nas @@ -10,37 +10,7 @@ var NearestNDB = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestNDBController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestNDB = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas index 0f3bede9c..e3c8ab994 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestNDB/NearestNDBController.nas @@ -4,7 +4,7 @@ var NearestNDBController = new : func (page, svg) { var obj = { - parents : [ NearestNDBController ], + parents : [ NearestNDBController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestNDBController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestNDBController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestNDBController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas index 8261c2d9b..00c1d617f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPT.nas @@ -10,37 +10,7 @@ var NearestUserWPT = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestUserWPTController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestUserWPT = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas index 7acb48935..9df82b98c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestUserWPT/NearestUserWPTController.nas @@ -4,7 +4,7 @@ var NearestUserWPTController = new : func (page, svg) { var obj = { - parents : [ NearestUserWPTController ], + parents : [ NearestUserWPTController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestUserWPTController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestUserWPTController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestUserWPTController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas index 936b3cedc..62aed5fad 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVOR.nas @@ -10,37 +10,7 @@ var NearestVOR = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.NearestVORController.new(obj, svg); @@ -63,4 +33,11 @@ var NearestVOR = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas index 2f9c624c8..5e5b5fd7c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestVOR/NearestVORController.nas @@ -4,7 +4,7 @@ var NearestVORController = new : func (page, svg) { var obj = { - parents : [ NearestVORController ], + parents : [ NearestVORController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var NearestVORController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var NearestVORController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var NearestVORController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas index 2a3b4b12e..af3197424 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlan.nas @@ -10,37 +10,7 @@ var StoredFlightPlan = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.StoredFlightPlanController.new(obj, svg); @@ -63,4 +33,11 @@ var StoredFlightPlan = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas index b41745a61..9218c9d19 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/StoredFlightPlan/StoredFlightPlanController.nas @@ -4,7 +4,7 @@ var StoredFlightPlanController = new : func (page, svg) { var obj = { - parents : [ StoredFlightPlanController ], + parents : [ StoredFlightPlanController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var StoredFlightPlanController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var StoredFlightPlanController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var StoredFlightPlanController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas index 929aec76a..58cdd3e5f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/Stormscope.nas @@ -10,37 +10,7 @@ var Stormscope = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.StormscopeController.new(obj, svg); @@ -63,4 +33,11 @@ var Stormscope = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas index 0e5f17738..fe8802861 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Stormscope/StormscopeController.nas @@ -4,7 +4,7 @@ var StormscopeController = new : func (page, svg) { var obj = { - parents : [ StormscopeController ], + parents : [ StormscopeController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var StormscopeController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var StormscopeController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var StormscopeController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/Surround.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/Surround.nas index c4edd0ebf..dd569e05f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/Surround.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/Surround.nas @@ -174,6 +174,10 @@ var Surround = if (name == "Nav1ID") me.setTextElement("Nav1ID", val); if (name == "Nav2ID") me.setTextElement("Nav2ID", val); + # TODO - COM Volume - display the current volume for 2 seconds in place of the + # standby frequency. + + } }, diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas index b51b713e8..2ab2653a6 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas @@ -7,8 +7,20 @@ var SurroundController = parents : [ SurroundController ], _recipient : nil, _page : page, + _comselected : 1, + _navselected : 1, + _com1active : 0.0, + _com1standby : 0.0, + _com2active : 0.0, + _com2standby : 0.0, + _nav1active : 0.0, + _nav1standby : 0.0, + _nav2active : 0.0, + _nav2standby : 0.0, }; + + obj.RegisterWithEmesary(); return obj; }, @@ -17,12 +29,297 @@ var SurroundController = me.DeRegisterWithEmesary(); }, - handleNavComData : func(values) { - # pass straight through the to page - we have nothing to do. - me._page.handleNavComData(values); + # Helper function to notify the Emesary bridge of a NavComData update. + sendNavComDataNotification : func(data) { + var notification = notifications.PFDEventNotification.new( + "MFD", + 1, + notifications.PFDEventNotification.NavComData, + data); + + me.transmitter.NotifyAll(notification); + }, + + handleNavComData : func(data) { + + # Store off particularly important data for control. + if (data["CommSelected"] != nil) me._comselected = data["CommSelected"]; + if (data["NavSelected"] != nil) me._navselected = data["NavSelected"]; + + if (data["Comm1SelectedFreq"] != nil) me._com1active = data["Comm1SelectedFreq"]; + if (data["Comm1StandbyFreq"] != nil) me._com1standby = data["Comm1StandbyFreq"]; + if (data["Comm2SelectedFreq"] != nil) me._com2active = data["Comm2SelectedFreq"]; + if (data["Comm2StandbyFreq"] != nil) me._com2standby = data["Comm2StandbyFreq"]; + + if (data["Nav1SelectedFreq"] != nil) me._nav1active = data["Nav1SelectedFreq"]; + if (data["Nav1StandbyFreq"] != nil) me._nav1standby = data["Nav1StandbyFreq"]; + if (data["Nav2SelectedFreq"] != nil) me._nav2active = data["Nav2SelectedFreq"]; + if (data["Nav2StandbyFreq"] != nil) me._nav2standby = data["Nav2StandbyFreq"]; + + # pass through to the page + me._page.handleNavComData(data); return emesary.Transmitter.ReceiptStatus_OK; }, + + # + # Handle the various COM and NAV controls at the top left and top right of the Fascia + # + handleNavVol : func (value) { + var data={}; + + if (me._navselected == 1) { + data["Nav1Volume"] = value; + } else { + data["Nav2Volume"] = value; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + handleNavVolToggle : func (value) { + var data={}; + + if (me._navselected == 1) { + data["Nav1AudioID"] = value; + } else { + data["Nav1AudioID"] = value; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Swap active and standby Nav frequencies. Note that we don't update internal state here - we + # instead pass updated NavComData notification data which will be picked up by the underlying + # updaters to map to properties, and this controller itself. + handleNavFreqTransfer : func (value) + { + var data={}; + + if (me._navselected == 1) { + data["Nav1SelectedFreq"] = me._nav1standby; + data["Nav1StandbyFreq"] = me._nav1active; + } else { + data["Nav2SelectedFreq"] = me._nav2standby; + data["Nav2StandbyFreq"] = me._nav2active; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Outer Nav dial updates the integer portion of the selected standby + # NAV frequency only, and wrap on limits - leaving the fractional part unchanged. + handleNavOuter : func (value) { + var incr_or_decr = (value > 0) ? 1000.0 : -1000.0; + var data={}; + + # Determine the new value, wrapping within the limits. + var datakey = ""; + var freq = 0; + var old_freq = 0; + + if (me._navselected == 1) { + datakey = "Nav1StandbyFreq"; + old_freq = me._nav1standby; + } else { + datakey = "Nav2StandbyFreq"; + old_freq = me._nav2standby; + } + + old_freq = math.round(old_freq * 1000); + freq = old_freq + incr_or_decr; + + # Wrap if out of bounds + if (freq > (fg1000.MAX_NAV_FREQ * 1000)) freq = freq - (fg1000.MAX_NAV_FREQ - fg1000.MIN_NAV_FREQ) * 1000; + if (freq < (fg1000.MIN_NAV_FREQ * 1000)) freq = freq + (fg1000.MAX_NAV_FREQ - fg1000.MIN_NAV_FREQ) * 1000; + + # Convert back to a frequency to 3 decimal places. + data[datakey] = sprintf("%.3f", freq/1000.0); + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Inner Nav dial updates the fractional portion of the selected standby + # NAV frequency only - leaving the integer part unchanged. Even if it + # increments past 0.975. + handleNavInner : func (value) { + var incr_or_decr = (value > 0) ? 25 : -25; + var data={}; + + # Determine the new value, wrapping within the limits. + var datakey = ""; + var freq = 0; + var old_freq = 0; + if (me._navselected == 1) { + datakey = "Nav1StandbyFreq"; + old_freq = me._nav1standby; + } else { + datakey = "Nav2StandbyFreq"; + old_freq = me._nav2standby; + } + + old_freq = math.round(old_freq * 1000); + freq = old_freq + incr_or_decr; + + # Wrap on decimal by handling case where the integer part has changed + if (int(old_freq/1000) < int(freq/1000)) freq = freq - 1000; + if (int(old_freq/1000) > int(freq/1000)) freq = freq + 1000; + + data[datakey] = sprintf("%.3f", freq/1000.0); + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Switch between Nav1 and Nav2. + handleNavToggle : func (value) + { + var data={}; + + if (me._navselected == 1) { + data["NavSelected"] = 2; + } else { + data["NavSelected"] = 1; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Outer COM dial changes the integer value of the standby selected COM + # frequency, wrapping on limits. Leaves the fractional part unchanged + handleComOuter : func (value) { + var incr_or_decr = (value > 0) ? 1000.0 : -1000.0; + var data={}; + + # Determine the new value, wrapping within the limits. + var datakey = ""; + var freq = 0; + var old_freq = 0; + + if (me._comselected == 1) { + datakey = "Comm1StandbyFreq"; + old_freq = me._com1standby; + } else { + datakey = "Comm2StandbyFreq"; + old_freq = me._com2standby; + } + + old_freq = math.round(old_freq * 1000); + freq = old_freq + incr_or_decr; + + # Wrap if out of bounds + if (freq > (fg1000.MAX_COM_FREQ * 1000)) freq = freq - (fg1000.MAX_COM_FREQ - fg1000.MIN_COM_FREQ) * 1000; + if (freq < (fg1000.MIN_COM_FREQ * 1000)) freq = freq + (fg1000.MAX_COM_FREQ - fg1000.MIN_COM_FREQ) * 1000; + + # Convert back to a frequency to 3 decimal places. + data[datakey] = sprintf("%.3f", freq/1000.0); + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Inner COM dial changes the fractional part of the standby selected COM frequency, + # wrapping on limits and leaving the integer part unchanged. + handleComInner : func (value) { + var incr_or_decr = (value > 0) ? 1 : -1; + var data={}; + + var datakey = ""; + var freq = 0; + var old_freq = 0; + if (me._comselected == 1) { + datakey = "Comm1StandbyFreq"; + old_freq = me._com1standby; + } else { + datakey = "Comm2StandbyFreq"; + old_freq = me._com2standby; + } + + old_freq = math.round(old_freq * 1000); + var integer_part = int(old_freq / 1000) * 1000; + var fractional_part = old_freq - integer_part; + + # 8.33kHz frequencies are complicated - we need to do a lookup to find + # the current and next frequencies + var idx = 0; + for (var i=0; i < size(fg1000.COM_833_SPACING); i = i + 1) { + if (math.round(fg1000.COM_833_SPACING[i] * 1000) == fractional_part) { + idx = i; + break; + } + } + + idx = math.mod(idx + incr_or_decr, size(fg1000.COM_833_SPACING)); + freq = integer_part + fg1000.COM_833_SPACING[idx] * 1000; + data[datakey] = sprintf("%.3f", freq/1000.0); + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Switch between COM1 and COM2 + handleComToggle : func (value) { + var data={}; + + if (me._comselected == 1) { + data["CommSelected"] = 2; + } else { + data["CommSelected"] = 1; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Swap active and standby Com frequencies. Note that we don't update internal state here - we + # instead pass updated NavComData notification data which will be picked up by the underlying + # updaters to map to properties, and this controller itself. + handleComFreqTransfer : func (value) { + var data={}; + + if (me._comselected == 1) { + data["Comm1SelectedFreq"] = me._com1standby; + data["Comm1StandbyFreq"] = me._com1active; + } else { + data["Comm2SelectedFreq"] = me._com2standby; + data["Comm2StandbyFreq"] = me._com2active; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + # Auto-tunes the ACTIVE COM channel to 121.2 when pressed for 2 seconds + handleComFreqTransferHold : func (value) { + var data={}; + + if (me._comselected == 1) { + data["Comm1SelectedFreq"] = 121.00; + } else { + data["Comm2SelectedFreq"] = 121.00; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + handleComVol : func (value) { + var data={}; + + if (me._comselected == 1) { + data["Comm1Volume"] = value; + } else { + data["Comm2Volume"] = value; + } + + me.sendNavComDataNotification(data); + return emesary.Transmitter.ReceiptStatus_Finished; + }, + + handleComVolToggle : func (value) { + }, + # These methods are slightly unusual in that they are called by other # controllers when the CRSR is not active. Hence they aren't referenced # in the RegisterWithEmesary call below. diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas index 5833274bf..ba54d12cf 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatus.nas @@ -10,37 +10,7 @@ var SystemStatus = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.SystemStatusController.new(obj, svg); @@ -63,4 +33,11 @@ var SystemStatus = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas index 3825e12a1..8c4ff9e78 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/SystemStatus/SystemStatusController.nas @@ -4,7 +4,7 @@ var SystemStatusController = new : func (page, svg) { var obj = { - parents : [ SystemStatusController ], + parents : [ SystemStatusController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var SystemStatusController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var SystemStatusController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var SystemStatusController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas deleted file mode 100644 index f57fc23da..000000000 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWS.nas +++ /dev/null @@ -1,66 +0,0 @@ -# TAWS -var TAWS = -{ - new : func (mfd, myCanvas, device, svg) - { - var obj = { - parents : [ - TAWS, - MFDPage.new(mfd, myCanvas, device, svg, "TAWS", "MAP - TAWS") - ], - }; - - 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); - - obj.controller = fg1000.TAWSController.new(obj, svg); - - 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(); - }, -}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas deleted file mode 100644 index 8bf714687..000000000 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSController.nas +++ /dev/null @@ -1,95 +0,0 @@ -# TAWS Controller -var TAWSController = -{ - new : func (page, svg) - { - var obj = { - parents : [ TAWSController ], - _crsrToggle : 0, - _recipient : nil, - _page : page, - }; - - return obj; - }, - - - # Input Handling - handleCRSR : func() { - me._crsrToggle = (! me._crsrToggle); - if (me._crsrToggle) { - } else { - me._page.hideCRSR(); - } - return emesary.Transmitter.ReceiptStatus_Finished; - }, - handleFMSInner : func(value) { - if (me._crsrToggle == 1) { - # Scroll through whatever is the current list - return emesary.Transmitter.ReceiptStatus_Finished; - } else { - # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); - } - }, - handleFMSOuter : func(value) { - if (me._crsrToggle == 1) { - return emesary.Transmitter.ReceiptStatus_Finished; - } else { - # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); - } - }, - handleEnter : func(value) { - if (me._crsrToggle == 1) { - return emesary.Transmitter.ReceiptStatus_Finished; - } else { - return emesary.Transmitter.ReceiptStatus_NotProcessed; - } - }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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/TAWSB/TAWSB.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSB.nas new file mode 100644 index 000000000..83b62b2e8 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSB.nas @@ -0,0 +1,43 @@ +# TAWSB +var TAWSB = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + parents : [ + TAWSB, + MFDPage.new(mfd, myCanvas, device, svg, "TAWSB", "MAP - TAWS") + ], + }; + + obj.topMenu(device, obj, nil); + + obj.controller = fg1000.TAWSBController.new(obj, svg); + + 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(); + }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBController.nas new file mode 100644 index 000000000..d8e6b342d --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBController.nas @@ -0,0 +1,59 @@ +# TAWSB Controller +var TAWSBController = +{ + new : func (page, svg) + { + var obj = { + parents : [ TAWSBController, MFDPageController.new(page) ], + _crsrToggle : 0, + _recipient : nil, + _page : page, + }; + + return obj; + }, + + + # Input Handling + handleCRSR : func() { + me._crsrToggle = (! me._crsrToggle); + if (me._crsrToggle) { + } else { + me._page.hideCRSR(); + } + return emesary.Transmitter.ReceiptStatus_Finished; + }, + handleFMSInner : func(value) { + if (me._crsrToggle == 1) { + # Scroll through whatever is the current list + return emesary.Transmitter.ReceiptStatus_Finished; + } else { + # Pass to the page group controller to display and scroll through the page group menu + return me._page.mfd.SurroundController.handleFMSInner(value); + } + }, + handleFMSOuter : func(value) { + if (me._crsrToggle == 1) { + return emesary.Transmitter.ReceiptStatus_Finished; + } else { + # Pass to the page group controller to display and scroll through the page group menu + return me._page.mfd.SurroundController.handleFMSOuter(value); + } + }, + handleEnter : func(value) { + if (me._crsrToggle == 1) { + return emesary.Transmitter.ReceiptStatus_Finished; + } else { + return emesary.Transmitter.ReceiptStatus_NotProcessed; + } + }, + + # 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/TAWS/TAWSOptions.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBOptions.nas similarity index 82% rename from Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas rename to Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBOptions.nas index 2cafd352a..c16d85b01 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSOptions.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBOptions.nas @@ -1,8 +1,8 @@ -# TAWS Options -var TAWSOptions = +# TAWSB Options +var TAWSBOptions = { new : func() { - var obj = { parents : [TAWSOptions] }; + var obj = { parents : [TAWSBOptions] }; obj.Options= {}; obj.loadOptions(); return obj; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBStyles.nas similarity index 82% rename from Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas rename to Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBStyles.nas index 55c54ffea..5ef6a607f 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TAWS/TAWSStyles.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TAWSB/TAWSBStyles.nas @@ -1,8 +1,8 @@ -# TAWS Styles -var TAWSStyles = +# TAWSB Styles +var TAWSBStyles = { new : func() { - var obj = { parents : [ TAWSStyles ]}; + var obj = { parents : [ TAWSBStyles ]}; obj.Styles = {}; obj.loadStyles(); return obj; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas index 19ed6a477..af57ec70e 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/Controller.nas @@ -4,7 +4,7 @@ var TemplateController = new : func (page, svg) { var obj = { - parents : [ TemplateController ], + parents : [ TemplateController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var TemplateController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var TemplateController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var TemplateController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas index fc949c7ba..0d882ec8b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TemplatePage/TemplatePage.nas @@ -10,37 +10,7 @@ var Template = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.TemplateController.new(obj, svg); @@ -63,4 +33,11 @@ var Template = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas index 69f45b9ff..42bcbdab9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanning.nas @@ -10,37 +10,7 @@ var TripPlanning = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.TripPlanningController.new(obj, svg); @@ -63,4 +33,11 @@ var TripPlanning = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas index 2dd24617e..d6b2baee8 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/TripPlanning/TripPlanningController.nas @@ -4,7 +4,7 @@ var TripPlanningController = new : func (page, svg) { var obj = { - parents : [ TripPlanningController ], + parents : [ TripPlanningController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var TripPlanningController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var TripPlanningController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var TripPlanningController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas index 157f0ea0f..7632fe547 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfo.nas @@ -10,37 +10,7 @@ var UserWPTInfo = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.UserWPTInfoController.new(obj, svg); @@ -63,4 +33,11 @@ var UserWPTInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas index 1860c7f19..e1c4f0e47 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/UserWPTInfo/UserWPTInfoController.nas @@ -4,7 +4,7 @@ var UserWPTInfoController = new : func (page, svg) { var obj = { - parents : [ UserWPTInfoController ], + parents : [ UserWPTInfoController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var UserWPTInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var UserWPTInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var UserWPTInfoController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas index c07c4f259..d4751dce1 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/Utility.nas @@ -10,37 +10,7 @@ var Utility = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.UtilityController.new(obj, svg); @@ -63,4 +33,11 @@ var Utility = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas index 1f9220015..0288ada9b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Utility/UtilityController.nas @@ -4,7 +4,7 @@ var UtilityController = new : func (page, svg) { var obj = { - parents : [ UtilityController ], + parents : [ UtilityController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var UtilityController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var UtilityController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var UtilityController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas index 3a0f98225..4c672ac61 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfo.nas @@ -10,37 +10,7 @@ var VORInfo = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.VORInfoController.new(obj, svg); @@ -63,4 +33,11 @@ var VORInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas index 17b3adbb4..beb32f499 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/VORInfo/VORInfoController.nas @@ -4,7 +4,7 @@ var VORInfoController = new : func (page, svg) { var obj = { - parents : [ VORInfoController ], + parents : [ VORInfoController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var VORInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var VORInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var VORInfoController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas index bf9b68aae..85cd318f1 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLink.nas @@ -10,37 +10,7 @@ var WeatherDataLink = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.WeatherDataLinkController.new(obj, svg); @@ -63,4 +33,11 @@ var WeatherDataLink = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas index 977ae9e33..90caba330 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/WeatherDataLink/WeatherDataLinkController.nas @@ -4,7 +4,7 @@ var WeatherDataLinkController = new : func (page, svg) { var obj = { - parents : [ WeatherDataLinkController ], + parents : [ WeatherDataLinkController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var WeatherDataLinkController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var WeatherDataLinkController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var WeatherDataLinkController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas index 4ec564c66..1c6e4d683 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfo.nas @@ -10,37 +10,7 @@ var XMInfo = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.XMInfoController.new(obj, svg); @@ -63,4 +33,11 @@ var XMInfo = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas index 765eb4a00..22bb551d9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMInfo/XMInfoController.nas @@ -4,7 +4,7 @@ var XMInfoController = new : func (page, svg) { var obj = { - parents : [ XMInfoController ], + parents : [ XMInfoController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var XMInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var XMInfoController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var XMInfoController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas index 26c514678..dffc59527 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadio.nas @@ -10,37 +10,7 @@ var XMRadio = ], }; - 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); + obj.topMenu(device, obj, nil); obj.controller = fg1000.XMRadioController.new(obj, svg); @@ -63,4 +33,11 @@ var XMRadio = me.mfd.setPageTitle(me.title); me.controller.ondisplay(); }, + topMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + device.updateMenus(); + }, + + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas index 08f6b19ad..4ea3c348e 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/XMRadio/XMRadioController.nas @@ -4,7 +4,7 @@ var XMRadioController = new : func (page, svg) { var obj = { - parents : [ XMRadioController ], + parents : [ XMRadioController, MFDPageController.new(page) ], _crsrToggle : 0, _recipient : nil, _page : page, @@ -29,7 +29,7 @@ var XMRadioController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSInner(value); + return me._page.mfd.SurroundController.handleFMSInner(value); } }, handleFMSOuter : func(value) { @@ -37,7 +37,7 @@ var XMRadioController = return emesary.Transmitter.ReceiptStatus_Finished; } else { # Pass to the page group controller to display and scroll through the page group menu - return me._page.mfd._pageGroupController.handleFMSOuter(value); + return me._page.mfd.SurroundController.handleFMSOuter(value); } }, handleEnter : func(value) { @@ -47,42 +47,6 @@ var XMRadioController = return emesary.Transmitter.ReceiptStatus_NotProcessed; } }, - 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.FASCIA.FMS_CRSR) return controller.handleCRSR(); - if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value); - if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value); - if (id == fg1000.FASCIA.ENT) return controller.handleEnter(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() { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/constants.nas b/Aircraft/Instruments-3d/FG1000/Nasal/constants.nas index e54cee974..f42339b14 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/constants.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/constants.nas @@ -36,10 +36,43 @@ var MAP_PARTIAL = { Y : ((DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT) / 2 + HEADER_HEIGHT), }, }; +# Frequency limits. We're assuming we're on 8.33kHz +var MIN_COM_FREQ = 118.000; +var MAX_COM_FREQ = 137.000; + +var COM_833_SPACING = [ +0.000, 0.005, 0.010, 0.015, 0.025, 0.030, 0.035, 0.040, 0.050, 0.055, 0.060, 0.065, 0.075, 0.080, 0.085, 0.090, +0.100, 0.105, 0.110, 0.115, 0.125, 0.130, 0.135, 0.140, 0.150, 0.155, 0.160, 0.165, 0.175, 0.180, 0.185, 0.190, +0.200, 0.205, 0.210, 0.215, 0.225, 0.230, 0.235, 0.240, 0.250, 0.255, 0.260, 0.265, 0.275, 0.280, 0.285, 0.290, +0.300, 0.305, 0.310, 0.315, 0.325, 0.330, 0.335, 0.340, 0.350, 0.355, 0.360, 0.365, 0.375, 0.380, 0.385, 0.390, +0.400, 0.405, 0.410, 0.415, 0.425, 0.430, 0.435, 0.440, 0.450, 0.455, 0.460, 0.465, 0.475, 0.480, 0.485, 0.490, +0.500, 0.505, 0.510, 0.515, 0.525, 0.530, 0.535, 0.540, 0.550, 0.555, 0.560, 0.565, 0.575, 0.580, 0.585, 0.590, +0.600, 0.605, 0.610, 0.615, 0.625, 0.630, 0.635, 0.640, 0.650, 0.655, 0.660, 0.665, 0.675, 0.680, 0.685, 0.690, +0.700, 0.705, 0.710, 0.715, 0.725, 0.730, 0.735, 0.740, 0.750, 0.755, 0.760, 0.765, 0.775, 0.780, 0.785, 0.790, +0.800, 0.805, 0.810, 0.815, 0.825, 0.830, 0.835, 0.840, 0.850, 0.855, 0.860, 0.865, 0.875, 0.880, 0.885, 0.890, +0.900, 0.905, 0.910, 0.915, 0.925, 0.930, 0.935, 0.940, 0.950, 0.955, 0.960, 0.965, 0.975, 0.980, 0.985, 0.990, +]; + +var NAV_SPACING = [ +0.000, 0.025, 0.050, 0.075, +0.100, 0.125, 0.150, 0.175, +0.200, 0.225, 0.250, 0.275, +0.300, 0.325, 0.350, 0.375, +0.400, 0.425, 0.450, 0.475, +0.500, 0.525, 0.550, 0.575, +0.600, 0.625, 0.650, 0.675, +0.700, 0.725, 0.750, 0.775, +0.800, 0.825, 0.850, 0.875, +0.900, 0.925, 0.950, 0.975, +]; + +var MIN_NAV_FREQ = 108.000; +var MAX_NAV_FREQ = 118.000; + # When the CRSR is selecting fields, this is the period for changing the # cursor color between normal and highlight (defined below) # Constants for the hard-buttons on the fascia -FASCIA = { +var FASCIA = { NAV_VOL : 0, NAV_VOL_TOGGLE : 1, NAV_FREQ_TRANSFER :2, diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl b/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl index 548ea36dd..e5266e04e 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl +++ b/Aircraft/Instruments-3d/FG1000/Nasal/createpgs.pl @@ -4,7 +4,7 @@ use warnings; my %pages = ("Stormscope" => "MAP - STORMSCOPE", "WeatherDataLink" => "MAP - WEATHER DATA LINK", -"TAWS" => "MAP - TAWS", +"TAWSB" => "MAP - TAWS", #"AirportInfo" => "WPT - AIRPORT INFORMATION", "AirportDirectory" => "WPT - AIRPORT DIRECTORY", "AirportDeparture" => "WPT - AIRPORT DEPARTURE INFORMATION", diff --git a/Nasal/canvas/map/VOR.lcontroller b/Nasal/canvas/map/VOR.lcontroller index ea6985bab..35656ab3a 100644 --- a/Nasal/canvas/map/VOR.lcontroller +++ b/Nasal/canvas/map/VOR.lcontroller @@ -22,7 +22,7 @@ var new = func(layer) { setsize(m.active_vors, size(m.navNs)); foreach (var navN; m.navNs) { append(m.listeners, setlistener( - navN.getNode("frequencies/selected-mhz"), + navN.getNode("frequencies/selected-mhz", 1), func m.changed_freq() )); } @@ -53,4 +53,3 @@ var changed_freq = func(update=1) { }; var searchCmd = NavaidSymbolLayer.make('vor'); - diff --git a/gui/dialogs/fg1000.xml b/gui/dialogs/fg1000.xml index 110d72fca..8bb0482e0 100644 --- a/gui/dialogs/fg1000.xml +++ b/gui/dialogs/fg1000.xml @@ -17,6 +17,7 @@ var mfd = nil; var eisPublisher = nil; var navcomPublisher = nil; + var navcomUpdater = nil; ]]> @@ -91,7 +94,7 @@