Changes throughout to separate VOID_Tools from ToadicusTools.Tools. Good idea?
[VOID.git] / VOID_Rendezvous.cs
blob:a/VOID_Rendezvous.cs -> blob:b/VOID_Rendezvous.cs
--- a/VOID_Rendezvous.cs
+++ b/VOID_Rendezvous.cs
@@ -47,7 +47,7 @@
 
 		public VOID_Rendezvous()
 		{
-			this._Name = "Rendezvous Information";
+			this.Name = "Rendezvous Information";
 
 			this.WindowPos.x = 845;
 			this.WindowPos.y = 85;
@@ -58,13 +58,16 @@
 			Vessel rendezvessel = new Vessel();
 			CelestialBody rendezbody = new CelestialBody();
 
-			this.RegisterModule = VOID_Core.Instance.Modules.Where(m => typeof(VOID_VesselRegister).IsAssignableFrom(m.GetType())).FirstOrDefault() as VOID_VesselRegister;
+			if (this.RegisterModule == null)
+			{
+				this.RegisterModule = this.core.Modules.Where(m => typeof(VOID_VesselRegister).IsAssignableFrom(m.GetType())).FirstOrDefault() as VOID_VesselRegister;
+			}
 
 			GUILayout.BeginVertical();
 
 			//display both
 			//Show Target Info
-			GUILayout.Label("Target:", VOID_Core.Instance.LabelStyles["center_bold"]);
+			GUILayout.Label("Target:", VOID_Styles.labelCenterBold);
 			if (FlightGlobals.fetch.VesselTarget != null)
 			{
 				//a KSP Target (body or vessel) is selected
@@ -91,13 +94,13 @@
 			else
 			{
 				//no KSP Target selected
-				GUILayout.Label("No Target Selected", VOID_Core.Instance.LabelStyles["center_bold"]);
+				GUILayout.Label("No Target Selected", VOID_Styles.labelCenterBold);
 			}
 
 			//Show Vessel Register vessel info
 			if (untoggleRegisterInfo == false && this.RegisterModule != default(IVOID_Module))
 			{
-				GUILayout.Label("Vessel Register:", VOID_Core.Instance.LabelStyles["center_bold"]);
+				GUILayout.Label("Vessel Register:", VOID_Styles.labelCenterBold);
 				if (this.RegisterModule.selectedVessel != null)
 				{
 					rendezvessel = this.RegisterModule.selectedVessel;
@@ -119,15 +122,15 @@
 				{
 					//vesreg Vessel is null
 					//targ = null;
-					GUILayout.Label("No Vessel Selected", VOID_Core.Instance.LabelStyles["center_bold"]);
-				}
-			}
-
-			untoggleRegisterInfo.value = GUILayout.Toggle(untoggleRegisterInfo, "Hide Vessel Register Info");
+					GUILayout.Label("No Vessel Selected", VOID_Styles.labelCenterBold);
+				}
+			}
+
+			untoggleRegisterInfo.value = GUITools.Toggle(untoggleRegisterInfo, "Hide Vessel Register Info");
 
 			GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 			GUILayout.Label(" ", GUILayout.ExpandWidth(true));
-			if (GUILayout.Button("Close", GUILayout.ExpandWidth(false))) this._Active = false;
+			if (GUILayout.Button("Close", GUILayout.ExpandWidth(false))) this.toggleActive = false;
 			GUILayout.EndHorizontal();
 
 			GUILayout.EndVertical();
@@ -140,7 +143,7 @@
 			{
 				//Display vessel rendezvous info
 				GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-				GUILayout.Label(v.vesselName, VOID_Core.Instance.LabelStyles["center_bold"], GUILayout.ExpandWidth(true));
+				GUILayout.Label(v.vesselName, VOID_Styles.labelCenterBold, GUILayout.ExpandWidth(true));
 				GUILayout.EndHorizontal();
 
 				if (v.situation == Vessel.Situations.ESCAPING || v.situation == Vessel.Situations.FLYING || v.situation == Vessel.Situations.ORBITING || v.situation == Vessel.Situations.SUB_ORBITAL)
@@ -190,13 +193,19 @@
 					GUILayout.Label(Tools.MuMech_ToSI((vessel.findWorldCenterOfMass() - v.findWorldCenterOfMass()).magnitude) + "m", GUILayout.ExpandWidth(false));
 					GUILayout.EndHorizontal();
 
-					//target_vessel_extended_orbital_info = GUILayout.Toggle(target_vessel_extended_orbital_info, "Extended info");
+					// Toadicus edit: added local sidereal longitude.
+					GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+					GUILayout.Label("Local Sidereal Longitude:");
+					GUILayout.Label(LSL.ToString("F3") + "°", VOID_Styles.labelRight);
+					GUILayout.EndHorizontal();
+
+					toggleExtendedOrbital.value = GUITools.Toggle(toggleExtendedOrbital, "Extended info");
 
 					if (toggleExtendedOrbital)
 					{
 						GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 						GUILayout.Label("Period:");
-						GUILayout.Label(VOID_Tools.ConvertInterval(v.orbit.period), GUILayout.ExpandWidth(false));
+						GUILayout.Label(VOID_Tools.FormatInterval(v.orbit.period), GUILayout.ExpandWidth(false));
 						GUILayout.EndHorizontal();
 
 						GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
@@ -235,12 +244,6 @@
 						GUILayout.Label("Arg. of periapsis:");
 						GUILayout.Label(v.orbit.argumentOfPeriapsis.ToString("F3") + "°", GUILayout.ExpandWidth(false));
 						GUILayout.EndHorizontal();
-
-						// Toadicus edit: added local sidereal longitude.
-						GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-						GUILayout.Label("Local Sidereal Longitude:");
-						GUILayout.Label(LSL.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"]);
-						GUILayout.EndHorizontal();
 					}
 				}
 				else
@@ -264,7 +267,7 @@
 			else if (cb != null && v == null)
 			{
 				//Display CelstialBody rendezvous info
-				GUILayout.Label(cb.bodyName, VOID_Core.Instance.LabelStyles["center_bold"]);
+				GUILayout.Label(cb.bodyName, VOID_Styles.labelCenterBold);
 
 				GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 				GUILayout.Label("Ap/Pe:");