diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 845e3f98..9cedc744 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3603,7 +3603,6 @@ var canvas_MCDU_base = { 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(); @@ -3630,6 +3629,12 @@ var canvas_MCDU_base = { me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + if (myArrival[i].arrowsMatrix[0][1]) { + me["Simple_L2_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/r"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/g"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/b")); + me["Simple_L2_Arrow"].show(); + } else { + me["Simple_L2_Arrow"].hide(); + } if (myArrival[i] != nil) { me["Simple_Title"].setText(sprintf("%s", myArrival[i].title[0] ~ myArrival[i].title[1] ~ myArrival[i].title[2])); @@ -3641,6 +3646,7 @@ var canvas_MCDU_base = { var sign = "R"; } forindex (var item; myArrival[i].arrowsMatrix[matrixArrow]) { + if (item == 1) { continue; } 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; diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 93ce84e7..64266b01 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -38,12 +38,13 @@ var arrivalPage = { computer: nil, enableScrollApproach: 0, enableScrollStars: 0, + enableScrollVias: 0, scrollApproach: 0, scrollStars: 0, activePage: 0, # runways, stars, vias hasPressNoTrans: 0, # temporary _approaches: nil, - _vias; nil, + _vias: nil, _stars: nil, _transitions: nil, new: func(icao, computer) { @@ -66,6 +67,9 @@ var arrivalPage = { 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].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + } } if (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; @@ -77,8 +81,14 @@ var arrivalPage = { } else { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; + if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans; + } } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; + if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + } } if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star; @@ -113,8 +123,10 @@ var arrivalPage = { } else { me.updateSTARs(); } + me.checkPageType(); me.updateActiveApproach(); + me.updateActiveVIAs(); me.updateActiveSTARs(); me.updateActiveTransitions(); }, @@ -153,13 +165,13 @@ var arrivalPage = { } elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"]; } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } } else { if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } } } elsif (me.selectedApproach != nil) { @@ -169,41 +181,41 @@ var arrivalPage = { } elsif (fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) { me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; } else { - me.L1 = ["---", " APPR", "wht"]; + 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"]; + me.L1 = ["-----", " APPR", "wht"]; } } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveSTARs: func() { if (me.selectedSTAR == "NO STAR") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.C1 = ["NONE", "STAR", "grn"]; + me.R1 = ["NONE", "STAR ", "grn"]; } else { - me.C1 = ["NONE", "STAR", "yel"]; + me.R1 = ["NONE", "STAR ", "yel"]; } } elsif (me.selectedSTAR != nil) { if (fmgc.flightPlanController.flightplans[2].star != nil) { if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR", "yel"]; + me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; } elsif (fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) { - me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR", "grn"]; + me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "grn"]; } else { - me.C1 = ["------- ", "STAR", "wht"]; + me.R1 = ["-------", "STAR ", "wht"]; } - } elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR", "yel"]; + } elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) { + me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; } else { - me.C1 = ["------- ", "STAR", "wht"]; + me.R1 = ["-------", "STAR ", "wht"]; } } else { - me.C1 = ["------- ", "STAR", "wht"]; + me.R1 = ["-------", "STAR ", "wht"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, @@ -212,25 +224,25 @@ var arrivalPage = { if (me.selectedTransition != nil) { if (fmgc.flightPlanController.flightplans[2].star_trans != nil) { if (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) { - me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"]; + me.R2 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS ", "yel"]; } elsif (fmgc.flightPlanController.flightplans[2].star_trans.id == me.selectedTransition.id) { - me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"]; + me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "grn"]; } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "STAR", "yel"]; + me.R2 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS ", "yel"]; } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } else { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.R1 = ["NONE", "TRANS ", "grn"]; + me.R2 = ["NONE", "TRANS ", "grn"]; } else { - me.R1 = ["NONE", "TRANS ", "yel"]; + me.R2 = ["NONE", "TRANS ", "yel"]; } } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); @@ -369,18 +381,8 @@ var arrivalPage = { } if (size(me.stars) >= 1) { - me.L2 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"]; + me.L3 = [" " ~ 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 { @@ -388,9 +390,9 @@ var arrivalPage = { 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) { + if (size(me.stars) >= 2) { + me.L4 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"]; + if (me.stars[1 + me.scrollStars] != me.selectedSTAR) { me.arrowsMatrix[0][3] = 1; me.arrowsColour[0][3] = "blu"; } else { @@ -398,9 +400,9 @@ var arrivalPage = { 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) { + if (size(me.stars) >= 3) { + me.L5 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"]; + if (me.stars[2 + me.scrollStars] != me.selectedSTAR) { me.arrowsMatrix[0][4] = 1; me.arrowsColour[0][4] = "blu"; } else { @@ -409,27 +411,47 @@ var arrivalPage = { } } - me.C2 = [nil, "AVAILABLE", "wht"]; - me.R2 = [nil, "TRANS ", "wht"]; + me.C3[1] = "AVAILABLE"; + me.R3[1] = "TRANS "; - if (size(me.stars) > 4) { + if (size(me.stars) > 3) { me.enableScrollStars = 1; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveVIAs: func() { - + if (me.selectedVIA == "NO VIA") { + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + me.C1 = ["NONE", "VIA", "grn"]; + } else { + me.C1 = ["NONE", "VIA", "yel"]; + } + } elsif (me.selectedVIA != nil) { + if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { + if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { + me.C1 = [fmgc.flightPlanController.flightplans[me.computer].approach_trans.id, "VIA", "yel"]; + } elsif (fmgc.flightPlanController.flightplans[2].approach_trans.id == me.selectedVIA.id) { + me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "grn"]; + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + } elsif (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { + me.C1 = [fmgc.flightPlanController.flightplans[me.computer].approach_trans.id, "VIA", "yel"]; + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateVIAs: func() { #placeholder }, 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.R3 = [nil, nil, "wht"]; + me.R4 = [nil, nil, "wht"]; + me.R5 = [nil, nil, "wht"]; me.arrowsMatrix[1][2] = 0; me.arrowsColour[1][2] = "ack"; me.arrowsMatrix[1][3] = 0; @@ -442,62 +464,52 @@ var arrivalPage = { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } if (me.selectedSTAR == nil) { - me.R2 = ["NO TRANS ", "TRANS", "blu"]; + me.R3 = ["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; - } - if (me.selectedSTAR == "NO STAR") { - - 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) { + return; + } + if (me.selectedSTAR == "NO STAR") { + 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.R3 = ["NO TRANS ", "TRANS", "blu"]; + if (!me.hasPressNoTrans) { + 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) >= 1) { + me.R3 = [me.transitions[0] ~ " ", "TRANS", "blu"]; + if (me.transitions[0] != 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) >= 2) { + me.R4 = [me.transitions[1] ~ " ", nil, "blu"]; + if (me.transitions[1] != 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) { + } elsif (size(me.transitions) >= 3) { + me.R5 = [me.transitions[2] ~ " ", nil, "blu"]; + if (me.transitions[2] != me.selectedTransition) { me.arrowsMatrix[1][4] = 1; me.arrowsColour[1][4] = "blu"; } else { @@ -505,6 +517,8 @@ var arrivalPage = { me.arrowsColour[1][4] = "ack"; } } + + # no indication it is scrollable... }, makeTmpy: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -518,6 +532,17 @@ var arrivalPage = { } } }, + checkPageType: func() { + if (me.activePage == 0) { + me.L2 = [nil, nil, "wht"]; + me.arrowsMatrix[0][1] = 0; + me.arrowsColour[0][1] = "wht"; + } else { + me.L2 = [" VIAS", " APPR", "wht"]; + me.arrowsMatrix[0][1] = 1; + me.arrowsColour[0][1] = "wht"; + } + }, scrollUp: func() { if (me.activePage == 0) { if (me.enableScrollApproach) { @@ -587,16 +612,18 @@ var arrivalPage = { scrollLeft: func() { if (me.activePage == 2) { return; } me.activePage = !me.activePage; + me.checkPageType(); me.updatePage(); }, scrollRight: func() { if (me.activePage == 2) { return; } me.activePage = !me.activePage; + me.checkPageType(); me.updatePage(); }, arrPushbuttonLeft: func(index) { if (me.activePage == 0) { - if (size(me.approaches) >= (index - 2) and index != 2) { + if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedSTAR = nil; me.hasPressNoTrans = 0; @@ -617,6 +644,7 @@ var arrivalPage = { me.updateApproaches(); fmgc.flightPlanController.flightPlanChanged(me.computer); me.scrollRight(); + me.checkPageType(); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } @@ -624,9 +652,9 @@ var arrivalPage = { mcdu_message(me.computer, "NOT ALLOWED"); } } elsif (me.activePage == 1) { - if (size(me.stars) >= (index - 2)) { + if (size(me.stars) >= (index - 2) and index != 2) { if (!dirToFlag) { - me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; + me.selectedSTAR = me.stars[index - 3 + me.scrollStars]; me.makeTmpy(); if (me.selectedSTAR != "NO STAR") { isNoStar[me.computer] = 0; @@ -655,7 +683,7 @@ var arrivalPage = { mcdu_message(me.computer, "NOT ALLOWED"); } } else { - if (size(me.vias) >= (index - 2)) { + if (size(me.vias) >= (index - 1)) { # different!! if (!dirToFlag) { my.selectedVIA = me.vias[index - 2 + me.scrollVias]; me.makeTmpy(); @@ -678,7 +706,7 @@ var arrivalPage = { } }, arrPushbuttonRight: func(index) { - if (index == 2 and size(me.transitions) == 0) { + if (index == 3 and size(me.transitions) == 0) { if (!dirToFlag) { me.hasPressNoTrans = 1; me.updateActiveTransitions(); @@ -686,9 +714,9 @@ var arrivalPage = { } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } - } elsif (size(me.transitions) >= (index - 1)) { + } elsif (size(me.transitions) >= (index - 2)) { if (!dirToFlag) { - me.selectedTransition = me.transitions[index - 2]; + me.selectedTransition = me.transitions[index - 3]; me.makeTmpy(); fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; me.updateActiveTransitions();