Enable text entry on crz/des pages
This commit is contained in:
parent
b7f153a601
commit
e05289b324
3 changed files with 146 additions and 20 deletions
|
@ -209,6 +209,10 @@ var lskbutton = func(btn, i) {
|
|||
initInputB("L1",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
canvas_mcdu.myCLBWIND[i].pushButtonLeft(1);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonLeft(1);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
canvas_mcdu.myDESWIND[i].pushButtonLeft(1);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") {
|
||||
progTOInput("L1",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") {
|
||||
|
@ -254,6 +258,10 @@ var lskbutton = func(btn, i) {
|
|||
initInputA("L2",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
canvas_mcdu.myCLBWIND[i].pushButtonLeft(2);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonLeft(2);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
canvas_mcdu.myDESWIND[i].pushButtonLeft(2);
|
||||
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") {
|
||||
perfTOInput("L2",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
|
||||
|
@ -294,6 +302,10 @@ var lskbutton = func(btn, i) {
|
|||
fuelPredInput("L3",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
canvas_mcdu.myCLBWIND[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
canvas_mcdu.myDESWIND[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
|
||||
perfTOInput("L3",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
|
||||
|
@ -339,6 +351,10 @@ var lskbutton = func(btn, i) {
|
|||
fuelPredInput("L4",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
canvas_mcdu.myCLBWIND[i].pushButtonLeft(4);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonLeft(4);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
canvas_mcdu.myDESWIND[i].pushButtonLeft(4);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
|
||||
perfTOInput("L4",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
|
||||
|
@ -369,6 +385,10 @@ var lskbutton = func(btn, i) {
|
|||
fuelPredInput("L5",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
canvas_mcdu.myCLBWIND[i].pushButtonLeft(5);
|
||||
# } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
# canvas_mcdu.myCRZWIND[i].pushButtonLeft(5);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
canvas_mcdu.myDESWIND[i].pushButtonLeft(5);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
|
||||
perfTOInput("L5",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {
|
||||
|
|
|
@ -30,7 +30,7 @@ var windCRZPage = {
|
|||
#index: nil,
|
||||
computer: nil,
|
||||
cur_location: 0,
|
||||
windList: [],
|
||||
windList: [nil],
|
||||
singleCRZ: 0,
|
||||
new: func(computer, waypoint, cur_location) {
|
||||
var wcp = {parents:[windCRZPage]};
|
||||
|
@ -55,27 +55,54 @@ var windCRZPage = {
|
|||
me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
|
||||
}
|
||||
me.titleColour = "wht";
|
||||
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]];
|
||||
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
|
||||
|
||||
if (size(me.windList) >= 4) {
|
||||
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[3] != nil) {
|
||||
me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"];
|
||||
me.fontMatrix[0][3] = 0;
|
||||
} else {
|
||||
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][3] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 3) {
|
||||
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[2] != nil) {
|
||||
me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"];
|
||||
me.fontMatrix[0][2] = 0;
|
||||
} else {
|
||||
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][2] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 2) {
|
||||
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[1] != nil) {
|
||||
me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"];
|
||||
me.fontMatrix[0][1] = 0;
|
||||
} else {
|
||||
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][1] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 1) {
|
||||
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
|
||||
if (me.windList[0] != nil) {
|
||||
me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"];
|
||||
me.fontMatrix[0][0] = 0;
|
||||
} else {
|
||||
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
|
||||
me.fontMatrix[0][0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"];
|
||||
|
@ -83,9 +110,6 @@ var windCRZPage = {
|
|||
me.R4 = [" PHASE ", "PREV ", "wht"];
|
||||
me.R5 = [" PHASE ", "NEXT ", "wht"];
|
||||
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]];
|
||||
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
makeTmpy: func() {
|
||||
|
@ -122,6 +146,32 @@ var windCRZPage = {
|
|||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
},
|
||||
pushButtonLeft: func(index) {
|
||||
if (size(me.windList) >= index) {
|
||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
|
||||
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
||||
if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||
size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
||||
size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
||||
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
||||
me.windList[index - 1] = [winds[0], winds[1], winds[2]];
|
||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||
if (index != 4) {
|
||||
append(me.windList, nil);
|
||||
}
|
||||
me._setupPageWithData();
|
||||
me.makeTmpy();
|
||||
me.updateTmpy();
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
},
|
||||
pushButtonUp: func() {
|
||||
if (me.cur_location < size(fmgc.flightPlanController.getWaypointList(2)) - 1) {
|
||||
me.cur_location = me.cur_location + 1;
|
||||
|
@ -129,7 +179,7 @@ var windCRZPage = {
|
|||
me.cur_location = 0;
|
||||
}
|
||||
me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location];
|
||||
me.windList = [];
|
||||
me.windList = [nil];
|
||||
#load stored data here
|
||||
me.reload();
|
||||
},
|
||||
|
@ -140,7 +190,7 @@ var windCRZPage = {
|
|||
me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1;
|
||||
}
|
||||
me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location];
|
||||
me.windList = [];
|
||||
me.windList = [nil];
|
||||
#load stored data here
|
||||
me.reload();
|
||||
}
|
||||
|
|
|
@ -46,42 +46,72 @@ var windDESPage = {
|
|||
me.title = "DES WIND";
|
||||
#me.title = ["DES WIND", " AT ", me.waypoint.wp_name];
|
||||
me.titleColour = "wht";
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]];
|
||||
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]];
|
||||
|
||||
if (size(me.windList) >= 5) {
|
||||
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[4] != nil) {
|
||||
me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"];
|
||||
me.fontMatrix[0][4] = 0;
|
||||
} else {
|
||||
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][4] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L5 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 4) {
|
||||
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[3] != nil) {
|
||||
me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"];
|
||||
me.fontMatrix[0][3] = 0;
|
||||
} else {
|
||||
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][3] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 3) {
|
||||
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[2] != nil) {
|
||||
me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"];
|
||||
me.fontMatrix[0][2] = 0;
|
||||
} else {
|
||||
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][2] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 2) {
|
||||
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
if (me.windList[1] != nil) {
|
||||
me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"];
|
||||
me.fontMatrix[0][1] = 0;
|
||||
} else {
|
||||
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
|
||||
me.fontMatrix[0][1] = 1;
|
||||
}
|
||||
} else {
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
}
|
||||
|
||||
if (size(me.windList) >= 1) {
|
||||
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
|
||||
if (me.windList[0] != nil) {
|
||||
me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"];
|
||||
me.fontMatrix[0][0] = 0;
|
||||
} else {
|
||||
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
|
||||
me.fontMatrix[0][0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"];
|
||||
me.R3 = [" REQUEST ", "WIND ", "amb"];
|
||||
me.R4 = [" PHASE ", "PREV ", "wht"];
|
||||
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]];
|
||||
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]];
|
||||
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
makeTmpy: func() {
|
||||
|
@ -119,5 +149,31 @@ var windDESPage = {
|
|||
reload: func() {
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
},
|
||||
pushButtonLeft: func(index) {
|
||||
if (size(me.windList) >= index) {
|
||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
|
||||
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
||||
if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||
size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
||||
size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
||||
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
||||
me.windList[index - 1] = [winds[0], winds[1], winds[2]];
|
||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||
if (index != 5) {
|
||||
append(me.windList, nil);
|
||||
}
|
||||
me._setupPageWithData();
|
||||
me.makeTmpy();
|
||||
me.updateTmpy();
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue