From 760c6b275f1032713454e7798e48b820c79de7a9 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 6 Feb 2022 17:54:21 +0000 Subject: [PATCH] AOC Weather request pages: adjust for new font. Correct some text to new manuals. Fix behavior with CLR prompt --- Models/Instruments/MCDU/MCDU.nas | 37 ++++++++++++----- Nasal/MCDU/MCDU.nas | 18 +++++--- Nasal/MCDU/RECEIVEDMESSAGES.nas | 70 ++++++++++++++++---------------- 3 files changed, 73 insertions(+), 52 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index db86aae6..f203f80a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -440,6 +440,25 @@ var canvas_MCDU_base = { me["Simple_R5S"].setFont("HoneywellMCDUSmall.ttf"); me["Simple_R5S"].setFontSize(small); } + if (page == "RECEIVEDMSG") { + me["Simple_L2S"].setFont("HoneywellMCDU.ttf"); + me["Simple_L2S"].setFontSize(normal); + me["Simple_L3S"].setFont("HoneywellMCDU.ttf"); + me["Simple_L3S"].setFontSize(normal); + me["Simple_L4S"].setFont("HoneywellMCDU.ttf"); + me["Simple_L4S"].setFontSize(normal); + me["Simple_L5S"].setFont("HoneywellMCDU.ttf"); + me["Simple_L5S"].setFontSize(normal); + } else { + me["Simple_L2S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_L2S"].setFontSize(small); + me["Simple_L3S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_L3S"].setFontSize(small); + me["Simple_L4S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_L4S"].setFontSize(small); + me["Simple_L5S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_L5S"].setFontSize(small); + } if (page == "IRSMON") { me["Simple_R1S"].setFont("HoneywellMCDU.ttf"); me["Simple_R1S"].setFontSize(normal); @@ -941,11 +960,11 @@ var canvas_MCDU_base = { me["Simple_L1"].setText(" WEATHER TYPE"); me["Simple_L1S"].setText(" " ~ atsu.AOC.selectedType); - me["Simple_R1S"].setText("STA 1 "); - me["Simple_R2"].setText("[ ]"); - me["Simple_R2S"].setText("STA 2 "); - me["Simple_R3"].setText("[ ]"); - me["Simple_R3S"].setText("STA 3 "); + me["Simple_R1S"].setText("STA 1"); + me["Simple_R2"].setText("[ ]"); + me["Simple_R2S"].setText("STA 2"); + me["Simple_R3"].setText("[ ]"); + me["Simple_R3S"].setText("STA 3"); pageSwitch[i].setBoolValue(1); } @@ -964,7 +983,7 @@ var canvas_MCDU_base = { } } else { me["Simple_R5"].setText("SEND "); - me["Simple_R1"].setText("[ ]"); + me["Simple_R1"].setText("[ ]"); me["WEATHERREQSEND"].hide(); } @@ -1029,12 +1048,8 @@ var canvas_MCDU_base = { if (mcdu.ReceivedMessagesDatabase.getCountPages() > 1) { me["Simple_PageNum"].show(); me["Simple_PageNum"].setText(myReceivedMessages[i].getPageNumStr()); - me["ArrowLeft"].show(); - me["ArrowRight"].show(); } else { me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); } me.dynamicPageArrowFunc(myReceivedMessages[i]); @@ -1069,7 +1084,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - me.fontSizeLeft(small, small, small, small, small, normal); + me.fontSizeLeft(normal, normal, normal, normal, normal, normal); me.fontSizeCenter(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, normal, normal); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6b2559ef..3adb3090 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -946,13 +946,19 @@ var rskbutton = func(btn, i) { } else if (page == "AOCMENU") { pageNode[i].setValue("FLTLOG"); } else if (page == "WEATHERREQ") { - var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); - if (result == 1) { - mcdu_message(i, "NOT ALLOWED"); - } elsif (result == 2) { - mcdu_message(i, "NOT IN DATA BASE"); + if (mcdu_scratchpad.scratchpads[i].scratchpad != "CLR") { + var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); + if (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } else { + mcdu_scratchpad.scratchpads[i].empty(); + } } else { - mcdu_scratchpad.scratchpads[i].empty(); + atsu.AOC.sent = 0; + atsu.AOC.received = 0; + atsu.AOC.station = nil; } } else if (page == "WEATHERTYPE") { atsu.AOC.selectedType = "TERM FCST"; diff --git a/Nasal/MCDU/RECEIVEDMESSAGES.nas b/Nasal/MCDU/RECEIVEDMESSAGES.nas index f2c683ba..8c41e118 100644 --- a/Nasal/MCDU/RECEIVEDMESSAGES.nas +++ b/Nasal/MCDU/RECEIVEDMESSAGES.nas @@ -17,7 +17,7 @@ var receivedMessagesPage = { computer: nil, size: 0, getPageNumStr: func() { - return me.curPage ~ "/" ~ ReceivedMessagesDatabase.getCountPages(); + return " " ~ sprintf("%02d",me.curPage) ~ "/" ~ sprintf("%02d",ReceivedMessagesDatabase.getCountPages()); }, new: func(computer) { var ap = {parents:[receivedMessagesPage]}; @@ -58,7 +58,7 @@ var receivedMessagesPage = { me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; }, _setupPageWithData: func() { - me.title = "RECEIVED MESSAGES "; + me.title = "ACARS - RCVD MSGS "; me.L6 = [" RETURN", nil, "wht"]; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; @@ -71,60 +71,60 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + -4) { message = ReceivedMessagesDatabase.database.vector[-5 + (me.curPage * 5)]; - me.L1[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); + me.L1[0] = " " ~ left(message.body, size(message.body) > 17 ? 17 : size(message.body)); me.L1[2] = "blu"; if (!message.viewed) { - me.L1[1] = " " ~ message.time ~ " NEW"; + me.L1[1] = " " ~ message.time ~ " NEW"; } else { - me.L1[1] = " " ~ message.time ~ " VIEWED"; + me.L1[1] = " " ~ message.time ~ " VIEWED"; } me.arrowsMatrix[0][0] = 1; } if (me.size >= (me.curPage * 5) + -3) { message = ReceivedMessagesDatabase.database.vector[-4 + (me.curPage * 5)]; - me.L2[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); + me.L2[0] = " " ~ left(message.body, size(message.body) > 17 ? 17 : size(message.body)); me.L2[2] = "blu"; if (!message.viewed) { - me.L2[1] = " " ~ message.time ~ " NEW"; + me.L2[1] = " " ~ message.time ~ " NEW"; } else { - me.L2[1] = " " ~ message.time ~ " VIEWED"; + me.L2[1] = " " ~ message.time ~ " VIEWED"; } me.arrowsMatrix[0][1] = 1; } if (me.size >= (me.curPage * 5) + -2) { message = ReceivedMessagesDatabase.database.vector[-3 + (me.curPage * 5)]; - me.L3[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); + me.L3[0] = " " ~ left(message.body, size(message.body) > 17 ? 17 : size(message.body)); me.L3[2] = "blu"; if (!message.viewed) { - me.L3[1] = " " ~ message.time ~ " NEW"; + me.L3[1] = " " ~ message.time ~ " NEW"; } else { - me.L3[1] = " " ~ message.time ~ " VIEWED"; + me.L3[1] = " " ~ message.time ~ " VIEWED"; } me.arrowsMatrix[0][2] = 1; } if (me.size >= (me.curPage * 5) + -1) { message = ReceivedMessagesDatabase.database.vector[-2 + (me.curPage * 5)]; - me.L4[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); + me.L4[0] = " " ~ left(message.body, size(message.body) > 17 ? 17 : size(message.body)); me.L4[2] = "blu"; if (!message.viewed) { - me.L4[1] = " " ~ message.time ~ " NEW"; + me.L4[1] = " " ~ message.time ~ " NEW"; } else { - me.L4[1] = " " ~ message.time ~ " VIEWED"; + me.L4[1] = " " ~ message.time ~ " VIEWED"; } me.arrowsMatrix[0][3] = 1; } if (me.size >= (me.curPage * 5) + 0) { message = ReceivedMessagesDatabase.database.vector[-1 + (me.curPage * 5)]; - me.L5[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); + me.L5[0] = " " ~ left(message.body, size(message.body) > 17 ? 17 : size(message.body)); me.L5[2] = "blu"; if (!message.viewed) { - me.L5[1] = " " ~ message.time ~ " NEW"; + me.L5[1] = " " ~ message.time ~ " NEW"; } else { - me.L5[1] = " " ~ message.time ~ " VIEWED"; + me.L5[1] = " " ~ message.time ~ " VIEWED"; } me.arrowsMatrix[0][4] = 1; } @@ -236,37 +236,37 @@ var receivedMessagePage = { me.L1[1] = message.time; me.C1[1] = "VIEWED"; me.C1[2] = "grn"; - me.R1[1] = me.curPage ~ "/" ~ ReceivedMessagesDatabase.getSize(); + me.R1[1] = sprintf("%02d",me.curPage) ~ "/" ~ sprintf("%02d",ReceivedMessagesDatabase.getSize()); - me.L1[0] = left(message.body, size(message.body) > 30 ? 30 : size(message.body)); + me.L1[0] = left(message.body, size(message.body) > 24 ? 24 : size(message.body)); me.L1[2] = "wht"; me.L2[2] = "wht"; me.L3[2] = "wht"; me.L4[2] = "wht"; me.L5[2] = "wht"; - if (size(message.body) > 30) { - me.L2[1] = left(split(me.L1[0], message.body)[1], size(message.body) > 60 ? 30 : size(message.body) - 30); + if (size(message.body) > 24) { + me.L2[1] = left(split(me.L1[0], message.body)[1], size(message.body) > 48 ? 24 : size(message.body) - 24); } - if (size(message.body) > 60) { - me.L2[0] = left(split(me.L2[1], message.body)[1], size(message.body) > 90 ? 30 : size(message.body) - 60); + if (size(message.body) > 48) { + me.L2[0] = left(split(me.L2[1], message.body)[1], size(message.body) > 72 ? 24 : size(message.body) - 48); } - if (size(message.body) > 90) { - me.L3[1] = left(split(me.L2[0], message.body)[1], size(message.body) > 120 ? 30 : size(message.body) - 90); + if (size(message.body) > 72) { + me.L3[1] = left(split(me.L2[0], message.body)[1], size(message.body) > 96 ? 24 : size(message.body) - 72); + } + if (size(message.body) > 96) { + me.L3[0] = left(split(me.L3[1], message.body)[1], size(message.body) > 120 ? 24 : size(message.body) - 96); } if (size(message.body) > 120) { - me.L3[0] = left(split(me.L3[1], message.body)[1], size(message.body) > 150 ? 30 : size(message.body) - 120); + me.L4[1] = left(split(me.L3[0], message.body)[1], size(message.body) > 144 ? 24 : size(message.body) - 120); } - if (size(message.body) > 150) { - me.L4[1] = left(split(me.L3[0], message.body)[1], size(message.body) > 180 ? 30 : size(message.body) - 150); + if (size(message.body) > 144) { + me.L4[0] = left(split(me.L4[1], message.body)[1], size(message.body) > 168 ? 24 : size(message.body) - 144); } - if (size(message.body) > 180) { - me.L4[0] = left(split(me.L4[1], message.body)[1], size(message.body) > 210 ? 30 : size(message.body) - 180); + if (size(message.body) > 168) { + me.L5[1] = left(split(me.L4[0], message.body)[1], size(message.body) > 192 ? 24 : size(message.body) - 168); } - if (size(message.body) > 210) { - me.L5[1] = left(split(me.L4[0], message.body)[1], size(message.body) > 240 ? 30 : size(message.body) - 210); - } - if (size(message.body) > 240) { - me.L5[0] = left(split(me.L5[1], message.body)[1], size(message.body) > 270 ? 30 : size(message.body) - 240); + if (size(message.body) > 192) { + me.L5[0] = left(split(me.L5[1], message.body)[1], size(message.body) > 216 ? 24 : size(message.body) - 192); } } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);