From b678cef6c87079983b23c5570cc7a48aeb41b803 Mon Sep 17 00:00:00 2001
From: Matthew Maring <56924612+hayden2000@users.noreply.github.com>
Date: Sun, 31 May 2020 10:05:44 -0400
Subject: [PATCH] Skeleton code for winds

---
 A320-main.xml                    |   4 +
 Models/Instruments/MCDU/MCDU.nas | 102 ++++++++++++++++++++++++++
 Nasal/MCDU/INITA.nas             |   7 ++
 Nasal/MCDU/MCDU.nas              |   6 +-
 Nasal/MCDU/WINDCLB.nas           | 122 +++++++++++++++++++++++++++++++
 Nasal/MCDU/WINDCRZ.nas           |  87 ++++++++++++++++++++++
 Nasal/MCDU/WINDDES.nas           |  97 ++++++++++++++++++++++++
 Nasal/MCDU/WINDHIST.nas          |  97 ++++++++++++++++++++++++
 8 files changed, 520 insertions(+), 2 deletions(-)
 create mode 100644 Nasal/MCDU/WINDCLB.nas
 create mode 100644 Nasal/MCDU/WINDCRZ.nas
 create mode 100644 Nasal/MCDU/WINDDES.nas
 create mode 100644 Nasal/MCDU/WINDHIST.nas

diff --git a/A320-main.xml b/A320-main.xml
index f0a86be2..b4712a4c 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -4053,6 +4053,10 @@
 			<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
 			<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
 			<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
+			<file>Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas</file> <!-- dynamic page - init before MCDU -->
+			<file>Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas</file> <!-- dynamic page - init before MCDU -->
+			<file>Aircraft/A320-family/Nasal/MCDU/WINDDES.nas</file> <!-- dynamic page - init before MCDU -->
+			<file>Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas</file> <!-- dynamic page - init before MCDU -->
 			<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
 			<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
 			<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>
diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas
index 845e3f98..eafee83e 100644
--- a/Models/Instruments/MCDU/MCDU.nas
+++ b/Models/Instruments/MCDU/MCDU.nas
@@ -18,6 +18,7 @@ var myAirways = [nil, nil];
 var myDuplicate = [nil, nil];
 var myClosestAirport = [nil, nil];
 var myPilotWP = [nil, nil];
+var myCLBWIND = [nil, nil];
 var default = "BoeingCDU-Large.ttf";
 var symbol = "helvetica_medium.txf";
 var normal = 70;
@@ -3137,6 +3138,107 @@ var canvas_MCDU_base = {
 			me["Simple_C1S"].setText("FLP RETR");
 			me["Simple_C2S"].setText("SLT RETR");
 			me["Simple_C3S"].setText("CLEAN  ");
+		} else if (page == "WINDCLB") {
+			if (!pageSwitch[i].getBoolValue()) {
+				me["Simple"].show();
+				me["Simple_Center"].hide();
+				me["FPLN"].hide();
+				me["DIRTO_TMPY_group"].hide();
+				me["INITA"].hide();
+				me["IRSINIT"].hide();
+				me["INITB"].hide();
+				me["FUELPRED"].hide();
+				me["PROG"].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["Simple_L0S"].hide();
+				me["Simple_C3B"].hide();
+				me["Simple_C4B"].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", "amb");
+				#me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
+				me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb");
+				#me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
+				
+				if (myCLBWIND[i] != nil) {
+					me["Simple_Title"].setText(sprintf("%s", myCLBWIND[i].title));
+					
+					forindex (var matrixArrow; myCLBWIND[i].arrowsMatrix) {
+						if (matrixArrow == 0) { 
+							var sign = "L"; 
+						} else { 
+							var sign = "R"; 
+						}
+						forindex (var item; myCLBWIND[i].arrowsMatrix[matrixArrow]) {
+							if (myCLBWIND[i].arrowsMatrix[matrixArrow][item] == 1) {
+								me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
+							} else {
+								me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
+							}
+						}
+					}
+					me.colorLeftArrow(myCLBWIND[i].arrowsColour[0][0],myCLBWIND[i].arrowsColour[0][1],myCLBWIND[i].arrowsColour[0][2],myCLBWIND[i].arrowsColour[0][3],myCLBWIND[i].arrowsColour[0][4],myCLBWIND[i].arrowsColour[0][5]);
+					
+					forindex (var matrixFont; myCLBWIND[i].fontMatrix) {
+						if (matrixFont == 0) { 
+							var sign = "L"; 
+						} else { 
+							var sign = "R"; 
+						}
+						forindex (var item; myCLBWIND[i].fontMatrix[matrixFont]) {
+							if (myCLBWIND[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);
+							}
+						}
+					}
+					
+					me.dynamicPageFunc(myCLBWIND[i].L1, "Simple_L1");
+					me.dynamicPageFunc(myCLBWIND[i].L2, "Simple_L2");
+					me.dynamicPageFunc(myCLBWIND[i].L3, "Simple_L3");
+					me.dynamicPageFunc(myCLBWIND[i].L4, "Simple_L4");
+					me.dynamicPageFunc(myCLBWIND[i].L5, "Simple_L5");
+					me.dynamicPageFunc(myCLBWIND[i].L6, "Simple_L6");
+					
+					me.colorLeft(myCLBWIND[i].L1[2],myCLBWIND[i].L2[2],myCLBWIND[i].L3[2],myCLBWIND[i].L4[2],myCLBWIND[i].L5[2],myCLBWIND[i].L6[2]);
+					
+					# me.dynamicPageFunc(myCLBWIND[i].C1, "Simple_C1");
+# 					me.dynamicPageFunc(myCLBWIND[i].C2, "Simple_C2");
+# 					me.dynamicPageFunc(myCLBWIND[i].C3, "Simple_C3");
+# 					me.dynamicPageFunc(myCLBWIND[i].C4, "Simple_C4");
+# 					me.dynamicPageFunc(myCLBWIND[i].C5, "Simple_C5");
+# 					me.dynamicPageFunc(myCLBWIND[i].C6, "Simple_C6");
+# 					
+# 					me.colorCenter(myCLBWIND[i].C1[2],myCLBWIND[i].C2[2],myCLBWIND[i].C3[2],myCLBWIND[i].C4[2],myCLBWIND[i].C5[2],myCLBWIND[i].C6[2]);
+					
+					me.dynamicPageFunc(myCLBWIND[i].R1, "Simple_R1");
+					me.dynamicPageFunc(myCLBWIND[i].R2, "Simple_R2");
+					me.dynamicPageFunc(myCLBWIND[i].R3, "Simple_R3");
+					me.dynamicPageFunc(myCLBWIND[i].R4, "Simple_R4");
+					me.dynamicPageFunc(myCLBWIND[i].R5, "Simple_R5");
+					me.dynamicPageFunc(myCLBWIND[i].R6, "Simple_R6");
+					
+					me.colorRight(myCLBWIND[i].R1[2],myCLBWIND[i].R2[2],myCLBWIND[i].R3[2],myCLBWIND[i].R4[2],myCLBWIND[i].R5[2],myCLBWIND[i].R6[2]);
+				}
+				pageSwitch[i].setBoolValue(1);
+			}
 		} else if (page == "LATREV") {
 			if (!pageSwitch[i].getBoolValue()) {
 				me["Simple"].show();
diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas
index 2fb0d757..e5bc7490 100644
--- a/Nasal/MCDU/INITA.nas
+++ b/Nasal/MCDU/INITA.nas
@@ -222,6 +222,13 @@ var initInputA = func(key, i) {
 		}
 	} else if (key == "R3") {
 		setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
+	} else if (key == "R4") {
+		if (canvas_mcdu.myCLBWIND[i] != nil) {
+			canvas_mcdu.myCLBWIND[i].del();
+		}
+		canvas_mcdu.myCLBWIND[i] = nil;
+		canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
+		setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
 	} else if (key == "R5") {
 		if (scratchpad == "CLR") {
 			setprop("/FMGC/internal/tropo", 36090);
diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas
index 8eaf94a8..63e3b209 100644
--- a/Nasal/MCDU/MCDU.nas
+++ b/Nasal/MCDU/MCDU.nas
@@ -473,7 +473,7 @@ var rskbutton = func(btn, i) {
 				}
 				canvas_mcdu.myPilotWP[i] = nil;
 				canvas_mcdu.myPilotWP[i] = pilotWaypointPage.new(i);
-					setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP");
+				setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP");
 			} else {
 				mcdu_message(i, "NOT ALLOWED"); # todo spawn new waypoints page
 			}
@@ -531,7 +531,9 @@ var rskbutton = func(btn, i) {
 			mcdu_message(i, "NOT ALLOWED");
 		}
 	} else if (btn == "4") {
-		if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
+		if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
+			initInputA("R4",i);
+		} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
 			fuelPredInput("R4",i);
 		} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
 			perfTOInput("R4",i);
diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas
new file mode 100644
index 00000000..1517bdb3
--- /dev/null
+++ b/Nasal/MCDU/WINDCLB.nas
@@ -0,0 +1,122 @@
+# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
+
+# Copyright (c) 2020 Matthew Maring (mattmaring)
+
+var windCLBPage = {
+	title: 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,
+	windList: [],
+	new: func(computer) {
+		var wcp = {parents:[windCLBPage]};
+		wcp.computer = computer;
+		wcp.windList = [nil];
+		wcp._setupPageWithData();
+		wcp.updateTmpy();
+		return wcp;
+	},
+	del: func() {
+		return nil;
+	},
+	_setupPageWithData: func() {
+		me.title = "CLIMB WIND";
+		#me.title = "DRAFT CLIMB WIND";
+		me.titleColour = "wht";
+		
+		if (size(me.windList) >= 5) {
+			me.L5 = ["[  ]/[  ]/[   ]", "", "blu"];
+		} else {
+			me.L5 = [nil, nil, "ack"];
+		}
+		
+		if (size(me.windList) >= 4) {
+			me.L4 = ["[  ]/[  ]/[   ]", "", "blu"];
+		} else {
+			me.L4 = [nil, nil, "ack"];
+		}
+		
+		if (size(me.windList) >= 3) {
+			me.L3 = ["[  ]/[  ]/[   ]", "", "blu"];
+		} else {
+			me.L3 = [nil, nil, "ack"];
+		}
+		
+		if (size(me.windList) >= 2) {
+			me.L2 = ["[  ]/[  ]/[   ]", "", "blu"];
+		} else {
+			me.L2 = [nil, nil, "ack"];
+		}
+		
+		if (size(me.windList) >= 1) {
+			me.L1 = ["[  ]/[  ]/[   ]", "TRU WIND/ALT", "blu"];
+		}
+
+		me.L6 = [" CANCEL", " WIND", "amb"];
+		me.R1 = [" HISTORY ", "WIND ", "wht"];
+		me.R3 = [" REQUEST ", "WIND ", "amb"];
+		me.R5 = [" PHASE ", "NEXT ", "wht"];
+		me.R6 = ["UPDATE ", "WIND ", "amb"];
+# 		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, "wht"];
+# 		me.R2 = ["DATABASE ", nil, "wht"];
+		me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]];
+		me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "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() {
+		if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
+			fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
+		}
+	},
+	updateTmpy: func() {
+		if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
+			#me.L1[2] = "yel";
+			#me.L2[2] = "yel";
+			#me.L6 = [" F-PLN", " TMPY", "yel"];
+			#me.R6 = ["INSERT* ", " TMPY", "yel"];
+			#me.arrowsColour[0][5] = "yel";
+			#me.titleColour = "yel";
+			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+		} else {
+			#me.L1[2] = "blu";
+			#me.L2[2] = "blu";
+			#me.L6 = [" RETURN", nil, "wht"];
+			#me.R6 = [nil, nil, "ack"];
+			#me.arrowsColour[0][5] = "wht";
+			#me.titleColour = "wht";
+			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+		}
+	}
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas
new file mode 100644
index 00000000..ae181970
--- /dev/null
+++ b/Nasal/MCDU/WINDCRZ.nas
@@ -0,0 +1,87 @@
+# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
+
+# Copyright (c) 2020 Matthew Maring (mattmaring)
+
+var windCRZPage = {
+	title: [nil, 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 wcp = {parents:[windCRZPage]};
+		wcp.computer = computer;
+		wcp.waypoint = waypoint;
+		wcp._setupPageWithData();
+		wcp.updateTmpy();
+		return wcp;
+	},
+	del: func() {
+		return nil;
+	},
+	_setupPageWithData: func() {
+		me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
+		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, "wht"];
+# 		me.R2 = ["DATABASE ", nil, "wht"];
+		me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]];
+		me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "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.L1[2] = "yel";
+			me.L2[2] = "yel";
+			me.L6 = [" F-PLN", " TMPY", "yel"];
+			me.R6 = ["INSERT* ", " TMPY", "yel"];
+			me.arrowsColour[0][5] = "yel";
+			me.titleColour = "yel";
+			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+		} else {
+			me.L1[2] = "blu";
+			me.L2[2] = "blu";
+			me.L6 = [" RETURN", nil, "wht"];
+			me.R6 = [nil, nil, "ack"];
+			me.arrowsColour[0][5] = "wht";
+			me.titleColour = "wht";
+			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+		}
+	}
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas
new file mode 100644
index 00000000..145eb02c
--- /dev/null
+++ b/Nasal/MCDU/WINDDES.nas
@@ -0,0 +1,97 @@
+# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
+
+# Copyright (c) 2020 Matthew Maring (mattmaring)
+
+var windDESPage = {
+	title: 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) {
+		var wdp = {parents:[windDESPage]};
+		wdp.computer = computer;
+		wdp._setupPageWithData();
+		wdp.updateTmpy();
+		return wdp;
+	},
+	del: func() {
+		return nil;
+	},
+	_setupPageWithData: func() {
+		me.title = "DESCENT WIND";
+		#me.title = "DRAFT DESCENT WIND";
+		me.titleColour = "wht";
+		me.L1 = ["[   ]g/[   ]/FL---", "TRU WIND/ALT", "blu"];
+		me.L2 = ["[   ]g/[   ]/FL200", "", "blu"];
+		me.L3 = ["[   ]g/[   ]/FL100", "", "blu"];
+		me.L4 = ["[   ]g/[   ]/FL050", "", "blu"];
+		me.L5 = ["[   ]g/[   ]/GRND", "", "blu"];
+		me.L6 = [" CANCEL", " WIND", "amb"];
+		me.R1 = ["[   ]g/[   ]", "WIND ", "blu"];
+		me.R2 = ["", "FL---", "grn"];
+		me.R3 = [" REQUEST ", "WIND ", "wht"];
+		me.R4 = [" PHASE ", "PREV ", "wht"];
+		me.R6 = ["UPDATE ", "WIND ", "amb"];
+# 		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, "wht"];
+# 		me.R2 = ["DATABASE ", nil, "wht"];
+		me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0]];
+		me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "wht", "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.L1[2] = "yel";
+# 			me.L2[2] = "yel";
+# 			me.L6 = [" F-PLN", " TMPY", "yel"];
+# 			me.R6 = ["INSERT* ", " TMPY", "yel"];
+# 			me.arrowsColour[0][5] = "yel";
+# 			me.titleColour = "yel";
+# 			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+# 		} else {
+# 			me.L1[2] = "blu";
+# 			me.L2[2] = "blu";
+# 			me.L6 = [" RETURN", nil, "wht"];
+# 			me.R6 = [nil, nil, "ack"];
+# 			me.arrowsColour[0][5] = "wht";
+# 			me.titleColour = "wht";
+# 			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+# 		}
+	}
+};
\ No newline at end of file
diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas
new file mode 100644
index 00000000..5142ee02
--- /dev/null
+++ b/Nasal/MCDU/WINDHIST.nas
@@ -0,0 +1,97 @@
+# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
+
+# Copyright (c) 2020 Matthew Maring (mattmaring)
+
+var windHistPage = {
+	title: 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) {
+		var whp = {parents:[windHistPage]};
+		whp.computer = computer;
+		whp._setupPageWithData();
+		#whp.updateTmpy();
+		return whp;
+	},
+	del: func() {
+		return nil;
+	},
+	_setupPageWithData: func() {
+		me.title = "HISTROY WIND";
+		me.titleColour = "wht";
+		me.L1 = ["----g/---", "", "blu"];
+		me.L2 = ["----g/---", "", "blu"];
+		me.L3 = ["----g/---", "", "blu"];
+		me.L4 = ["----g/---", "", "blu"];
+		me.L5 = ["----g/---", "", "blu"];
+		me.L6 = [" CLIMB WIND", "", "wht"];
+		me.C1 = ["FL050", "", "blu"];
+		me.C2 = ["FL150", "", "blu"];
+		me.C3 = ["FL250", "", "blu"];
+		me.C4 = ["FL---", "", "blu"];
+		me.C5 = ["FL370", "", "blu"];
+		me.R6 = ["SELECT ", "", "amb"];
+# 		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, "wht"];
+# 		me.R2 = ["DATABASE ", 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 = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1]];
+		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.L1[2] = "yel";
+# 			me.L2[2] = "yel";
+# 			me.L6 = [" F-PLN", " TMPY", "yel"];
+# 			me.R6 = ["INSERT* ", " TMPY", "yel"];
+# 			me.arrowsColour[0][5] = "yel";
+# 			me.titleColour = "yel";
+# 			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+# 		} else {
+# 			me.L1[2] = "blu";
+# 			me.L2[2] = "blu";
+# 			me.L6 = [" RETURN", nil, "wht"];
+# 			me.R6 = [nil, nil, "ack"];
+# 			me.arrowsColour[0][5] = "wht";
+# 			me.titleColour = "wht";
+# 			canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
+# 		}
+	}
+};
\ No newline at end of file