First pass at the Oribtal module port.
[VOID.git] / VOID_Orbital.cs
blob:a/VOID_Orbital.cs -> blob:b/VOID_Orbital.cs
--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -24,17 +24,20 @@
 
 namespace VOID
 {
-	public class VOID_Orbital : VOID_Module
+	public class VOID_Orbital : VOID_WindowModule
 	{
-		protected new string _Name = "Orbital Information";
+		[AVOID_SaveValue("toggleExtended")]
+		protected VOID_SaveValue<bool> toggleExtended = false;
 
-		[AVOID_SaveValue("OrbitalWindowPos")]
-		protected Rect OrbitalWindowPos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f);
+		public VOID_Orbital()
+		{
+			this._Name = "Orbital Information";
 
-		[AVOID_SaveValue("toggleExtendedOribtal")]
-		protected bool toggleExtendedOribtal = false;
+			this.WindowPos.x = Screen.width - 520f;
+			this.WindowPos.y = 250f;
+		}
 
-		public void OrbitalWindow(int _)
+		public override void ModuleWindow(int _)
 		{
 			// Toadicus edit: added local sidereal longitude.
 			double LSL = vessel.longitude + vessel.orbit.referenceBody.rotationAngle;
@@ -89,9 +92,9 @@
 			GUILayout.Label(Tools.MuMech_ToSI(g_vessel) + "m/s²", GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
 
-            toggleExtendedOribtal = GUILayout.Toggle(toggleExtendedOribtal, "Extended info");
+			this.toggleExtended = GUILayout.Toggle(this.toggleExtended, "Extended info");
 
-            if (toggleExtendedOribtal)
+			if (this.toggleExtended)
             {
                 GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                 GUILayout.Label("Period:");
@@ -145,16 +148,6 @@
             GUILayout.EndVertical();
             GUI.DragWindow();
 		}
-
-		public override void DrawGUI()
-		{
-			OrbitalWindowPos = GUILayout.Window(
-				++VOID_Core.Instance.windowID,
-				OrbitalWindowPos,
-				this.OrbitalWindow,
-				this.Name, GUILayout.Width(250),
-				GUILayout.Height(50));
-		}
 	}
 }