diff --git a/A320-main.xml b/A320-main.xml
index fa0faba6..6ef6ce7a 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -431,7 +431,7 @@
300.0
- 2019.2.0
+ 2019.1.2
@@ -1905,11 +1905,20 @@
Aircraft/A320-family/Nasal/FMGC/FCU.nas
+ Aircraft/A320-family/Nasal/FMGC/flightplan.nas
Aircraft/A320-family/Nasal/FMGC/FMGC.nas
Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas
Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas
+ Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas
+ Aircraft/A320-family/Nasal/MCDU/DIRTO.nas
+ Aircraft/A320-family/Nasal/MCDU/LATREV.nas
+ Aircraft/A320-family/Nasal/MCDU/VERTREV.nas
+ Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas
+ Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas
+ Aircraft/A320-family/Nasal/MCDU/HOLD.nas
+ Aircraft/A320-family/Nasal/MCDU/F-PLN.nas
Aircraft/A320-family/Nasal/MCDU/MCDU.nas
Aircraft/A320-family/Nasal/MCDU/INITA.nas
Aircraft/A320-family/Nasal/MCDU/INITB.nas
diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas
index a271a7d7..2c9acf91 100644
--- a/Models/Instruments/MCDU/MCDU.nas
+++ b/Models/Instruments/MCDU/MCDU.nas
@@ -6,11 +6,32 @@ var MCDU_1 = nil;
var MCDU_2 = nil;
var MCDU1_display = nil;
var MCDU2_display = nil;
+var myLatRev = [nil, nil];
+var myVertRev = [nil, nil];
+var myDeparture = [nil, nil];
+var myArrival = [nil, nil];
+var myFpln = [nil, nil];
+var myDirTo = [nil, nil];
+var myHold = [nil, nil];
+var myDuplicate = [nil, nil];
var default = "BoeingCDU-Large.ttf";
var symbol = "helvetica_medium.txf";
var normal = 70;
var small = 56;
var page = "";
+var fplnLineSize = 0;
+var fplnl1 = "";
+var fplnl1s = "";
+var fplnl2 = "";
+var fplnl2s = "";
+var fplnl3 = "";
+var fplnl3s = "";
+var fplnl4 = "";
+var fplnl4s = "";
+var fplnl5 = "";
+var fplnl5s = "";
+var fplnl6 = "";
+var fplnl6s = "";
setprop("MCDUC/colors/wht/r", 1);
setprop("MCDUC/colors/wht/g", 1);
setprop("MCDUC/colors/wht/b", 1);
@@ -26,78 +47,88 @@ setprop("MCDUC/colors/amb/b", 0.0000);
setprop("MCDUC/colors/yel/r", 0.9333);
setprop("MCDUC/colors/yel/g", 0.9333);
setprop("MCDUC/colors/yel/b", 0.0000);
+setprop("MCDUC/colors/mag/r", 0.6902);
+setprop("MCDUC/colors/mag/g", 0.3333);
+setprop("MCDUC/colors/mag/b", 0.7541);
+
+var WHITE = [1.0000,1.0000,1.0000];
+var GREEN = [0.0509,0.7529,0.2941];
+var BLUE = [0.0901,0.6039,0.7176];
+var AMBER = [0.7333,0.3803,0.0000];
+var YELLOW = [0.9333,0.9333,0.0000];
+var MAGENTA = [0.6902,0.3333,0.7541];
# Fetch nodes:
+var mcdu1_lgt = props.globals.getNode("/controls/lighting/DU/mcdu1", 1);
+var mcdu2_lgt = props.globals.getNode("/controls/lighting/DU/mcdu2", 1);
+var acType = props.globals.getNode("/MCDUC/type", 1);
+var engType = props.globals.getNode("/MCDUC/eng", 1);
+var database1 = props.globals.getNode("/FMGC/internal/navdatabase", 1);
+var database2 = props.globals.getNode("/FMGC/internal/navdatabase2", 1);
+var databaseCode = props.globals.getNode("/FMGC/internal/navdatabasecode", 1);
+var vor1 = props.globals.getNode("/FMGC/internal/vor1-mcdu", 1);
+var vor2 = props.globals.getNode("/FMGC/internal/vor2-mcdu", 1);
+var ils1 = props.globals.getNode("/FMGC/internal/ils1-mcdu", 1);
+var adf1 = props.globals.getNode("/FMGC/internal/adf1-mcdu", 1);
+var adf2 = props.globals.getNode("/FMGC/internal/adf2-mcdu", 1);
+var vor1FreqSet = props.globals.getNode("/FMGC/internal/vor1freq-set", 1);
+var vor1CRSSet = props.globals.getNode("/FMGC/internal/vor1crs-set", 1);
+var vor2FreqSet = props.globals.getNode("/FMGC/internal/vor2freq-set", 1);
+var vor2CRSSet = props.globals.getNode("/FMGC/internal/vor2crs-set", 1);
+var ils1FreqSet = props.globals.getNode("/FMGC/internal/ils1freq-set", 1);
+var ils1CRSSet = props.globals.getNode("/FMGC/internal/ils1crs-set", 1);
+var adf1FreqSet = props.globals.getNode("/FMGC/internal/adf1freq-set", 1);
+var adf2FreqSet = props.globals.getNode("/FMGC/internal/adf2freq-set", 1);
+var ils1CRS = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg", 1);
+var vor1CRS = props.globals.getNode("/instrumentation/nav[2]/radials/selected-deg", 1);
+var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg", 1);
+var flightNum = props.globals.getNode("/MCDUC/flight-num", 1);
+var flightNumSet = props.globals.getNode("/MCDUC/flight-num-set", 1);
+var depArpt = props.globals.getNode("/FMGC/internal/dep-arpt", 1);
+var arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
+var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1);
+var costIndex = props.globals.getNode("/FMGC/internal/cost-index", 1);
+var costIndexSet = props.globals.getNode("/FMGC/internal/cost-index-set", 1);
+var cruiseFL = props.globals.getNode("/FMGC/internal/cruise-fl", 1);
+var cruiseSet = props.globals.getNode("/FMGC/internal/cruise-lvl-set", 1);
+var tropo = props.globals.getNode("/FMGC/internal/tropo", 1);
+var tropoSet = props.globals.getNode("/FMGC/internal/tropo-set", 1);
+var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1);
+var zfwcg = props.globals.getNode("/FMGC/internal/zfwcg", 1);
+var zfwcgSet = props.globals.getNode("/FMGC/internal/zfwcg-set", 1);
+var zfw = props.globals.getNode("/FMGC/internal/zfw", 1);
+var zfwSet = props.globals.getNode("/FMGC/internal/zfw-set", 1);
+var block = props.globals.getNode("/FMGC/internal/block", 1);
+var blockSet = props.globals.getNode("/FMGC/internal/block-set", 1);
+var state1 = props.globals.getNode("/engines/engine[0]/state", 1);
+var state2 = props.globals.getNode("/engines/engine[1]/state", 1);
+var engrdy = props.globals.getNode("/engines/ready", 1);
+var v1 = props.globals.getNode("/FMGC/internal/v1", 1);
+var v1Set = props.globals.getNode("/FMGC/internal/v1-set", 1);
+var vr = props.globals.getNode("/FMGC/internal/vr", 1);
+var vrSet = props.globals.getNode("/FMGC/internal/vr-set", 1);
+var v2 = props.globals.getNode("/FMGC/internal/v2", 1);
+var v2Set = props.globals.getNode("/FMGC/internal/v2-set", 1);
+var clbReducFt = props.globals.getNode("/systems/thrust/clbreduc-ft", 1);
+var reducFt = props.globals.getNode("/FMGC/internal/reduc-agl-ft", 1); # It's not AGL anymore
+var thrAccSet = props.globals.getNode("/MCDUC/thracc-set", 1);
+var flapTO = props.globals.getNode("/FMGC/internal/to-flap", 1);
+var THSTO = props.globals.getNode("/FMGC/internal/to-ths", 1);
+var flapTHSSet = props.globals.getNode("/FMGC/internal/flap-ths-set", 1);
+var flex = props.globals.getNode("/FMGC/internal/flex", 1);
+var flexSet = props.globals.getNode("/FMGC/internal/flex-set", 1);
+var engOutAcc = props.globals.getNode("/FMGC/internal/eng-out-reduc", 1);
+var engOutAccSet = props.globals.getNode("/MCDUC/reducacc-set", 1);
+var transAlt = props.globals.getNode("/FMGC/internal/trans-alt", 1);
+var managedSpeed = props.globals.getNode("/it-autoflight/input/spd-managed", 1);
var ac1 = props.globals.getNode("systems/electrical/bus/ac-1", 1);
var ac2 = props.globals.getNode("systems/electrical/bus/ac-2", 1);
-var mcdu1_lgt = props.globals.getNode("controls/lighting/DU/mcdu1", 1);
-var mcdu2_lgt = props.globals.getNode("controls/lighting/DU/mcdu2", 1);
-var acType = props.globals.getNode("MCDUC/type", 1);
-var engType = props.globals.getNode("MCDUC/eng", 1);
-var database1 = props.globals.getNode("FMGC/internal/navdatabase", 1);
-var database2 = props.globals.getNode("FMGC/internal/navdatabase2", 1);
-var databaseCode = props.globals.getNode("FMGC/internal/navdatabasecode", 1);
-var vor1 = props.globals.getNode("FMGC/internal/vor1-mcdu", 1);
-var vor2 = props.globals.getNode("FMGC/internal/vor2-mcdu", 1);
-var ils1 = props.globals.getNode("FMGC/internal/ils1-mcdu", 1);
-var adf1 = props.globals.getNode("FMGC/internal/adf1-mcdu", 1);
-var adf2 = props.globals.getNode("FMGC/internal/adf2-mcdu", 1);
-var vor1FreqSet = props.globals.getNode("FMGC/internal/vor1freq-set", 1);
-var vor1CRSSet = props.globals.getNode("FMGC/internal/vor1crs-set", 1);
-var vor2FreqSet = props.globals.getNode("FMGC/internal/vor2freq-set", 1);
-var vor2CRSSet = props.globals.getNode("FMGC/internal/vor2crs-set", 1);
-var ils1FreqSet = props.globals.getNode("FMGC/internal/ils1freq-set", 1);
-var ils1CRSSet = props.globals.getNode("FMGC/internal/ils1crs-set", 1);
-var adf1FreqSet = props.globals.getNode("FMGC/internal/adf1freq-set", 1);
-var adf2FreqSet = props.globals.getNode("FMGC/internal/adf2freq-set", 1);
-var ils1CRS = props.globals.getNode("instrumentation/nav[0]/radials/selected-deg", 1);
-var vor1CRS = props.globals.getNode("instrumentation/nav[2]/radials/selected-deg", 1);
-var vor2CRS = props.globals.getNode("instrumentation/nav[3]/radials/selected-deg", 1);
-var flightNum = props.globals.getNode("MCDUC/flight-num", 1);
-var flightNumSet = props.globals.getNode("MCDUC/flight-num-set", 1);
-var depArpt = props.globals.getNode("FMGC/internal/dep-arpt", 1);
-var arrArpt = props.globals.getNode("FMGC/internal/arr-arpt", 1);
-var toFromSet = props.globals.getNode("FMGC/internal/tofrom-set", 1);
-var costIndex = props.globals.getNode("FMGC/internal/cost-index", 1);
-var costIndexSet = props.globals.getNode("FMGC/internal/cost-index-set", 1);
-var cruiseFL = props.globals.getNode("FMGC/internal/cruise-fl", 1);
-var cruiseSet = props.globals.getNode("FMGC/internal/cruise-lvl-set", 1);
-var tropo = props.globals.getNode("FMGC/internal/tropo", 1);
-var tropoSet = props.globals.getNode("FMGC/internal/tropo-set", 1);
-var ADIRSMCDUBTN = props.globals.getNode("controls/adirs/mcducbtn", 1);
-var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1);
-var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1);
-var zfw = props.globals.getNode("FMGC/internal/zfw", 1);
-var zfwSet = props.globals.getNode("FMGC/internal/zfw-set", 1);
-var block = props.globals.getNode("FMGC/internal/block", 1);
-var blockSet = props.globals.getNode("FMGC/internal/block-set", 1);
-var state1 = props.globals.getNode("engines/engine[0]/state", 1);
-var state2 = props.globals.getNode("engines/engine[1]/state", 1);
-var engrdy = props.globals.getNode("engines/ready", 1);
-var v1 = props.globals.getNode("FMGC/internal/v1", 1);
-var v1Set = props.globals.getNode("FMGC/internal/v1-set", 1);
-var vr = props.globals.getNode("FMGC/internal/vr", 1);
-var vrSet = props.globals.getNode("FMGC/internal/vr-set", 1);
-var v2 = props.globals.getNode("FMGC/internal/v2", 1);
-var v2Set = props.globals.getNode("FMGC/internal/v2-set", 1);
var f_speed = props.globals.getNode("FMGC/internal/f-speed", 1);
var s_speed = props.globals.getNode("FMGC/internal/s-speed", 1);
var o_speed = props.globals.getNode("FMGC/internal/o-speed", 1);
var min_speed = props.globals.getNode("FMGC/internal/minspeed", 1);
#var vapp_speed = props.globals.getNode("FMGC/internal/vapp-speed", 1);
var altitude = props.globals.getNode("instrumentation/altimeter/indicated-altitude-ft", 1);
-var clbReducFt = props.globals.getNode("systems/thrust/clbreduc-ft", 1);
-var reducFt = props.globals.getNode("FMGC/internal/reduc-agl-ft", 1); # It's not AGL anymore
-var thrAccSet = props.globals.getNode("MCDUC/thracc-set", 1);
-var flapTO = props.globals.getNode("FMGC/internal/to-flap", 1);
-var THSTO = props.globals.getNode("FMGC/internal/to-ths", 1);
-var flapTHSSet = props.globals.getNode("FMGC/internal/flap-ths-set", 1);
-var flex = props.globals.getNode("FMGC/internal/flex", 1);
-var flexSet = props.globals.getNode("FMGC/internal/flex-set", 1);
-var engOutAcc = props.globals.getNode("FMGC/internal/eng-out-reduc", 1);
-var engOutAccSet = props.globals.getNode("MCDUC/reducacc-set", 1);
-var transAlt = props.globals.getNode("FMGC/internal/trans-alt", 1);
-var managedSpeed = props.globals.getNode("it-autoflight/input/spd-managed", 1);
# Fetch nodes into vectors
var pageProp = [props.globals.getNode("MCDU[0]/page", 1), props.globals.getNode("MCDU[1]/page", 1)];
@@ -166,20 +197,24 @@ var canvas_MCDU_base = {
return me;
},
getKeys: func() {
- return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4","Simple_L5","Simple_L6","Simple_L0S","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S",
- "Simple_L1_Arrow","Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5","Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S",
- "Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow","Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S","Simple_C2S","Simple_C3S","Simple_C4S",
- "Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp","INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR",
- "PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR","PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE"];
+ return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4"
+ ,"Simple_L5","Simple_L6","Simple_L0S","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S", "Simple_L1_Arrow",
+ "Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5",
+ "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow",
+ "Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S",
+ "Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp",
+ "INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR","PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE",
+ "FPLN","FPLN_From","FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L",
+ "arrow1R","arrow2R","arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group"];
},
update: func() {
- if (ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) {
+ if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) {
MCDU_1.update();
MCDU_1.page.show();
} else {
MCDU_1.page.hide();
}
- if (ac2.getValue() >= 110 and mcdu2_lgt.getValue() > 0.01) {
+ if (systems.ELEC.Bus.ac2.getValue() >= 110 and mcdu2_lgt.getValue() > 0.01) {
MCDU_2.update();
MCDU_2.page.show();
} else {
@@ -188,15 +223,348 @@ var canvas_MCDU_base = {
},
updateCommon: func(i) {
page = pageProp[i].getValue();
- if (page == "MCDU") {
+ if (page == "F-PLNA" or page == "F-PLNB") {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
- me["Simple_Center"].hide();
+ me["Simple_Center"].show();
+ me["FPLN"].show();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
+ me["Simple_Title"].hide();
+ me["Simple_PageNum"].hide();
+ me["ArrowLeft"].show();
+ me["ArrowRight"].show();
+ me["arrowsDepArr"].hide();
+
+ me["Simple_L1_Arrow"].hide();
+ me["Simple_L2_Arrow"].hide();
+ me["Simple_L3_Arrow"].hide();
+ me["Simple_L4_Arrow"].hide();
+ me["Simple_L5_Arrow"].hide();
+ me["Simple_L6_Arrow"].hide();
+ me["Simple_R1_Arrow"].hide();
+ me["Simple_R2_Arrow"].hide();
+ me["Simple_R3_Arrow"].hide();
+ me["Simple_R4_Arrow"].hide();
+ me["Simple_R5_Arrow"].hide();
+ me["Simple_R6_Arrow"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeCenter(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+ pageSwitch[i].setBoolValue(1);
+ }
+
+ if (myFpln[i] != nil) {
+
+ if (flightNumSet.getValue()) {
+ me["FPLN_Callsign"].setText(flightNum.getValue());
+ me["FPLN_Callsign"].show();
+ } else {
+ me["FPLN_Callsign"].hide();
+ }
+
+ if (myFpln[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myFpln[i].L1[0]);
+ if (myFpln[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myFpln[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myFpln[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myFpln[i].L2[0]);
+ if (myFpln[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myFpln[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myFpln[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myFpln[i].L3[0]);
+ if (myFpln[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myFpln[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myFpln[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myFpln[i].L4[0]);
+ if (myFpln[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myFpln[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myFpln[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myFpln[i].L5[0]);
+ if (myFpln[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myFpln[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myFpln[i].L6[0] == nil or fmgc.flightPlanController.temporaryFlag[i]) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myFpln[i].L6[0]);
+ if (myFpln[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myFpln[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myFpln[i].L1[2],myFpln[i].L2[2],myFpln[i].L3[2],myFpln[i].L4[2],myFpln[i].L5[2],myFpln[i].L6[2]);
+
+ if (myFpln[i].C1[0] == nil) {
+ me["Simple_C1"].hide();
+ me["Simple_C1S"].hide();
+ } else {
+ me["Simple_C1"].show();
+ me["Simple_C1"].setText(myFpln[i].C1[0]);
+ if (myFpln[i].C1[1] != nil) {
+ me["Simple_C1S"].show();
+ me["Simple_C1S"].setText(myFpln[i].C1[1]);
+ } else {
+ me["Simple_C1S"].hide();
+ }
+ }
+
+ if (myFpln[i].C2[0] == nil) {
+ me["Simple_C2"].hide();
+ me["Simple_C2S"].hide();
+ } else {
+ me["Simple_C2"].show();
+ me["Simple_C2"].setText(myFpln[i].C2[0]);
+ if (myFpln[i].C2[1] != nil) {
+ me["Simple_C2S"].show();
+ me["Simple_C2S"].setText(myFpln[i].C2[1]);
+ } else {
+ me["Simple_C2S"].hide();
+ }
+ }
+
+ if (myFpln[i].C3[0] == nil) {
+ me["Simple_C3"].hide();
+ me["Simple_C3S"].hide();
+ } else {
+ me["Simple_C3"].show();
+ me["Simple_C3"].setText(myFpln[i].C3[0]);
+ if (myFpln[i].C3[1] != nil) {
+ me["Simple_C3S"].show();
+ me["Simple_C3S"].setText(myFpln[i].C3[1]);
+ } else {
+ me["Simple_C3S"].hide();
+ }
+ }
+
+ if (myFpln[i].C4[0] == nil) {
+ me["Simple_C4"].hide();
+ me["Simple_C4S"].hide();
+ } else {
+ me["Simple_C4"].show();
+ me["Simple_C4"].setText(myFpln[i].C4[0]);
+ if (myFpln[i].C4[1] != nil) {
+ me["Simple_C4S"].show();
+ me["Simple_C4S"].setText(myFpln[i].C4[1]);
+ } else {
+ me["Simple_C4S"].hide();
+ }
+ }
+
+ if (myFpln[i].C5[0] == nil) {
+ me["Simple_C5"].hide();
+ me["Simple_C5S"].hide();
+ } else {
+ me["Simple_C5"].show();
+ me["Simple_C5"].setText(myFpln[i].C5[0]);
+ if (myFpln[i].C5[1] != nil) {
+ me["Simple_C5S"].show();
+ me["Simple_C5S"].setText(myFpln[i].C5[1]);
+ } else {
+ me["Simple_C5S"].hide();
+ }
+ }
+
+ if (myFpln[i].C6[0] == nil or fmgc.flightPlanController.temporaryFlag[i]) {
+ me["Simple_C6"].hide();
+ me["Simple_C6S"].hide();
+ } else {
+ me["Simple_C6"].show();
+ me["Simple_C6"].setText(myFpln[i].C6[0]);
+ if (myFpln[i].C6[1] != nil) {
+ me["Simple_C6S"].show();
+ me["Simple_C6S"].setText(myFpln[i].C6[1]);
+ } else {
+ me["Simple_C6S"].hide();
+ }
+ }
+
+ me.colorCenter(myFpln[i].C1[2],myFpln[i].C2[2],myFpln[i].C3[2],myFpln[i].C4[2],myFpln[i].C5[2],myFpln[i].C6[2]);
+
+ if (myFpln[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myFpln[i].R1[0]);
+ if (myFpln[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myFpln[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myFpln[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myFpln[i].R2[0]);
+ if (myFpln[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myFpln[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myFpln[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myFpln[i].R3[0]);
+ if (myFpln[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myFpln[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myFpln[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myFpln[i].R4[0]);
+ if (myFpln[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myFpln[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myFpln[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myFpln[i].R5[0]);
+ if (myFpln[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myFpln[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myFpln[i].R6[0] == nil or fmgc.flightPlanController.temporaryFlag[i]) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myFpln[i].R6[0]);
+ if (myFpln[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myFpln[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myFpln[i].R1[2],myFpln[i].R2[2],myFpln[i].R3[2],myFpln[i].R4[2],myFpln[i].R5[2],myFpln[i].R6[2]);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+
+ #if (mcdu.FPLNLines[i].index == 0) {
+ # me["FPLN_From"].show();
+ #} else {
+ # me["FPLN_From"].hide();
+ #}
+
+ if (fmgc.flightPlanController.temporaryFlag[i]) {
+ if (!mcdu.dirToFlag) {
+ me["FPLN_TMPY_group"].show();
+ me["DIRTO_TMPY_group"].hide();
+ } else {
+ me["DIRTO_TMPY_group"].show();
+ me["FPLN_TMPY_group"].hide();
+ }
+ } else {
+ me["FPLN_TMPY_group"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ }
+ }
+ } elsif (page == "MCDU") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
+ me["PERFAPPR"].hide();
+ me["PERFGA"].hide();
me["Simple_Title"].setText("MCDU MENU");
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
@@ -276,9 +644,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText(sprintf("%s", " " ~ acType.getValue()));
@@ -360,9 +731,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("DATA INDEX");
@@ -442,9 +816,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("DATA INDEX");
@@ -529,9 +906,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("POSITION MONITOR");
@@ -628,9 +1008,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("RADIO NAV");
@@ -769,9 +1152,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].show();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("INIT");
@@ -926,9 +1312,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].show();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("INIT");
@@ -1058,9 +1447,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("FUEL PRED");
@@ -1172,9 +1564,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].show();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText("TAKE OFF");
@@ -1623,9 +2018,12 @@ var canvas_MCDU_base = {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
me["PERFAPPR"].hide();
me["PERFGA"].hide();
me["Simple_Title"].setText(sprintf("%s", page));
@@ -1744,9 +2142,2075 @@ var canvas_MCDU_base = {
me["Simple_C1"].setText("--- ");
me["Simple_C5"].setText(" -350");
me["Simple_C1S"].setText("TIME ");
+ } elsif (page == "LATREV") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].hide();
+ me["ArrowRight"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myLatRev[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myLatRev[i].title[0] ~ myLatRev[i].title[1] ~ myLatRev[i].title[2]));
+
+ if (myLatRev[i].subtitle[0] != nil) {
+ me["Simple_Center"].show();
+ me["Simple_C1S"].setText(sprintf("%s", myLatRev[i].subtitle[0] ~ "/" ~ myLatRev[i].subtitle[1]));
+ me["Simple_C1S"].show();
+ me["Simple_C1"].hide();
+ me["Simple_C2"].hide();
+ me["Simple_C3"].hide();
+ me["Simple_C4"].hide();
+ me["Simple_C5"].hide();
+ me["Simple_C6"].hide();
+ me["Simple_C2S"].hide();
+ me["Simple_C3S"].hide();
+ me["Simple_C4S"].hide();
+ me["Simple_C5S"].hide();
+ me["Simple_C6S"].hide();
+ } else {
+ me["Simple_Center"].hide();
+ }
+ forindex (var matrixArrow; myLatRev[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myLatRev[i].arrowsMatrix[matrixArrow]) {
+ if (myLatRev[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
+ } else {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
+ }
+ }
+ }
+ me.colorLeftArrow(myLatRev[i].arrowsColour[0][0],myLatRev[i].arrowsColour[0][1],myLatRev[i].arrowsColour[0][2],myLatRev[i].arrowsColour[0][3],myLatRev[i].arrowsColour[0][4],myLatRev[i].arrowsColour[0][5]);
+
+
+ forindex (var matrixFont; myLatRev[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myLatRev[i].fontMatrix[matrixFont]) {
+ if (myLatRev[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myLatRev[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myLatRev[i].L1[0]);
+ if (myLatRev[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myLatRev[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myLatRev[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myLatRev[i].L2[0]);
+ if (myLatRev[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myLatRev[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myLatRev[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myLatRev[i].L3[0]);
+ if (myLatRev[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myLatRev[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myLatRev[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myLatRev[i].L4[0]);
+ if (myLatRev[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myLatRev[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myLatRev[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myLatRev[i].L5[0]);
+ if (myLatRev[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myLatRev[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myLatRev[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myLatRev[i].L6[0]);
+ if (myLatRev[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myLatRev[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myLatRev[i].L1[2],myLatRev[i].L2[2],myLatRev[i].L3[2],myLatRev[i].L4[2],myLatRev[i].L5[2],myLatRev[i].L6[2]);
+
+ if (myLatRev[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myLatRev[i].R1[0]);
+ if (myLatRev[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myLatRev[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myLatRev[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myLatRev[i].R2[0]);
+ if (myLatRev[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myLatRev[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myLatRev[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myLatRev[i].R3[0]);
+ if (myLatRev[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myLatRev[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myLatRev[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myLatRev[i].R4[0]);
+ if (myLatRev[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myLatRev[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myLatRev[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myLatRev[i].R5[0]);
+ if (myLatRev[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myLatRev[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myLatRev[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myLatRev[i].R6[0]);
+ if (myLatRev[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myLatRev[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myLatRev[i].R1[2],myLatRev[i].R2[2],myLatRev[i].R3[2],myLatRev[i].R4[2],myLatRev[i].R5[2],myLatRev[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "VERTREV") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].hide();
+ me["ArrowRight"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myVertRev[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myVertRev[i].title[0] ~ myVertRev[i].title[1] ~ myVertRev[i].title[2]));
+
+ if (myVertRev[i].subtitle[0] != nil) {
+ me["Simple_Center"].show();
+ me["Simple_C1S"].setText(sprintf("%s", myVertRev[i].subtitle[0] ~ "/" ~ myVertRev[i].subtitle[1]));
+ me["Simple_C1S"].show();
+ me["Simple_C1"].hide();
+ me["Simple_C2"].hide();
+ me["Simple_C3"].hide();
+ me["Simple_C4"].hide();
+ me["Simple_C5"].hide();
+ me["Simple_C6"].hide();
+ me["Simple_C2S"].hide();
+ me["Simple_C3S"].hide();
+ me["Simple_C4S"].hide();
+ me["Simple_C5S"].hide();
+ me["Simple_C6S"].hide();
+ } else {
+ me["Simple_Center"].hide();
+ }
+ forindex (var matrixArrow; myVertRev[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myVertRev[i].arrowsMatrix[matrixArrow]) {
+ if (myVertRev[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
+ } else {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
+ }
+ }
+ }
+ me.colorLeftArrow(myVertRev[i].arrowsColour[0][0],myVertRev[i].arrowsColour[0][1],myVertRev[i].arrowsColour[0][2],myVertRev[i].arrowsColour[0][3],myVertRev[i].arrowsColour[0][4],myVertRev[i].arrowsColour[0][5]);
+
+
+ forindex (var matrixFont; myVertRev[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myVertRev[i].fontMatrix[matrixFont]) {
+ if (myVertRev[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myVertRev[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myVertRev[i].L1[0]);
+ if (myVertRev[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myVertRev[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myVertRev[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myVertRev[i].L2[0]);
+ if (myVertRev[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myVertRev[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myVertRev[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myVertRev[i].L3[0]);
+ if (myVertRev[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myVertRev[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myVertRev[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myVertRev[i].L4[0]);
+ if (myVertRev[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myVertRev[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myVertRev[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myVertRev[i].L5[0]);
+ if (myVertRev[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myVertRev[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myVertRev[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myVertRev[i].L6[0]);
+ if (myVertRev[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myVertRev[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myVertRev[i].L1[2],myVertRev[i].L2[2],myVertRev[i].L3[2],myVertRev[i].L4[2],myVertRev[i].L5[2],myVertRev[i].L6[2]);
+
+ if (myVertRev[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myVertRev[i].R1[0]);
+ if (myVertRev[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myVertRev[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myVertRev[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myVertRev[i].R2[0]);
+ if (myVertRev[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myVertRev[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myVertRev[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myVertRev[i].R3[0]);
+ if (myVertRev[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myVertRev[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myVertRev[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myVertRev[i].R4[0]);
+ if (myVertRev[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myVertRev[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myVertRev[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myVertRev[i].R5[0]);
+ if (myVertRev[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myVertRev[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myVertRev[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myVertRev[i].R6[0]);
+ if (myVertRev[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myVertRev[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myVertRev[i].R1[2],myVertRev[i].R2[2],myVertRev[i].R3[2],myVertRev[i].R4[2],myVertRev[i].R5[2],myVertRev[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "DEPARTURE") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].show();
+ me["ArrowRight"].show();
+ me["arrowsDepArr"].show();
+ me["Simple_L1_Arrow"].hide();
+ me["Simple_L2_Arrow"].hide();
+ me["Simple_L3_Arrow"].hide();
+ me["Simple_L4_Arrow"].hide();
+ me["Simple_L5_Arrow"].hide();
+ me["Simple_L6_Arrow"].show();
+ me["Simple_R1_Arrow"].hide();
+ me["Simple_R2_Arrow"].hide();
+ me["Simple_R3_Arrow"].hide();
+ me["Simple_R4_Arrow"].hide();
+ me["Simple_R5_Arrow"].hide();
+ me["Simple_R6_Arrow"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myDeparture[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myDeparture[i].title[0] ~ myDeparture[i].title[1] ~ myDeparture[i].title[2]));
+
+ forindex (var matrixArrow; myDeparture[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDeparture[i].arrowsMatrix[matrixArrow]) {
+ if (item == 5) {
+ me["Simple_L6_Arrow"].setColor(getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[0][5] ~ "/r"), getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[0][5] ~ "/g"), getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[0][5] ~ "/b"));
+ continue;
+ }
+ if (myDeparture[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["arrow" ~ (item + 1) ~ sign].show();
+ me["arrow" ~ (item + 1) ~ sign].setColor(getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[matrixArrow][item] ~ "/r"), getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[matrixArrow][item] ~ "/g"), getprop("MCDUC/colors/" ~ myDeparture[i].arrowsColour[matrixArrow][item] ~ "/b"));
+ } else {
+ me["arrow" ~ (item + 1) ~ sign].hide();
+ }
+ }
+ }
+
+ forindex (var matrixFont; myDeparture[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDeparture[i].fontMatrix[matrixFont]) {
+ if (myDeparture[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myDeparture[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myDeparture[i].L1[0]);
+ if (myDeparture[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myDeparture[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myDeparture[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myDeparture[i].L2[0]);
+ if (myDeparture[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myDeparture[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myDeparture[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myDeparture[i].L3[0]);
+ if (myDeparture[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myDeparture[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myDeparture[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myDeparture[i].L4[0]);
+ if (myDeparture[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myDeparture[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myDeparture[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myDeparture[i].L5[0]);
+ if (myDeparture[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myDeparture[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myDeparture[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myDeparture[i].L6[0]);
+ if (myDeparture[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myDeparture[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myDeparture[i].L1[2],myDeparture[i].L2[2],myDeparture[i].L3[2],myDeparture[i].L4[2],myDeparture[i].L5[2],myDeparture[i].L6[2]);
+
+ if (myDeparture[i].C1[0] == nil) {
+ me["Simple_C1"].hide();
+ me["Simple_C1S"].hide();
+ } else {
+ me["Simple_C1"].show();
+ me["Simple_C1"].setText(myDeparture[i].C1[0]);
+ if (myDeparture[i].C1[1] != nil) {
+ me["Simple_C1S"].show();
+ me["Simple_C1S"].setText(myDeparture[i].C1[1]);
+ } else {
+ me["Simple_C1S"].hide();
+ }
+ }
+
+ if (myDeparture[i].C2[0] == nil) {
+ me["Simple_C2"].hide();
+ me["Simple_C2S"].hide();
+ } else {
+ me["Simple_C2"].show();
+ me["Simple_C2"].setText(myDeparture[i].C2[0]);
+ if (myDeparture[i].C2[1] != nil) {
+ me["Simple_C2S"].show();
+ me["Simple_C2S"].setText(myDeparture[i].C2[1]);
+ } else {
+ me["Simple_C2S"].hide();
+ }
+ }
+
+ if (myDeparture[i].C3[0] == nil) {
+ me["Simple_C3"].hide();
+ me["Simple_C3S"].hide();
+ } else {
+ me["Simple_C3"].show();
+ me["Simple_C3"].setText(myDeparture[i].C3[0]);
+ if (myDeparture[i].C3[1] != nil) {
+ me["Simple_C3S"].show();
+ me["Simple_C3S"].setText(myDeparture[i].C3[1]);
+ } else {
+ me["Simple_C3S"].hide();
+ }
+ }
+
+ if (myDeparture[i].C4[0] == nil) {
+ me["Simple_C4"].hide();
+ me["Simple_C4S"].hide();
+ } else {
+ me["Simple_C4"].show();
+ me["Simple_C4"].setText(myDeparture[i].C4[0]);
+ if (myDeparture[i].C4[1] != nil) {
+ me["Simple_C4S"].show();
+ me["Simple_C4S"].setText(myDeparture[i].C4[1]);
+ } else {
+ me["Simple_C4S"].hide();
+ }
+ }
+
+ if (myDeparture[i].C5[0] == nil) {
+ me["Simple_C5"].hide();
+ me["Simple_C5S"].hide();
+ } else {
+ me["Simple_C5"].show();
+ me["Simple_C5"].setText(myDeparture[i].C5[0]);
+ if (myDeparture[i].C5[1] != nil) {
+ me["Simple_C5S"].show();
+ me["Simple_C5S"].setText(myDeparture[i].C5[1]);
+ } else {
+ me["Simple_C5S"].hide();
+ }
+ }
+ me.colorCenter(myDeparture[i].C1[2],myDeparture[i].C2[2],myDeparture[i].C3[2],myDeparture[i].C4[2],myDeparture[i].C5[2],myDeparture[i].C6[2]);
+
+ me["Simple_C6"].hide();
+ me["Simple_C6S"].hide();
+
+ if (myDeparture[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myDeparture[i].R1[0]);
+ if (myDeparture[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myDeparture[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myDeparture[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myDeparture[i].R2[0]);
+ if (myDeparture[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myDeparture[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myDeparture[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myDeparture[i].R3[0]);
+ if (myDeparture[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myDeparture[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myDeparture[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myDeparture[i].R4[0]);
+ if (myDeparture[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myDeparture[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myDeparture[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myDeparture[i].R5[0]);
+ if (myDeparture[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myDeparture[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myDeparture[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myDeparture[i].R6[0]);
+ if (myDeparture[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myDeparture[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myDeparture[i].R1[2],myDeparture[i].R2[2],myDeparture[i].R3[2],myDeparture[i].R4[2],myDeparture[i].R5[2],myDeparture[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "DUPLICATENAMES") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["arrowsDepArr"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].hide();
+ me["ArrowRight"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myDuplicate[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myDuplicate[i].title));
+
+ forindex (var matrixArrow; myDuplicate[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDuplicate[i].arrowsMatrix[matrixArrow]) {
+ if (myDuplicate[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
+ } else {
+ me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
+ }
+ }
+ }
+ me.colorLeftArrow(myDuplicate[i].arrowsColour[0][0],myDuplicate[i].arrowsColour[0][1],myDuplicate[i].arrowsColour[0][2],myDuplicate[i].arrowsColour[0][3],myDuplicate[i].arrowsColour[0][4],myDuplicate[i].arrowsColour[0][5]);
+
+
+ forindex (var matrixFont; myDuplicate[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDuplicate[i].fontMatrix[matrixFont]) {
+ if (myDuplicate[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myDuplicate[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myDuplicate[i].L1[0]);
+ if (myDuplicate[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myDuplicate[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myDuplicate[i].L2[0]);
+ if (myDuplicate[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myDuplicate[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myDuplicate[i].L3[0]);
+ if (myDuplicate[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myDuplicate[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myDuplicate[i].L4[0]);
+ if (myDuplicate[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myDuplicate[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myDuplicate[i].L5[0]);
+ if (myDuplicate[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myDuplicate[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myDuplicate[i].L6[0]);
+ if (myDuplicate[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myDuplicate[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myDuplicate[i].L1[2],myDuplicate[i].L2[2],myDuplicate[i].L3[2],myDuplicate[i].L4[2],myDuplicate[i].L5[2],myDuplicate[i].L6[2]);
+
+
+ if (myDuplicate[i].C1[0] == nil) {
+ me["Simple_C1"].hide();
+ me["Simple_C1S"].hide();
+ } else {
+ me["Simple_C1"].show();
+ me["Simple_C1"].setText(myDuplicate[i].C1[0]);
+ if (myDuplicate[i].C1[1] != nil) {
+ me["Simple_C1S"].show();
+ me["Simple_C1S"].setText(myDuplicate[i].C1[1]);
+ } else {
+ me["Simple_C1S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].C2[0] == nil) {
+ me["Simple_C2"].hide();
+ me["Simple_C2S"].hide();
+ } else {
+ me["Simple_C2"].show();
+ me["Simple_C2"].setText(myDuplicate[i].C2[0]);
+ if (myDuplicate[i].C2[1] != nil) {
+ me["Simple_C2S"].show();
+ me["Simple_C2S"].setText(myDuplicate[i].C2[1]);
+ } else {
+ me["Simple_C2S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].C3[0] == nil) {
+ me["Simple_C3"].hide();
+ me["Simple_C3S"].hide();
+ } else {
+ me["Simple_C3"].show();
+ me["Simple_C3"].setText(myDuplicate[i].C3[0]);
+ if (myDuplicate[i].C3[1] != nil) {
+ me["Simple_C3S"].show();
+ me["Simple_C3S"].setText(myDuplicate[i].C3[1]);
+ } else {
+ me["Simple_C3S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].C4[0] == nil) {
+ me["Simple_C4"].hide();
+ me["Simple_C4S"].hide();
+ } else {
+ me["Simple_C4"].show();
+ me["Simple_C4"].setText(myDuplicate[i].C4[0]);
+ if (myDuplicate[i].C4[1] != nil) {
+ me["Simple_C4S"].show();
+ me["Simple_C4S"].setText(myDuplicate[i].C4[1]);
+ } else {
+ me["Simple_C4S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].C5[0] == nil) {
+ me["Simple_C5"].hide();
+ me["Simple_C5S"].hide();
+ } else {
+ me["Simple_C5"].show();
+ me["Simple_C5"].setText(myDuplicate[i].C5[0]);
+ if (myDuplicate[i].C5[1] != nil) {
+ me["Simple_C5S"].show();
+ me["Simple_C5S"].setText(myDuplicate[i].C5[1]);
+ } else {
+ me["Simple_C5S"].hide();
+ }
+ }
+ me.colorCenter(myDuplicate[i].C1[2],myDuplicate[i].C2[2],myDuplicate[i].C3[2],myDuplicate[i].C4[2],myDuplicate[i].C5[2],myDuplicate[i].C6[2]);
+
+ me["Simple_C6"].hide();
+ me["Simple_C6S"].hide();
+
+ if (myDuplicate[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myDuplicate[i].R1[0]);
+ if (myDuplicate[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myDuplicate[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myDuplicate[i].R2[0]);
+ if (myDuplicate[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myDuplicate[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myDuplicate[i].R3[0]);
+ if (myDuplicate[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myDuplicate[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myDuplicate[i].R4[0]);
+ if (myDuplicate[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myDuplicate[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myDuplicate[i].R5[0]);
+ if (myDuplicate[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myDuplicate[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myDuplicate[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myDuplicate[i].R6[0]);
+ if (myDuplicate[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myDuplicate[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myDuplicate[i].R1[2],myDuplicate[i].R2[2],myDuplicate[i].R3[2],myDuplicate[i].R4[2],myDuplicate[i].R5[2],myDuplicate[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "ARRIVAL") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].show();
+ me["ArrowRight"].show();
+ me["arrowsDepArr"].show();
+ me["Simple_L1_Arrow"].hide();
+ me["Simple_L2_Arrow"].hide();
+ me["Simple_L3_Arrow"].hide();
+ me["Simple_L4_Arrow"].hide();
+ me["Simple_L5_Arrow"].hide();
+ me["Simple_L6_Arrow"].show();
+ me["Simple_R1_Arrow"].hide();
+ me["Simple_R2_Arrow"].hide();
+ me["Simple_R3_Arrow"].hide();
+ me["Simple_R4_Arrow"].hide();
+ me["Simple_R5_Arrow"].hide();
+ me["Simple_R6_Arrow"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myArrival[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myArrival[i].title[0] ~ myArrival[i].title[1] ~ myArrival[i].title[2]));
+
+ forindex (var matrixArrow; myArrival[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myArrival[i].arrowsMatrix[matrixArrow]) {
+ if (item == 5) {
+ me["Simple_L6_Arrow"].setColor(getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/r"), getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/g"), getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/b"));
+ continue;
+ }
+ if (myArrival[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["arrow" ~ (item + 1) ~ sign].show();
+ me["arrow" ~ (item + 1) ~ sign].setColor(getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[matrixArrow][item] ~ "/r"), getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[matrixArrow][item] ~ "/g"), getprop("MCDUC/colors/" ~ myArrival[i].arrowsColour[matrixArrow][item] ~ "/b"));
+ } else {
+ me["arrow" ~ (item + 1) ~ sign].hide();
+ }
+ }
+ }
+
+ forindex (var matrixFont; myArrival[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myArrival[i].fontMatrix[matrixFont]) {
+ if (myArrival[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myArrival[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myArrival[i].L1[0]);
+ if (myArrival[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myArrival[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myArrival[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myArrival[i].L2[0]);
+ if (myArrival[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myArrival[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myArrival[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myArrival[i].L3[0]);
+ if (myArrival[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myArrival[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myArrival[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myArrival[i].L4[0]);
+ if (myArrival[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myArrival[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myArrival[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myArrival[i].L5[0]);
+ if (myArrival[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myArrival[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myArrival[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myArrival[i].L6[0]);
+ if (myArrival[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myArrival[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myArrival[i].L1[2],myArrival[i].L2[2],myArrival[i].L3[2],myArrival[i].L4[2],myArrival[i].L5[2],myArrival[i].L6[2]);
+
+ if (myArrival[i].C1[0] == nil) {
+ me["Simple_C1"].hide();
+ me["Simple_C1S"].hide();
+ } else {
+ me["Simple_C1"].show();
+ me["Simple_C1"].setText(myArrival[i].C1[0]);
+ if (myArrival[i].C1[1] != nil) {
+ me["Simple_C1S"].show();
+ me["Simple_C1S"].setText(myArrival[i].C1[1]);
+ } else {
+ me["Simple_C1S"].hide();
+ }
+ }
+
+ if (myArrival[i].C2[0] == nil) {
+ me["Simple_C2"].hide();
+ me["Simple_C2S"].hide();
+ } else {
+ me["Simple_C2"].show();
+ me["Simple_C2"].setText(myArrival[i].C2[0]);
+ if (myArrival[i].C2[1] != nil) {
+ me["Simple_C2S"].show();
+ me["Simple_C2S"].setText(myArrival[i].C2[1]);
+ } else {
+ me["Simple_C2S"].hide();
+ }
+ }
+
+ if (myArrival[i].C3[0] == nil) {
+ me["Simple_C3"].hide();
+ me["Simple_C3S"].hide();
+ } else {
+ me["Simple_C3"].show();
+ me["Simple_C3"].setText(myArrival[i].C3[0]);
+ if (myArrival[i].C3[1] != nil) {
+ me["Simple_C3S"].show();
+ me["Simple_C3S"].setText(myArrival[i].C3[1]);
+ } else {
+ me["Simple_C3S"].hide();
+ }
+ }
+
+ if (myArrival[i].C4[0] == nil) {
+ me["Simple_C4"].hide();
+ me["Simple_C4S"].hide();
+ } else {
+ me["Simple_C4"].show();
+ me["Simple_C4"].setText(myArrival[i].C4[0]);
+ if (myArrival[i].C4[1] != nil) {
+ me["Simple_C4S"].show();
+ me["Simple_C4S"].setText(myArrival[i].C4[1]);
+ } else {
+ me["Simple_C4S"].hide();
+ }
+ }
+
+ if (myArrival[i].C5[0] == nil) {
+ me["Simple_C5"].hide();
+ me["Simple_C5S"].hide();
+ } else {
+ me["Simple_C5"].show();
+ me["Simple_C5"].setText(myArrival[i].C5[0]);
+ if (myArrival[i].C5[1] != nil) {
+ me["Simple_C5S"].show();
+ me["Simple_C5S"].setText(myArrival[i].C5[1]);
+ } else {
+ me["Simple_C5S"].hide();
+ }
+ }
+ me.colorCenter(myArrival[i].C1[2],myArrival[i].C2[2],myArrival[i].C3[2],myArrival[i].C4[2],myArrival[i].C5[2],myArrival[i].C6[2]);
+
+ me["Simple_C6"].hide();
+ me["Simple_C6S"].hide();
+
+ if (myArrival[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myArrival[i].R1[0]);
+ if (myArrival[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myArrival[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myArrival[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myArrival[i].R2[0]);
+ if (myArrival[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myArrival[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myArrival[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myArrival[i].R3[0]);
+ if (myArrival[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myArrival[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myArrival[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myArrival[i].R4[0]);
+ if (myArrival[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myArrival[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myArrival[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myArrival[i].R5[0]);
+ if (myArrival[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myArrival[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myArrival[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myArrival[i].R6[0]);
+ if (myArrival[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myArrival[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myArrival[i].R1[2],myArrival[i].R2[2],myArrival[i].R3[2],myArrival[i].R4[2],myArrival[i].R5[2],myArrival[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "HOLD") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].show();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].hide();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].show();
+ me["ArrowRight"].show();
+ me["arrowsDepArr"].show();
+ me["Simple_L1_Arrow"].hide();
+ me["Simple_L2_Arrow"].hide();
+ me["Simple_L3_Arrow"].hide();
+ me["Simple_L4_Arrow"].hide();
+ me["Simple_L5_Arrow"].hide();
+ me["Simple_L6_Arrow"].show();
+ me["Simple_R1_Arrow"].hide();
+ me["Simple_R2_Arrow"].hide();
+ me["Simple_R3_Arrow"].hide();
+ me["Simple_R4_Arrow"].hide();
+ me["Simple_R5_Arrow"].hide();
+ me["Simple_R6_Arrow"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeCenter(normal, normal, normal, small, normal, normal); # if updating watch out - this is needed
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+
+
+ if (myHold[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myHold[i].title[0] ~ myHold[i].title[1] ~ myHold[i].title[2]));
+
+ forindex (var matrixArrow; myHold[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myHold[i].arrowsMatrix[matrixArrow]) {
+ if (item == 5) {
+ me["Simple_L6_Arrow"].setColor(getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[0][5] ~ "/r"), getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[0][5] ~ "/g"), getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[0][5] ~ "/b"));
+ continue;
+ }
+ if (myHold[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["arrow" ~ (item + 1) ~ sign].show();
+ me["arrow" ~ (item + 1) ~ sign].setColor(getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[matrixArrow][item] ~ "/r"), getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[matrixArrow][item] ~ "/g"), getprop("MCDUC/colors/" ~ myHold[i].arrowsColour[matrixArrow][item] ~ "/b"));
+ } else {
+ me["arrow" ~ (item + 1) ~ sign].hide();
+ }
+ }
+ }
+
+ forindex (var matrixFont; myHold[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myHold[i].fontMatrix[matrixFont]) {
+ if (myHold[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (myHold[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myHold[i].L1[0]);
+ if (myHold[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myHold[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myHold[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myHold[i].L2[0]);
+ if (myHold[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myHold[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myHold[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myHold[i].L3[0]);
+ if (myHold[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myHold[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myHold[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myHold[i].L4[0]);
+ if (myHold[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myHold[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myHold[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myHold[i].L5[0]);
+ if (myHold[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myHold[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myHold[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myHold[i].L6[0]);
+ if (myHold[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myHold[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myHold[i].L1[2],myHold[i].L2[2],myHold[i].L3[2],myHold[i].L4[2],myHold[i].L5[2],myHold[i].L6[2]);
+
+ if (myHold[i].C1[0] == nil) {
+ me["Simple_C1"].hide();
+ me["Simple_C1S"].hide();
+ } else {
+ me["Simple_C1"].show();
+ me["Simple_C1"].setText(myHold[i].C1[0]);
+ if (myHold[i].C1[1] != nil) {
+ me["Simple_C1S"].show();
+ me["Simple_C1S"].setText(myHold[i].C1[1]);
+ } else {
+ me["Simple_C1S"].hide();
+ }
+ }
+
+ if (myHold[i].C2[0] == nil) {
+ me["Simple_C2"].hide();
+ me["Simple_C2S"].hide();
+ } else {
+ me["Simple_C2"].show();
+ me["Simple_C2"].setText(myHold[i].C2[0]);
+ if (myHold[i].C2[1] != nil) {
+ me["Simple_C2S"].show();
+ me["Simple_C2S"].setText(myHold[i].C2[1]);
+ } else {
+ me["Simple_C2S"].hide();
+ }
+ }
+
+ if (myHold[i].C3[0] == nil) {
+ me["Simple_C3"].hide();
+ me["Simple_C3S"].hide();
+ } else {
+ me["Simple_C3"].show();
+ me["Simple_C3"].setText(myHold[i].C3[0]);
+ if (myHold[i].C3[1] != nil) {
+ me["Simple_C3S"].show();
+ me["Simple_C3S"].setText(myHold[i].C3[1]);
+ } else {
+ me["Simple_C3S"].hide();
+ }
+ }
+
+ if (myHold[i].C4[0] == nil) {
+ me["Simple_C4"].hide();
+ me["Simple_C4S"].hide();
+ } else {
+ me["Simple_C4"].show();
+ me["Simple_C4"].setText(myHold[i].C4[0]);
+ if (myHold[i].C4[1] != nil) {
+ me["Simple_C4S"].show();
+ me["Simple_C4S"].setText(myHold[i].C4[1]);
+ } else {
+ me["Simple_C4S"].hide();
+ }
+ }
+
+ if (myHold[i].C5[0] == nil) {
+ me["Simple_C5"].hide();
+ me["Simple_C5S"].hide();
+ } else {
+ me["Simple_C5"].show();
+ me["Simple_C5"].setText(myHold[i].C5[0]);
+ if (myHold[i].C5[1] != nil) {
+ me["Simple_C5S"].show();
+ me["Simple_C5S"].setText(myHold[i].C5[1]);
+ } else {
+ me["Simple_C5S"].hide();
+ }
+ }
+ me.colorCenter(myHold[i].C1[2],myHold[i].C2[2],myHold[i].C3[2],myHold[i].C4[2],myHold[i].C5[2],myHold[i].C6[2]);
+
+ me["Simple_C6"].hide();
+ me["Simple_C6S"].hide();
+
+ if (myHold[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myHold[i].R1[0]);
+ if (myHold[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myHold[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myHold[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myHold[i].R2[0]);
+ if (myHold[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myHold[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myHold[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myHold[i].R3[0]);
+ if (myHold[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myHold[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myHold[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myHold[i].R4[0]);
+ if (myHold[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myHold[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myHold[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myHold[i].R5[0]);
+ if (myHold[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myHold[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myHold[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myHold[i].R6[0]);
+ if (myHold[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myHold[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myHold[i].R1[2],myHold[i].R2[2],myHold[i].R3[2],myHold[i].R4[2],myHold[i].R5[2],myHold[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
+ } elsif (page == "DIRTO") {
+ if (!pageSwitch[i].getBoolValue()) {
+ me["Simple"].show();
+ me["Simple_Center"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].show();
+ me["INITA"].hide();
+ me["INITB"].hide();
+ me["PERFTO"].hide();
+ me["arrowsDepArr"].show();
+ me["Simple_PageNum"].setText("X/X");
+ me["Simple_PageNum"].hide();
+ me["Simple_Title"].show();
+ me["ArrowLeft"].hide();
+ me["ArrowRight"].hide();
+ me["Simple_L1_Arrow"].hide();
+ me["Simple_L2_Arrow"].hide();
+ me["Simple_L3_Arrow"].hide();
+ me["Simple_L4_Arrow"].hide();
+ me["Simple_L5_Arrow"].hide();
+ me["Simple_L6_Arrow"].hide();
+ me["Simple_R1_Arrow"].hide();
+ me["Simple_R2_Arrow"].hide();
+ me["Simple_R3_Arrow"].hide();
+ me["Simple_R4_Arrow"].hide();
+ me["Simple_R5_Arrow"].hide();
+ me["Simple_R6_Arrow"].hide();
+
+ me.fontLeft(default, default, default, default, default, default);
+ me.fontLeftS(default, default, default, default, default, default);
+ me.fontRight(default, default, default, default, default, default);
+ me.fontRightS(default, default, default, default, default, default);
+
+ me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
+ me.fontSizeRight(normal, normal, normal, normal, normal, normal);
+
+ me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+ me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+
+ if (myDirTo[i] != nil) {
+ me["Simple_Title"].setText(sprintf("%s", myDirTo[i].title[0]));
+ me["Simple_Title"].setColor(getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/r"), getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/g"), getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/b"));
+
+ forindex (var matrixArrow; myDirTo[i].arrowsMatrix) {
+ if (matrixArrow == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDirTo[i].arrowsMatrix[matrixArrow]) {
+ if (item == 5) { continue; }
+ if (myDirTo[i].arrowsMatrix[matrixArrow][item] == 1) {
+ me["arrow" ~ (item + 1) ~ sign].show();
+ me["arrow" ~ (item + 1) ~ sign].setColor(getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/r"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/g"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/b"));
+ } else {
+ me["arrow" ~ (item + 1) ~ sign].hide();
+ }
+ }
+ }
+
+ forindex (var matrixFont; myDirTo[i].fontMatrix) {
+ if (matrixFont == 0) {
+ var sign = "L";
+ } else {
+ var sign = "R";
+ }
+ forindex (var item; myDirTo[i].fontMatrix[matrixFont]) {
+ if (myDirTo[i].fontMatrix[matrixFont][item] == 1) {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
+ } else {
+ me["Simple_" ~ sign ~ (item + 1)].setFont(default);
+ me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
+ }
+ }
+ }
+
+ if (fmgc.flightPlanController.temporaryFlag[i] and mcdu.dirToFlag) {
+ me["DIRTO_TMPY_group"].show();
+ } else {
+ me["DIRTO_TMPY_group"].hide();
+ }
+
+ if (myDirTo[i].L1[0] == nil) {
+ me["Simple_L1"].hide();
+ me["Simple_L1S"].hide();
+ } else {
+ me["Simple_L1"].show();
+ me["Simple_L1"].setText(myDirTo[i].L1[0]);
+ if (myDirTo[i].L1[1] != nil) {
+ me["Simple_L1S"].show();
+ me["Simple_L1S"].setText(myDirTo[i].L1[1]);
+ } else {
+ me["Simple_L1S"].hide();
+ }
+ }
+
+ if (myDirTo[i].L2[0] == nil) {
+ me["Simple_L2"].hide();
+ me["Simple_L2S"].hide();
+ } else {
+ me["Simple_L2"].show();
+ me["Simple_L2"].setText(myDirTo[i].L2[0]);
+ if (myDirTo[i].L2[1] != nil) {
+ me["Simple_L2S"].show();
+ me["Simple_L2S"].setText(myDirTo[i].L2[1]);
+ } else {
+ me["Simple_L2S"].hide();
+ }
+ }
+
+ if (myDirTo[i].L3[0] == nil) {
+ me["Simple_L3"].hide();
+ me["Simple_L3S"].hide();
+ } else {
+ me["Simple_L3"].show();
+ me["Simple_L3"].setText(myDirTo[i].L3[0]);
+ if (myDirTo[i].L3[1] != nil) {
+ me["Simple_L3S"].show();
+ me["Simple_L3S"].setText(myDirTo[i].L3[1]);
+ } else {
+ me["Simple_L3S"].hide();
+ }
+ }
+
+ if (myDirTo[i].L4[0] == nil) {
+ me["Simple_L4"].hide();
+ me["Simple_L4S"].hide();
+ } else {
+ me["Simple_L4"].show();
+ me["Simple_L4"].setText(myDirTo[i].L4[0]);
+ if (myDirTo[i].L4[1] != nil) {
+ me["Simple_L4S"].show();
+ me["Simple_L4S"].setText(myDirTo[i].L4[1]);
+ } else {
+ me["Simple_L4S"].hide();
+ }
+ }
+
+ if (myDirTo[i].L5[0] == nil) {
+ me["Simple_L5"].hide();
+ me["Simple_L5S"].hide();
+ } else {
+ me["Simple_L5"].show();
+ me["Simple_L5"].setText(myDirTo[i].L5[0]);
+ if (myDirTo[i].L5[1] != nil) {
+ me["Simple_L5S"].show();
+ me["Simple_L5S"].setText(myDirTo[i].L5[1]);
+ } else {
+ me["Simple_L5S"].hide();
+ }
+ }
+
+ if (myDirTo[i].L6[0] == nil) {
+ me["Simple_L6"].hide();
+ me["Simple_L6S"].hide();
+ } else {
+ me["Simple_L6"].show();
+ me["Simple_L6"].setText(myDirTo[i].L6[0]);
+ if (myDirTo[i].L6[1] != nil) {
+ me["Simple_L6S"].show();
+ me["Simple_L6S"].setText(myDirTo[i].L6[1]);
+ } else {
+ me["Simple_L6S"].hide();
+ }
+ }
+ me.colorLeft(myDirTo[i].L1[2],myDirTo[i].L2[2],myDirTo[i].L3[2],myDirTo[i].L4[2],myDirTo[i].L5[2],myDirTo[i].L6[2]);
+
+ if (myDirTo[i].R1[0] == nil) {
+ me["Simple_R1"].hide();
+ me["Simple_R1S"].hide();
+ } else {
+ me["Simple_R1"].show();
+ me["Simple_R1"].setText(myDirTo[i].R1[0]);
+ if (myDirTo[i].R1[1] != nil) {
+ me["Simple_R1S"].show();
+ me["Simple_R1S"].setText(myDirTo[i].R1[1]);
+ } else {
+ me["Simple_R1S"].hide();
+ }
+ }
+
+ if (myDirTo[i].R2[0] == nil) {
+ me["Simple_R2"].hide();
+ me["Simple_R2S"].hide();
+ } else {
+ me["Simple_R2"].show();
+ me["Simple_R2"].setText(myDirTo[i].R2[0]);
+ if (myDirTo[i].R2[1] != nil) {
+ me["Simple_R2S"].show();
+ me["Simple_R2S"].setText(myDirTo[i].R2[1]);
+ } else {
+ me["Simple_R2S"].hide();
+ }
+ }
+
+ if (myDirTo[i].R3[0] == nil) {
+ me["Simple_R3"].hide();
+ me["Simple_R3S"].hide();
+ } else {
+ me["Simple_R3"].show();
+ me["Simple_R3"].setText(myDirTo[i].R3[0]);
+ if (myDirTo[i].R3[1] != nil) {
+ me["Simple_R3S"].show();
+ me["Simple_R3S"].setText(myDirTo[i].R3[1]);
+ } else {
+ me["Simple_R3S"].hide();
+ }
+ }
+
+ if (myDirTo[i].R4[0] == nil) {
+ me["Simple_R4"].hide();
+ me["Simple_R4S"].hide();
+ } else {
+ me["Simple_R4"].show();
+ me["Simple_R4"].setText(myDirTo[i].R4[0]);
+ if (myDirTo[i].R4[1] != nil) {
+ me["Simple_R4S"].show();
+ me["Simple_R4S"].setText(myDirTo[i].R4[1]);
+ } else {
+ me["Simple_R4S"].hide();
+ }
+ }
+
+ if (myDirTo[i].R5[0] == nil) {
+ me["Simple_R5"].hide();
+ me["Simple_R5S"].hide();
+ } else {
+ me["Simple_R5"].show();
+ me["Simple_R5"].setText(myDirTo[i].R5[0]);
+ if (myDirTo[i].R5[1] != nil) {
+ me["Simple_R5S"].show();
+ me["Simple_R5S"].setText(myDirTo[i].R5[1]);
+ } else {
+ me["Simple_R5S"].hide();
+ }
+ }
+
+ if (myDirTo[i].R6[0] == nil) {
+ me["Simple_R6"].hide();
+ me["Simple_R6S"].hide();
+ } else {
+ me["Simple_R6"].show();
+ me["Simple_R6"].setText(myDirTo[i].R6[0]);
+ if (myDirTo[i].R6[1] != nil) {
+ me["Simple_R6S"].show();
+ me["Simple_R6S"].setText(myDirTo[i].R6[1]);
+ } else {
+ me["Simple_R6S"].hide();
+ }
+ }
+ me.colorRight(myDirTo[i].R1[2],myDirTo[i].R2[2],myDirTo[i].R3[2],myDirTo[i].R4[2],myDirTo[i].R5[2],myDirTo[i].R6[2]);
+ }
+ pageSwitch[i].setBoolValue(1);
+ }
} else {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].hide();
+ me["FPLN"].hide();
+ me["DIRTO_TMPY_group"].show();
me["INITA"].hide();
me["INITB"].hide();
me["PERFTO"].hide();
@@ -1761,7 +4225,7 @@ var canvas_MCDU_base = {
me["Scratchpad"].setText(sprintf("%s", scratchpad[i].getValue()));
},
- # ack = ignore, wht = white, grn = green, blu = blue, amb = amber, yel = yellow
+ # ack = ignore, wht = white, grn = green, blu = blue, amb = amber, yel = yellow, mag = magenta
colorLeft: func(a, b, c, d, e, f) {
if (a != "ack") {
me["Simple_L1"].setColor(getprop("MCDUC/colors/" ~ a ~ "/r"), getprop("MCDUC/colors/" ~ a ~ "/g"), getprop("MCDUC/colors/" ~ a ~ "/b"));
diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml
index 541b08a2..518cf4d9 100644
--- a/Models/Instruments/MCDU/MCDU1.xml
+++ b/Models/Instruments/MCDU/MCDU1.xml
@@ -251,6 +251,31 @@
+
+ pick
+ dir
+
+
+ false
+
+ nasal
+
+
+
+
+ systems/electrical/bus/ac-1
+ 110
+
+
+ controls/lighting/DU/mcdu1
+ 0.01
+
+
+
+
+
+
+
pick
L1
diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml
index adf05c55..015c4def 100644
--- a/Models/Instruments/MCDU/MCDU2.xml
+++ b/Models/Instruments/MCDU/MCDU2.xml
@@ -251,6 +251,31 @@
+
+ pick
+ dir
+
+
+ false
+
+ nasal
+
+
+
+
+ systems/electrical/bus/ac-2
+ 110
+
+
+ controls/lighting/DU/mcdu2
+ 0.01
+
+
+
+
+
+
+
pick
L1
diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg
index 6c5d8b16..042c0080 100644
--- a/Models/Instruments/MCDU/res/mcdu.svg
+++ b/Models/Instruments/MCDU/res/mcdu.svg
@@ -12,7 +12,7 @@
viewBox="0 0 1024 864"
version="1.1"
id="svg2"
- inkscape:version="1.0beta2 (2b71d25, 2019-12-03)"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="mcdu.svg">
@@ -37,17 +37,17 @@
guidetolerance="20"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
- inkscape:window-width="1920"
- inkscape:window-height="1035"
+ inkscape:window-width="1366"
+ inkscape:window-height="705"
id="namedview371"
showgrid="true"
- inkscape:zoom="0.5"
- inkscape:cx="997.98642"
- inkscape:cy="772.65269"
- inkscape:window-x="0"
- inkscape:window-y="23"
+ inkscape:zoom="1.5306292"
+ inkscape:cx="1100.8644"
+ inkscape:cy="75.945873"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
inkscape:window-maximized="1"
- inkscape:current-layer="Simple"
+ inkscape:current-layer="svg2"
showguides="false"
inkscape:snap-global="false"
units="px"
@@ -872,6 +872,579 @@
id="tspan4269-7"
sodipodi:role="line">TEXT
+
+
+
+
+
+
+
+
+
+
+
+
+ CALLSIG
+
+ TMPY
+
+ ERASE
+ TMPY
+
+
+
+
+
+
+
+ TMPY
+ INSERT
+
+
+
+
+
+
+
+
+ FROM
+
+
+
+ ERASE
+ DIR TO
+
+
+
+
+
+
+
+ DIR TO
+ INSERT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
F
S
@@ -1719,7 +2292,7 @@
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1"
y="422.15305"
x="398.21817"
- id="tspan1085"
+ id="tspan345"
sodipodi:role="line">O
=
@@ -1745,7 +2318,7 @@
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1"
y="278.32764"
x="478.87796"
- id="tspan1091"
+ id="tspan351"
sodipodi:role="line">=
=
diff --git a/Models/Instruments/ND/canvas/A3XX_ND.nas b/Models/Instruments/ND/canvas/A3XX_ND.nas
index 0a38070c..4d82cdbb 100644
--- a/Models/Instruments/ND/canvas/A3XX_ND.nas
+++ b/Models/Instruments/ND/canvas/A3XX_ND.nas
@@ -5,8 +5,8 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var get_local_path = func(file){
- var aircraft_dir = split("/", getprop("sim/aircraft-dir"))[-1];
- return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
+ var aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
+ return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
};
var version = getprop("sim/version/flightgear");
diff --git a/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas b/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas
index eca43a4e..d8a41c5b 100644
--- a/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas
+++ b/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas
@@ -5,107 +5,118 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var A3XXRouteDriver = {
- new: func(){
- var m = {
- parents: [A3XXRouteDriver],
- };
- m.init();
- return m;
- },
- init: func(){
- me.update();
- },
- update: func(){
- me.flightplan = flightplan();
- },
- getNumberOfFlightPlans: func(){1},
- getFlightPlanType: func(fpNum){"current"},
- getFlightPlan: func(fpNum){me.flightplan},
- getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
- getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
- getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)},
- hasDiscontinuity: func(fpNum, wptID){0},
- getListeners: func(){[]},
- shouldUpdate: func 1
+ new: func(){
+ var m = {
+ parents: [A3XXRouteDriver],
+ };
+ m.init();
+ return m;
+ },
+ init: func(){
+ me.update();
+ },
+ update: func(){
+ me.flightplan = fmgc.flightPlanController.flightplans[2];
+ },
+ getNumberOfFlightPlans: func(){1},
+ getFlightPlanType: func(fpNum){"current"},
+ getFlightPlan: func(fpNum){me.flightplan},
+ getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
+ getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
+ getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)},
+ hasDiscontinuity: func(fpNum, wptID){0},
+ triggerSignal: func(signal){
+ setprop(me.signalPath(signal),1);
+ setprop(me.signalPath(signal),0);
+ },
+ signalPath: func(signal){
+ "autopilot/route-manager/signals/rd-"~ signal;
+ },
+ getListeners: func(){[
+ me.signalPath("fp-added"),
+ me.signalPath("fp-removed")
+ ]},
+ shouldUpdate: func 1
};
var MultiA3XXRouteDriver = {
- parents: [A3XXRouteDriver],
- new: func(){
- var m = {
- parents: [MultiA3XXRouteDriver],
- _flightplans: [],
- currentFlightPlan: 0
- };
- m.init();
- return m;
- },
- addFlightPlan: func(type, plan){
- append(me._flightplans, {
- type: type,
- flightplan: plan
- });
- },
- removeFlightPlanAtIndex: func(idx){
- var sz = size(me._flightplans);
- if(idx < sz){
- if(sz == 1)
- me._flightplans = [];
- elsif(sz == 2 and idx == 0)
- me._flightplans = [me._flightplans[1]];
- elsif(sz == 2 and idx == 1)
- pop(me._flightplans);
- else {
- var subv_l = subvec(me._flightplans, 0, idx);
- var subv_r = subvec(me._flightplans, idx + 1);
- me._flightplans = subv_l ~ subv_r;
- }
- }
- me.triggerSignal("fp-added");
- },
- removeFlightPlanOfType: func(type){
- var new_vec = [];
- foreach(var fp; me._flightplans){
- if(fp["type"] != type)
- append(new_vec, fp);
- }
- me._flightplans = new_vec;
- me.triggerSignal("fp-removed");
- },
- getNumberOfFlightPlans: func(){
- size(me._flightplans);
- },
- getFlightPlanType: func(fpNum){
- if(fpNum >= size(me._flightplans)) return nil;
- var fp = me._flightplans[fpNum];
- return fp.type;
- },
- getFlightPlan: func(fpNum){
- if(fpNum >= size(me._flightplans)) return nil;
- return me._flightplans[fpNum];
- },
- getPlanSize: func(fpNum){
- if(fpNum >= size(me._flightplans)) return 0;
- return me._flightplans[fpNum].getPlanSize();
- },
- getWP: func(fpNum, idx){
- if(fpNum >= size(me._flightplans)) return nil;
- var fp = me._flightplans[fpNum].getPlanSize();
- return fp.getWP(idx);
- },
- getPlanModeWP: func(idx){
- if(me.currentFlightPlan >= size(me._flightplans)) return nil;
- var fp = me._flightplans[me.currentFlightPlan];
- return fp.getWP(idx);
- },
- triggerSignal: func(signal){
- setprop(me.signalPath(signal));
- },
- signalPath: func(signal){
- "autopilot/route-manager/signals/rd-"~ signal;
- },
- getListeners: func(){[
- me.getSignal("fp-added"),
- me.getSignal("fp-removed")
- ]}
+ parents: [A3XXRouteDriver],
+ new: func(){
+ var m = {
+ parents: [MultiA3XXRouteDriver],
+ _flightplans: [],
+ currentFlightPlan: 0
+ };
+ m.init();
+ return m;
+ },
+ addFlightPlan: func(type, plan){
+ append(me._flightplans, {
+ type: type,
+ flightplan: plan
+ });
+ },
+ removeFlightPlanAtIndex: func(idx){
+ var sz = size(me._flightplans);
+ if(idx < sz){
+ if(sz == 1)
+ me._flightplans = [];
+ elsif(sz == 2 and idx == 0)
+ me._flightplans = [me._flightplans[1]];
+ elsif(sz == 2 and idx == 1)
+ pop(me._flightplans);
+ else {
+ var subv_l = subvec(me._flightplans, 0, idx);
+ var subv_r = subvec(me._flightplans, idx + 1);
+ me._flightplans = subv_l ~ subv_r;
+ }
+ }
+ me.triggerSignal("fp-added");
+ },
+ removeFlightPlanOfType: func(type){
+ var new_vec = [];
+ foreach(var fp; me._flightplans){
+ if(fp["type"] != type)
+ append(new_vec, fp);
+ }
+ me._flightplans = new_vec;
+ me.triggerSignal("fp-removed");
+ },
+ getNumberOfFlightPlans: func(){
+ size(me._flightplans);
+ },
+ getFlightPlanType: func(fpNum){
+ if(fpNum >= size(me._flightplans)) return nil;
+ var fp = me._flightplans[fpNum];
+ return fp.type;
+ },
+ getFlightPlan: func(fpNum){
+ if(fpNum >= size(me._flightplans)) return nil;
+ return me._flightplans[fpNum];
+ },
+ getPlanSize: func(fpNum){
+ if(fpNum >= size(me._flightplans)) return 0;
+ return me._flightplans[fpNum].getPlanSize();
+ },
+ getWP: func(fpNum, idx){
+ if(fpNum >= size(me._flightplans)) return nil;
+ var fp = me._flightplans[fpNum].getPlanSize();
+ return fp.getWP(idx);
+ },
+ getPlanModeWP: func(idx){
+ if(me.currentFlightPlan >= size(me._flightplans)) return nil;
+ var fp = me._flightplans[me.currentFlightPlan];
+ return fp.getWP(idx);
+ },
+ triggerSignal: func(signal){
+ setprop(me.signalPath(signal), 1);
+ setprop(me.signalPath(signal), 0);
+ },
+ signalPath: func(signal){
+ "autopilot/route-manager/signals/rd-"~ signal;
+ },
+ getListeners: func(){[
+ me.getSignal("fp-added"),
+ me.getSignal("fp-removed")
+ ]}
};
diff --git a/Models/Instruments/ND/canvas/ND_config.nas b/Models/Instruments/ND/canvas/ND_config.nas
index ef122e70..af7281f8 100644
--- a/Models/Instruments/ND/canvas/ND_config.nas
+++ b/Models/Instruments/ND/canvas/ND_config.nas
@@ -5,23 +5,23 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
canvas.NDConfig = {
- properties: {
- des_apt: "/autopilot/route-manager/destination/airport",
- dep_apt: "/autopilot/route-manager/departure/airport",
- des_rwy: "/autopilot/route-manager/destination/runway",
- dep_rwy: "/autopilot/route-manager/departure/runway",
- fplan_active: "autopilot/route-manager/active",
- athr: "/it-autoflight/output/athr",
- cur_wp: "/autopilot/route-manager/current-wp",
- vnav_node: "/autopilot/route-manager/vnav/",
- spd_node: "/autopilot/route-manager/spd/",
- holding: "/flight-management/hold",
- holding_points: "/flight-management/hold/points",
- adf1_frq: "instrumentation/adf[0]/frequencies/selected-khz",
- adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz",
- nav1_frq: "instrumentation/nav[0]/frequencies/selected-mhz",
- nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz",
- lat_ctrl: "/it-autoflight/output/lat",
- ver_ctrl: "/it-autoflight/output/vert",
- }
+ properties: {
+ des_apt: "/autopilot/route-manager/destination/airport",
+ dep_apt: "/autopilot/route-manager/departure/airport",
+ des_rwy: "/autopilot/route-manager/destination/runway",
+ dep_rwy: "/autopilot/route-manager/departure/runway",
+ fplan_active: "autopilot/route-manager/active",
+ athr: "/it-autoflight/output/athr",
+ cur_wp: "/autopilot/route-manager/current-wp",
+ vnav_node: "/autopilot/route-manager/vnav/",
+ spd_node: "/autopilot/route-manager/spd/",
+ holding: "/flight-management/hold",
+ holding_points: "/flight-management/hold/points",
+ adf1_frq: "instrumentation/adf[0]/frequencies/selected-khz",
+ adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz",
+ nav1_frq: "instrumentation/nav[0]/frequencies/selected-mhz",
+ nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz",
+ lat_ctrl: "/it-autoflight/output/lat",
+ ver_ctrl: "/it-autoflight/output/vert",
+ }
};
diff --git a/Models/Instruments/ND/canvas/helpers.nas b/Models/Instruments/ND/canvas/helpers.nas
index f7d69ed1..c6a890a3 100644
--- a/Models/Instruments/ND/canvas/helpers.nas
+++ b/Models/Instruments/ND/canvas/helpers.nas
@@ -5,141 +5,141 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var SymbolPainter = {
- aircraft_dir: nil,
- getOpts: func(opts){
- if(opts == nil) opts = {};
- var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0};
- if(contains(opts, "id"))
- defOpts.id = opts.id;
- if(contains(opts, "color"))
- defOpts.color = opts.color;
- if(contains(opts, "scale"))
- defOpts.scale = opts.scale;
- if(contains(opts, "create_group"))
- defOpts.create_group = opts.create_group;
- if(contains(opts, "update_center"))
- defOpts.update_center = opts.update_center;
- return defOpts;
- },
- getAircraftDir: func(){
- if(me.aircraft_dir == nil)
- me.aircraft_dir = split("/", getprop("sim/aircraft-dir"))[-1];
- return me.aircraft_dir;
- },
- svgPath: func(file){
- return "Aircraft/" ~ me.getAircraftDir() ~ "/Models/Instruments/ND/canvas/res/"~file;
- },
- drawFIX : func(grp, opts = nil){
- var icon_fix = nil;
- opts = me.getOpts(opts);
- var sym_id = opts.id;
- if(sym_id != nil)
- icon_fix = grp.createChild("path", sym_id);
- else
- icon_fix = grp.createChild("path");
- var color = opts.color;
- if(color == nil){
- color = {
- r: 0.69,
- g: 0,
- b: 0.39
- };
- }
- var scale = opts.scale;
- if(scale == nil) scale = 0.8;
- icon_fix.moveTo(-10,0)
- .lineTo(0,-17)
- .lineTo(10,0)
- .lineTo(0,17)
- .close()
- .setStrokeLineWidth(3)
- .setColor(color.r,color.g,color.b)
- .setScale(scale,scale);
- return icon_fix;
- },
- drawVOR: func(grp, opts = nil){
- opts = me.getOpts(opts);
- if(opts.create_group){
- var sym_id = opts.id;
- if(sym_id != nil)
- grp = grp.createChild("group", sym_id);
- else
- grp = grp.createChild("group");
- }
- var svg_path = me.svgPath("airbus_vor.svg");
- canvas.parsesvg(grp, svg_path);
- var scale = opts.scale;
- if(scale == nil) scale = 0.8;
- grp.setScale(scale,scale);
- if(opts.update_center)
- grp.setTranslation(-24 * scale,-24 * scale);
- if(!contains(grp, "setColor")){
- grp.setColor = func {
- var layer1 = grp.getElementById("layer1");
- if(layer1 == nil) return;
- var children = layer1.getChildren();
- foreach(var c; children){
- if(isa(c, canvas.Path))
- c.setColor(arg);
- }
- };
- }
- return grp;
- },
- drawNDB: func(grp, opts = nil){
- var icon_ndb = nil;
- opts = me.getOpts(opts);
- var sym_id = opts.id;
- if(sym_id != nil)
- icon_ndb = grp.createChild("path", sym_id);
- else
- icon_ndb = grp.createChild("path");
- var color = opts.color;
- var color = opts.color;
- if(color == nil){
- color = {
- r: 0.69,
- g: 0,
- b: 0.39
- };
- }
- var scale = opts.scale;
- if(scale == nil) scale = 0.8;
- icon_ndb.moveTo(-15,15)
- .lineTo(0,-15)
- .lineTo(15,15)
- .close()
- .setStrokeLineWidth(3)
- .setColor(color.r,color.g,color.b)
- .setScale(scale,scale);
- return icon_ndb;
- },
- drawAirport: func(grp, opts = nil){
- opts = me.getOpts(opts);
- if(opts.create_group){
- var sym_id = opts.id;
- if(sym_id != nil)
- grp = grp.createChild("group", sym_id);
- else
- grp = grp.createChild("group");
- }
- var svg_path = me.svgPath("airbus_airport.svg");
- canvas.parsesvg(grp, svg_path);
- var scale = opts.scale;
- if(scale == nil) scale = 0.8;
- grp.setScale(scale,scale);
- if(opts.update_center)
- grp.setTranslation(-24 * scale,-24 * scale);
- return grp;
- },
- draw: func(type, grp, opts = nil){
- if(type == "VOR" or type == "vor")
- return me.drawVOR(grp, opts);
- elsif(type == "NDB" or type == "ndb")
- return me.drawNDB(grp, opts);
- elsif(type == "ARPT" or type == "arpt")
- return me.drawAirport(grp, opts);
- else
- return me.drawFIX(grp, opts);
- }
+ aircraft_dir: nil,
+ getOpts: func(opts){
+ if(opts == nil) opts = {};
+ var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0};
+ if(contains(opts, "id"))
+ defOpts.id = opts.id;
+ if(contains(opts, "color"))
+ defOpts.color = opts.color;
+ if(contains(opts, "scale"))
+ defOpts.scale = opts.scale;
+ if(contains(opts, "create_group"))
+ defOpts.create_group = opts.create_group;
+ if(contains(opts, "update_center"))
+ defOpts.update_center = opts.update_center;
+ return defOpts;
+ },
+ getAircraftDir: func(){
+ if(me.aircraft_dir == nil)
+ me.aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
+ return me.aircraft_dir;
+ },
+ svgPath: func(file){
+ return "Aircraft/" ~ me.getAircraftDir() ~ "/Models/Instruments/ND/canvas/res/"~file;
+ },
+ drawFIX : func(grp, opts = nil){
+ var icon_fix = nil;
+ opts = me.getOpts(opts);
+ var sym_id = opts.id;
+ if(sym_id != nil)
+ icon_fix = grp.createChild("path", sym_id);
+ else
+ icon_fix = grp.createChild("path");
+ var color = opts.color;
+ if(color == nil){
+ color = {
+ r: 0.69,
+ g: 0,
+ b: 0.39
+ };
+ }
+ var scale = opts.scale;
+ if(scale == nil) scale = 0.8;
+ icon_fix.moveTo(-10,0)
+ .lineTo(0,-17)
+ .lineTo(10,0)
+ .lineTo(0,17)
+ .close()
+ .setStrokeLineWidth(3)
+ .setColor(color.r,color.g,color.b)
+ .setScale(scale,scale);
+ return icon_fix;
+ },
+ drawVOR: func(grp, opts = nil){
+ opts = me.getOpts(opts);
+ if(opts.create_group){
+ var sym_id = opts.id;
+ if(sym_id != nil)
+ grp = grp.createChild("group", sym_id);
+ else
+ grp = grp.createChild("group");
+ }
+ var svg_path = me.svgPath("airbus_vor.svg");
+ canvas.parsesvg(grp, svg_path);
+ var scale = opts.scale;
+ if(scale == nil) scale = 0.8;
+ grp.setScale(scale,scale);
+ if(opts.update_center)
+ grp.setTranslation(-24 * scale,-24 * scale);
+ if(!contains(grp, "setColor")){
+ grp.setColor = func {
+ var layer1 = grp.getElementById("layer1");
+ if(layer1 == nil) return;
+ var children = layer1.getChildren();
+ foreach(var c; children){
+ if(isa(c, canvas.Path))
+ c.setColor(arg);
+ }
+ };
+ }
+ return grp;
+ },
+ drawNDB: func(grp, opts = nil){
+ var icon_ndb = nil;
+ opts = me.getOpts(opts);
+ var sym_id = opts.id;
+ if(sym_id != nil)
+ icon_ndb = grp.createChild("path", sym_id);
+ else
+ icon_ndb = grp.createChild("path");
+ var color = opts.color;
+ var color = opts.color;
+ if(color == nil){
+ color = {
+ r: 0.69,
+ g: 0,
+ b: 0.39
+ };
+ }
+ var scale = opts.scale;
+ if(scale == nil) scale = 0.8;
+ icon_ndb.moveTo(-15,15)
+ .lineTo(0,-15)
+ .lineTo(15,15)
+ .close()
+ .setStrokeLineWidth(3)
+ .setColor(color.r,color.g,color.b)
+ .setScale(scale,scale);
+ return icon_ndb;
+ },
+ drawAirport: func(grp, opts = nil){
+ opts = me.getOpts(opts);
+ if(opts.create_group){
+ var sym_id = opts.id;
+ if(sym_id != nil)
+ grp = grp.createChild("group", sym_id);
+ else
+ grp = grp.createChild("group");
+ }
+ var svg_path = me.svgPath("airbus_airport.svg");
+ canvas.parsesvg(grp, svg_path);
+ var scale = opts.scale;
+ if(scale == nil) scale = 0.8;
+ grp.setScale(scale,scale);
+ if(opts.update_center)
+ grp.setTranslation(-24 * scale,-24 * scale);
+ return grp;
+ },
+ draw: func(type, grp, opts = nil){
+ if(type == "VOR" or type == "vor")
+ return me.drawVOR(grp, opts);
+ elsif(type == "NDB" or type == "ndb")
+ return me.drawNDB(grp, opts);
+ elsif(type == "ARPT" or type == "arpt")
+ return me.drawAirport(grp, opts);
+ else
+ return me.drawFIX(grp, opts);
+ }
};
diff --git a/Models/Instruments/ND/canvas/loaders.nas b/Models/Instruments/ND/canvas/loaders.nas
index a6d831b6..ba07c923 100644
--- a/Models/Instruments/ND/canvas/loaders.nas
+++ b/Models/Instruments/ND/canvas/loaders.nas
@@ -10,78 +10,78 @@ version = num(v[0]~"."~v[1]);
setlistener("/nasal/canvas/loaded", func() {
- ####### LOAD FILES #######
- #print("loading files");
- (func {
- var aircraft_root = getprop("sim/aircraft-dir");
+ ####### LOAD FILES #######
+ #print("loading files");
+ (func {
+ var aircraft_root = getprop("/sim/aircraft-dir");
- var load = func(file, name) {
- #print("Loading ..." ~ file);
- if (name == nil)
- var name = split("/", file)[-1];
- if (substr(name, size(name)-4) == ".draw")
- name = substr(name, 0, size(name)-5);
- #print("reading file");
- var code = io.readfile(file);
- #print("compiling file");
- # This segfaults for some reason:
- #var code = call(compile, [code], var err=[]);
- var code = call(func compile(code, file), [code], var err=[]);
- if (size(err)) {
- #print("handling error");
- if (substr(err[0], 0, 12) == "Parse error:") { # hack around Nasal feature
- var e = split(" at line ", err[0]);
- if (size(e) == 2)
- err[0] = string.join("", [e[0], "\n at ", file, ", line ", e[1], "\n "]);
- }
- for (var i = 1; (var c = caller(i)) != nil; i += 1)
- err ~= subvec(c, 2, 2);
- debug.printerror(err);
- return;
- }
- #print("calling code");
- call(code, nil, nil, var hash = {});
- #debug.dump(keys(hash));
- return hash;
- };
+ var load = func(file, name) {
+ #print("Loading ..." ~ file);
+ if (name == nil)
+ var name = split("/", file)[-1];
+ if (substr(name, size(name)-4) == ".draw")
+ name = substr(name, 0, size(name)-5);
+ #print("reading file");
+ var code = io.readfile(file);
+ #print("compiling file");
+ # This segfaults for some reason:
+ #var code = call(compile, [code], var err=[]);
+ var code = call(func compile(code, file), [code], var err=[]);
+ if (size(err)) {
+ #print("handling error");
+ if (substr(err[0], 0, 12) == "Parse error:") { # hack around Nasal feature
+ var e = split(" at line ", err[0]);
+ if (size(e) == 2)
+ err[0] = string.join("", [e[0], "\n at ", file, ", line ", e[1], "\n "]);
+ }
+ for (var i = 1; (var c = caller(i)) != nil; i += 1)
+ err ~= subvec(c, 2, 2);
+ debug.printerror(err);
+ return;
+ }
+ #print("calling code");
+ call(code, nil, nil, var hash = {});
+ #debug.dump(keys(hash));
+ return hash;
+ };
- var load_deps = func(name) {
- print("Loading MapStructure Layer: "~ name);
- load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name);
- load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name);
- if(version < 3.2)
- load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name);
- }
+ var load_deps = func(name) {
+ print("Loading MapStructure Layer: "~ name);
+ load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name);
+ load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name);
+ if(version < 3.2)
+ load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name);
+ }
- #foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] )
- #load_deps( name );
- var dep_names = [
- # With these extensions, in this order:
- "lcontroller",
- "symbol",
- "scontroller",
- "controller",
- ];
- var map_root = aircraft_root~"/Models/Instruments/ND/canvas/map/";
- var files = directory(map_root);
- var deps = {};
- foreach (var d; dep_names) deps[d] = [];
- foreach(var f; files){
- var ext = size(var s=split(".", f)) > 1 ? s[-1] : nil;
- foreach (var d; dep_names) {
- if (ext == d) {
- append(deps[d], f);
- break
- }
- }
- }
+ #foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] )
+ #load_deps( name );
+ var dep_names = [
+ # With these extensions, in this order:
+ "lcontroller",
+ "symbol",
+ "scontroller",
+ "controller",
+ ];
+ var map_root = aircraft_root~"/Models/Instruments/ND/canvas/map/";
+ var files = directory(map_root);
+ var deps = {};
+ foreach (var d; dep_names) deps[d] = [];
+ foreach(var f; files){
+ var ext = size(var s=split(".", f)) > 1 ? s[-1] : nil;
+ foreach (var d; dep_names) {
+ if (ext == d) {
+ append(deps[d], f);
+ break
+ }
+ }
+ }
- foreach (var d; dep_names) {
- foreach (var f; deps[d]) {
- var name = split(".", f)[0];
- load(map_root~f, name);
- }
- }
+ foreach (var d; dep_names) {
+ foreach (var f; deps[d]) {
+ var name = split(".", f)[0];
+ load(map_root~f, name);
+ }
+ }
})();
diff --git a/Models/Instruments/ND/canvas/map/ALT-profile.scontroller b/Models/Instruments/ND/canvas/map/ALT-profile.scontroller
index 1bd3fee3..a880967c 100644
--- a/Models/Instruments/ND/canvas/map/ALT-profile.scontroller
+++ b/Models/Instruments/ND/canvas/map/ALT-profile.scontroller
@@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func()
- die(name~".scontroller.query_range /MUST/ be provided by implementation");
+ die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position');
diff --git a/Models/Instruments/ND/canvas/map/APS.scontroller b/Models/Instruments/ND/canvas/map/APS.scontroller
index e82d4c0a..8af1c96f 100644
--- a/Models/Instruments/ND/canvas/map/APS.scontroller
+++ b/Models/Instruments/ND/canvas/map/APS.scontroller
@@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func()
- die(name~".scontroller.query_range /MUST/ be provided by implementation");
+ die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position');
diff --git a/Models/Instruments/ND/canvas/map/APT.scontroller b/Models/Instruments/ND/canvas/map/APT.scontroller
index d41a6049..48ed05d7 100644
--- a/Models/Instruments/ND/canvas/map/APT.scontroller
+++ b/Models/Instruments/ND/canvas/map/APT.scontroller
@@ -11,6 +11,6 @@ var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation");
var getpos = func(model){
- [model.lat, model.lon];
+ [model.lat, model.lon];
}
diff --git a/Models/Instruments/ND/canvas/map/DEBUG.lcontroller b/Models/Instruments/ND/canvas/map/DEBUG.lcontroller
index 9d427ba2..3b1fce73 100644
--- a/Models/Instruments/ND/canvas/map/DEBUG.lcontroller
+++ b/Models/Instruments/ND/canvas/map/DEBUG.lcontroller
@@ -6,66 +6,66 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
- parents: [canvas.MultiSymbolLayer],
- type: name, # Symbol type
- df_controller: __self__, # controller to use by default -- this one
- df_options: {
- update_t : 'autopilot/route-manager/debug/update_t',
- listen: ['update_t']
- },
- df_style: {
- default_color: [1,0,0],
- }
+ parents: [canvas.MultiSymbolLayer],
+ type: name, # Symbol type
+ df_controller: __self__, # controller to use by default -- this one
+ df_options: {
+ update_t : 'autopilot/route-manager/debug/update_t',
+ listen: ['update_t']
+ },
+ df_style: {
+ default_color: [1,0,0],
+ }
});
var new = func(layer) {
- var m = {
- parents: [__self__],
- layer: layer,
- map: layer.map,
- listeners: [],
- };
- layer.searcher._equals = func(a,b) a.equals(b);
+ var m = {
+ parents: [__self__],
+ layer: layer,
+ map: layer.map,
+ listeners: [],
+ };
+ layer.searcher._equals = func(a,b) a.equals(b);
- return m;
+ return m;
};
var del = func() {
- foreach (var l; me.listeners)
- removelistener(l);
+ foreach (var l; me.listeners)
+ removelistener(l);
};
var searchCmd = func {
- var result = [];
- #return result;
- var node = me['node'];
- if (node == nil) {
- node = props.globals.getNode('autopilot/route-manager/debug/', 1);
- me.node = node;
- }
- var points = me.node.getNode('points', 1).getChildren();
- #var count = getprop('autopilot/route-manager/debug/num') or 0;
- var count = size(points);
- #print('Map DEBUG: querying '~ count ~' results.');
- for(var idx = 0; idx < count; idx += 1){
- var point = points[idx];
- #var id = getprop('autopilot/route-manager/debug/point['~idx~']/id');
- #var lat = getprop('autopilot/route-manager/debug/point['~idx~']/lat');
- #var lon = getprop('autopilot/route-manager/debug/point['~idx~']/lon');
- var id = point.getValue('id');
- var lat = point.getValue('lat');
- var lon = point.getValue('lon');
- if (id == nil or id == '') continue;
- #print('Map DEBUG: found '~ id ~' debug point.');
- var model = {
- id: id,
- lat: lat,
- lon: lon,
- equals: func(o){
- me.id == o.id and me.lat == o.lat and me.lon == o.lon
- }
- };
- append(result, model);
- }
- return result;
+ var result = [];
+ #return result;
+ var node = me['node'];
+ if (node == nil) {
+ node = props.globals.getNode('autopilot/route-manager/debug/', 1);
+ me.node = node;
+ }
+ var points = me.node.getNode('points', 1).getChildren();
+ #var count = getprop('autopilot/route-manager/debug/num') or 0;
+ var count = size(points);
+ #print('Map DEBUG: querying '~ count ~' results.');
+ for(var idx = 0; idx < count; idx += 1){
+ var point = points[idx];
+ #var id = getprop('autopilot/route-manager/debug/point['~idx~']/id');
+ #var lat = getprop('autopilot/route-manager/debug/point['~idx~']/lat');
+ #var lon = getprop('autopilot/route-manager/debug/point['~idx~']/lon');
+ var id = point.getValue('id');
+ var lat = point.getValue('lat');
+ var lon = point.getValue('lon');
+ if (id == nil or id == '') continue;
+ #print('Map DEBUG: found '~ id ~' debug point.');
+ var model = {
+ id: id,
+ lat: lat,
+ lon: lon,
+ equals: func(o){
+ me.id == o.id and me.lat == o.lat and me.lon == o.lon
+ }
+ };
+ append(result, model);
+ }
+ return result;
}
diff --git a/Models/Instruments/ND/canvas/map/DEBUG.symbol b/Models/Instruments/ND/canvas/map/DEBUG.symbol
index b58444d7..12fc978f 100644
--- a/Models/Instruments/ND/canvas/map/DEBUG.symbol
+++ b/Models/Instruments/ND/canvas/map/DEBUG.symbol
@@ -8,20 +8,20 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group";
var init = func {
- me.text_wps = me.element.createChild("text", "dbg-text-" ~ me.model.id)
- .setDrawMode( canvas.Text.TEXT )
- .setText(me.model.id)
- .setFont("LiberationFonts/LiberationSans-Regular.ttf")
- .setFontSize(28)
- .setTranslation(25,15)
- .setColor(1,0,0);
- me.text_alt = nil;
- me.sym = me.element.createChild("path").
- setStrokeLineWidth(4).
- moveTo(-16,0).
- arcSmallCW(16,16,0,32,0).
- arcSmallCW(16,16,0,-32,0).
- setColor(1,0,0);
+ me.text_wps = me.element.createChild("text", "dbg-text-" ~ me.model.id)
+ .setDrawMode( canvas.Text.TEXT )
+ .setText(me.model.id)
+ .setFont("LiberationFonts/LiberationSans-Regular.ttf")
+ .setFontSize(28)
+ .setTranslation(25,15)
+ .setColor(1,0,0);
+ me.text_alt = nil;
+ me.sym = me.element.createChild("path").
+ setStrokeLineWidth(4).
+ moveTo(-16,0).
+ arcSmallCW(16,16,0,32,0).
+ arcSmallCW(16,16,0,-32,0).
+ setColor(1,0,0);
}
var draw = func{
diff --git a/Models/Instruments/ND/canvas/map/DECEL.lcontroller b/Models/Instruments/ND/canvas/map/DECEL.lcontroller
index a4ec57a1..8a5d302a 100644
--- a/Models/Instruments/ND/canvas/map/DECEL.lcontroller
+++ b/Models/Instruments/ND/canvas/map/DECEL.lcontroller
@@ -6,32 +6,32 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
- parents: [MultiSymbolLayer],
- type: name, # Symbol type
- df_controller: __self__, # controller to use by default -- this one
- df_options : { # default configuration options
- decel_node: "/autopilot/route-manager/vnav/decel/"
- }
+ parents: [MultiSymbolLayer],
+ type: name, # Symbol type
+ df_controller: __self__, # controller to use by default -- this one
+ df_options : { # default configuration options
+ decel_node: "/autopilot/route-manager/vnav/decel/"
+ }
});
var new = func(layer) {
- var m = {
- parents: [__self__],
- layer: layer,
- map: layer.map,
- listeners: [],
- };
- layer.searcher._equals = func(a,b) a.getName() == b.getName();
- return m;
+ var m = {
+ parents: [__self__],
+ layer: layer,
+ map: layer.map,
+ listeners: [],
+ };
+ layer.searcher._equals = func(a,b) a.getName() == b.getName();
+ return m;
};
var del = func() {
- foreach (var l; me.listeners)
- removelistener(l);
+ foreach (var l; me.listeners)
+ removelistener(l);
};
var searchCmd = func {
- var results = [];
- var symNode = props.globals.getNode(me.layer.options.decel_node);
- if (symNode != nil and symNode.getValue('longitude-deg') != nil)
- append(results, symNode);
- return results;
+ var results = [];
+ var symNode = props.globals.getNode(me.layer.options.decel_node);
+ if (symNode != nil and symNode.getValue('longitude-deg') != nil)
+ append(results, symNode);
+ return results;
}
diff --git a/Models/Instruments/ND/canvas/map/DECEL.scontroller b/Models/Instruments/ND/canvas/map/DECEL.scontroller
index 4e749b10..7d66482a 100644
--- a/Models/Instruments/ND/canvas/map/DECEL.scontroller
+++ b/Models/Instruments/ND/canvas/map/DECEL.scontroller
@@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func()
- die(name~".scontroller.query_range /MUST/ be provided by implementation");
+ die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position');
diff --git a/Models/Instruments/ND/canvas/map/DECEL.symbol b/Models/Instruments/ND/canvas/map/DECEL.symbol
index cc39fd65..c0a65b20 100644
--- a/Models/Instruments/ND/canvas/map/DECEL.symbol
+++ b/Models/Instruments/ND/canvas/map/DECEL.symbol
@@ -12,21 +12,21 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group";
var init = func {
- var svg_path = me.getStyle('svg_path');
- if(svg_path == nil)
- svg_path = get_local_path('res/airbus_decel.svg');
- me.decel_grp = me.element.createChild("group","decel");
- canvas.parsesvg(me.decel_grp, svg_path);
- me.decel_grp.set('z-index', 5);
+ var svg_path = me.getStyle('svg_path');
+ if(svg_path == nil)
+ svg_path = get_local_path('res/airbus_decel.svg');
+ me.decel_grp = me.element.createChild("group","decel");
+ canvas.parsesvg(me.decel_grp, svg_path);
+ me.decel_grp.set('z-index', 5);
}
var draw = func{
- if(me.decel_grp != nil){
- var spd_ctrl = getprop(me.options.spd_ctrl);
- var spd_managed = (spd_ctrl == me.options.managed_val);
- if(spd_managed)
- me.decel_grp.setColor(me.style.managed_color);
- else
- me.decel_grp.setColor(me.style.selected_color);
- }
+ if(me.decel_grp != nil){
+ var spd_ctrl = getprop(me.options.spd_ctrl);
+ var spd_managed = (spd_ctrl == me.options.managed_val);
+ if(spd_managed)
+ me.decel_grp.setColor(me.style.managed_color);
+ else
+ me.decel_grp.setColor(me.style.selected_color);
+ }
}
diff --git a/Models/Instruments/ND/canvas/map/RTE.lcontroller b/Models/Instruments/ND/canvas/map/RTE.lcontroller
index 7c4979d7..04dd5eab 100644
--- a/Models/Instruments/ND/canvas/map/RTE.lcontroller
+++ b/Models/Instruments/ND/canvas/map/RTE.lcontroller
@@ -12,9 +12,9 @@ SymbolLayer.add(name, {
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options
- active_node: "/autopilot/route-manager/active",
- current_wp_node: "/autopilot/route-manager/current-wp",
- wp_num: "/autopilot/route-manager/route/num",
+ active_node: "/FMGC/flightplan[2]/active",
+ current_wp_node: "/FMGC/flightplan[2]/current-wp",
+ wp_num: "/FMGC/flightplan[2]/num",
display_inactive_rte: 0
}
});
@@ -74,12 +74,12 @@ var searchCmd = func {
path = [{},{lon:leg.wp_lon, lat:leg.wp_lat}];
else
path = leg.path();
- if(i == (fpSize - 1) and !discontinuity){# WORKAROUND FOR FG BUG
- var ltype = leg.wp_type;
- var path_l = size(path);
- if(ltype != 'runway' and path_l >= 2)
- path = subvec(path, 0, 1) ~ subvec(path, path_l - 1, 1);
- }
+# if(i == (fpSize - 1) and !discontinuity){# WORKAROUND FOR FG BUG -- we don't need it anymore (I think)!
+# var ltype = leg.wp_type;
+# var path_l = size(path);
+# if(ltype != 'runway' and path_l >= 2)
+# path = subvec(path, 0, 1) ~ subvec(path, path_l - 1, 1);
+# }
coords ~= path;
discontinuity = driver.hasDiscontinuity(idx, leg);
}
diff --git a/Models/Instruments/ND/canvas/map/RTE.scontroller b/Models/Instruments/ND/canvas/map/RTE.scontroller
index 7890370b..968becb8 100644
--- a/Models/Instruments/ND/canvas/map/RTE.scontroller
+++ b/Models/Instruments/ND/canvas/map/RTE.scontroller
@@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func()
- die(name~".scontroller.query_range /MUST/ be provided by implementation");
+ die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position');
diff --git a/Models/Instruments/ND/canvas/map/RWY-profile.symbol b/Models/Instruments/ND/canvas/map/RWY-profile.symbol
index 41987a75..59ce331e 100644
--- a/Models/Instruments/ND/canvas/map/RWY-profile.symbol
+++ b/Models/Instruments/ND/canvas/map/RWY-profile.symbol
@@ -9,72 +9,72 @@ DotSym.makeinstance( name, __self__ );
var element_type = "group";
var style = { # style to use by default
- zoom: 20,
- color: [1,1,1],
- center_line_len: 0.75,
- line_width: 3
+ zoom: 20,
+ color: [1,1,1],
+ center_line_len: 0.75,
+ line_width: 3
};
SymbolLayer.get(name).df_style = style;
#var already_drawn = 0;
var init = func {
- #if(me.already_drawn) return;
- var lat = me.model.lat;
- var lon = me.model.lon;
- var rwyhdg = me.model.heading;
- var width = me.model.width;
- var length = me.model.length;
- var group = me.element;
- var ctr_len = length * me.getStyle('center_line_len', 0.75);
- var crds = [];
- var coord = geo.Coord.new();
- width = width * me.getStyle('zoom', 20); # Else rwy is too thin to be visible
- var line_w = me.getStyle('line_width', 3);
- var color = me.getStyle('color', [1,1,1]);
- coord.set_latlon(lat, lon);
- coord.apply_course_distance(rwyhdg, -(ctr_len / 2));
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg, (ctr_len));
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- icon_rwy = group.createChild("path", "rwy-cl")
- .setStrokeLineWidth(line_w)
- .setDataGeo([2,4],crds)
- .setColor(color);
- #.setStrokeDashArray([10, 20, 10, 20, 10]);
- #icon_rwy.hide();
- var crds = [];
- coord.set_latlon(lat, lon);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg + 90, width/2);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg, length);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- icon_rwy = group.createChild("path", "rwy")
- .setStrokeLineWidth(line_w)
- .setDataGeo([2,4,4],crds)
- .setColor(color);
- var crds = [];
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg - 90, width);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg, -length);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- coord.apply_course_distance(rwyhdg + 90, width / 2);
- append(crds,"N"~coord.lat());
- append(crds,"E"~coord.lon());
- icon_rwy = group.createChild("path", "rwy")
- .setStrokeLineWidth(line_w)
- .setDataGeo([2,4,4,4],crds)
- .setColor(color);
+ #if(me.already_drawn) return;
+ var lat = me.model.lat;
+ var lon = me.model.lon;
+ var rwyhdg = me.model.heading;
+ var width = me.model.width;
+ var length = me.model.length;
+ var group = me.element;
+ var ctr_len = length * me.getStyle('center_line_len', 0.75);
+ var crds = [];
+ var coord = geo.Coord.new();
+ width = width * me.getStyle('zoom', 20); # Else rwy is too thin to be visible
+ var line_w = me.getStyle('line_width', 3);
+ var color = me.getStyle('color', [1,1,1]);
+ coord.set_latlon(lat, lon);
+ coord.apply_course_distance(rwyhdg, -(ctr_len / 2));
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg, (ctr_len));
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ icon_rwy = group.createChild("path", "rwy-cl")
+ .setStrokeLineWidth(line_w)
+ .setDataGeo([2,4],crds)
+ .setColor(color);
+ #.setStrokeDashArray([10, 20, 10, 20, 10]);
+ #icon_rwy.hide();
+ var crds = [];
+ coord.set_latlon(lat, lon);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg + 90, width/2);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg, length);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ icon_rwy = group.createChild("path", "rwy")
+ .setStrokeLineWidth(line_w)
+ .setDataGeo([2,4,4],crds)
+ .setColor(color);
+ var crds = [];
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg - 90, width);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg, -length);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ coord.apply_course_distance(rwyhdg + 90, width / 2);
+ append(crds,"N"~coord.lat());
+ append(crds,"E"~coord.lon());
+ icon_rwy = group.createChild("path", "rwy")
+ .setStrokeLineWidth(line_w)
+ .setDataGeo([2,4,4,4],crds)
+ .setColor(color);
};
var draw = func{}
diff --git a/Models/Instruments/ND/canvas/map/SPD-profile.lcontroller b/Models/Instruments/ND/canvas/map/SPD-profile.lcontroller
index 65d08ad6..f4a6d392 100644
--- a/Models/Instruments/ND/canvas/map/SPD-profile.lcontroller
+++ b/Models/Instruments/ND/canvas/map/SPD-profile.lcontroller
@@ -5,47 +5,47 @@ var parents = [canvas.SymbolLayer.Controller];
var __self__ = caller(0)[0];
var _options = { # default configuration options
- alts: [100,140,250,260,'wp']
+ alts: [100,140,250,260,'wp']
};
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
- parents: [MultiSymbolLayer],
- type: name, # Symbol type
- df_controller: __self__, # controller to use by default -- this one
- df_options: _options
+ parents: [MultiSymbolLayer],
+ type: name, # Symbol type
+ df_controller: __self__, # controller to use by default -- this one
+ df_options: _options
});
var new = func(layer) {
- var m = {
- parents: [__self__],
- layer: layer,
- #map: layer.map,
- listeners: [],
- };
- layer.searcher._equals = func(a,b) a.getName() == b.getName();
- #append(m.listeners, setlistener(layer.options.fplan_active, func m.layer.update() ));
- #m.addVisibilityListener();
+ var m = {
+ parents: [__self__],
+ layer: layer,
+ #map: layer.map,
+ listeners: [],
+ };
+ layer.searcher._equals = func(a,b) a.getName() == b.getName();
+ #append(m.listeners, setlistener(layer.options.fplan_active, func m.layer.update() ));
+ #m.addVisibilityListener();
- return m;
+ return m;
};
var del = func() {
- foreach (var l; me.listeners)
- removelistener(l);
+ foreach (var l; me.listeners)
+ removelistener(l);
};
var searchCmd = func {
- var results = [];
- var spdNode = props.globals.getNode(me.layer.options.spd_node);
- if (spdNode != nil) {
- var limits = spdNode.getChildren();
- foreach (var limit; limits) {
- #t = 'spd-change-point' ~ '-' ~ alt;
- #print('SPD-Controller, search for '~t);
- #var n = spdNode.getNode(t);
- if (limit != nil and limit.getValue('longitude-deg') != nil){
- #print('SPD-Controller -> Append');
- append(results, limit);
- }
- }
- }
- return results;
+ var results = [];
+ var spdNode = props.globals.getNode(me.layer.options.spd_node);
+ if (spdNode != nil) {
+ var limits = spdNode.getChildren();
+ foreach (var limit; limits) {
+ #t = 'spd-change-point' ~ '-' ~ alt;
+ #print('SPD-Controller, search for '~t);
+ #var n = spdNode.getNode(t);
+ if (limit != nil and limit.getValue('longitude-deg') != nil){
+ #print('SPD-Controller -> Append');
+ append(results, limit);
+ }
+ }
+ }
+ return results;
}
diff --git a/Models/Instruments/ND/canvas/map/SPD-profile.scontroller b/Models/Instruments/ND/canvas/map/SPD-profile.scontroller
index 191945db..018d3633 100644
--- a/Models/Instruments/ND/canvas/map/SPD-profile.scontroller
+++ b/Models/Instruments/ND/canvas/map/SPD-profile.scontroller
@@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func()
- die(name~".scontroller.query_range /MUST/ be provided by implementation");
+ die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position');
diff --git a/Models/Instruments/ND/canvas/map/SPD-profile.symbol b/Models/Instruments/ND/canvas/map/SPD-profile.symbol
index deffbafe..96aefdff 100644
--- a/Models/Instruments/ND/canvas/map/SPD-profile.symbol
+++ b/Models/Instruments/ND/canvas/map/SPD-profile.symbol
@@ -32,9 +32,9 @@ var draw = func{
# var name = me.model.getName();
# var sym_group = me.element.getElementById(name);
# sym_group.set('z-index', 5);
- if(me.spd_sym == nil){
- me.spd_sym = me.getElementById("airbus-spd-sym");
- me.spd_sym.setTranslation(-24, -24).set('z-index', 5);
- }
-
+ if(me.spd_sym == nil){
+ me.spd_sym = me.getElementById("airbus-spd-sym");
+ me.spd_sym.setTranslation(-24, -24).set('z-index', 5);
+ }
+
}
diff --git a/Models/Instruments/ND/canvas/map/VOR-airbus.lcontroller b/Models/Instruments/ND/canvas/map/VOR-airbus.lcontroller
index 75290cc3..f254aacc 100644
--- a/Models/Instruments/ND/canvas/map/VOR-airbus.lcontroller
+++ b/Models/Instruments/ND/canvas/map/VOR-airbus.lcontroller
@@ -5,58 +5,58 @@ var parents = [SymbolLayer.Controller];
var __self__ = caller(0)[0];
SymbolLayer.Controller.add(name, __self__);
SymbolLayer.add(name, {
- parents: [NavaidSymbolLayer],
- type: name, # Symbol type
- df_controller: __self__, # controller to use by default -- this one
- df_options: {
- vor1_frq: 'instrumentation/nav[2]/frequencies/selected-mhz',
- vor2_frq: 'instrumentation/nav[3]/frequencies/selected-mhz'
- },
- df_style: {
- scale: 1
- }
+ parents: [NavaidSymbolLayer],
+ type: name, # Symbol type
+ df_controller: __self__, # controller to use by default -- this one
+ df_options: {
+ vor1_frq: 'instrumentation/nav[2]/frequencies/selected-mhz',
+ vor2_frq: 'instrumentation/nav[3]/frequencies/selected-mhz'
+ },
+ df_style: {
+ scale: 1
+ }
});
var new = func(layer) {
- var m = {
- parents: [__self__],
- layer: layer,
- map: layer.map,
- active_vors: [],
- navNs: props.globals.getNode("instrumentation").getChildren("nav"),
- listeners: [],
- query_type:'vor',
- };
- setsize(m.active_vors, size(m.navNs));
- foreach (var navN; m.navNs) {
- append(m.listeners, setlistener(
- navN.getNode("frequencies/selected-mhz"),
- func m.changed_freq()
- ));
- }
- #call(debug.dump, keys(layer));
- m.changed_freq(update:0);
- m.addVisibilityListener();
+ var m = {
+ parents: [__self__],
+ layer: layer,
+ map: layer.map,
+ active_vors: [],
+ navNs: props.globals.getNode("instrumentation").getChildren("nav"),
+ listeners: [],
+ query_type:'vor',
+ };
+ setsize(m.active_vors, size(m.navNs));
+ foreach (var navN; m.navNs) {
+ append(m.listeners, setlistener(
+ navN.getNode("frequencies/selected-mhz"),
+ func m.changed_freq()
+ ));
+ }
+ #call(debug.dump, keys(layer));
+ m.changed_freq(update:0);
+ m.addVisibilityListener();
- return m;
+ return m;
};
var del = func() {
- printlog(_MP_dbg_lvl, name,".lcontroller.del()");
- foreach (var l; me.listeners)
- removelistener(l);
+ printlog(_MP_dbg_lvl, name,".lcontroller.del()");
+ foreach (var l; me.listeners)
+ removelistener(l);
};
# Controller methods
var isActive = func(model) {
- var my_freq = model.frequency/100;
- foreach (var freq; me.active_vors)
- if (freq == my_freq) return 1;
- return 0;
+ var my_freq = model.frequency/100;
+ foreach (var freq; me.active_vors)
+ if (freq == my_freq) return 1;
+ return 0;
};
var changed_freq = func(update=1) {
- #debug.dump(me.active_vors);
- foreach (var navN; me.navNs)
- me.active_vors[ navN.getIndex() ] = navN.getValue("frequencies/selected-mhz");
- if (update) me.layer.update();
+ #debug.dump(me.active_vors);
+ foreach (var navN; me.navNs)
+ me.active_vors[ navN.getIndex() ] = navN.getValue("frequencies/selected-mhz");
+ if (update) me.layer.update();
};
var searchCmd = NavaidSymbolLayer.make('vor');
\ No newline at end of file
diff --git a/Models/Instruments/ND/canvas/map/VOR-airbus.symbol b/Models/Instruments/ND/canvas/map/VOR-airbus.symbol
index bdd8f7ca..4782fbb6 100644
--- a/Models/Instruments/ND/canvas/map/VOR-airbus.symbol
+++ b/Models/Instruments/ND/canvas/map/VOR-airbus.symbol
@@ -11,33 +11,33 @@ var svg_path = get_local_path('res/airbus_vor.svg');
var vor_sym = nil;
var draw = func{
- if(me.vor_sym == nil)
- me.vor_sym = me.element.getElementById("airbus-vor-sym");
- me.vor_sym.setTranslation(-24,-24);
- if(me.text_vor == nil){
- var transl = me.getStyle('translation', [25,10]);
- var text_color = me.getStyle('text_color', [1,1,1]);
- me.text_vor = me.element.createChild("text")
- .setDrawMode( canvas.Text.TEXT )
- .setText(me.model.id)
- .setFont("LiberationFonts/LiberationSans-Regular.ttf")
- .setFontSize(28)
- .setColor(text_color)
- .setTranslation(transl);
- }
-
- var frq = me.model.frequency;
- if(frq != nil){
- var dfcolor = me.getStyle('color', [0.9,0,0.47]);
- var tuned_color = me.getStyle('tuned_color', [0,0.62,0.84]);
- frq = frq / 100;
- var vor1_frq = getprop(me.options.vor1_frq);
- var vor2_frq = getprop(me.options.vor2_frq);
- if(vor1_frq == frq or vor2_frq == frq){
- me.element.setColor(tuned_color);
- } else {
- me.element.setColor(dfcolor);
- }
- }
- me.text_vor.setColor(me.getStyle('text_color', [1,1,1]));
+ if(me.vor_sym == nil)
+ me.vor_sym = me.element.getElementById("airbus-vor-sym");
+ me.vor_sym.setTranslation(-24,-24);
+ if(me.text_vor == nil){
+ var transl = me.getStyle('translation', [25,10]);
+ var text_color = me.getStyle('text_color', [1,1,1]);
+ me.text_vor = me.element.createChild("text")
+ .setDrawMode( canvas.Text.TEXT )
+ .setText(me.model.id)
+ .setFont("LiberationFonts/LiberationSans-Regular.ttf")
+ .setFontSize(28)
+ .setColor(text_color)
+ .setTranslation(transl);
+ }
+
+ var frq = me.model.frequency;
+ if(frq != nil){
+ var dfcolor = me.getStyle('color', [0.9,0,0.47]);
+ var tuned_color = me.getStyle('tuned_color', [0,0.62,0.84]);
+ frq = frq / 100;
+ var vor1_frq = getprop(me.options.vor1_frq);
+ var vor2_frq = getprop(me.options.vor2_frq);
+ if(vor1_frq == frq or vor2_frq == frq){
+ me.element.setColor(tuned_color);
+ } else {
+ me.element.setColor(dfcolor);
+ }
+ }
+ me.text_vor.setColor(me.getStyle('text_color', [1,1,1]));
}
\ No newline at end of file
diff --git a/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller b/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller
index 2ca8d845..7f510dc4 100644
--- a/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller
+++ b/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller
@@ -6,132 +6,132 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
- parents: [canvas.MultiSymbolLayer],
- type: name, # Symbol type
- df_controller: __self__, # controller to use by default -- this one
- df_options: { # default configuration options
- fix_symbol: func(group){
- group.createChild('path')
- .moveTo(-10,0)
- .lineTo(0,-17)
- .lineTo(10,0)
- .lineTo(0,17)
- .close()
- .setStrokeLineWidth(3)
- .setColor(1,1,1)
- .setScale(1,1);
- },
- vor_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_vor.svg',
- airport_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg',
- ndb_symbol: func(group){
- group.createChild('path')
- .moveTo(-15,15)
- .lineTo(0,-15)
- .lineTo(15,15)
- .close()
- .setStrokeLineWidth(3)
- #.setColor(0.69,0,0.39)
- #.setTranslation(-24, -24),
- .setScale(1,1);
- }
- },
- df_style: {
- active_wp_color: [0.4,0.7,0.4],
- current_wp_color: [1,1,1],
- translation: {
- 'airport': [-24,-24],
- 'vor': [-24,-24]
- }
- },
- toggle_cstr: 0
+ parents: [canvas.MultiSymbolLayer],
+ type: name, # Symbol type
+ df_controller: __self__, # controller to use by default -- this one
+ df_options: { # default configuration options
+ fix_symbol: func(group){
+ group.createChild('path')
+ .moveTo(-10,0)
+ .lineTo(0,-17)
+ .lineTo(10,0)
+ .lineTo(0,17)
+ .close()
+ .setStrokeLineWidth(3)
+ .setColor(1,1,1)
+ .setScale(1);
+ },
+ vor_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_vor.svg',
+ airport_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg',
+ ndb_symbol: func(group){
+ group.createChild('path')
+ .moveTo(-15,15)
+ .lineTo(0,-15)
+ .lineTo(15,15)
+ .close()
+ .setStrokeLineWidth(3)
+ #.setColor(0.69,0,0.39)
+ #.setTranslation(-24, -24),
+ .setScale(1,1);
+ }
+ },
+ df_style: {
+ active_wp_color: [0.4,0.7,0.4],
+ current_wp_color: [1,1,1],
+ translation: {
+ 'airport': [-24,-24],
+ 'vor': [-24,-24]
+ }
+ },
+ toggle_cstr: 0
});
var new = func(layer) {
- var m = {
- parents: [__self__],
- layer: layer,
- map: layer.map,
- listeners: [],
- };
- layer.searcher._equals = func(a,b) a.equals(b);
- var driver = opt_member(m.layer.options, 'route_driver');
- if(driver == nil){
- driver = RouteDriver.new();
- }
- var driver_listeners = driver.getListeners();
- foreach(var listener; driver_listeners){
- append(m.listeners, setlistener(listener, func m.layer.update()));
- }
- m.route_driver = driver;
- return m;
+ var m = {
+ parents: [__self__],
+ layer: layer,
+ map: layer.map,
+ listeners: [],
+ };
+ layer.searcher._equals = func(a,b) a.equals(b);
+ var driver = opt_member(m.layer.options, 'route_driver');
+ if(driver == nil){
+ driver = RouteDriver.new();
+ }
+ var driver_listeners = driver.getListeners();
+ foreach(var listener; driver_listeners){
+ append(m.listeners, setlistener(listener, func m.layer.update()));
+ }
+ m.route_driver = driver;
+ return m;
};
var del = func() {
- foreach (var l; me.listeners)
- removelistener(l);
+ foreach (var l; me.listeners)
+ removelistener(l);
};
var WPTModel = {
- new: func(fp, idx) {
- var m = { parents:[WPTModel] };
- var wp = fp.getWP(idx);
+ new: func(fp, idx) {
+ var m = { parents:[WPTModel] };
+ var wp = fp.getWP(idx);
- m.id = wp.id;
- m.name = wp.wp_name;
- m.alt = wp.alt_cstr;
- m.spd = wp.speed_cstr;
- m.type = wp.wp_type;
+ m.id = wp.id;
+ m.name = wp.wp_name;
+ m.alt = wp.alt_cstr;
+ m.spd = wp.speed_cstr;
+ m.type = wp.wp_type;
- (m.lat,m.lon) = (wp.wp_lat,wp.wp_lon);
- var is_rwy = (m.type == 'runway');
- var id_len = size(m.id);
- if(!is_rwy and id_len < 5){
- if(id_len == 4 and airportinfo(m.id) != nil)
- m.navtype = 'airport';
- else {
- var navaid = nil;
- foreach(var t; ['vor', 'ndb']){
- navaid = navinfo(m.lat, m.lon, t, m.id);
- if(navaid != nil and size(navaid)){
- m.navtype = t;
- break;
- }
- }
- if(navaid == nil or !size(navaid)) m.navtype = 'fix';
- }
- } else {
- m.navtype = (is_rwy ? 'rwy' : 'fix');
- }
-
- m.wp = wp;
- idx = wp.index;
- m.idx = idx;
- m.is_departure = (idx == 0 and is_rwy);
- m.is_destination = (idx > 0 and is_rwy);
- return m;
- },
- equals: func(other) {
- # this is set on symbol init, so use this for equality...
- me.name == other.name and me.alt == other.alt and
- me.type == other.type and me.idx == other.idx and
- me.navtype == other.navtype
- },
+ (m.lat,m.lon) = (wp.wp_lat,wp.wp_lon);
+ var is_rwy = (m.type == 'runway');
+ var id_len = size(m.id);
+ if(!is_rwy and id_len < 5){
+ if(id_len == 4 and airportinfo(m.id) != nil)
+ m.navtype = 'airport';
+ else {
+ var navaid = nil;
+ foreach(var t; ['vor', 'ndb']){
+ navaid = navinfo(m.lat, m.lon, t, m.id);
+ if(navaid != nil and size(navaid)){
+ m.navtype = t;
+ break;
+ }
+ }
+ if(navaid == nil or !size(navaid)) m.navtype = 'fix';
+ }
+ } else {
+ m.navtype = (is_rwy ? 'rwy' : 'fix');
+ }
+
+ m.wp = wp;
+ idx = wp.index;
+ m.idx = idx;
+ m.is_departure = (idx == 0 and is_rwy);
+ m.is_destination = (idx > 0 and is_rwy);
+ return m;
+ },
+ equals: func(other) {
+ # this is set on symbol init, so use this for equality...
+ me.name == other.name and me.alt == other.alt and
+ me.type == other.type and me.idx == other.idx and
+ me.navtype == other.navtype
+ },
};
var searchCmd = func {
- var driver = me.route_driver;
- if(!driver.shouldUpdate()) return [];
- driver.update();
- var result = [];
- var planCount = driver.getNumberOfFlightPlans();
- for(var idx = 0; idx < planCount; idx += 1){
- var fp = driver.getFlightPlan(idx);
- if(fp == nil) continue;
- var fpSize = fp.getPlanSize(idx);
- for (var i = 0; i < fpSize; i+=1){
- if(!driver.shouldUpdate()) return[];
- append(result, WPTModel.new(fp, i));
- }
- }
- return result;
+ var driver = me.route_driver;
+ if(!driver.shouldUpdate()) return [];
+ driver.update();
+ var result = [];
+ var planCount = driver.getNumberOfFlightPlans();
+ for(var idx = 0; idx < planCount; idx += 1){
+ var fp = driver.getFlightPlan(idx);
+ if(fp == nil) continue;
+ var fpSize = fp.getPlanSize(idx);
+ for (var i = 0; i < fpSize; i+=1){
+ if(!driver.shouldUpdate()) return[];
+ append(result, WPTModel.new(fp, i));
+ }
+ }
+ return result;
}
diff --git a/Models/Instruments/ND/canvas/map/WPT-airbus.symbol b/Models/Instruments/ND/canvas/map/WPT-airbus.symbol
index 2b502de2..439e8e1e 100644
--- a/Models/Instruments/ND/canvas/map/WPT-airbus.symbol
+++ b/Models/Instruments/ND/canvas/map/WPT-airbus.symbol
@@ -8,130 +8,130 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group";
var init = func {
- var name = me.model.name;
- var alt = me.model.alt;
- var spd = me.model.spd;
- var wp_group = me.element;
- me.alt_path = nil;
+ var name = me.model.name;
+ var alt = me.model.alt;
+ var spd = me.model.spd;
+ var wp_group = me.element;
+ me.alt_path = nil;
- var colors = [
- 'wp_color',
- 'current_wp_color',
- 'constraint_color',
- 'active_constraint_color',
- 'missed_constraint_color'
- ];
- foreach(col; colors){
- me[col] = me.getStyle(col, me.getOption(col));
- }
+ var colors = [
+ 'wp_color',
+ 'current_wp_color',
+ 'constraint_color',
+ 'active_constraint_color',
+ 'missed_constraint_color'
+ ];
+ foreach(col; colors){
+ me[col] = me.getStyle(col, me.getOption(col));
+ }
- var idLen = size(me.model.id);
- var draw_sym = nil;
- var navtype = me.model.navtype;
- if (navtype == nil) navtype = 'fix';
- if(navtype == 'airport')
- draw_sym = me.options.airport_symbol;
- elsif(navtype == 'vor')
- draw_sym = me.options.vor_symbol;
- elsif(navtype == 'ndb')
- draw_sym = me.options.ndb_symbol;
- else
- draw_sym = me.options.fix_symbol;
- me.wp_sym = me.element.createChild('group', 'wp-'~ me.model.idx);
- if(typeof(draw_sym) == 'func')
- draw_sym(me.wp_sym);
- elsif(typeof(draw_sym) == 'scalar')
- canvas.parsesvg(me.wp_sym, draw_sym);
- var translation = me.getStyle('translation', {});
- if(contains(translation, navtype)){
- me.wp_sym.setTranslation(translation[navtype]);
- }
- me.text_wps = wp_group.createChild("text", "wp-text-" ~ me.model.idx)
- .setDrawMode( canvas.Text.TEXT )
- .setText(me.model.name)
- .setFont("LiberationFonts/LiberationSans-Regular.ttf")
- .setFontSize(28)
- .setTranslation(25,15)
- .setColor(1,1,1);
- me.text_alt = nil;
- if(alt > 0 or spd > 0){
- var cstr_txt = "\n";
- if(alt > 0){
- if(alt > 10000)
- cstr_txt ~= sprintf('FL%3.0f', int(alt / 100));
- else
- cstr_txt ~= sprintf('%4.0f', int(alt));
- }
- if(spd > 0){
- if(alt > 0) cstr_txt ~= "\n";
- if(spd <= 1)
- cstr_txt ~= sprintf('%1.2fM', spd);
- else
- cstr_txt ~= sprintf('%3.0fKT', int(spd));
- }
- me.text_alt = wp_group.createChild("text", "wp-alt-text-" ~ me.model.idx)
- .setDrawMode( canvas.Text.TEXT )
- .setText(cstr_txt)
- .setFont("LiberationFonts/LiberationSans-Regular.ttf")
- .setFontSize(28)
- .setTranslation(25,15);
- }
+ var idLen = size(me.model.id);
+ var draw_sym = nil;
+ var navtype = me.model.navtype;
+ if (navtype == nil) navtype = 'fix';
+ if(navtype == 'airport')
+ draw_sym = me.options.airport_symbol;
+ elsif(navtype == 'vor')
+ draw_sym = me.options.vor_symbol;
+ elsif(navtype == 'ndb')
+ draw_sym = me.options.ndb_symbol;
+ else
+ draw_sym = me.options.fix_symbol;
+ me.wp_sym = me.element.createChild('group', 'wp-'~ me.model.idx);
+ if(typeof(draw_sym) == 'func')
+ draw_sym(me.wp_sym);
+ elsif(typeof(draw_sym) == 'scalar')
+ canvas.parsesvg(me.wp_sym, draw_sym);
+ var translation = me.getStyle('translation', {});
+ if(contains(translation, navtype)){
+ me.wp_sym.setTranslation(translation[navtype]);
+ }
+ me.text_wps = wp_group.createChild("text", "wp-text-" ~ me.model.idx)
+ .setDrawMode( canvas.Text.TEXT )
+ .setText(me.model.name)
+ .setFont("LiberationFonts/LiberationSans-Regular.ttf")
+ .setFontSize(28)
+ .setTranslation(25,15)
+ .setColor(1,1,1);
+ me.text_alt = nil;
+ if(alt > 0 or spd > 0){
+ var cstr_txt = "\n";
+ if(alt > 0){
+ if(alt > 10000)
+ cstr_txt ~= sprintf('FL%3d', int(alt / 100));
+ else
+ cstr_txt ~= sprintf('%4d', int(alt));
+ }
+ if(spd > 0){
+ if(alt > 0) cstr_txt ~= "\n";
+ if(spd <= 1)
+ cstr_txt ~= sprintf('%4.2fM', spd);
+ else
+ cstr_txt ~= sprintf('%3dKT', int(spd));
+ }
+ me.text_alt = wp_group.createChild("text", "wp-alt-text-" ~ me.model.idx)
+ .setDrawMode( canvas.Text.TEXT )
+ .setText(cstr_txt)
+ .setFont("LiberationFonts/LiberationSans-Regular.ttf")
+ .setFontSize(28)
+ .setTranslation(25,15);
+ }
}
var draw = func{
- var wp_group = me.element;
- var alt = me.model.alt;
- var i = me.model.idx;
- var vnav_actv = getprop(me.options.ver_ctrl) == me.options.managed_val;
- var curwp = getprop(me.options.current_wp);
- if(alt > 0){
- var wp_d = me.model.wp.distance_along_route;
- var lvl_off_at = getprop(me.options.level_off_alt);
- if(lvl_off_at == nil) lvl_off_at = 0;
- if(me.alt_path == nil){
- me.alt_path = wp_group.createChild("path").
- setStrokeLineWidth(4).
- moveTo(-22,0).
- arcSmallCW(22,22,0,44,0).
- arcSmallCW(22,22,0,-44,0);
- }
- if(vnav_actv){
- if(lvl_off_at and (lvl_off_at - wp_d) > 0.5 and curwp == i)
- me.alt_path.setColor(me.missed_constraint_color);
- else
- me.alt_path.setColor(me.active_constraint_color);
- }
- else
- me.alt_path.setColor(me.constraint_color);
- if(me.layer.toggle_cstr)
- me.alt_path.show();
- else
- me.alt_path.hide();
- } else {
- if(me.alt_path != nil) me.alt_path.hide();
- }
- wp_group.set("z-index",4);
- #var sym = me.element.getElementById('wp-' ~ me.model.idx);
- if(alt > 0 and me.text_alt != nil){
- if(vnav_actv)
- me.text_alt.setColor(me.active_constraint_color);
- else
- me.text_alt.setColor(me.constraint_color);
- }
- if(i == curwp) {
- me.wp_sym.setColor(me.current_wp_color);
- me.text_wps.setColor(me.current_wp_color);
- } else {
- me.wp_sym.setColor(me.wp_color);
- me.text_wps.setColor(me.wp_color);
- }
- if(me.model.is_departure or me.model.is_destination){
- var prop = (me.model.is_departure ? 'departure' : 'destination');
- var rwy = getprop("autopilot/route-manager/"~prop~"/runway");
- if(rwy != nil and size(rwy) > 0){
- me.wp_sym.hide();
- } else {
- me.wp_sym.show();
- }
- }
+ var wp_group = me.element;
+ var alt = me.model.alt;
+ var i = me.model.idx;
+ var vnav_actv = getprop(me.options.ver_ctrl) == me.options.managed_val;
+ var curwp = getprop(me.options.current_wp);
+ if(alt > 0){
+ var wp_d = me.model.wp.distance_along_route;
+ var lvl_off_at = getprop(me.options.level_off_alt);
+ if(lvl_off_at == nil) lvl_off_at = 0;
+ if(me.alt_path == nil){
+ me.alt_path = wp_group.createChild("path").
+ setStrokeLineWidth(4).
+ moveTo(-22,0).
+ arcSmallCW(22,22,0,44,0).
+ arcSmallCW(22,22,0,-44,0);
+ }
+ if(vnav_actv){
+ if(lvl_off_at and (lvl_off_at - wp_d) > 0.5 and curwp == i)
+ me.alt_path.setColor(me.missed_constraint_color);
+ else
+ me.alt_path.setColor(me.active_constraint_color);
+ }
+ else
+ me.alt_path.setColor(me.constraint_color);
+ if(me.layer.toggle_cstr)
+ me.alt_path.show();
+ else
+ me.alt_path.hide();
+ } else {
+ if(me.alt_path != nil) me.alt_path.hide();
+ }
+ wp_group.set("z-index",4);
+ #var sym = me.element.getElementById('wp-' ~ me.model.idx);
+ if(alt > 0 and me.text_alt != nil){
+ if(vnav_actv)
+ me.text_alt.setColor(me.active_constraint_color);
+ else
+ me.text_alt.setColor(me.constraint_color);
+ }
+ if(i == curwp) {
+ me.wp_sym.setColor(me.current_wp_color);
+ me.text_wps.setColor(me.current_wp_color);
+ } else {
+ me.wp_sym.setColor(me.wp_color);
+ me.text_wps.setColor(me.wp_color);
+ }
+ if(me.model.is_departure or me.model.is_destination){
+ var prop = (me.model.is_departure ? 'departure' : 'destination');
+ var rwy = getprop("/autopilot/route-manager/"~prop~"/runway");
+ if(rwy != nil and size(rwy) > 0){
+ me.wp_sym.hide();
+ } else {
+ me.wp_sym.show();
+ }
+ }
}
diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas
index 80d45d5b..fec101f7 100644
--- a/Models/Instruments/ND/canvas/style.nas
+++ b/Models/Instruments/ND/canvas/style.nas
@@ -46,12 +46,12 @@ canvas.NDStyles["Airbus"] = {
# that the lateral flight mode is managed.
# You can easily override these options before creating the ND, example:
# canvas.NDStyles["Airbus"].options.defaults.fplan_active = "my/autpilot/f-plan/active"
- fplan_active: "autopilot/route-manager/active",
+ fplan_active: "/FMGC/flightplan[2]/active",
lat_ctrl: "/it-autoflight/output/lat",
managed_val: 1,
ver_ctrl: "/it-autoflight/output/vert",
spd_ctrl: "/flight-management/control/spd-ctrl",
- current_wp: "/autopilot/route-manager/current-wp",
+ current_wp: "/FMGC/flightplan[2]/current-wp",
ap1: "/it-autoflight/output/ap1",
ap2: "/it-autoflight/output/ap2",
nav1_frq: "/instrumentation/nav[0]/frequencies/selected-mhz",
@@ -740,11 +740,11 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveId",
impl: {
init: func(nd,symbol),
- predicate: func(nd) getprop("autopilot/route-manager/wp/id") != nil and
- getprop("autopilot/route-manager/active") and
+ predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and
+ getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
- nd.symbols.wpActiveId.setText(getprop("autopilot/route-manager/wp/id"));
+ nd.symbols.wpActiveId.setText(getprop("/FMGC/flightplan[2]/current-leg"));
nd.symbols.wpActiveId.show();
},
is_false: func(nd) nd.symbols.wpActiveId.hide(),
@@ -754,12 +754,16 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveCrs",
impl: {
init: func(nd,symbol),
- predicate: func(nd) getprop("autopilot/route-manager/wp/id") != nil and
- getprop("autopilot/route-manager/active") and
+ predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and
+ getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
#var cur_wp = getprop("autopilot/route-manager/current-wp");
- var deg = int(getprop("autopilot/route-manager/wp/bearing-deg"));
+ if (nd.get_switch("toggle_true_north")) {
+ var deg = math.round(getprop("/FMGC/flightplan[2]/current-leg-course"));
+ } else {
+ var deg = math.round(getprop("/FMGC/flightplan[2]/current-leg-course-mag"));
+ }
nd.symbols.wpActiveCrs.setText((deg or "")~"°");
nd.symbols.wpActiveCrs.show();
},
@@ -770,11 +774,11 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveDist",
impl: {
init: func(nd,symbol),
- predicate: func(nd) getprop("autopilot/route-manager/wp/dist") != nil and
- getprop("autopilot/route-manager/active") and
+ predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and
+ getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
- var dst = getprop("autopilot/route-manager/wp/dist");
+ var dst = getprop("/FMGC/flightplan[2]/current-leg-dist");
nd.symbols.wpActiveDist.setText(sprintf("%3.01f",dst));
nd.symbols.wpActiveDist.show();
},
@@ -785,10 +789,10 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveDistLbl",
impl: {
init: func(nd,symbol),
- predicate: func(nd) getprop("autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
+ predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
nd.symbols.wpActiveDistLbl.show();
- if(getprop("autopilot/route-manager/wp/dist") > 1000)
+ if(getprop("/FMGC/flightplan[2]/current-leg-dist") > 1000)
nd.symbols.wpActiveDistLbl.setText(" NM");
},
is_false: func(nd) nd.symbols.wpActiveDistLbl.hide(),
@@ -798,7 +802,7 @@ canvas.NDStyles["Airbus"] = {
id: "eta",
impl: {
init: func(nd,symbol),
- predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
+ predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
var etaSec = getprop("sim/time/utc/day-seconds")+
getprop("autopilot/route-manager/wp/eta-seconds");
@@ -1679,7 +1683,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")),
is_true: func(nd){
- var active = getprop("autopilot/route-manager/active");
+ var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@@ -1708,7 +1712,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")),
is_true: func(nd){
- var active = getprop("autopilot/route-manager/active");
+ var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@@ -1737,7 +1741,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")),
is_true: func(nd){
- var active = getprop("autopilot/route-manager/active");
+ var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@@ -1766,7 +1770,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")),
is_true: func(nd){
- var active = getprop("autopilot/route-manager/active");
+ var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@@ -1795,7 +1799,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["MAP", "PLAN"])),
is_true: func(nd){
- var active = getprop("autopilot/route-manager/active");
+ var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas
index 9233553a..fadd2624 100644
--- a/Nasal/FMGC/FMGC-b.nas
+++ b/Nasal/FMGC/FMGC-b.nas
@@ -48,10 +48,10 @@ var Radio = {
};
var FPLN = {
- active: props.globals.getNode("autopilot/route-manager/active", 1),
+ active: props.globals.getNode("/FMGC/flightplan[2]/active", 1),
activeTemp: 0,
currentCourse: 0,
- currentWP: props.globals.getNode("autopilot/route-manager/current-wp", 1),
+ currentWP: props.globals.getNode("/FMGC/flightplan[2]/current-wp", 1),
currentWPTemp: 0,
deltaAngle: 0,
deltaAngleRad: 0,
@@ -59,12 +59,10 @@ var FPLN = {
maxBank: 0,
maxBankLimit: 0,
nextCourse: 0,
- num: props.globals.getNode("autopilot/route-manager/route/num", 1),
- numTemp: 0,
R: 0,
radius: 0,
turnDist: 0,
- wp0Dist: props.globals.getNode("autopilot/route-manager/wp/dist", 1),
+ wp0Dist: props.globals.getNode("/FMGC/flightplan[2]/current-leg-dist", 1),
wpFlyFrom: 0,
wpFlyTo: 0,
};
@@ -376,7 +374,6 @@ var ITAF = {
Velocity.trueAirspeedKtTemp = Velocity.trueAirspeedKt.getValue();
FPLN.activeTemp = FPLN.active.getValue();
FPLN.currentWPTemp = FPLN.currentWP.getValue();
- FPLN.numTemp = FPLN.num.getValue();
# Bank Limit
if (Velocity.trueAirspeedKtTemp >= 420) {
@@ -391,25 +388,25 @@ var ITAF = {
# If in LNAV mode and route is not longer active, switch to HDG HLD
if (Output.lat.getValue() == 1) { # Only evaulate the rest of the condition if we are in LNAV mode
- if (FPLN.num.getValue() == 0 or !FPLN.active.getBoolValue()) {
+ if (flightPlanController.num[2].getValue() == 0 or !FPLN.active.getBoolValue()) {
me.setLatMode(3);
}
}
# Waypoint Advance Logic
- if (FPLN.numTemp > 0 and FPLN.activeTemp == 1) {
- if ((FPLN.currentWPTemp + 1) < FPLN.numTemp) {
+ if (flightPlanController.num[2].getValue() > 0 and FPLN.activeTemp == 1) {
+ if ((FPLN.currentWPTemp + 1) < flightPlanController.num[2].getValue()) {
Velocity.groundspeedMps = Velocity.groundspeedKt.getValue() * 0.5144444444444;
FPLN.wpFlyFrom = FPLN.currentWPTemp;
if (FPLN.wpFlyFrom < 0) {
FPLN.wpFlyFrom = 0;
}
- FPLN.currentCourse = getprop("autopilot/route-manager/route/wp[" ~ FPLN.wpFlyFrom ~ "]/leg-bearing-true-deg"); # Best left at getprop
+ FPLN.currentCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyFrom ~ "]/course"); # Best left at getprop
FPLN.wpFlyTo = FPLN.currentWPTemp + 1;
if (FPLN.wpFlyTo < 0) {
FPLN.wpFlyTo = 0;
}
- FPLN.nextCourse = getprop("autopilot/route-manager/route/wp[" ~ FPLN.wpFlyTo ~ "]/leg-bearing-true-deg"); # Best left at getprop
+ FPLN.nextCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyTo ~ "]/course"); # Best left at getprop
FPLN.maxBankLimit = Internal.bankLimit.getValue();
FPLN.deltaAngle = math.abs(geo.normdeg180(FPLN.currentCourse - FPLN.nextCourse));
@@ -431,7 +428,11 @@ var ITAF = {
Internal.lnavAdvanceNm.setValue(FPLN.turnDist);
if (FPLN.wp0Dist.getValue() <= FPLN.turnDist) {
- FPLN.currentWP.setValue(FPLN.currentWPTemp + 1);
+ if (flightPlanController.currentToWptIndex.getValue() < 1) {
+ flightPlanController.currentToWptIndex.setValue(1);
+ } else if (flightPlanController.num[2].getValue() > 2) { # The Airbus doesn't display anything past the previous waypoint after advancing
+ flightPlanController.autoSequencing();
+ }
}
}
}
@@ -600,7 +601,7 @@ var ITAF = {
Custom.showHdg.setBoolValue(1);
me.armTextCheck();
} else if (n == 1) {
- if (FPLN.num.getValue() > 0 and FPLN.active.getBoolValue()) {
+ if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue()) {
Output.lnavArm.setBoolValue(1);
Custom.showHdg.setBoolValue(0);
me.armTextCheck();
@@ -647,7 +648,10 @@ var ITAF = {
Text.vert.setValue("ALT CAP");
} else if (n == 4) { # FLCH
Output.apprArm.setBoolValue(0);
- if (abs(Input.altDiff) >= 125) { # SPD CLB or SPD DES
+ Output.vert.setValue(1);
+ Internal.alt.setValue(Input.alt.getValue());
+ Internal.altDiff = Internal.alt.getValue() - Position.indicatedAltitudeFt.getValue();
+ if (abs(Internal.altDiff) >= 250) { # SPD CLB or SPD DES
if (Input.alt.getValue() >= Position.indicatedAltitudeFt.getValue()) { # Usually set Thrust Mode Selector, but we do it now due to timer lag
Text.vert.setValue("SPD CLB");
} else {
@@ -734,7 +738,7 @@ var ITAF = {
}
},
checkLNAV: func(t) {
- if (FPLN.num.getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
+ if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
me.activateLNAV();
} else if (Output.lat.getValue() != 1 and t != 1) {
Output.lnavArm.setBoolValue(1);
diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas
index dae2db71..542db553 100644
--- a/Nasal/FMGC/FMGC.nas
+++ b/Nasal/FMGC/FMGC.nas
@@ -148,24 +148,6 @@ var trimReset = func {
}
}
-###############
-# MCDU Inputs #
-###############
-
-var updateARPT = func {
- dep = getprop("FMGC/internal/dep-arpt");
- arr = getprop("FMGC/internal/arr-arpt");
- setprop("autopilot/route-manager/departure/airport", dep);
- setprop("autopilot/route-manager/destination/airport", arr);
- if (getprop("autopilot/route-manager/active") != 1) {
- fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
- }
-}
-
-setlistener("/FMGC/internal/cruise-ft", func {
- setprop("autopilot/route-manager/cruise/altitude-ft", getprop("FMGC/internal/cruise-ft"));
-});
-
############################
# Flight Phase and Various #
############################
@@ -248,10 +230,10 @@ var masterFMGC = maketimer(0.2, func {
setprop("FMGC/status/phase", "5");
}
- if (getprop("autopilot/route-manager/route/num") > 0 and getprop("autopilot/route-manager/active") == 1 and getprop("autopilot/route-manager/distance-remaining-nm") <= 15) {
- setprop("FMGC/internal/decel", 1);
- } else if (getprop("FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
- setprop("FMGC/internal/decel", 0);
+ if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15) {
+ setprop("/FMGC/internal/decel", 1);
+ } else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
+ setprop("/FMGC/internal/decel", 0);
}
if (phase == "5" and state1 == "TOGA" and state2 == "TOGA") {
@@ -304,6 +286,7 @@ var reset_FMGC = func {
alt = getprop("it-autoflight/input/alt");
ITAF.init();
FMGCinit();
+ flightPlanController.reset();
mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1);
setprop("it-autoflight/input/fd1", fd1);
diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas
new file mode 100644
index 00000000..da789105
--- /dev/null
+++ b/Nasal/FMGC/flightplan.nas
@@ -0,0 +1,551 @@
+# A3XX FMGC Flightplan Driver
+# Copyright (c) 2019 Jonathan Redpath (2019)
+
+var wpDep = nil;
+var wpArr = nil;
+var pos = nil;
+var geoPosPrev = geo.Coord.new();
+var currentLegCourseDist = nil;
+var courseDistanceFrom = nil;
+var courseDistanceFromPrev = nil;
+var sizeWP = nil;
+var magTrueError = 0;
+
+# Props.getNode
+var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1);
+var trueHDG = props.globals.getNode("/orientation/heading-deg", 1);
+var FMGCdep = props.globals.getNode("/FMGC/internal/dep-arpt", 1);
+var FMGCarr = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
+var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1);
+
+# Props.initNode
+var wpID = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/id", "", "STRING")]];
+var wpLat = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/lat", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/lat", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/lat", 0, "DOUBLE")]];
+var wpLon = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/lon", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/lon", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/lon", 0, "DOUBLE")]];
+var wpCourse = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course", 0, "DOUBLE")]];
+var wpDistance = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance", 0, "DOUBLE")]];
+var wpCoursePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course-from-prev", 0, "DOUBLE")]];
+var wpDistancePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance-from-prev", 0, "DOUBLE")]];
+
+var flightPlanController = {
+ flightplans: [createFlightplan(), createFlightplan(), createFlightplan()],
+ temporaryFlag: [0, 0],
+
+ # These flags are only for the main flgiht-plan
+ active: props.globals.initNode("/FMGC/flightplan[2]/active", 0, "BOOL"),
+
+ currentToWpt: nil, # container for the current TO waypoint ghost
+ currentToWptIndex: props.globals.initNode("/FMGC/flightplan[2]/current-wp", 0, "INT"),
+ currentToWptID: props.globals.initNode("/FMGC/flightplan[2]/current-leg", "", "STRING"),
+ courseToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-course", 0, "DOUBLE"),
+ courseMagToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-course-mag", 0, "DOUBLE"),
+ distToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-dist", 0, "DOUBLE"),,
+
+ distanceToDest: [0, 0, 0],
+ num: [props.globals.initNode("/FMGC/flightplan[0]/num", 0, "INT"), props.globals.initNode("/FMGC/flightplan[1]/num", 0, "INT"), props.globals.initNode("/FMGC/flightplan[2]/num", 0, "INT")],
+ arrivalIndex: [0, 0, 0],
+ arrivalDist: 0,
+ _arrivalDist: 0,
+ fromWptTime: nil,
+ fromWptAlt: nil,
+ _timeTemp: nil,
+ _altTemp: nil,
+
+ reset: func() {
+ me.temporaryFlag[0] = 0;
+ me.temporaryFlag[1] = 0;
+ me.resetFlightplan(0);
+ me.resetFlightplan(1);
+ me.resetFlightplan(2);
+ },
+
+ resetFlightplan: func(n) {
+ me.flightplans[n].cleanPlan();
+ me.flightplans[n].departure = nil;
+ me.flightplans[n].destination = nil;
+ },
+
+ createTemporaryFlightPlan: func(n) {
+ me.resetFlightplan(n);
+ me.flightplans[n] = me.flightplans[2].clone();
+ me.temporaryFlag[n] = 1;
+ if (canvas_mcdu.myDirTo[n] != nil) {
+ canvas_mcdu.myDirTo[n].updateTmpy();
+ }
+ me.flightPlanChanged(n);
+ },
+
+ destroyTemporaryFlightPlan: func(n, a) { # a = 1 activate, a = 0 erase
+ if (a == 1) {
+ flightPlanTimer.stop();
+ me.resetFlightplan(2);
+ me.flightplans[2] = me.flightplans[n].clone();
+ me.flightPlanChanged(2);
+ flightPlanTimer.start();
+ }
+ me.resetFlightplan(n);
+ me.temporaryFlag[n] = 0;
+ if (canvas_mcdu.myDirTo[n] != nil) {
+ canvas_mcdu.myDirTo[n].updateTmpy();
+ }
+ },
+
+ updateAirports: func(dep, arr, plan) {
+ me.resetFlightplan(plan);
+ me.flightplans[plan].departure = airportinfo(dep);
+ me.flightplans[plan].destination = airportinfo(arr);
+ if (plan == 2) {
+ me.currentToWptIndex.setValue(0);
+ }
+
+ me.addDiscontinuity(1, plan);
+ #todo if plan = 2, kill any tmpy flightplan
+ me.flightPlanChanged(plan);
+ },
+
+ autoSequencing: func() {
+ me._timeTemp = math.round(getprop("/sim/time/utc/minute") + (getprop("/sim/time/utc/second") / 60));
+ if (me._timeTemp < 10) {
+ me._timeTemp = "0" ~ me._timeTemp;
+ }
+ me.fromWptTime = getprop("/sim/time/utc/hour") ~ me._timeTemp;
+ me._altTemp = getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt");
+
+ if (me._altTemp > getprop("FMGC/internal/trans-alt")) {
+ me.fromWptAlt = "FL" ~ math.round(me._altTemp / 100);
+ } else {
+ if (me._altTemp > 0) {
+ me.fromWptAlt = math.round(me._altTemp);
+ } else {
+ me.fromWptAlt = "M" ~ math.round(me._altTemp);
+ }
+ }
+
+ # todo setlistener on sim/time/warp to recompute predictions
+ if (me.num[2].getValue() > 2) {
+ if (me.temporaryFlag[0] == 1 and wpID[0][0] == wpID[2][0]) {
+ me.deleteWP(0, 0);
+ }
+
+ if (me.temporaryFlag[1] == 1 and wpID[1][0] == wpID[2][0]) {
+ me.deleteWP(0, 1);
+ }
+
+ me.deleteWP(0, 2, 0, 1);
+ }
+ },
+
+ # for these two remember to call flightPlanChanged
+ addDiscontinuity: func(index, plan) {
+ if (index > 0) {
+ if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") {
+ me.flightplans[plan].insertWP(createDiscontinuity(), index);
+ }
+ } else {
+ if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") {
+ me.flightplans[plan].insertWP(createDiscontinuity(), index);
+ }
+ }
+ },
+
+ insertPPOS: func(n) {
+ me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), 0);
+ },
+
+ insertTP: func(n) {
+ me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), 1);
+ },
+
+ directTo: func(waypointGhost, plan) {
+ if (me.flightplans[plan].indexOfWP(waypointGhost) == -1) {
+ me.insertTP(plan);
+ me.flightplans[plan].insertWP(createWPFrom(waypointGhost), 2);
+ me.addDiscontinuity(3, plan);
+ me.deleteWP(0, plan);
+ } else {
+ var timesToDelete = me.flightplans[plan].indexOfWP(waypointGhost); # delete four times, so on last iteration it equals one and then goes to zero, leave it without subtracting one
+ while (timesToDelete > 1) {
+ me.deleteWP(1, plan, 1);
+ timesToDelete -= 1;
+ }
+ me.insertTP(plan);
+ # we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
+ # example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4.
+ # so four individual deletions. Delete index 1 four times.
+ }
+ me.flightPlanChanged(plan);
+ var curAircraftPosDirTo = geo.aircraft_position();
+ canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(1).courseAndDistanceFrom(curAircraftPosDirTo)[1]);
+ },
+
+ deleteWP: func(index, n, a = 0, s = 0) { # a = 1, means adding a waypoint via deleting intermediate. s = 1, means autosequencing
+ var wp = wpID[n][index].getValue();
+ if (((s == 0 and left(wp, 4) != FMGCdep.getValue() and left(wp, 4) != FMGCarr.getValue()) or (s == 1)) and me.flightplans[n].getPlanSize() > 2) {
+ if (me.flightplans[n].getWP(index).id != "DISCONTINUITY" and a == 0) { # if it is a discont, don't make a new one
+ me.flightplans[n].deleteWP(index);
+ if (me.flightplans[n].getWP(index) != nil and s == 0) {
+ if (me.flightplans[n].getWP(index).id != "DISCONTINUITY") { # else, if the next one isn't a discont, add one
+ me.addDiscontinuity(index, n);
+ }
+ }
+ } else {
+ me.flightplans[n].deleteWP(index);
+ }
+ me.flightPlanChanged(n);
+ canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
+ return 2;
+ } else {
+ return 1;
+ }
+ },
+
+ insertAirport: func(text, index, plan, override = 0, overrideIndex = -1) {
+ if (index == 0) {
+ return 1;
+ }
+
+ var airport = findAirportsByICAO(text);
+ if (size(airport) == 0) {
+ return 0;
+ }
+
+ if (size(airport) == 1 or override) {
+ if (!override) {
+ if (me.flightplans[plan].indexOfWP(airport[0]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(airport[0]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(airport[0]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ } else {
+ if (me.flightplans[plan].indexOfWP(airport[overrideIndex]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(airport[overrideIndex]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(airport[overrideIndex]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ }
+ } elsif (size(airport) >= 1) {
+ if (canvas_mcdu.myDuplicate[plan] != nil) {
+ canvas_mcdu.myDuplicate[plan].del();
+ }
+ canvas_mcdu.myDuplicate[plan] = nil;
+ canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(airport, index, 0, plan);
+ setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
+ return 2;
+ }
+ },
+
+ insertFix: func(text, index, plan, override = 0, overrideIndex = -1) { # override - means always choose [0]
+ if (index == 0) {
+ return 1;
+ }
+
+ var fix = findFixesByID(text);
+ if (size(fix) == 0) {
+ return 0;
+ }
+
+ if (size(fix) == 1 or override) {
+ if (!override) {
+ if (me.flightplans[plan].indexOfWP(fix[0]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(fix[0]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(fix[0]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ } else {
+ if (me.flightplans[plan].indexOfWP(fix[overrideIndex]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(fix[overrideIndex]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(fix[overrideIndex]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ }
+ } elsif (size(fix) >= 1) {
+ if (canvas_mcdu.myDuplicate[plan] != nil) {
+ canvas_mcdu.myDuplicate[plan].del();
+ }
+ canvas_mcdu.myDuplicate[plan] = nil;
+ canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(fix, index, 0, plan);
+ setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
+ return 2;
+ }
+ },
+
+ insertLatLonFix: func(text, index, plan) {
+ if (index == 0) {
+ return 1;
+ }
+
+ var lat = split("/", text)[0];
+ var lon = split("/", text)[1];
+ var latDecimal = mcdu.stringToDegrees(lat, "lat");
+ var lonDecimal = mcdu.stringToDegrees(lon, "lon");
+
+ if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
+ return 1;
+ }
+
+ var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ index);
+ if (me.flightplans[plan].indexOfWP(myWpLatLon) == -1) {
+ me.flightplans[plan].insertWP(myWpLatLon, index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(myWpLatLon) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ },
+
+ insertNavaid: func(text, index, plan, override = 0, overrideIndex = -1) {
+ if (index == 0) {
+ return 1;
+ }
+
+ var navaid = findNavaidsByID(text);
+ if (size(navaid) == 0) {
+ return 0;
+ }
+
+ if (size(navaid) == 1 or override) {
+ if (!override) {
+ if (me.flightplans[plan].indexOfWP(navaid[0]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(navaid[0]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(navaid[0]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ } else {
+ if (me.flightplans[plan].indexOfWP(navaid[overrideIndex]) == -1) {
+ me.flightplans[plan].insertWP(createWPFrom(navaid[overrideIndex]), index);
+ me.addDiscontinuity(index + 1, plan);
+ me.flightPlanChanged(plan);
+ return 2;
+ } else {
+ var numToDel = me.flightplans[plan].indexOfWP(navaid[overrideIndex]) - index;
+ while (numToDel > 0) {
+ me.deleteWP(index, plan, 1);
+ numToDel -= 1;
+ }
+ return 2;
+ }
+ }
+ } elsif (size(navaid) >= 1) {
+ if (canvas_mcdu.myDuplicate[plan] != nil) {
+ canvas_mcdu.myDuplicate[plan].del();
+ }
+ canvas_mcdu.myDuplicate[plan] = nil;
+ canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(navaid, index, 1, plan);
+ setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
+ return 2;
+ }
+ },
+
+ scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success, 3 = not allowed due to dir to
+ if (mcdu.dirToFlag) {
+ return 3;
+ }
+
+ if (!fmgc.flightPlanController.temporaryFlag[plan]) {
+ if (text == "CLR" and me.flightplans[2].getWP(index).wp_name == "DISCONTINUITY") {
+ var thePlan = 2;
+ } else {
+ fmgc.flightPlanController.createTemporaryFlightPlan(plan);
+ var thePlan = plan;
+ }
+ } else {
+ var thePlan = plan;
+ }
+
+ if (text == "CLR") {
+ return me.deleteWP(index, thePlan, 0);
+ } elsif (size(text) == 16) {
+ return me.insertLatLonFix(text, index, thePlan);
+ } elsif (size(text) == 5) {
+ return me.insertFix(text, index, thePlan);
+ } elsif (size(text) == 4) {
+ return me.insertAirport(text, index, thePlan);
+ } elsif (size(text) == 3 or size(text) == 2) {
+ return me.insertNavaid(text, index, thePlan);
+ } else {
+ return 1;
+ }
+ },
+
+ flightPlanChanged: func(n) {
+ sizeWP = size(wpID[n]);
+ for (var counter = sizeWP; counter < me.flightplans[n].getPlanSize(); counter += 1) { # create new properties if they are required
+ append(wpID[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/text", "", "STRING"));
+ append(wpLat[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/lat", 0, "DOUBLE"));
+ append(wpLon[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/lon", 0, "DOUBLE"));
+ append(wpCourse[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course", 0, "DOUBLE"));
+ append(wpDistance[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance", 0, "DOUBLE"));
+ append(wpCoursePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course-from-prev", 0, "DOUBLE"));
+ append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE"));
+ }
+ me.updatePlans();
+ canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
+ },
+
+ updatePlans: func() {
+ me.updateCurrentWaypoint();
+ me._arrivalDist = 0;
+ for (var n = 0; n <= 2; n += 1) {
+ for (var wpt = 0; wpt < me.flightplans[n].getPlanSize(); wpt += 1) { # Iterate through the waypoints and update their data
+ var curAircraftPos = geo.aircraft_position(); # don't want to get this corrupted so make sure it is a local variable
+ var waypointHashStore = me.flightplans[n].getWP(wpt);
+
+ courseDistanceFrom = waypointHashStore.courseAndDistanceFrom(curAircraftPos);
+ wpID[n][wpt].setValue(waypointHashStore.wp_name);
+ wpLat[n][wpt].setValue(waypointHashStore.wp_lat);
+ wpLon[n][wpt].setValue(waypointHashStore.wp_lon);
+
+ wpCourse[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[0]);
+ wpDistance[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[1]);
+
+ if (wpt == 1) {
+ if (me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
+ me._arrivalDist += courseDistanceFrom[1]; # distance to next waypoint, therafter to end of flightplan
+ }
+ }
+
+ if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) {
+ if (me.arrivalIndex[n] != wpt) {
+ me.arrivalIndex[n] = wpt;
+ }
+ }
+
+ if (wpt > 0) {
+ geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon);
+
+ courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev);
+ wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]);
+ wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]);
+ if (wpt > 1) {
+ if (me.flightplans[n].getWP(wpt - 1).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt - 1).wp_type != "vectors" and me.flightplans[n].getWP(wpt - 1).wp_type != "hdgToAlt" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
+ me._arrivalDist += courseDistanceFromPrev[1]; # todo - buggy. Neglect discontinuity
+ }
+ }
+ } else {
+ # use PPOS for the first waypoint
+ wpCoursePrev[n][wpt].setValue(courseDistanceFrom[0]);
+ wpDistancePrev[n][wpt].setValue(courseDistanceFrom[1]);
+ }
+
+ if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) {
+ if (me.arrivalIndex[n] != wpt) { # don't merge line 397 and 398 if statements
+ if (canvas_mcdu.myFpln[0] != nil) {
+ canvas_mcdu.myFpln[0].destInfo();
+ }
+ if (canvas_mcdu.myFpln[1] != nil) {
+ canvas_mcdu.myFpln[1].destInfo();
+ }
+ }
+ }
+ }
+ }
+ me.arrivalDist = me._arrivalDist;
+ me.updateMCDUDriver(n);
+ },
+
+ updateCurrentWaypoint: func() {
+ for (var india = 0; india <= 2; india += 1) {
+ if (toFromSet.getBoolValue() and me.flightplans[india].departure != nil and me.flightplans[india].destination != nil) { # check if flightplan exists
+ var curAircraftPos = geo.aircraft_position(); # don't want to get this corrupted so make sure it is a local variable
+
+ if (india == 2) { # main plan
+ if (!me.active.getBoolValue()) {
+ me.active.setValue(1);
+ }
+
+ if (me.currentToWptIndex.getValue() > me.flightplans[india].getPlanSize()) {
+ me.currentToWptIndex.setValue(me.flightplans[india].getPlanSize());
+ }
+
+ me.currentToWpt = me.flightplans[india].getWP(me.currentToWptIndex.getValue());
+
+ if (me.currentToWptID.getValue() != me.currentToWpt.wp_name) {
+ me.currentToWptID.setValue(me.currentToWpt.wp_name);
+ }
+ me.courseToWpt.setValue(me.currentToWpt.courseAndDistanceFrom(curAircraftPos)[0]);
+ me.distToWpt.setValue(me.currentToWpt.courseAndDistanceFrom(curAircraftPos)[1]);
+
+ magTrueError = magHDG.getValue() - trueHDG.getValue();
+ me.courseMagToWpt.setValue(me.courseToWpt.getValue() + magTrueError);
+
+ }
+
+ if (me.num[india].getValue() != me.flightplans[india].getPlanSize()) {
+ me.num[india].setValue(me.flightplans[india].getPlanSize());
+ }
+ } else {
+ if (india == 2) {
+ if (me.active.getBoolValue()) {
+ me.active.setValue(0);
+ }
+ if (me.currentToWptID.getValue() != "") {
+ me.currentToWptID.setValue("");
+ }
+ }
+
+ if (me.num[india].getValue() != 0) {
+ me.num[india].setValue(0);
+ }
+ }
+ }
+ },
+
+ updateMCDUDriver: func() {
+ for (var i = 0; i <= 1; i += 1) {
+ if (canvas_mcdu.myFpln[i] != nil) {
+ canvas_mcdu.myFpln[i].updatePlan();
+ }
+ if (canvas_mcdu.myDirTo[i] != nil) {
+ canvas_mcdu.myDirTo[i].updateFromFpln();
+ }
+ }
+ },
+};
+
+var flightPlanTimer = maketimer(0.1, flightPlanController, flightPlanController.updatePlans);
diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas
new file mode 100644
index 00000000..f504f244
--- /dev/null
+++ b/Nasal/MCDU/ARRIVAL.nas
@@ -0,0 +1,526 @@
+var arrivalPage = {
+ title: [nil, nil, nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ C1: [nil, nil, "ack"],
+ C2: [nil, nil, "ack"],
+ C3: [nil, nil, "ack"],
+ C4: [nil, nil, "ack"],
+ C5: [nil, nil, "ack"],
+ C6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ arrAirport: nil,
+ runways: nil,
+ selectedApproach: nil,
+ selectedVIA: nil,
+ selectedSTAR: nil,
+ selectedTransition: nil,
+ stars: nil,
+ transitions: nil,
+ vias: nil,
+ computer: nil,
+ enableScrollApproach: 0,
+ enableScrollStars: 0,
+ scrollApproach: 0,
+ scrollStars: 0,
+ activePage: 0, # runways, stars, trans
+ hasPressNoTrans: 0, # temporary
+ _approaches: nil,
+ _stars: nil,
+ _transitions: nil,
+ new: func(icao, computer) {
+ var lr = {parents:[arrivalPage]};
+ lr.id = icao;
+ lr.computer = computer;
+ lr._setupPageWithData();
+ return lr;
+ },
+ del: func() {
+ return nil;
+ },
+ _setupPageWithData: func() {
+ me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
+
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (fmgc.flightPlanController.flightplans[2].approach != nil) {
+ me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
+ }
+ if (fmgc.flightPlanController.flightplans[2].star != nil) {
+ me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
+ }
+ } else {
+ if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
+ me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
+ } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
+ me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
+ }
+ if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
+ me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
+ } elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
+ me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
+ }
+ }
+
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L6 = [" RETURN END", nil, "wht"];
+ } else {
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ }
+
+ if (me.activePage == 0) {
+ me.updateApproaches();
+ } else {
+ me.updateSTARs();
+ }
+
+ me.updateActiveApproach();
+ me.updateActiveSTARs();
+ me.updateActiveTransitions();
+ },
+ _clearPage: func() {
+ me.L1 = [nil, nil, "ack"];
+ me.L2 = [nil, nil, "ack"];
+ me.L3 = [nil, nil, "ack"];
+ me.L4 = [nil, nil, "ack"];
+ me.L5 = [nil, nil, "ack"];
+ me.L6 = [nil, nil, "ack"];
+ me.C1 = [nil, nil, "ack"];
+ me.C2 = [nil, nil, "ack"];
+ me.C3 = [nil, nil, "ack"];
+ me.C4 = [nil, nil, "ack"];
+ me.C5 = [nil, nil, "ack"];
+ me.C6 = [nil, nil, "ack"];
+ me.R1 = [nil, nil, "ack"];
+ me.R2 = [nil, nil, "ack"];
+ me.R3 = [nil, nil, "ack"];
+ me.R4 = [nil, nil, "ack"];
+ me.R5 = [nil, nil, "ack"];
+ me.R6 = [nil, nil, "ack"];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+ },
+ updatePage: func() {
+ me._clearPage();
+ me._setupPageWithData();
+ },
+ updateActiveApproach: func() {
+ if (me.selectedApproach != nil) {
+ if (fmgc.flightPlanController.flightplans[2].approach != nil) {
+ if (fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) {
+ me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
+ me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
+ } else {
+ me.L1 = ["---", " APPR", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
+ me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
+ } else {
+ me.L1 = ["---", " APPR", "wht"];
+ }
+ } else {
+ me.L1 = ["---", " APPR", "wht"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateActiveSTARs: func() {
+ if (me.selectedSTAR != nil) {
+ if (fmgc.flightPlanController.flightplans[2].star != nil) {
+ if (fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) {
+ me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "SID", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
+ } else {
+ me.C1 = ["------- ", "STAR", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
+ } else {
+ me.C1 = ["------- ", "STAR", "wht"];
+ }
+ } else {
+ me.C1 = ["------- ", "STAR", "wht"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateActiveTransitions: func() {
+ if (!me.hasPressNoTrans) {
+ if (me.selectedTransition != nil) {
+ if (fmgc.flightPlanController.flightplans[2].star_trans != nil) {
+ if (fmgc.flightPlanController.flightplans[2].star_trans == me.selectedTransition) {
+ me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
+ me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"];
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "SID", "yel"];
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } else {
+ me.R1 = ["NONE", "TRANS ", "yel"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateApproaches: func() {
+ if (me.arrAirport == nil) {
+ me.arrAirport = findAirportsByICAO(left(me.id, 4));
+ }
+ me._approaches = me.arrAirport[0].getApproachList();
+ me.approaches = sort(me._approaches,func(a,b) cmp(a,b));
+
+ if (size(me.approaches) >= 1) {
+ me.L3 = [" " ~ me.approaches[0 + me.scrollApproach], " APPR", "blu"];
+ me.C3 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].length) ~ "M", "AVAILABLE ", "blu"];
+ me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
+ if (me.approaches[0 + me.scrollApproach] != me.selectedApproach) {
+ me.arrowsMatrix[0][2] = 1;
+ me.arrowsColour[0][2] = "blu";
+ } else {
+ me.arrowsMatrix[0][2] = 0;
+ me.arrowsColour[0][2] = "ack";
+ }
+ }
+ if (size(me.approaches) >= 2) {
+ me.L4 = [" " ~ me.approaches[1 + me.scrollApproach], nil, "blu"];
+ if (me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).radio == "ILS") {
+ me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
+ } else {
+ me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
+ }
+ me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
+ if (me.approaches[1 + me.scrollApproach] != me.selectedApproach) {
+ me.arrowsMatrix[0][3] = 1;
+ me.arrowsColour[0][3] = "blu";
+ } else {
+ me.arrowsMatrix[0][3] = 0;
+ me.arrowsColour[0][3] = "ack";
+ }
+ }
+ if (size(me.approaches) >= 3) {
+ me.L5 = [" " ~ me.approaches[2 + me.scrollApproach], nil, "blu"];
+ if (me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).radio == "ILS") {
+ me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
+ } else {
+ me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
+ }
+ me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
+ if (me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).radio == "ILS") {
+ me.C6[1] = me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils_frequency_mhz);
+ }
+ if (me.approaches[2 + me.scrollApproach] != me.selectedApproach) {
+ me.arrowsMatrix[0][4] = 1;
+ me.arrowsColour[0][4] = "blu";
+ } else {
+ me.arrowsMatrix[0][3] = 0;
+ me.arrowsColour[0][3] = "ack";
+ }
+ }
+
+ if (size(me.approaches) > 3) {
+ me.enableScrollApproach = 1;
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateSTARs: func() {
+ if (me.arrAirport == nil) {
+ me.arrAirport = findAirportsByICAO(left(me.id, 4));
+ }
+ if (me.selectedApproach != nil) {
+ me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]);
+ } else {
+ me._stars = me.arrAirport[0].stars();
+ }
+
+ me.stars = sort(me._stars,func(a,b) cmp(a,b));
+
+ if (size(me.stars) >= 1) {
+ me.L2 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"];
+ if (me.stars[0 + me.scrollStars] != me.selectedSTAR) {
+ me.arrowsMatrix[0][1] = 1;
+ me.arrowsColour[0][1] = "blu";
+ } else {
+ me.arrowsMatrix[0][1] = 0;
+ me.arrowsColour[0][1] = "ack";
+ }
+ }
+ if (size(me.stars) >= 2) {
+ me.L3 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"];
+ if (me.stars[1 + me.scrollStars] != me.selectedSTAR) {
+ me.arrowsMatrix[0][2] = 1;
+ me.arrowsColour[0][2] = "blu";
+ } else {
+ me.arrowsMatrix[0][2] = 0;
+ me.arrowsColour[0][2] = "ack";
+ }
+ }
+ if (size(me.stars) >= 3) {
+ me.L4 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"];
+ if (me.stars[2 + me.scrollStars] != me.selectedSTAR) {
+ me.arrowsMatrix[0][3] = 1;
+ me.arrowsColour[0][3] = "blu";
+ } else {
+ me.arrowsMatrix[0][3] = 0;
+ me.arrowsColour[0][3] = "ack";
+ }
+ }
+ if (size(me.stars) >= 4) {
+ me.L5 = [" " ~ me.stars[3 + me.scrollStars], nil, "blu"];
+ if (me.stars[3 + me.scrollStars] != me.selectedSTAR) {
+ me.arrowsMatrix[0][4] = 1;
+ me.arrowsColour[0][4] = "blu";
+ } else {
+ me.arrowsMatrix[0][4] = 0;
+ me.arrowsColour[0][4] = "ack";
+ }
+ }
+
+ me.C2 = [nil, "AVAILABLE", "wht"];
+ me.R2 = [nil, "TRANS ", "wht"];
+
+ if (size(me.stars) > 4) {
+ me.enableScrollStars = 1;
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ clearTransitions: func() {
+ me.R2 = [nil, "TRANS", "wht"];
+ me.R3 = [nil, "TRANS", "wht"];
+ me.R4 = [nil, "TRANS", "wht"];
+ me.R5 = [nil, "TRANS", "wht"];
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ me.arrowsMatrix[1][2] = 0;
+ me.arrowsColour[1][2] = "ack";
+ me.arrowsMatrix[1][3] = 0;
+ me.arrowsColour[1][3] = "ack";
+ me.arrowsMatrix[1][4] = 0;
+ me.arrowsColour[1][4] = "ack";
+ },
+ updateTransitions: func() {
+ if (me.arrAirport == nil) {
+ me.arrAirport = findAirportsByICAO(left(me.id, 4));
+ }
+ if (me.selectedSTAR == nil) {
+ me.R2 = ["NO TRANS ", "TRANS", "blu"];
+ if (!me.hasPressNoTrans) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ return;
+ }
+ me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions;
+ me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
+
+ if (size(me.transitions) == 0) {
+ me.R2 = ["NO TRANS ", "TRANS", "blu"];
+ if (!me.hasPressNoTrans) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ } elsif (size(me.transitions) >= 1) {
+ me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
+ if (me.transitions[0] != me.selectedTransition) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ } elsif (size(me.transitions) >= 2) {
+ me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
+ if (me.transitions[1] != me.selectedTransition) {
+ me.arrowsMatrix[1][2] = 1;
+ me.arrowsColour[1][2] = "blu";
+ } else {
+ me.arrowsMatrix[1][2] = 0;
+ me.arrowsColour[1][2] = "ack";
+ }
+ } elsif (size(me.transitions) >= 3) {
+ me.R4 = [me.transitions[2] ~ " ", nil, "blu"];
+ if (me.transitions[2] != me.selectedTransition) {
+ me.arrowsMatrix[1][3] = 1;
+ me.arrowsColour[1][3] = "blu";
+ } else {
+ me.arrowsMatrix[1][3] = 0;
+ me.arrowsColour[1][3] = "ack";
+ }
+ } elsif (size(me.transitions) >= 4) {
+ me.R5 = [me.transitions[3] ~ " ", nil, "blu"];
+ if (me.transitions[3] != me.selectedTransition) {
+ me.arrowsMatrix[1][4] = 1;
+ me.arrowsColour[1][4] = "blu";
+ } else {
+ me.arrowsMatrix[1][4] = 0;
+ me.arrowsColour[1][4] = "ack";
+ }
+ }
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (!dirToFlag) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ } else {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ }
+ },
+ scrollUp: func() {
+ if (me.activePage == 0) {
+ if (me.enableScrollApproach) {
+ me.scrollApproach += 1;
+ if (me.scrollApproach > size(me.approaches) - 4) {
+ me.scrollApproach = 0;
+ }
+ me.updateApproaches();
+ }
+ } else {
+ if (me.enableScrollStars) {
+ me.scrollStars += 1;
+ if (me.scrollStars > size(me.stars) - 4) {
+ me.scrollStars = 0;
+ }
+ me.updateSTARs();
+ if (me.selectedSTAR == nil) {
+ me.clearTransitions();
+ } else {
+ me.updateTransitions();
+ }
+ me.hasPressNoTrans = 0;
+ }
+ }
+ },
+ scrollDn: func() {
+ if (me.activePage == 0) {
+ if (me.enableScrollApproach) {
+ me.scrollApproach -= 1;
+ if (me.scrollApproach < 0) {
+ me.scrollApproach = size(me.approaches) - 4;
+ }
+ me.updateApproaches();
+ }
+ } else {
+ if (me.enableScrollStars) {
+ me.scrollStars -= 1;
+ if (me.scrollStars < 0) {
+ me.scrollStars = size(me.stars) - 4;
+ }
+ me.updateSTARs();
+ if (me.selectedSTAR == nil) {
+ me.clearTransitions();
+ } else {
+ me.updateTransitions();
+ }
+ me.hasPressNoTrans = 0;
+ }
+ }
+ },
+ scrollLeft: func() {
+ me.activePage = !me.activePage;
+ me.updatePage();
+ },
+ scrollRight: func() {
+ me.activePage = !me.activePage;
+ me.updatePage();
+ },
+ arrPushbuttonLeft: func(index) {
+ if (me.activePage == 0) {
+ if (size(me.approaches) >= (index - 1) and index != 2) {
+ if (!dirToFlag) {
+ me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]);
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]];
+ fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach;
+ me.updateActiveApproach();
+ me.updateApproaches();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ me.scrollRight();
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ } else {
+ if (size(me.stars) >= (index - 1)) {
+ if (!dirToFlag) {
+ me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR);
+ me.updateActiveSTARs();
+ me.updateSTARs();
+ me.hasPressNoTrans = 0;
+ me.updateTransitions();
+ me.updateActiveTransitions();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ }
+ },
+ arrPushbuttonRight: func(index) {
+ if (index == 2 and size(me.transitions) == 0) {
+ if (!dirToFlag) {
+ me.hasPressNoTrans = 1;
+ me.updateActiveTransitions();
+ me.updateTransitions();
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } elsif (size(me.transitions) >= (index - 1)) {
+ if (!dirToFlag) {
+ me.selectedTransition = me.transitions[index - 2];
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
+ me.updateActiveTransitions();
+ me.updateTransitions();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ },
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas
new file mode 100644
index 00000000..6eec9002
--- /dev/null
+++ b/Nasal/MCDU/DEPARTURE.nas
@@ -0,0 +1,528 @@
+var departurePage = {
+ title: [nil, nil, nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ C1: [nil, nil, "ack"],
+ C2: [nil, nil, "ack"],
+ C3: [nil, nil, "ack"],
+ C4: [nil, nil, "ack"],
+ C5: [nil, nil, "ack"],
+ C6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ depAirport: nil,
+ runways: nil,
+ selectedRunway: nil,
+ selectedSID: nil,
+ selectedTransition: nil,
+ sids: nil,
+ transitions: nil,
+ computer: nil,
+ enableScrollRwy: 0,
+ enableScrollSids: 0,
+ scrollRwy: 0,
+ scrollSids: 0,
+ activePage: 0, # runways, sids, trans
+ hasPressNoTrans: 0, # temporary
+ _runways: nil,
+ _sids: nil,
+ _transitions: nil,
+ new: func(icao, computer) {
+ var lr = {parents:[departurePage]};
+ lr.id = icao;
+ lr.computer = computer;
+ lr._setupPageWithData();
+ return lr;
+ },
+ del: func() {
+ return nil;
+ },
+ _setupPageWithData: func() {
+ me.title = ["DEPARTURE", " FROM ", left(me.id, 4)];
+
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
+ me.selectedRunway = fmgc.flightPlanController.flightplans[2].departure_runway;
+ }
+ if (fmgc.flightPlanController.flightplans[2].sid != nil) {
+ me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
+ }
+ } else {
+ if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
+ me.selectedRunway = fmgc.flightPlanController.flightplans[me.computer].departure_runway;
+ } elsif (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
+ me.selectedRunway = fmgc.flightPlanController.flightplans[2].departure_runway;
+ }
+ if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
+ me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid;
+ } elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
+ me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
+ }
+ }
+
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L6 = [" RETURN END", nil, "wht"];
+ } else {
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ }
+
+ if (me.activePage == 0) {
+ me.updateRunways();
+ } else {
+ me.updateSIDs();
+ }
+
+ me.updateActiveRunway();
+ me.updateActiveSIDs();
+ me.updateActiveTransitions();
+ },
+ _clearPage: func() {
+ me.L1 = [nil, nil, "ack"];
+ me.L2 = [nil, nil, "ack"];
+ me.L3 = [nil, nil, "ack"];
+ me.L4 = [nil, nil, "ack"];
+ me.L5 = [nil, nil, "ack"];
+ me.L6 = [nil, nil, "ack"];
+ me.C1 = [nil, nil, "ack"];
+ me.C2 = [nil, nil, "ack"];
+ me.C3 = [nil, nil, "ack"];
+ me.C4 = [nil, nil, "ack"];
+ me.C5 = [nil, nil, "ack"];
+ me.C6 = [nil, nil, "ack"];
+ me.R1 = [nil, nil, "ack"];
+ me.R2 = [nil, nil, "ack"];
+ me.R3 = [nil, nil, "ack"];
+ me.R4 = [nil, nil, "ack"];
+ me.R5 = [nil, nil, "ack"];
+ me.R6 = [nil, nil, "ack"];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+ },
+ updatePage: func() {
+ me._clearPage();
+ me._setupPageWithData();
+ },
+ updateActiveRunway: func() {
+ if (me.selectedRunway != nil) {
+ if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
+ if (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) {
+ me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
+ me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
+ } else {
+ me.L1 = ["---", " RWY", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
+ me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
+ } else {
+ me.L1 = ["---", " RWY", "wht"];
+ }
+ } else {
+ me.L1 = ["---", " RWY", "wht"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateActiveSIDs: func() {
+ if (me.selectedSID != nil) {
+ if (fmgc.flightPlanController.flightplans[2].sid != nil) {
+ if (fmgc.flightPlanController.flightplans[2].sid == me.selectedSID) {
+ me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
+ } else {
+ me.C1 = ["------- ", "SID", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].sid.id != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
+ } else {
+ me.C1 = ["------- ", "SID", "wht"];
+ }
+ } else {
+ me.C1 = ["------- ", "SID", "wht"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateActiveTransitions: func() {
+ if (!me.hasPressNoTrans) {
+ if (me.selectedTransition != nil) {
+ if (fmgc.flightPlanController.flightplans[2].sid_trans != nil) {
+ if (fmgc.flightPlanController.flightplans[2].sid_trans == me.selectedTransition) {
+ me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "grn"];
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
+ me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "TRANS", "yel"];
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
+ me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "SID", "yel"];
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } else {
+ me.R1 = ["-------", "TRANS ", "wht"];
+ }
+ } else {
+ me.R1 = ["NONE", "TRANS ", "yel"];
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateRunways: func() {
+ if (me.depAirport == nil) {
+ me.depAirport = findAirportsByICAO(left(me.id, 4));
+ }
+ me._runways = keys(me.depAirport[0].runways);
+ me.runways = sort(me._runways,func(a,b) cmp(a,b));
+
+ if (size(me.runways) >= 1) {
+ me.L2 = [" " ~ me.runways[0 + me.scrollRwy], nil, "blu"];
+ me.C2 = [math.round(me.depAirport[0].runways[me.runways[0 + me.scrollRwy]].length) ~ "M", "AVAILABLE RUNWAYS", "blu"];
+ me.R2 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[0 + me.scrollRwy]].heading), nil, "blu"];
+ if (me.runways[0 + me.scrollRwy] != me.selectedRunway) {
+ me.arrowsMatrix[0][1] = 1;
+ me.arrowsColour[0][1] = "blu";
+ } else {
+ me.arrowsMatrix[0][1] = 0;
+ me.arrowsColour[0][1] = "ack";
+ }
+ }
+ if (size(me.runways) >= 2) {
+ me.L3 = [" " ~ me.runways[1 + me.scrollRwy], nil, "blu"];
+ me.C3 = [math.round(me.depAirport[0].runways[me.runways[1 + me.scrollRwy]].length) ~ "M", nil, "blu"];
+ me.R3 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[1 + me.scrollRwy]].heading), nil, "blu"];
+ if (me.runways[1 + me.scrollRwy] != me.selectedRunway) {
+ me.arrowsMatrix[0][2] = 1;
+ me.arrowsColour[0][2] = "blu";
+ } else {
+ me.arrowsMatrix[0][2] = 0;
+ me.arrowsColour[0][2] = "ack";
+ }
+ }
+ if (size(me.runways) >= 3) {
+ me.L4 = [" " ~ me.runways[2 + me.scrollRwy], nil, "blu"];
+ me.C4 = [math.round(me.depAirport[0].runways[me.runways[2 + me.scrollRwy]].length) ~ "M", nil, "blu"];
+ me.R4 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[2 + me.scrollRwy]].heading), nil, "blu"];
+ if (me.runways[2 + me.scrollRwy] != me.selectedRunway) {
+ me.arrowsMatrix[0][3] = 1;
+ me.arrowsColour[0][3] = "blu";
+ } else {
+ me.arrowsMatrix[0][3] = 0;
+ me.arrowsColour[0][3] = "ack";
+ }
+ }
+ if (size(me.runways) >= 4) {
+ me.L5 = [" " ~ me.runways[3 + me.scrollRwy], nil, "blu"];
+ me.C5 = [math.round(me.depAirport[0].runways[me.runways[3 + me.scrollRwy]].length) ~ "M", nil, "blu"];
+ me.R5 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[3 + me.scrollRwy]].heading), nil, "blu"];
+ if (me.runways[3 + me.scrollRwy] != me.selectedRunway) {
+ me.arrowsMatrix[0][4] = 1;
+ me.arrowsColour[0][4] = "blu";
+ } else {
+ me.arrowsMatrix[0][4] = 0;
+ me.arrowsColour[0][4] = "ack";
+ }
+ }
+
+ if (size(me.runways) > 4) {
+ me.enableScrollRwy = 1;
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateSIDs: func() {
+ if (me.depAirport == nil) {
+ me.depAirport = findAirportsByICAO(left(me.id, 4));
+ }
+ if (me.selectedRunway != nil) {
+ me._sids = me.depAirport[0].sids(me.selectedRunway.id);
+ if (size(me._sids) == 0) { # account for cases such as EGJJ where runway code does not match SIDS
+ me._sids = me.depAirport[0].sids();
+ }
+ } else {
+ me._sids = me.depAirport[0].sids();
+ }
+
+ me.sids = sort(me._sids,func(a,b) cmp(a,b));
+
+ if (size(me.sids) >= 1) {
+ me.L2 = [" " ~ me.sids[0 + me.scrollSids], "SIDS", "blu"];
+ if (me.sids[0 + me.scrollSids] != me.selectedSID) {
+ me.arrowsMatrix[0][1] = 1;
+ me.arrowsColour[0][1] = "blu";
+ } else {
+ me.arrowsMatrix[0][1] = 0;
+ me.arrowsColour[0][1] = "ack";
+ }
+ }
+ if (size(me.sids) >= 2) {
+ me.L3 = [" " ~ me.sids[1 + me.scrollSids], nil, "blu"];
+ if (me.sids[1 + me.scrollSids] != me.selectedSID) {
+ me.arrowsMatrix[0][2] = 1;
+ me.arrowsColour[0][2] = "blu";
+ } else {
+ me.arrowsMatrix[0][2] = 0;
+ me.arrowsColour[0][2] = "ack";
+ }
+ }
+ if (size(me.sids) >= 3) {
+ me.L4 = [" " ~ me.sids[2 + me.scrollSids], nil, "blu"];
+ if (me.sids[2 + me.scrollSids] != me.selectedSID) {
+ me.arrowsMatrix[0][3] = 1;
+ me.arrowsColour[0][3] = "blu";
+ } else {
+ me.arrowsMatrix[0][3] = 0;
+ me.arrowsColour[0][3] = "ack";
+ }
+ }
+ if (size(me.sids) >= 4) {
+ me.L5 = [" " ~ me.sids[3 + me.scrollSids], nil, "blu"];
+ if (me.sids[3 + me.scrollSids] != me.selectedSID) {
+ me.arrowsMatrix[0][4] = 1;
+ me.arrowsColour[0][4] = "blu";
+ } else {
+ me.arrowsMatrix[0][4] = 0;
+ me.arrowsColour[0][4] = "ack";
+ }
+ }
+
+ me.C2 = [nil, "AVAILABLE", "wht"];
+ me.R2 = [nil, "TRANS ", "wht"];
+
+ if (size(me.sids) > 4) {
+ me.enableScrollSids = 1;
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ clearTransitions: func() {
+ me.R2 = [nil, "TRANS", "wht"];
+ me.R3 = [nil, "TRANS", "wht"];
+ me.R4 = [nil, "TRANS", "wht"];
+ me.R5 = [nil, "TRANS", "wht"];
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ me.arrowsMatrix[1][2] = 0;
+ me.arrowsColour[1][2] = "ack";
+ me.arrowsMatrix[1][3] = 0;
+ me.arrowsColour[1][3] = "ack";
+ me.arrowsMatrix[1][4] = 0;
+ me.arrowsColour[1][4] = "ack";
+ },
+ updateTransitions: func() {
+ if (me.depAirport == nil) {
+ me.depAirport = findAirportsByICAO(left(me.id, 4));
+ }
+
+ if (me.selectedSID == nil) {
+ me.R2 = ["NO TRANS ", "TRANS", "blu"];
+ if (!me.hasPressNoTrans) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ return;
+ }
+ me._transitions = me.depAirport[0].getSid(me.selectedSID).transitions;
+ me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
+
+ if (size(me.transitions) == 0) {
+ me.R2 = ["NO TRANS ", "TRANS", "blu"];
+ if (!me.hasPressNoTrans) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ } elsif (size(me.transitions) >= 1) {
+ me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
+ if (me.transitions[0] != me.selectedTransition) {
+ me.arrowsMatrix[1][1] = 1;
+ me.arrowsColour[1][1] = "blu";
+ } else {
+ me.arrowsMatrix[1][1] = 0;
+ me.arrowsColour[1][1] = "ack";
+ }
+ } elsif (size(me.transitions) >= 2) {
+ me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
+ if (me.transitions[1] != me.selectedTransition) {
+ me.arrowsMatrix[1][2] = 1;
+ me.arrowsColour[1][2] = "blu";
+ } else {
+ me.arrowsMatrix[1][2] = 0;
+ me.arrowsColour[1][2] = "ack";
+ }
+ } elsif (size(me.transitions) >= 3) {
+ me.R4 = [me.transitions[2] ~ " ", nil, "blu"];
+ if (me.transitions[2] != me.selectedTransition) {
+ me.arrowsMatrix[1][3] = 1;
+ me.arrowsColour[1][3] = "blu";
+ } else {
+ me.arrowsMatrix[1][3] = 0;
+ me.arrowsColour[1][3] = "ack";
+ }
+ } elsif (size(me.transitions) >= 4) {
+ me.R5 = [me.transitions[3] ~ " ", nil, "blu"];
+ if (me.transitions[3] != me.selectedTransition) {
+ me.arrowsMatrix[1][4] = 1;
+ me.arrowsColour[1][4] = "blu";
+ } else {
+ me.arrowsMatrix[1][4] = 0;
+ me.arrowsColour[1][4] = "ack";
+ }
+ }
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (!dirToFlag) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ } else {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ }
+ },
+ scrollUp: func() {
+ if (me.activePage == 0) {
+ if (me.enableScrollRwy) {
+ me.scrollRwy += 1;
+ if (me.scrollRwy > size(me.runways) - 4) {
+ me.scrollRwy = 0;
+ }
+ me.updateRunways();
+ }
+ } else {
+ if (me.enableScrollSids) {
+ me.scrollSids += 1;
+ if (me.scrollSids > size(me.sids) - 4) {
+ me.scrollSids = 0;
+ }
+ me.updateSIDs();
+ if (me.selectedSID == nil) {
+ me.clearTransitions();
+ } else {
+ me.updateTransitions();
+ }
+ me.hasPressNoTrans = 0;
+ }
+ }
+ },
+ scrollDn: func() {
+ if (me.activePage == 0) {
+ if (me.enableScrollRwy) {
+ me.scrollRwy -= 1;
+ if (me.scrollRwy < 0) {
+ me.scrollRwy = size(me.runways) - 4;
+ }
+ me.updateRunways();
+ }
+ } else {
+ if (me.enableScrollSids) {
+ me.scrollSids -= 1;
+ if (me.scrollSids < 0) {
+ me.scrollSids = size(me.sids) - 4;
+ }
+ me.updateSIDs();
+ if (me.selectedSID == nil) {
+ me.clearTransitions();
+ } else {
+ me.updateTransitions();
+ }
+ me.hasPressNoTrans = 0;
+ }
+ }
+ },
+ scrollLeft: func() {
+ me.activePage = !me.activePage;
+ me.updatePage();
+ },
+ scrollRight: func() {
+ me.activePage = !me.activePage;
+ me.updatePage();
+ },
+ depPushbuttonLeft: func(index) {
+ if (me.activePage == 0) {
+ if (size(me.runways) >= (index - 1)) {
+ if (!dirToFlag) {
+ me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
+ me.updateActiveRunway();
+ me.updateRunways();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ me.scrollRight();
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ } else {
+ if (size(me.sids) >= (index - 1)) {
+ if (!dirToFlag) {
+ me.selectedSID = me.sids[index - 2 + me.scrollSids];
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
+ me.updateActiveSIDs();
+ me.updateSIDs();
+ me.hasPressNoTrans = 0;
+ me.updateTransitions();
+ me.updateActiveTransitions();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ }
+ },
+ depPushbuttonRight: func(index) {
+ if (index == 2 and size(me.transitions) == 0) {
+ if (!dirToFlag) {
+ me.hasPressNoTrans = 1;
+ me.updateActiveTransitions();
+ me.updateTransitions();
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } elsif (size(me.transitions) >= (index - 1)) {
+ if (!dirToFlag) {
+ me.selectedTransition = me.transitions[index - 2];
+ me.makeTmpy();
+ fmgc.flightPlanController.flightplans[me.computer].sid = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition);
+ me.updateActiveTransitions();
+ me.updateTransitions();
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ },
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/DIRTO.nas b/Nasal/MCDU/DIRTO.nas
new file mode 100644
index 00000000..50bc54aa
--- /dev/null
+++ b/Nasal/MCDU/DIRTO.nas
@@ -0,0 +1,275 @@
+var dirToFlag = 0;
+
+var dirTo = {
+ title: [nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ scroll: 0,
+ vector: [],
+ index: nil,
+ computer: nil,
+ new: func(computer) {
+ var dt = {parents:[dirTo]};
+ dt.computer = computer;
+ dt._setupPageWithData();
+ return dt;
+ },
+ del: func() {
+ return nil;
+ },
+ _setupPageWithData: func() {
+ me.title = ["DIR TO"];
+ me.titleColour = "wht";
+ me.L1 = [" [ ]", " WAYPOINT", "blu"];
+ me.L2 = [nil, " F-PLN WPTS", "blu"];
+ me.L3 = [nil, nil, "blu"];
+ me.L4 = [nil, nil, "blu"];
+ me.L5 = [nil, nil, "blu"];
+ me.R1 = ["---- --- ", "UTC DIST ", "wht"];
+ me.R2 = ["DIRECT TO ", nil, "blu"];
+ me.R3 = ["ABEAM PTS ", "WITH ", "blu"];
+ me.R4 = ["[ ] ", "RADIAL IN ", "blu"];
+ me.R5 = ["[ ] ", "RADIAL OUT ", "blu"];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "blu", "blu", "blu", "blu", "ack"], ["ack", "blu", "blu", "ack", "ack", "ack"]];
+ me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
+ me.updateFromFpln();
+ me.updateTmpy();
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ }
+ dirToFlag = 1;
+ },
+ insertDirTo: func() {
+ dirToFlag = 0;
+ },
+ updateTmpy: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L1[2] = "yel";
+ me.R2[2] = "yel";
+ me.arrowsMatrix[1][2] = 1;
+ me.titleColour = "yel";
+ } else {
+ me.L1[2] = "blu";
+ me.R2[2] = "blu";
+ me.arrowsMatrix[1][2] = 0;
+ me.titleColour = "wht";
+ }
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ updateFromFpln: func() {
+ if (canvas_mcdu.myFpln[me.computer] == nil) {
+ canvas_mcdu.myFpln[me.computer] = fplnPage.new(2, me.computer);
+ }
+
+ var x = 0;
+ me.vector = [];
+ for (var i = 1 + (me.scroll); i < size(canvas_mcdu.myFpln[me.computer].planList) - 2; i = i + 1) {
+ if (canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "DISCONTINUITY" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "VECTORS" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "T-P" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_type == "hdgToAlt") { continue; } # can't ever have tmpy with dir to
+ if (canvas_mcdu.myFpln[me.computer].planList[i].index > fmgc.flightPlanController.arrivalIndex[2]) {
+ continue;
+ }
+ append(me.vector, canvas_mcdu.myFpln[me.computer].planList[i].wp);
+ x += 1;
+ if (x == 4) { break; }
+ }
+
+ if (size(me.vector) > 0) {
+ me.L2[0] = " " ~ me.vector[0].wp_name;
+ me.arrowsMatrix[0][1] = 1;
+ } else {
+ me.L2[0] = nil;
+ me.arrowsMatrix[0][1] = 0;
+ }
+ if (size(me.vector) > 1) {
+ me.L3[0] = " " ~ me.vector[1].wp_name;
+ me.arrowsMatrix[0][2] = 1;
+ } else {
+ me.L3[0] = nil;
+ me.arrowsMatrix[0][2] = 0;
+ }
+ if (size(me.vector) > 2) {
+ me.L4[0] = " " ~ me.vector[2].wp_name;
+ me.arrowsMatrix[0][3] = 1;
+ } else {
+ me.L4[0] = nil;
+ me.arrowsMatrix[0][3] = 0;
+ }
+ if (size(me.vector) > 3) {
+ me.L5[0] = " " ~ me.vector[3].wp_name;
+ me.arrowsMatrix[0][4] = 1;
+ } else {
+ me.L5[0] = nil;
+ me.arrowsMatrix[0][4] = 0;
+ }
+ me.updateTmpy();
+ },
+ scrollUp: func() {
+ if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
+ me.scroll += 1;
+ if (me.scroll > size(canvas_mcdu.myFpln[me.computer].planList) - 6) {
+ me.scroll = 0;
+ }
+ } else {
+ me.scroll = 0;
+ }
+ me.updateFromFpln();
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ scrollDn: func() {
+ if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
+ me.scroll -= 1;
+ if (me.scroll < 0) {
+ me.scroll = size(canvas_mcdu.myFpln[me.computer].planList) - 6;
+ }
+ } else {
+ me.scroll = 0;
+ }
+ me.updateFromFpln();
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ fieldL1: func(text, override = 0, overrideIndex = -1) {
+ me.makeTmpy();
+ me.L1[0] = text;
+ if (size(text) == 16) {
+ # lat lon
+ var lat = split("/", text)[0];
+ var lon = split("/", text)[1];
+ var latDecimal = mcdu.stringToDegrees(lat, "lat");
+ var lonDecimal = mcdu.stringToDegrees(lon, "lon");
+
+ if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
+ notAllowed(me.computer);
+ }
+
+ var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ 01);
+ fmgc.flightPlanController.directTo(myWpLatLon, me.computer);
+
+ } elsif (size(text) == 5) {
+ # fix
+ var fix = findFixesByID(text);
+ if (size(fix) == 0) {
+ notInDataBase(me.computer);
+ }
+
+ if (size(fix) == 1 or override) {
+ if (!override) {
+ fmgc.flightPlanController.directTo(fix[0], me.computer);
+ } else {
+ fmgc.flightPlanController.directTo(fix[overrideIndex], me.computer);
+ }
+ } elsif (size(fix) >= 1) {
+ if (canvas_mcdu.myDuplicate[me.computer] != nil) {
+ canvas_mcdu.myDuplicate[me.computer].del();
+ }
+ canvas_mcdu.myDuplicate[me.computer] = nil;
+ canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(fix, 0, 0, me.computer);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
+ }
+
+ } elsif (size(text) == 4) {
+ # airport
+ var airport = findAirportsByICAO(text);
+ if (size(airport) == 0) {
+ notInDataBase(me.computer);
+ }
+
+ if (size(airport) == 1 or override) {
+ if (!override) {
+ fmgc.flightPlanController.directTo(airport[0], me.computer);
+ } else {
+ fmgc.flightPlanController.directTo(airport[overrideIndex], me.computer);
+ }
+ } elsif (size(airport) >= 1) {
+ if (canvas_mcdu.myDuplicate[me.computer] != nil) {
+ canvas_mcdu.myDuplicate[me.computer].del();
+ }
+ canvas_mcdu.myDuplicate[me.computer] = nil;
+ canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(airport, 0, 0, me.computer);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
+ }
+
+ } elsif (size(text) == 3 or size(text) == 2) {
+ # navaid
+ var navaid = findNavaidsByID(text);
+ if (size(navaid) == 0) {
+ notInDataBase(me.computer);
+ }
+
+ if (size(navaid) == 1 or override) {
+ if (!override) {
+ fmgc.flightPlanController.directTo(navaid[0], me.computer);
+ } else {
+ fmgc.flightPlanController.directTo(navaid[overrideIndex], me.computer);
+ }
+ } elsif (size(navaid) >= 1) {
+ if (canvas_mcdu.myDuplicate[me.computer] != nil) {
+ canvas_mcdu.myDuplicate[me.computer].del();
+ }
+ canvas_mcdu.myDuplicate[me.computer] = nil;
+ canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(navaid, 0, 0, me.computer);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
+ }
+
+ } else {
+ notAllowed(me.computer);
+ }
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
+ },
+ leftFieldBtn: func(index) {
+ me.makeTmpy();
+ me.L1[0] = me.vector[index + me.scroll - 2].wp_name;
+ fmgc.flightPlanController.directTo(me.vector[index + me.scroll - 2], me.computer);
+ me.arrowsMatrix[0][1] = 0;
+ # FIGURE OUT HOW TO MAKE IT SO IT DOESN'T DELETE THE WAYPOINTS ON DIR TO BUT DOES IN FLIGHTPLAN
+ #for (var i = 2; i != 6; i = i + 1) {
+ # if (i == index) {
+ # me.arrowsMatrix[0][i - 1] = 0;
+ # } else {
+ # me.arrowsMatrix[0][i - 1] = 1;
+ # }
+ #}
+ },
+ fieldL6: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
+ dirToFlag = 0;
+ fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
+ } else {
+ notAllowed(me.computer);
+ }
+ me.L1 = [" [ ]", " WAYPOINT", "blu"];
+ me.R1 = ["---- --- ", "UTC DIST ", "wht"];
+ },
+ fieldR6: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
+ dirToFlag = 0;
+ fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
+ } else {
+ notAllowed(me.computer);
+ }
+ me.L1 = [" [ ]", " WAYPOINT", "blu"];
+ me.R1 = ["---- --- ", "UTC DIST ", "wht"];
+ setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
+ },
+ updateDist: func(dist) {
+ me.R1 = ["---- " ~ sprintf("%.0f", dist) ~ " ", "UTC DIST ", "wht"];
+ },
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/DUPLICATE.nas b/Nasal/MCDU/DUPLICATE.nas
new file mode 100644
index 00000000..d782724f
--- /dev/null
+++ b/Nasal/MCDU/DUPLICATE.nas
@@ -0,0 +1,149 @@
+var duplicateNamesPage = {
+ title: nil,
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ C1: [nil, nil, "ack"],
+ C2: [nil, nil, "ack"],
+ C3: [nil, nil, "ack"],
+ C4: [nil, nil, "ack"],
+ C5: [nil, nil, "ack"],
+ C6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ vector: nil,
+ type: nil,
+ computer: nil,
+ enableScroll: 0,
+ scroll: 0,
+ distances: nil,
+ new: func(vector, index, type, computer) {
+ var fp = {parents:[duplicateNamesPage]};
+ fp.vector = vector;
+ fp.index = index;
+ fp.type = type; # 0 = other, 1 = navaid
+ fp.computer = computer;
+ fp._setupPageWithData();
+ fp.distances = [];
+ return fp;
+ },
+ del: func() {
+ return nil;
+ },
+ _setupPageWithData: func() {
+ me.title = "DUPLICATE NAMES";
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+
+ me.distances = [];
+ for (var i = 0; i < size(me.vector); i += 1) {
+ append(me.distances, math.round(courseAndDistance(me.vector[i])[1]));
+ }
+
+ me.C1[1] = "LAT/LONG";
+ me.R1[1] = "FREQ";
+ if (size(me.vector) >= 1) {
+ me.L1 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[0 + me.scroll] ~ "NM", "blu"];
+ me.arrowsMatrix[0][0] = 1;
+ me.arrowsColour[0][0] = "blu";
+ me.C1 = [" " ~ decimalToShortString(me.vector[0 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[0 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
+ if (me.type == 1) {
+ if (me.vector[0 + me.scroll].frequency != nil) {
+ me.R1 = [sprintf("%7.2f", me.vector[0 + me.scroll].frequency / 100), "FREQ", "grn"];
+ }
+ }
+ }
+ if (size(me.vector) >= 2) {
+ me.L2 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[1 + me.scroll] ~ "NM", "blu"];
+ me.arrowsMatrix[0][1] = 1;
+ me.arrowsColour[0][1] = "blu";
+ me.C2 = [" " ~ decimalToShortString(me.vector[1 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[1 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
+ if (me.type == 1) {
+ if (me.vector[1 + me.scroll].frequency != nil) {
+ me.R2 = [sprintf("%7.2f", me.vector[1 + me.scroll].frequency / 100), "FREQ", "grn"];
+ }
+ }
+ }
+ if (size(me.vector) >= 3) {
+ me.L3 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[2 + me.scroll] ~ "NM", "blu"];
+ me.arrowsMatrix[0][2] = 1;
+ me.arrowsColour[0][2] = "blu";
+ me.C3 = [" " ~ decimalToShortString(me.vector[2 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[2 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
+ if (me.type == 1) {
+ if (me.vector[2 + me.scroll].frequency != nil) {
+ me.R3 = [sprintf("%7.2f", me.vector[2 + me.scroll].frequency / 100), "FREQ", "grn"];
+ }
+ }
+ }
+ if (size(me.vector) >= 4) {
+ me.L4 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[3 + me.scroll] ~ "NM", "blu"];
+ me.arrowsMatrix[0][3] = 1;
+ me.arrowsColour[0][3] = "blu";
+ me.C4 = [" " ~ decimalToShortString(me.vector[3 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[3 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
+ if (me.type == 1) {
+ if (me.vector[3 + me.scroll].frequency != nil) {
+ me.R4 = [sprintf("%7.2f", me.vector[3 + me.scroll].frequency / 100), "FREQ", "grn"];
+ }
+ }
+ }
+ if (size(me.vector) >= 5) {
+ me.L5 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[4 + me.scroll] ~ "NM", "blu"];
+ me.arrowsMatrix[0][4] = 1;
+ me.arrowsColour[0][4] = "blu";
+ me.C5 = [" " ~ decimalToShortString(me.vector[4 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[4 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
+ if (me.type == 1) {
+ if (me.vector[4 + me.scroll].frequency != nil) {
+ me.R5 = [sprintf("%7.2f", me.vector[4 + me.scroll].frequency / 100), "FREQ", "grn"];
+ }
+ }
+ }
+ if (size(me.vector) > 5) { me.enableScroll = 1; }
+
+ me.L6 = [" RETURN", nil, "wht"];
+ },
+ scrollUp: func() {
+ if (me.enableScroll) {
+ me.scroll += 1;
+ if (me.scroll > size(me.vector) - 5) {
+ me.scroll = 0;
+ }
+ }
+ },
+ scrollDn: func() {
+ if (me.enableScroll) {
+ me.scroll -= 1;
+ if (me.scroll < 0) {
+ me.scroll = size(me.vector) - 5;
+ }
+ }
+ },
+ pushButtonLeft: func(indexSelect) {
+ if (!dirToFlag) {
+ if (size(me.vector[0].id) == 5) {
+ fmgc.flightPlanController.insertFix(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
+ } elsif (size(me.vector[0].id) == 4) {
+ fmgc.flightPlanController.insertAirport(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
+ } elsif (size(me.vector[0].id) == 3 or size(me.vector[0].id)== 2) {
+ fmgc.flightPlanController.insertNavaid(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
+ }
+ } else {
+ canvas_mcdu.myDirTo[me.computer].fieldL1(me.vector[0].id, 1, indexSelect - 1);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "DIRTO");
+ }
+ },
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas
new file mode 100644
index 00000000..6804cba4
--- /dev/null
+++ b/Nasal/MCDU/F-PLN.nas
@@ -0,0 +1,424 @@
+var fplnItem = {
+ new: func(wp, index, plan, computer, colour = "grn") {
+ var fI = {parents:[fplnItem]};
+ fI.wp = wp;
+ fI.index = index;
+ fI.plan = plan;
+ fI.computer = computer;
+ fI.colour = colour;
+ return fI;
+ },
+ updateLeftText: func() {
+ if (me.wp != nil) {
+ if (me.wp.wp_name == "T-P") {
+ return ["T-P", nil, me.colour];
+ } elsif (me.wp.wp_name != "DISCONTINUITY") {
+ var wptName = split("-", me.wp.wp_name);
+ if (wptName[0] == "VECTORS") {
+ return ["MANUAL", nil, me.colour];
+ } else {
+ if (size(wptName) == 2) {
+ return[wptName[0] ~ wptName[1], nil, me.colour];
+ } else {
+ return [me.wp.wp_name, nil, me.colour];
+ }
+ }
+ } else {
+ return [nil, nil, "ack"];
+ }
+ } else {
+ return ["problem", nil, "ack"];
+ }
+ },
+ updateCenterText: func() {
+ if (me.wp != nil) {
+ if (me.wp.wp_name != "DISCONTINUITY") {
+ if (me.index != (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) or fmgc.flightPlanController.fromWptTime == nil) {
+ me.brg = me.getBrg();
+ me.track = me.getTrack();
+ return ["---- ", nil, me.colour];
+ } else {
+ me.brg = me.getBrg();
+ me.track = me.getTrack();
+ return [fmgc.flightPlanController.fromWptTime ~ " ", nil, me.colour];
+ }
+ } else {
+ return ["---F-PLN DISCONTINUITY--", nil, "wht"];
+ }
+ } else {
+ return ["problem", nil, "ack"];
+ }
+ },
+ updateRightText: func() {
+ if (me.wp != nil) {
+ if (me.wp.wp_name != "DISCONTINUITY") {
+ me.spd = me.getSpd();
+ me.alt = me.getAlt();
+ me.dist = me.getDist();
+ return [me.spd ~ "/" ~ me.alt, " " ~ me.dist ~ "NM ", me.colour];
+ } else {
+ return [nil, nil, "ack"];
+ }
+ } else {
+ return ["problem", nil, "ack"];
+ }
+ },
+ getBrg: func() {
+ return nil;
+ },
+ getTrack: func() {
+ return nil;
+ },
+ getSpd: func() {
+ return "---";
+ },
+ getAlt: func() {
+ if (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) {
+ return " " ~ fmgc.flightPlanController.fromWptAlt;
+ } else {
+ return "-----";
+ }
+ },
+ getDist: func() {
+ return "--";
+ },
+ pushButtonLeft: func() {
+ if (canvas_mcdu.myLatRev[me.computer] != nil) {
+ canvas_mcdu.myLatRev[me.computer].del();
+ }
+ canvas_mcdu.myLatRev[me.computer] = nil;
+
+ if (me.wp.wp_name == "DISCONTINUITY") {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(4, "DISCON", me.index, me.computer);
+ } elsif (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
+ } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
+ } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer);
+ } else {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer);
+ }
+ } else {
+ if (me.index == fmgc.flightPlanController.arrivalIndex[2]) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
+ } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
+ } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer);
+ } else {
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer);
+ }
+ }
+ setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
+ },
+ pushButtonRight: func() {
+ if (canvas_mcdu.myVertRev[me.computer] != nil) {
+ canvas_mcdu.myVertRev[me.computer].del();
+ }
+ canvas_mcdu.myVertRev[me.computer] = nil;
+
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
+ } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
+ notAllowed(me.computer);
+ return;
+ } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
+ } else {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
+ }
+ } else {
+ if (me.index == fmgc.flightPlanController.arrivalIndex[2]) {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
+ } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
+ notAllowed(me.computer);
+ return;
+ } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
+ } else {
+ canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
+ }
+ }
+ setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
+ },
+};
+
+var staticText = {
+ new: func(computer, text) {
+ var sT = {parents:[staticText]};
+ sT.computer = computer;
+ sT.text = text;
+ return sT;
+ },
+ updateLeftText: func() {
+ return [nil, nil, "ack"];
+ },
+ updateCenterText: func() {
+ return [me.text, nil, "wht"];
+ },
+ updateRightText: func() {
+ return [nil, nil, "ack"];
+ },
+ pushButtonLeft: func() {
+ notAllowed(me.computer);
+ },
+ pushButtonRight: func() {
+ notAllowed(me.computer);
+ },
+};
+
+var fplnPage = { # this one is only created once, and then updated - remember this
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ C1: [nil, nil, "ack"],
+ C2: [nil, nil, "ack"],
+ C3: [nil, nil, "ack"],
+ C4: [nil, nil, "ack"],
+ C5: [nil, nil, "ack"],
+ C6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+
+ # init conditions
+ # line 1 = FROM
+ # line 2 = TO
+ # line 6 = DEST
+ # neither pseudo nor markers may be FROM waypoint
+ # bearing between FROM and TO waypoints
+ # track between line 2 and line 3 waypoints
+ # name of LEG above TO waypoint - is airway identifier, or waypoint name
+
+ # DEST in LINE 6 time prediction, distance along flightplan, and EFOB
+ # dashes if no predictions
+ planList: [],
+ outputList: [],
+ scroll: 0,
+ temporaryFlagFpln: 0,
+ new: func(plan, computer) {
+ var fp = {parents:[fplnPage]};
+ fp.plan = fmgc.flightPlanController.flightplans[plan];
+ fp.planIndex = plan;
+ fp.computer = computer;
+ fp.planList = [];
+ fp.outputList = [];
+ return fp;
+ },
+ _setupPageWithData: func() {
+ me.destInfo();
+ me.createPlanList();
+ },
+ updatePlan: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.planIndex = 2;
+ me.plan = fmgc.flightPlanController.flightplans[2];
+ me.temporaryFlagFpln = 0;
+ } else {
+ me.planIndex = me.computer;
+ me.plan = fmgc.flightPlanController.flightplans[me.computer];
+ me.temporaryFlagFpln = 1;
+ }
+ me._setupPageWithData();
+ },
+ getText: func(type) {
+ if (type == "fplnEnd") {
+ return "------END OF F-PLN------";
+ } else if (type == "altnFplnEnd") {
+ return "----END OF ALTN F-PLN---";
+ } else if (type == "noAltnFpln") {
+ return "------NO ALTN F-PLN-----";
+ } else if (type == "empty") {
+ return "";
+ }
+ },
+ createPlanList: func() {
+ me.planList = [];
+ if (me.temporaryFlagFpln) {
+ for (var i = 0; i < me.plan.getPlanSize(); i += 1) {
+ append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.plan, me.computer, "yel"));
+ }
+ } else {
+ for (var i = 0; i < me.plan.getPlanSize(); i += 1) {
+ append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.plan, me.computer));
+ }
+ }
+ append(me.planList, staticText.new(me.computer, me.getText("fplnEnd")));
+ append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
+ me.basePage();
+ },
+ basePage: func() {
+ me.outputList = [];
+ for (var i = 0; i + me.scroll < size(me.planList); i += 1) {
+ append(me.outputList, me.planList[i + me.scroll] );
+ }
+ if (size(me.outputList) >= 1) {
+ me.L1 = me.outputList[0].updateLeftText();
+ me.C1 = me.outputList[0].updateCenterText();
+ me.C1[1] = "TIME ";
+ me.R1 = me.outputList[0].updateRightText();
+ me.R1[1] = "SPD/ALT ";
+ } else {
+ me.L1 = [nil, nil, "ack"];
+ me.C1 = [nil, nil, "ack"];
+ me.R1 = [nil, nil, "ack"];
+ }
+ if (size(me.outputList) >= 2) {
+ me.L2 = me.outputList[1].updateLeftText();
+ me.C2 = me.outputList[1].updateCenterText();
+ me.R2 = me.outputList[1].updateRightText();
+ } else {
+ me.L2 = [nil, nil, "ack"];
+ me.C2 = [nil, nil, "ack"];
+ me.R2 = [nil, nil, "ack"];
+ }
+ if (size(me.outputList) >= 3) {
+ me.L3 = me.outputList[2].updateLeftText();
+ me.C3 = me.outputList[2].updateCenterText();
+ me.R3 = me.outputList[2].updateRightText();
+ } else {
+ me.L3 = [nil, nil, "ack"];
+ me.C3 = [nil, nil, "ack"];
+ me.R3 = [nil, nil, "ack"];
+ }
+ if (size(me.outputList) >= 4) {
+ me.L4 = me.outputList[3].updateLeftText();
+ me.C4 = me.outputList[3].updateCenterText();
+ me.R4 = me.outputList[3].updateRightText();
+ } else {
+ me.L4 = [nil, nil, "ack"];
+ me.C4 = [nil, nil, "ack"];
+ me.R4 = [nil, nil, "ack"];
+ }
+ if (size(me.outputList) >= 5) {
+ me.L5 = me.outputList[4].updateLeftText();
+ me.C5 = me.outputList[4].updateCenterText();
+ me.R5 = me.outputList[4].updateRightText();
+ } else {
+ me.L5 = [nil, nil, "ack"];
+ me.C5 = [nil, nil, "ack"];
+ me.R5 = [nil, nil, "ack"];
+ }
+ },
+ destInfo: func() {
+ if (me.plan.getWP(fmgc.flightPlanController.arrivalIndex[me.planIndex]) != nil) {
+ me.L6 = [left(me.plan.getWP(fmgc.flightPlanController.arrivalIndex[me.planIndex]).wp_name, 4), " DEST", "wht"];
+ } else {
+ me.L6 = ["----", " DEST", "wht"];
+ }
+ if (fmgc.flightPlanController.arrivalDist != nil) {
+ me.C6 = ["---- " ~ int(fmgc.flightPlanController.arrivalDist), "TIME DIST", "wht"];
+ } else {
+ me.C6 = ["---- ----", "TIME DIST", "wht"];
+ }
+ me.R6 = ["--.-", "EFOB", "wht"];
+ },
+ update: func() {
+ #me.basePage();
+ },
+ scrollUp: func() {
+ if (size(me.planList) > 5) {
+ me.scroll += 1;
+ if (me.scroll > size(me.planList) - 5) {
+ me.scroll = 0;
+ }
+ } else {
+ me.scroll = 0;
+ }
+ },
+ scrollDn: func() {
+ if (size(me.planList) > 5) {
+ me.scroll -= 1;
+ if (me.scroll < 0) {
+ me.scroll = size(me.planList) - 5;
+ }
+ } else {
+ me.scroll = 0;
+ }
+ },
+ pushButtonLeft: func(index) {
+ if (index == 6) {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
+ } else {
+ if (canvas_mcdu.myLatRev[me.computer] != nil) {
+ canvas_mcdu.myLatRev[me.computer].del();
+ }
+ canvas_mcdu.myLatRev[me.computer] = nil;
+ canvas_mcdu.myLatRev[me.computer] = latRev.new(1, me.L6[0], fmgc.flightPlanController.arrivalIndex[me.computer], me.computer);
+ setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
+ }
+ } else {
+ if (size(me.outputList) >= index) {
+ if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) {
+ var returny = fmgc.flightPlanController.scratchpad(getprop("MCDU[" ~ me.computer ~ "]/scratchpad"), (index - 1 + me.scroll), me.computer);
+ if (returny == 3) {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ } elsif (returny == 0) {
+ notInDataBase(me.computer);
+ } elsif (returny == 1) {
+ notAllowed(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
+ }
+ } else {
+ me.outputList[index - 1].pushButtonLeft();
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ }
+ },
+ pushButtonRight: func(index) {
+ if (index == 6) {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (dirToFlag) { dirToFlag = 0; }
+ fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
+ } else {
+ notAllowed(me.computer);
+ }
+ } else {
+ if (size(me.outputList) >= index) {
+ if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) {
+ notAllowed(me.computer);
+ } else {
+ me.outputList[index - 1].pushButtonRight();
+ }
+ } else {
+ notAllowed(me.computer);
+ }
+ }
+ },
+};
+
+var notInDataBase = func(i) {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "NOT IN DATABASE");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ }
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT IN DATABASE");
+}
+
+var decimalToShortString = func(dms, type) {
+ var degrees = split(".", sprintf(dms))[0];
+ if (type == "lat") {
+ var sign = degrees >= 0 ? "N" : "S";
+ } else {
+ var sign = degrees >= 0 ? "E" : "W";
+ }
+ return abs(degrees) ~ sign;
+}
\ No newline at end of file
diff --git a/Nasal/MCDU/HOLD.nas b/Nasal/MCDU/HOLD.nas
new file mode 100644
index 00000000..1cc0306c
--- /dev/null
+++ b/Nasal/MCDU/HOLD.nas
@@ -0,0 +1,76 @@
+var holdPage = {
+ title: [nil, nil, nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ C1: [nil, nil, "ack"],
+ C2: [nil, nil, "ack"],
+ C3: [nil, nil, "ack"],
+ C4: [nil, nil, "ack"],
+ C5: [nil, nil, "ack"],
+ C6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ scroll: 0,
+ vector: [],
+ index: nil,
+ computer: nil,
+ new: func(computer, waypoint) {
+ var hp = {parents:[holdPage]};
+ hp.computer = computer;
+ hp.waypoint = waypoint;
+ hp.updateTmpy();
+ hp._setupPageWithData();
+ return hp;
+ },
+ del: func() {
+ return nil;
+ },
+ _setupPageWithData: func() {
+ # me.title = ["LAT REV", " AT ", me.waypoint.wp_name]; TODO FIXME LATREV
+ me.title = ["HOLD", " AT ", me.waypoint];
+ me.titleColour = "wht";
+ me.L1 = [" [ ]", " INB CRS", "blu"];
+ me.L2 = [" R", " TURN", "blu"];
+ if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) {
+ me.L2 = [" 1.5/----", "TIME/DIST", "blu"];
+ } else {
+ me.L2 = [" 1.0/----", "TIME/DIST", "blu"];
+ }
+ me.L6 = [" RETURN", nil, "wht"];
+ me.C4 = ["LAST EXIT", nil, "wht"];
+ me.C5 = ["---- ---.-", "UTC FUEL", "wht"];
+ me.R1 = ["COMPUTED ", nil, "blu"];
+ me.R2 = ["DATABASE ", nil, "blu"];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["blu", "blu", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ }
+ },
+ updateTmpy: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ me.R2[2] = "yel";
+ me.R3[2] = "yel";
+ me.R4[2] = "yel";
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ }
+ }
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas
index 5c0e4bf1..300e707b 100644
--- a/Nasal/MCDU/INITA.nas
+++ b/Nasal/MCDU/INITA.nas
@@ -70,12 +70,13 @@ var initInputA = func(key, i) {
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
- setprop("FMGC/internal/dep-arpt", "");
- setprop("FMGC/internal/arr-arpt", "");
- setprop("FMGC/internal/tofrom-set", 0);
- fmgc.updateARPT();
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
+ clearFPLNComputer();
+ setprop("/FMGC/internal/dep-arpt", "");
+ setprop("/FMGC/internal/arr-arpt", "");
+ setprop("/FMGC/internal/tofrom-set", 0);
+ fmgc.flightPlanController.reset();
+ setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 9 and find("/", scratchpad) != -1) {
@@ -83,11 +84,11 @@ var initInputA = func(key, i) {
var froms = size(fromto[0]);
var tos = size(fromto[1]);
if (froms == 4 and tos == 4) {
- setprop("FMGC/internal/dep-arpt", fromto[0]);
- setprop("FMGC/internal/arr-arpt", fromto[1]);
- setprop("FMGC/internal/tofrom-set", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
- fmgc.updateARPT();
+ setprop("/FMGC/internal/dep-arpt", fromto[0]);
+ setprop("/FMGC/internal/arr-arpt", fromto[1]);
+ setprop("/FMGC/internal/tofrom-set", 1);
+ setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
+ fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
} else {
notAllowed(i);
}
diff --git a/Nasal/MCDU/LATREV.nas b/Nasal/MCDU/LATREV.nas
new file mode 100644
index 00000000..6ecb9633
--- /dev/null
+++ b/Nasal/MCDU/LATREV.nas
@@ -0,0 +1,191 @@
+var latRev = {
+ title: [nil, nil, nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ depAirport: nil,
+ arrAirport: nil,
+ index: nil,
+ computer: nil,
+ new: func(type, id, index, computer) {
+ var lr = {parents:[latRev]};
+ lr.type = type; # 0 = origin 1 = destination 2 = ppos (from waypoint) 3 = generic wpt, 4 = discon
+ lr.id = id;
+ lr.index = index;
+ lr.computer = computer;
+ lr._setupPageWithData();
+ lr._checkTmpy();
+ return lr;
+ },
+ del: func() {
+ return nil;
+ },
+ _checkTmpy: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ me.R2[2] = "yel";
+ me.R3[2] = "yel";
+ me.R4[2] = "yel";
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ }
+ },
+ _setupPageWithData: func() {
+ if (me.type == 2) {
+ me.title = ["LAT REV", " FROM ", "PPOS"];
+ me.L2 = [" OFFSET", nil, "wht"];
+ me.L3 = [" HOLD", nil, "wht"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.R1 = ["FIX INFO ", nil, "wht"];
+ me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"];
+ me.arrowsMatrix = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "wht", "wht", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]];
+ } elsif (me.type == 4) {
+ me.title = ["LAT REV", " FROM ", "DISCON"];
+ me.R3 = ["[ ]", "NEXT WPT ", "blu"];
+ me.R4 = ["[ ]", "NEW DEST", "blu"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
+ } else {
+ me.title = ["LAT REV", " FROM ", me.id];
+
+ if (me.type == 0) {
+ if (size(me.id) > 4) {
+ me.depAirport = findAirportsByICAO(left(me.id, 4));
+ } else {
+ me.depAirport = findAirportsByICAO(me.id);
+ }
+ me.subtitle = [dmsToString(sprintf(me.depAirport[0].lat), "lat"), dmsToString(sprintf(me.depAirport[0].lon), "lon")];
+ me.L1 = [" DEPARTURE", nil, "wht"];
+ me.L2 = [" OFFSET", nil, "wht"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.R1 = ["FIX INFO ", nil, "wht"];
+ me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"];
+ me.R3 = ["[ ]", "NEXT WPT ", "blu"];
+ me.R4 = ["[ ]", "NEW DEST", "blu"];
+ me.arrowsMatrix = [[1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["wht", "wht", "ack", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0]];
+ } elsif (me.type == 1) {
+ if (size(me.id) > 4) {
+ me.arrAirport = findAirportsByICAO(left(me.id, 4));
+ } else {
+ me.arrAirport = findAirportsByICAO(me.id);
+ }
+ me.subtitle = [dmsToString(sprintf(me.arrAirport[0].lat), "lat"), dmsToString(sprintf(me.arrAirport[0].lon), "lon")];
+ me.L3 = [" ALTN", nil, "wht"];
+ me.L4 = [" ALTN", " ENABLE", "blu"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.R1 = ["ARRIVAL ", nil, "wht"];
+ me.R3 = ["[ ]", "NEXT WPT ", "blu"];
+ me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]];
+ me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
+ } elsif (me.type == 3) {
+ if (size(me.id) == 2 or size(me.id) == 3) {
+ me.wpt = findNavaidsByID(me.id);
+ } elsif (size(me.id) == 4) {
+ me.wpt = findAirportsByICAO(me.id);
+ } elsif (size(me.id) == 5) {
+ me.wpt = findFixesByID(me.id);
+ }
+ if (me.wpt[0] != nil) {
+ me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")];
+ }
+ me.L3 = [" HOLD", nil, "wht"];
+ me.L4 = [" ALTN", " ENABLE", "blu"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.R1 = ["FIX INFO ", nil, "wht"];
+ me.R3 = ["[ ]", "NEXT WPT ", "blu"];
+ me.R4 = ["[ ]", "NEW DEST", "blu"];
+ me.R5 = ["AIRWAYS ", nil, "wht"];
+ me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]];
+ me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
+ }
+ }
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (!dirToFlag) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ me._checkTmpy();
+ }
+ },
+ nextWpt: func() {
+ me.makeTmpy();
+
+ var returny = fmgc.flightPlanController.scratchpad(getprop("/MCDU[" ~ me.computer ~ "]/scratchpad"), me.index + 1, me.computer);
+ if (returny == 0) {
+ notInDataBase(me.computer);
+ } elsif (returny == 1) {
+ notAllowed(me.computer);
+ } else {
+ setprop("/MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
+ setprop("/MCDU[" ~ me.computer ~ "]/scratchpad", "");
+ fmgc.flightPlanController.flightPlanChanged(me.computer);
+ if (getprop("/MCDU[" ~ me.computer ~ "]/page") != "DUPLICATENAMES") {
+ setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
+ }
+ }
+ },
+};
+
+var dmsToString = func(dms, type) {
+ var degrees = int(dms);
+ var minutes = sprintf("%.1f",abs((dms - degrees) * 60));
+ if (type == "lat") {
+ var sign = degrees >= 0 ? "N" : "S";
+ } else {
+ var sign = degrees >= 0 ? "E" : "W";
+ }
+ return abs(degrees) ~ "g" ~ minutes ~ " " ~ sign;
+}
+
+
+var stringToDegrees = func(string, type) {
+ if (type == "lat") {
+ var degrees = left(string, 2);
+ var minutesStr = right(string, 5);
+ } else {
+ var degrees = left(string, 3);
+ var minutesStr = right(string, 5);
+ }
+
+ var minutes = left(minutesStr, 4);
+ var sign = right(minutesStr, 1);
+ var decimal = degrees + (minutes / 60);
+ if (type == "lat") {
+ if (sign == "N") {
+ return decimal;
+ } else {
+ return -decimal;
+ }
+ } else {
+ if (sign == "E") {
+ return decimal;
+ } else {
+ return -decimal;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas
index 1a9cc9b2..f507751c 100644
--- a/Nasal/MCDU/MCDU.nas
+++ b/Nasal/MCDU/MCDU.nas
@@ -3,580 +3,763 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var MCDU_init = func(i) {
- MCDU_reset(i); # Reset MCDU, clears data
+ MCDU_reset(i); # Reset MCDU, clears data
}
var MCDU_reset = func(i) {
- setprop("MCDU[" ~ i ~ "]/active", 0);
- setprop("it-autoflight/settings/togaspd", 157);
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/last-page", "NONE");
- setprop("MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
- setprop("MCDU[" ~ i ~ "]/page", "MCDU");
- setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- setprop("MCDUC/flight-num", "");
- setprop("MCDUC/thracc-set", 0);
- setprop("MCDUC/reducacc-set", 0);
- setprop("MCDUC/flight-num-set", 0);
- setprop("FMGC/internal/flex", 0);
- setprop("FMGC/internal/dep-arpt", "");
- setprop("FMGC/internal/arr-arpt", "");
- setprop("FMGC/internal/cruise-ft", 10000);
- setprop("FMGC/internal/cruise-fl", 100);
- setprop("FMGC/internal/cost-index", "0");
- setprop("FMGC/internal/trans-alt", 18000);
- setprop("FMGC/internal/reduc-agl-ft", "1500"); #eventually set to 1500 above runway
- setprop("FMGC/internal/eng-out-reduc", "1500");
- setprop("FMGC/internal/v1", 0);
- setprop("FMGC/internal/vr", 0);
- setprop("FMGC/internal/v2", 0);
- setprop("FMGC/internal/f-speed", 0);
- setprop("FMGC/internal/s-speed", 0);
- setprop("FMGC/internal/o-speed", 0);
- setprop("FMGC/internal/minspeed", 0);
- #setprop("FMGC/internal/vapp-speed", 0);
- setprop("FMGC/internal/vr", 0);
- setprop("FMGC/internal/v2", 0);
- setprop("FMGC/internal/block", 0.0);
- setprop("FMGC/internal/zfw", 0);
- setprop("FMGC/internal/zfwcg", 55.1); # 25KG default
- setprop("FMGC/internal/v1-set", 0);
- setprop("FMGC/internal/vr-set", 0);
- setprop("FMGC/internal/v2-set", 0);
- setprop("FMGC/internal/block-set", 0);
- setprop("FMGC/internal/zfw-set", 0);
- setprop("FMGC/internal/zfwcg-set", 0);
- setprop("FMGC/internal/to-flap", 0);
- setprop("FMGC/internal/to-ths", "0.0");
- setprop("FMGC/internal/tofrom-set", 0);
- setprop("FMGC/internal/cost-index-set", 0);
- setprop("FMGC/internal/cruise-lvl-set", 0);
- setprop("FMGC/internal/flap-ths-set", 0);
- setprop("FMGC/internal/flex-set", 0);
- setprop("FMGC/internal/ils1freq-set", 0);
- setprop("FMGC/internal/ils1crs-set", 0);
- setprop("FMGC/internal/vor1freq-set", 0);
- setprop("FMGC/internal/vor1crs-set", 0);
- setprop("FMGC/internal/vor2freq-set", 0);
- setprop("FMGC/internal/vor2crs-set", 0);
- setprop("FMGC/internal/adf1freq-set", 0);
- setprop("FMGC/internal/adf2freq-set", 0);
- setprop("FMGC/internal/navdatabase", "01JAN-28JAN");
- setprop("FMGC/internal/navdatabase2", "29JAN-26FEB");
- setprop("FMGC/internal/navdatabasecode", "AB20170101");
- setprop("FMGC/internal/navdatabasecode2", "AB20170102");
- setprop("FMGC/print/mcdu/page1/L1auto", 0);
- setprop("FMGC/print/mcdu/page1/L2auto", 0);
- setprop("FMGC/print/mcdu/page1/L3auto", 0);
- setprop("FMGC/print/mcdu/page1/R1req", 0);
- setprop("FMGC/print/mcdu/page1/R2req", 0);
- setprop("FMGC/print/mcdu/page1/R3req", 0);
- setprop("FMGC/print/mcdu/page2/L1auto", 0);
- setprop("FMGC/print/mcdu/page2/L2auto", 0);
- setprop("FMGC/print/mcdu/page2/L3auto", 0);
- setprop("FMGC/print/mcdu/page2/L4auto", 0);
- setprop("FMGC/print/mcdu/page2/R1req", 0);
- setprop("FMGC/print/mcdu/page2/R2req", 0);
- setprop("FMGC/print/mcdu/page2/R3req", 0);
- setprop("FMGC/print/mcdu/page2/R4req", 0);
- setprop("FMGC/internal/tropo", 36090);
- setprop("FMGC/internal/tropo-set", 0);
+ setprop("MCDU[" ~ i ~ "]/active", 0);
+ setprop("it-autoflight/settings/togaspd", 157);
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/last-page", "NONE");
+ setprop("MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
+ setprop("MCDU[" ~ i ~ "]/page", "MCDU");
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ setprop("MCDUC/flight-num", "");
+ setprop("MCDUC/thracc-set", 0);
+ setprop("MCDUC/reducacc-set", 0);
+ setprop("MCDUC/flight-num-set", 0);
+ setprop("FMGC/internal/flex", 0);
+ setprop("FMGC/internal/dep-arpt", "");
+ setprop("FMGC/internal/arr-arpt", "");
+ setprop("FMGC/internal/cruise-ft", 10000);
+ setprop("FMGC/internal/cruise-fl", 100);
+ setprop("FMGC/internal/cost-index", "0");
+ setprop("FMGC/internal/trans-alt", 18000);
+ setprop("FMGC/internal/reduc-agl-ft", "1500"); #eventually set to 1500 above runway
+ setprop("FMGC/internal/eng-out-reduc", "1500");
+ setprop("FMGC/internal/v1", 0);
+ setprop("FMGC/internal/vr", 0);
+ setprop("FMGC/internal/v2", 0);
+ setprop("FMGC/internal/f-speed", 0);
+ setprop("FMGC/internal/s-speed", 0);
+ setprop("FMGC/internal/o-speed", 0);
+ setprop("FMGC/internal/minspeed", 0);
+ #setprop("FMGC/internal/vapp-speed", 0);
+ setprop("FMGC/internal/vr", 0);
+ setprop("FMGC/internal/v2", 0);
+ setprop("FMGC/internal/block", 0.0);
+ setprop("FMGC/internal/zfw", 0);
+ setprop("FMGC/internal/zfwcg", 55.1); # 25KG default
+ setprop("FMGC/internal/v1-set", 0);
+ setprop("FMGC/internal/vr-set", 0);
+ setprop("FMGC/internal/v2-set", 0);
+ setprop("FMGC/internal/block-set", 0);
+ setprop("FMGC/internal/zfw-set", 0);
+ setprop("FMGC/internal/zfwcg-set", 0);
+ setprop("FMGC/internal/to-flap", 0);
+ setprop("FMGC/internal/to-ths", "0.0");
+ setprop("FMGC/internal/tofrom-set", 0);
+ setprop("FMGC/internal/cost-index-set", 0);
+ setprop("FMGC/internal/cruise-lvl-set", 0);
+ setprop("FMGC/internal/flap-ths-set", 0);
+ setprop("FMGC/internal/flex-set", 0);
+ setprop("FMGC/internal/ils1freq-set", 0);
+ setprop("FMGC/internal/ils1crs-set", 0);
+ setprop("FMGC/internal/vor1freq-set", 0);
+ setprop("FMGC/internal/vor1crs-set", 0);
+ setprop("FMGC/internal/vor2freq-set", 0);
+ setprop("FMGC/internal/vor2crs-set", 0);
+ setprop("FMGC/internal/adf1freq-set", 0);
+ setprop("FMGC/internal/adf2freq-set", 0);
+ setprop("FMGC/internal/navdatabase", "01JAN-28JAN");
+ setprop("FMGC/internal/navdatabase2", "29JAN-26FEB");
+ setprop("FMGC/internal/navdatabasecode", "AB20170101");
+ setprop("FMGC/internal/navdatabasecode2", "AB20170102");
+ setprop("FMGC/print/mcdu/page1/L1auto", 0);
+ setprop("FMGC/print/mcdu/page1/L2auto", 0);
+ setprop("FMGC/print/mcdu/page1/L3auto", 0);
+ setprop("FMGC/print/mcdu/page1/R1req", 0);
+ setprop("FMGC/print/mcdu/page1/R2req", 0);
+ setprop("FMGC/print/mcdu/page1/R3req", 0);
+ setprop("FMGC/print/mcdu/page2/L1auto", 0);
+ setprop("FMGC/print/mcdu/page2/L2auto", 0);
+ setprop("FMGC/print/mcdu/page2/L3auto", 0);
+ setprop("FMGC/print/mcdu/page2/L4auto", 0);
+ setprop("FMGC/print/mcdu/page2/R1req", 0);
+ setprop("FMGC/print/mcdu/page2/R2req", 0);
+ setprop("FMGC/print/mcdu/page2/R3req", 0);
+ setprop("FMGC/print/mcdu/page2/R4req", 0);
+ setprop("FMGC/internal/tropo", 36090);
+ setprop("FMGC/internal/tropo-set", 0);
}
var lskbutton = func(btn, i) {
- if (btn == "1") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "MCDU") {
- if (getprop("MCDU[" ~ i ~ "]/active") != 2) {
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "WAIT FOR SYSTEM RESPONSE");
- setprop("MCDU[" ~ i ~ "]/active", 1);
- settimer(func(){
- setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-fmgc-page"));
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- setprop("MCDU[" ~ i ~ "]/active", 2);
- }, 2);
- } else {
- setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-fmgc-page"));
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- }
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("L1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("L1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- dataInput("L1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("L1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L1",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "2") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- PerfInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
- initInputA("L5",i); # Does the same thing as on the INIT page
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
- initInputA("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
- initInputA("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- dataInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("L2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L2",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "3") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "STATUS") {
- statusInput("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("L3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L3",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "4") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- setprop("MCDU[" ~ i ~ "]/page", "STATUS");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("L4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("L4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L4",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "5") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
- perfCLBInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
- perfCRZInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
- perfDESInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
- perfGAInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("L5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L5",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "6") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
- perfCLBInput("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
- perfCRZInput("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
- perfDESInput("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
- perfGAInput("L6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("L6",i);
- } else {
- notAllowed(i);
- }
- }
-}
-
-var lskbutton_b = func(btn, i) {
- # Special Middle Click Functions
-}
-
-var rskbutton = func(btn, i) {
- if (btn == "1") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("R1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
- initInputB("R1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("R1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("R1",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("R1",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "2") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
- initInputB("R2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("R2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("R2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("R2",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("R2",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "3") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("R3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("R3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("R3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- printInput("R3",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("R3",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "4") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("R4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("R4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("R4",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- printInput2("R4",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "5") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("R5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
- perfGAInput("R5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
- radnavInput("R5",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- dataInput("R5",i);
- } else {
- notAllowed(i);
- }
- } else if (btn == "6") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "MCDU") {
- if (getprop("MCDU[" ~ i ~ "]/last-page") != "NONE") {
- setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-page"));
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ if (btn == "1") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "MCDU") {
+ if (getprop("MCDU[" ~ i ~ "]/active") != 2) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "WAIT FOR SYSTEM RESPONSE");
+ setprop("MCDU[" ~ i ~ "]/active", 1);
+ settimer(func(){
+ setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-fmgc-page"));
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ setprop("MCDU[" ~ i ~ "]/active", 2);
+ }, 2);
+ } else {
+ setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-fmgc-page"));
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ dataInput("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
+ if (canvas_mcdu.myLatRev[i].type == 0) {
+ if (canvas_mcdu.myDeparture[i] != nil) {
+ canvas_mcdu.myDeparture[i].del();
+ }
+ canvas_mcdu.myDeparture[i] = nil;
+ canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i);
+ setprop("MCDU[" ~ i ~ "]/page", "DEPARTURE");
} else {
notAllowed(i);
}
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
- perfTOInput("R6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
- perfCLBInput("R6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
- perfCRZInput("R6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
- perfDESInput("R6",i);
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
- perfAPPRInput("R6",i);
- } else if ((getprop("MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) {
- if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "AOC DISABLED") {
- if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
- } else {
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(1);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].fieldL1(getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ canvas_mcdu.myDuplicate[i].pushButtonLeft(1);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "2") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ PerfInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
+ initInputA("L5", i); # Does the same thing as on the INIT page
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
+ initInputA("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
+ initInputA("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ dataInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonLeft(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonLeft(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].leftFieldBtn(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ canvas_mcdu.myDuplicate[i].pushButtonLeft(2);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "3") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "STATUS") {
+ statusInput("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonLeft(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonLeft(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].leftFieldBtn(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
+ if (canvas_mcdu.myLatRev[i].type != 0 and canvas_mcdu.myLatRev[i].type != 1) {
+ if (canvas_mcdu.myHold[i] != nil) {
+ canvas_mcdu.myHold[i].del();
}
+ canvas_mcdu.myHold[i] = nil;
+ canvas_mcdu.myHold[i] = holdPage.new(i, canvas_mcdu.myLatRev[i].id);
+ setprop("MCDU[" ~ i ~ "]/page", "HOLD");
+ } else {
+ notAllowed(i);
}
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- initInputA("R6",i);
- } else {
- notAllowed(i);
- }
- }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "4") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ setprop("MCDU[" ~ i ~ "]/page", "STATUS");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("L4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("L4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonLeft(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonLeft(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].leftFieldBtn(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ canvas_mcdu.myDuplicate[i].pushButtonLeft(4);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "5") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
+ perfCLBInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
+ perfCRZInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
+ perfDESInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
+ perfGAInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonLeft(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonLeft(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].leftFieldBtn(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "6") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("L6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
+ perfCLBInput("L6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
+ perfCRZInput("L6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
+ perfDESInput("L6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("L6",i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
+ perfGAInput("L6",i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("L6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonLeft(6);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("MCDU[" ~ i ~ "]/page") == "VERTREV" or getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
+ setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE" or getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL" or getprop("MCDU[" ~ i ~ "]/page") == "HOLD") {
+ if (fmgc.flightPlanController.temporaryFlag[i]) {
+ setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/page", "LATREV");
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].fieldL6();
+ } else {
+ notAllowed(i);
+ }
+ }
+}
+
+var lskbutton_b = func(btn, i) {
+ # Special Middle Click Functions
+}
+
+var rskbutton = func(btn, i) {
+ if (btn == "1") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("R1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
+ initInputB("R1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("R1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("R1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("R1", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
+ if (canvas_mcdu.myLatRev[i].type == 1) {
+ if (canvas_mcdu.myArrival[i] != nil) {
+ canvas_mcdu.myArrival[i].del();
+ }
+ canvas_mcdu.myArrival[i] = nil;
+ canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i);
+ setprop("MCDU[" ~ i ~ "]/page", "ARRIVAL");
+ } else {
+ notAllowed(i);
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(1);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "2") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
+ initInputB("R2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("R2",i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("R2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("R2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("R2", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonRight(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonRight(2);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(2);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "3") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("R3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("R3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("R3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ printInput("R3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("R3", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonRight(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonRight(3);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
+ if (canvas_mcdu.myLatRev[i].type != 2) {
+ canvas_mcdu.myLatRev[i].nextWpt();
+ } else {
+ notAllowed(i);
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(3);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "4") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("R4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("R4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("R4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ printInput2("R4", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonRight(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonRight(4);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(4);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "5") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("R5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "GA") {
+ perfGAInput("R5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") {
+ radnavInput("R5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ dataInput("R5", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].depPushbuttonRight(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].arrPushbuttonRight(5);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(5);
+ } else {
+ notAllowed(i);
+ }
+ } else if (btn == "6") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "MCDU") {
+ if (getprop("MCDU[" ~ i ~ "]/last-page") != "NONE") {
+ setprop("MCDU[" ~ i ~ "]/page", getprop("MCDU[" ~ i ~ "]/last-page"));
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else {
+ notAllowed(i);
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") {
+ perfTOInput("R6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") {
+ perfCLBInput("R6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") {
+ perfCRZInput("R6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") {
+ perfDESInput("R6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "APPR") {
+ perfAPPRInput("R6", i);
+ } else if ((getprop("MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "AOC DISABLED") {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ }
+ }
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ initInputA("R6", i);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].pushButtonRight(6);
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "VERTREV") {
+ setprop("MCDU/[" ~ i ~ "]/page", "F-PLNA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].fieldR6();
+ } else {
+ notAllowed(i);
+ }
+ }
}
var rskbutton_b = func(btn, i) {
- # Special Middle Click Functions
+ # Special Middle Click Functions
}
var arrowbutton = func(btn, i) {
- if (btn == "left") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- setprop("MCDU[" ~ i ~ "]/page", "DATA2");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
- setprop("MCDU[" ~ i ~ "]/page", "DATA");
- }
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
- setprop("MCDU[" ~ i ~ "]/page", "INITB");
- }
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
- setprop("MCDU[" ~ i ~ "]/page", "INITA");
- }
- if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
- }
- } else if (btn == "right") {
- if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
- setprop("MCDU[" ~ i ~ "]/page", "DATA2");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
- setprop("MCDU[" ~ i ~ "]/page", "DATA");
- }
- if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
- if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
- setprop("MCDU[" ~ i ~ "]/page", "INITB");
- }
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
- setprop("MCDU[" ~ i ~ "]/page", "INITA");
- }
- if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
- setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
- } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
- setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
- }
- } else if (btn == "up") {
- # Nothing for now
- } else if (btn == "down") {
- # Nothing for now
- }
+ if (btn == "left") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ setprop("MCDU[" ~ i ~ "]/page", "DATA2");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
+ setprop("MCDU[" ~ i ~ "]/page", "DATA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") != 3) {
+ setprop("MCDU[" ~ i ~ "]/page", "INITB");
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
+ setprop("MCDU[" ~ i ~ "]/page", "INITA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].scrollLeft();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].scrollLeft();
+ }
+ } else if (btn == "right") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
+ setprop("MCDU[" ~ i ~ "]/page", "DATA2");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
+ setprop("MCDU[" ~ i ~ "]/page", "DATA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
+ if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") != 3) {
+ setprop("MCDU[" ~ i ~ "]/page", "INITB");
+ }
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
+ setprop("MCDU[" ~ i ~ "]/page", "INITA");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
+ setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
+ setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].scrollRight();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].scrollRight();
+ }
+ } else if (btn == "up") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].scrollUp();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].scrollUp();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].scrollUp();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].scrollUp();
+ }
+ } else if (btn == "down") {
+ if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
+ canvas_mcdu.myFpln[i].scrollDn();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
+ canvas_mcdu.myDeparture[i].scrollDn();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
+ canvas_mcdu.myArrival[i].scrollDn();
+ } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
+ canvas_mcdu.myDirTo[i].scrollDn();
+ }
+ }
}
var pagebutton = func(btn, i) {
- if (getprop("MCDU[" ~ i ~ "]/page") != "MCDU") {
- if (btn == "radnav") {
- setprop("MCDU[" ~ i ~ "]/page", "RADNAV");
- } else if (btn == "perf") {
- if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) {
- setprop("MCDU[" ~ i ~ "]/page", "TO");
- } else if (getprop("FMGC/status/phase") == 2) {
- setprop("MCDU[" ~ i ~ "]/page", "CLB");
- } else if (getprop("FMGC/status/phase") == 3) {
- setprop("MCDU[" ~ i ~ "]/page", "CRZ");
- } else if (getprop("FMGC/status/phase") == 4) {
- setprop("MCDU[" ~ i ~ "]/page", "DES");
- } else if (getprop("FMGC/status/phase") == 5) {
- setprop("MCDU[" ~ i ~ "]/page", "APPR");
- } else if (getprop("FMGC/status/phase") == 6) {
- setprop("MCDU[" ~ i ~ "]/page", "GA");
- }
- } else if (btn == "init") {
- setprop("MCDU[" ~ i ~ "]/page", "INITA");
- } else if (btn == "data") {
- setprop("MCDU[" ~ i ~ "]/page", "DATA");
- } else if (btn == "mcdu") {
- setprop("MCDU[" ~ i ~ "]/last-page", getprop("MCDU[" ~ i ~ "]/page"));
- setprop("MCDU[" ~ i ~ "]/last-fmgc-page", getprop("MCDU[" ~ i ~ "]/page"));
- setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
- setprop("MCDU[" ~ i ~ "]/page", "MCDU");
- } else if (btn == "f-pln") {
- setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
- } else if (btn == "fuel-pred") {
- setprop("MCDU[" ~ i ~ "]/page", "FUELPRED");
- }
- }
+ if (getprop("MCDU[" ~ i ~ "]/page") != "MCDU") {
+ if (btn == "radnav") {
+ setprop("MCDU[" ~ i ~ "]/page", "RADNAV");
+ } else if (btn == "perf") {
+ if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) {
+ setprop("MCDU[" ~ i ~ "]/page", "TO");
+ } else if (getprop("FMGC/status/phase") == 2) {
+ setprop("MCDU[" ~ i ~ "]/page", "CLB");
+ } else if (getprop("FMGC/status/phase") == 3) {
+ setprop("MCDU[" ~ i ~ "]/page", "CRZ");
+ } else if (getprop("FMGC/status/phase") == 4) {
+ setprop("MCDU[" ~ i ~ "]/page", "DES");
+ } else if (getprop("FMGC/status/phase") == 5) {
+ setprop("MCDU[" ~ i ~ "]/page", "APPR");
+ } else if (getprop("FMGC/status/phase") == 6) {
+ setprop("MCDU[" ~ i ~ "]/page", "GA");
+ }
+ } else if (btn == "init") {
+ setprop("MCDU[" ~ i ~ "]/page", "INITA");
+ } else if (btn == "data") {
+ setprop("MCDU[" ~ i ~ "]/page", "DATA");
+ } else if (btn == "mcdu") {
+ setprop("MCDU[" ~ i ~ "]/last-page", getprop("MCDU[" ~ i ~ "]/page"));
+ setprop("MCDU[" ~ i ~ "]/last-fmgc-page", getprop("MCDU[" ~ i ~ "]/page"));
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
+ setprop("MCDU[" ~ i ~ "]/page", "MCDU");
+ } else if (btn == "f-pln") {
+ if (fmgc.flightPlanController.active.getBoolValue()) {
+ if (canvas_mcdu.myFpln[i] == nil) {
+ canvas_mcdu.myFpln[i] = fplnPage.new(2, i);
+ }
+ setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
+ }
+ } else if (btn == "fuel-pred") {
+ setprop("MCDU[" ~ i ~ "]/page", "FUELPRED");
+ } else if (btn == "dirto") {
+ if (fmgc.flightPlanController.active.getBoolValue()) {
+ if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
+ return;
+ } elsif (canvas_mcdu.myDirTo[i] == nil) {
+ canvas_mcdu.myDirTo[i] = dirTo.new(i);
+ }
+ setprop("MCDU[" ~ i ~ "]/page", "DIRTO");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
+ }
+ }
+ }
}
var button = func(btn, i) {
- if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 0 and getprop("MCDU[" ~ i ~ "]/page") != "MCDU") {
- var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
- if (btn == "A") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "A");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "B") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "B");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "C") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "C");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "D") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "D");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "E") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "E");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "F") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "F");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "G") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "G");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "H") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "H");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "I") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "I");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "J") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "J");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "K") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "K");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "L") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "L");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "M") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "M");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "N") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "N");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "O") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "O");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "P") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "P");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "Q") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Q");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "R") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "R");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "S") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "S");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "T") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "T");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "U") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "U");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "V") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "V");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "W") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "W");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "X") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "X");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "Y") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Y");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "Z") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Z");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "SLASH") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "/");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "SP") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ " ");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "CLR") {
- var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
- if (size(scratchpad) == 0) {
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "CLR");
- } else if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
- setprop("MCDU[" ~ i ~ "]/scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (size(scratchpad) > 0) {
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad", left(scratchpad, size(scratchpad) - 1));
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- }
- } else if (btn == "0") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "0");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "1") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "1");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "2") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "2");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "3") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "3");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "4") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "4");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "5") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "5");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "6") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "6");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "7") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "7");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "8") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "8");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "9") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "9");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "DOT") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ ".");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- } else if (btn == "PLUSMINUS") {
- setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "-");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- }
- } else {
- if (btn == "CLR") {
- var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
- if (size(scratchpad) == 0) {
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "CLR");
- } else if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
- setprop("MCDU[" ~ i ~ "]/scratchpad", getprop("MCDU[" ~ i ~ "]/last-scratchpad"));
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
- }
- }
- }
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 0 and getprop("MCDU[" ~ i ~ "]/page") != "MCDU") {
+ var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
+ if (btn == "A") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "A");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "B") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "B");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "C") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "C");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "D") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "D");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "E") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "E");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "F") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "F");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "G") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "G");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "H") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "H");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "I") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "I");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "J") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "J");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "K") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "K");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "L") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "L");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "M") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "M");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "N") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "N");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "O") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "O");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "P") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "P");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "Q") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Q");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "R") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "R");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "S") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "S");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "T") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "T");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "U") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "U");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "V") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "V");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "W") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "W");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "X") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "X");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "Y") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Y");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "Z") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "Z");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "SLASH") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "/");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "SP") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ " ");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "CLR") {
+ var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
+ if (size(scratchpad) == 0) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "CLR");
+ } else if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (size(scratchpad) > 0) {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad", left(scratchpad, size(scratchpad) - 1));
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ }
+ } else if (btn == "0") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "0");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "1") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "1");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "2") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "2");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "3") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "3");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "4") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "4");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "5") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "5");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "6") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "6");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "7") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "7");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "8") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "8");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "9") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "9");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "DOT") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ ".");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ } else if (btn == "PLUSMINUS") {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "-");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ }
+ } else {
+ if (btn == "CLR") {
+ var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
+ if (size(scratchpad) == 0) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "CLR");
+ } else if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/scratchpad", getprop("MCDU[" ~ i ~ "]/last-scratchpad"));
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
+ }
+ }
+ }
}
var notAllowed = func(i) {
- if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "NOT ALLOWED") {
- if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
- } else {
- setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
- }
- }
- setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
- setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT ALLOWED");
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "NOT ALLOWED") {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ }
+ }
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT ALLOWED");
+}
+
+var formatError = func(i) {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "FORMAT ERROR") {
+ if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
+ } else {
+ setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
+ }
+ }
+ setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ i ~ "]/scratchpad", "FORMAT ERROR");
}
var screenFlash = func(time, i) {
- var page = getprop("MCDU[" ~ i ~ "]/page");
- setprop("MCDU[" ~ i ~ "]/page", "NONE");
- settimer(func {
- setprop("MCDU[" ~ i ~ "]/page", page);
- }, time);
+ var page = getprop("MCDU[" ~ i ~ "]/page");
+ setprop("MCDU[" ~ i ~ "]/page", "NONE");
+ settimer(func {
+ setprop("MCDU[" ~ i ~ "]/page", page);
+ }, time);
}
diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas
new file mode 100644
index 00000000..1dd68b85
--- /dev/null
+++ b/Nasal/MCDU/VERTREV.nas
@@ -0,0 +1,110 @@
+var vertRev = {
+ title: [nil, nil, nil],
+ subtitle: [nil, nil],
+ fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
+ arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
+ L1: [nil, nil, "ack"], # content, title, colour
+ L2: [nil, nil, "ack"],
+ L3: [nil, nil, "ack"],
+ L4: [nil, nil, "ack"],
+ L5: [nil, nil, "ack"],
+ L6: [nil, nil, "ack"],
+ R1: [nil, nil, "ack"],
+ R2: [nil, nil, "ack"],
+ R3: [nil, nil, "ack"],
+ R4: [nil, nil, "ack"],
+ R5: [nil, nil, "ack"],
+ R6: [nil, nil, "ack"],
+ depAirport: nil,
+ arrAirport: nil,
+ index: nil,
+ computer: nil,
+ new: func(type, id, index, computer) {
+ var vr = {parents:[vertRev]};
+ vr.type = type; # 0 = origin 1 = destination 2 = wpt not ppos 3 = ppos 4 = cruise wpt 5 = climb wpt (3 + 4 not needed yet)
+ vr.id = id;
+ vr.index = index;
+ vr.computer = computer;
+ vr._setupPageWithData();
+ vr._checkTmpy();
+ return vr;
+ },
+ del: func() {
+ return nil;
+ },
+ _checkTmpy: func() {
+ if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ me.L6 = [" F-PLN", " TMPY", "yel"];
+ me.arrowsColour[0][5] = "yel";
+ canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+ }
+ },
+ _setupPageWithData: func() {
+ if (me.type == 3) {
+ me.title = ["VERT REV", " AT ", "PPOS"];
+ me.L1 = ["", " EFOB ---.-", "wht"];
+ me.R1 = ["", "EXTRA ---.- ", "wht"];
+ me.L2 = [" 250/10000", " CLB SPD LIM", "mag"];
+ me.L4 = [" CONSTANT MACH", nil, "wht"];
+ me.L5 = [" WIND DATA", nil, "wht"];
+ me.L6 = [" RETURN", nil, "wht"];
+ me.R5 = ["STEP ALTS ", nil, "wht"];
+ me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
+ me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
+ me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
+ } if (me.type == 2) {
+ me.title = ["VERT REV", " AT ", me.id];
+ me.L1 = ["", " EFOB ---.-", "wht"];
+ me.R1 = ["", "EXTRA ---.- ", "wht"];
+ me.L2 = [" 250/10000", " CLB SPD LIM", "mag"];
+ me.L3 = [" [ ]", " SPD CSTR", "blu"];
+ me.L4 = [" CONSTANT MACH", nil, "wht"];
+ me.L5 = [" WIND DATA", nil, "wht"];
+ me.L6 = [" CLB", nil, "wht"];
+ me.R2 = ["[ ] ", "UTC CSTR ", "blu"];
+ me.R3 = ["[ ] ", "ALT CSTR ", "blu"];
+ me.R5 = ["STEP ALTS ", nil, "wht"];
+ me.R6 = ["DES ", nil, "wht"];
+ me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
+ me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
+ me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0]];
+ } else {
+ me.title = ["VERT REV", " AT ", me.id];
+
+ if (me.type == 0) {
+ # dunno
+ } elsif (me.type == 1) {
+ if (size(me.id) > 4) {
+ me.arrAirport = findAirportsByICAO(left(me.id, 4));
+ } else {
+ me.arrAirport = findAirportsByICAO(me.id);
+ }
+ me.L1 = ["", " EFOB ---.-", "wht"];
+ me.R1 = ["", "EXTRA ---.- ", "wht"];
+ me.L2 = [" 250/10000", " DES SPD LIM", "mag"];
+ me.L4 = [" CONSTANT MACH", nil, "wht"];
+ me.L5 = [" WIND DATA", nil, "wht"];
+ me.L6 = [" CLB", nil, "wht"];
+ me.R2 = ["[ ] ", "UTC CSTR ", "blu"];
+ me.R3 = ["[ ]", "G/S INTCPT ", "grn"];
+ me.R5 = ["STEP ALTS ", nil, "wht"];
+ me.R6 = ["DES ", nil, "wht"];
+ me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
+ me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
+ me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0]];
+ }
+ }
+ },
+ makeTmpy: func() {
+ if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+ if (!dirToFlag) {
+ fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+ } else {
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
+ setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
+ }
+ me._checkTmpy();
+ }
+ },
+};
\ No newline at end of file
diff --git a/Nasal/Sim/libraries.nas b/Nasal/Sim/libraries.nas
index 251f2ff0..23efdbfb 100644
--- a/Nasal/Sim/libraries.nas
+++ b/Nasal/Sim/libraries.nas
@@ -205,6 +205,7 @@ var systemsInit = func {
systems.eng_init();
systems.fire_init();
systems.autobrake_init();
+ fmgc.flightPlanController.reset();
fadec.FADEC.init();
fmgc.ITAF.init();
fmgc.FMGCinit();
@@ -226,6 +227,7 @@ var systemsInit = func {
setlistener("/sim/signals/fdm-initialized", func {
systemsInit();
+ fmgc.flightPlanTimer.start();
});
var systemsLoop = maketimer(0.1, func {
diff --git a/Nasal/Sim/property-tree-setup.nas b/Nasal/Sim/property-tree-setup.nas
index 99a8f83a..ad907609 100644
--- a/Nasal/Sim/property-tree-setup.nas
+++ b/Nasal/Sim/property-tree-setup.nas
@@ -73,6 +73,9 @@ var Instrumentation = {
AirspeedIndicator: {
indicatedSpdKt: props.globals.getNode("instrumentation/airspeed-indicator/indicated-speed-kt"),
},
+ Altimeter: {
+ indicatedFt: props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft"),
+ },
TCAS: {
Inputs: {
mode: props.globals.getNode("instrumentation/tcas/inputs/mode"),
diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml
index 9fba3c19..35dac06a 100644
--- a/Sounds/A320-common-sound.xml
+++ b/Sounds/A320-common-sound.xml
@@ -1557,9 +1557,11 @@
once
avionics
- /sim/current-view/internal
/sim/sound/warnings/chime
+
+ /sim/current-view/internal
+
10
100
diff --git a/Systems/fmgc-drivers.xml b/Systems/fmgc-drivers.xml
index 16346fac..97a13834 100644
--- a/Systems/fmgc-drivers.xml
+++ b/Systems/fmgc-drivers.xml
@@ -449,7 +449,7 @@
- /autopilot/route-manager/wp[0]/true-bearing-deg
+ /FMGC/flightplan[2]/current-leg-course
/it-autoflight/internal/drift-angle-deg
-1.0
diff --git a/gui/dialogs/mcdu1-dlg.xml b/gui/dialogs/mcdu1-dlg.xml
index 545235b3..82a9cfc3 100644
--- a/gui/dialogs/mcdu1-dlg.xml
+++ b/gui/dialogs/mcdu1-dlg.xml
@@ -292,6 +292,16 @@
25
40
+
+ nasal
+
+
+
+ systems/electrical/bus/ac-1
+ 110
+
+
+