VOID_Core: Added AppLauncher button stuff.
VOID_Core: Added AppLauncher button stuff.

--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("0.12.0.*")]
+[assembly: AssemblyVersion("0.13.*")]
 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.
 //[assembly: AssemblyDelaySign(false)]

--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -175,6 +175,8 @@
 		protected VOID_SaveValue<bool> _UseToolbarManager;
 		internal IButton ToolbarButton;
 
+		internal ApplicationLauncherButton AppLauncherButton;
+
 		/*
 		 * Properties
 		 * */
@@ -333,6 +335,12 @@
 				}
 				if (value == true)
 				{
+					if (this.AppLauncherButton != null)
+					{
+						ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);
+						this.AppLauncherButton = null;
+					}
+
 					this.InitializeToolbarButton();
 				}
 
@@ -366,9 +374,9 @@
 
 			if (!this.UseToolbarManager)
 			{
-				if (GUI.Button(VOIDIconPos, VOIDIconTexture, this.iconStyle) && this.VOIDIconLocked)
-				{
-					this.ToggleMainWindow();
+				if (this.AppLauncherButton == null)
+				{
+					this.InitializeAppLauncherButton();
 				}
 			}
 			else if (this.ToolbarButton == null)
@@ -902,6 +910,27 @@
 			Tools.PostDebugMessage(string.Format("{0}: Toolbar Button initialized.", this.GetType().Name));
 		}
 
+		protected void InitializeAppLauncherButton()
+		{
+			if (ApplicationLauncher.Ready)
+			{
+				this.AppLauncherButton = ApplicationLauncher.Instance.AddModApplication(
+					this.ToggleMainWindow, this.ToggleMainWindow,
+					HighLogic.LoadedScene.ToAppScenes(),
+					this.VOIDIconTexture
+				);
+
+				Tools.PostDebugMessage(
+					this,
+					"AppLauncherButton initialized in {0}",
+					Enum.GetName(
+						typeof(GameScenes),
+						HighLogic.LoadedScene
+					)
+				);
+			}
+		}
+
 		protected void ToggleMainWindow()
 		{
 			this.mainGuiMinimized = !this.mainGuiMinimized;
@@ -937,6 +966,11 @@
 			}
 
 			this.VOIDIconTexture = GameDatabase.Instance.GetTexture(texturePath, false);
+
+			if (this.AppLauncherButton != null)
+			{
+				this.AppLauncherButton.SetTexture(VOIDIconTexture);
+			}
 		}
 
 		protected void CheckAndSave()
@@ -988,6 +1022,27 @@
 			this.configDirty = false;
 		}
 
+		public void onSceneChangeRequested(GameScenes scene)
+		{
+			if (this.AppLauncherButton != null)
+			{
+				if (this is VOID_EditorCore)
+				{
+					if (!HighLogic.LoadedSceneIsEditor)
+					{
+						ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);
+					}
+				}
+				else
+				{
+					if (!HighLogic.LoadedSceneIsFlight)
+					{
+						ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);
+					}
+				}
+			}
+		}
+
 		protected VOID_Core()
 		{
 			this._Name = "VOID Core";

--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -378,7 +378,7 @@
 		public static readonly VOID_DoubleValue vesselAccel = new VOID_DoubleValue(
 			"Acceleration",
 			() => geeForce * KerbinGee,
-			"m/s"
+			"m/s²"
 		);
 
 		public static readonly VOID_IntValue vesselCrewCount = new VOID_IntValue(

--- a/VOID_TWR.cs
+++ b/VOID_TWR.cs
@@ -76,84 +76,6 @@
 
 	public class VOID_EditorTWR : VOID_TWR, IVOID_EditorModule {}
 
-	public class CBListComparer : IComparer<CelestialBody>
-	{
-		public int Compare(CelestialBody bodyA, CelestialBody bodyB)
-		{
-			Tools.PostDebugMessage(this, "got bodyA: {0} & bodyB: {1}", bodyA, bodyB);
-
-			if (bodyA == null && bodyB == null)
-			{
-				Tools.PostDebugMessage(this, "both bodies are null, returning 0");
-				return 0;
-			}
-			if (bodyA == null)
-			{
-				Tools.PostDebugMessage(this, "bodyA is null, returning -1");
-				return -1;
-			}
-			if (bodyB == null)
-			{
-				Tools.PostDebugMessage(this, "bodyB is null, returning 1");
-				return 1;
-			}
-
-			Tools.PostDebugMessage(this, "bodies are not null, carrying on");
-
-			if (object.ReferenceEquals(bodyA, bodyB))
-			{
-				Tools.PostDebugMessage(this, "bodies are equal, returning 0");
-				return 0;
-			}
-
-			Tools.PostDebugMessage(this, "bodies are not equal, carrying on");
-
-			if (bodyA.orbitDriver == null)
-			{
-				Tools.PostDebugMessage(this, "bodyA.orbit is null (bodyA is the sun, returning 1");
-				return 1;
-			}
-			if (bodyB.orbitDriver == null)
-			{
-				Tools.PostDebugMessage(this, "bodyB.orbit is null (bodyB is the sun, returning -1");
-				return -1;
-			}
-
-			Tools.PostDebugMessage(this, "orbits are not null, carrying on");
-
-			if (bodyA.orbit.referenceBody == bodyB.orbit.referenceBody)
-			{
-				Tools.PostDebugMessage(this, "bodies share a parent, comparing SMAs");
-				return -bodyA.orbit.semiMajorAxis.CompareTo(bodyB.orbit.semiMajorAxis);
-			}
-
-			Tools.PostDebugMessage(this, "orbits do not share a parent, carrying on");
-
-			if (bodyA.hasAncestor(bodyB))
-			{
-				Tools.PostDebugMessage(this, "bodyA is a moon or sub-moon of bodyB, returning -1");
-				return -1;
-			}
-			if (bodyB.hasAncestor(bodyA))
-			{
-				Tools.PostDebugMessage(this, "bodyA is a moon or sub-moon of bodyB, returning 1");
-				return 1;
-			}
-
-			Tools.PostDebugMessage(this, "bodies do not have an obvious relationship, searching for one");
-
-			if (VOID_Tools.NearestRelatedParents(ref bodyA, ref bodyB))
-			{
-				Tools.PostDebugMessage(this, "good relation {0} and {1}, comparing", bodyA.bodyName, bodyB.bodyName);
-				return this.Compare(bodyA, bodyB);
-			}
-
-			Tools.PostDebugMessage(this, "bad relation {0} and {1}, giving up", bodyA.bodyName, bodyB.bodyName);
-
-			return 0;
-		}
-	}
-
 	public static partial class VOID_Data
 	{
 		public static readonly VOID_DoubleValue nominalThrustWeight = new VOID_DoubleValue(

--- a/VOID_Tools.cs
+++ b/VOID_Tools.cs
@@ -29,6 +29,7 @@
 using KSP;
 using System;
 using System.Collections.Generic;
+using ToadicusTools;
 using UnityEngine;
 
 namespace VOID
@@ -333,7 +334,11 @@
 					{
 						func(id);
 					}
+					#if DEBUG
 					catch (ArgumentException ex)
+					#else
+					catch (ArgumentException)
+					#endif
 					{
 						Debug.LogWarning(
 							string.Format("[{0}]: ArgumentException caught during window call.", func.Target.GetType().Name)
@@ -863,6 +868,83 @@
 				return "";
 		}
 	}
+
+	public class CBListComparer : IComparer<CelestialBody>
+	{
+		public int Compare(CelestialBody bodyA, CelestialBody bodyB)
+		{
+			Tools.PostDebugMessage(this, "got bodyA: {0} & bodyB: {1}", bodyA, bodyB);
+
+			if (bodyA == null && bodyB == null)
+			{
+				Tools.PostDebugMessage(this, "both bodies are null, returning 0");
+				return 0;
+			}
+			if (bodyA == null)
+			{
+				Tools.PostDebugMessage(this, "bodyA is null, returning -1");
+				return -1;
+			}
+			if (bodyB == null)
+			{
+				Tools.PostDebugMessage(this, "bodyB is null, returning 1");
+				return 1;
+			}
+
+			Tools.PostDebugMessage(this, "bodies are not null, carrying on");
+
+			if (object.ReferenceEquals(bodyA, bodyB))
+			{
+				Tools.PostDebugMessage(this, "bodies are equal, returning 0");
+				return 0;
+			}
+
+			Tools.PostDebugMessage(this, "bodies are not equal, carrying on");
+
+			if (bodyA.orbitDriver == null)
+			{
+				Tools.PostDebugMessage(this, "bodyA.orbit is null (bodyA is the sun, returning 1");
+				return 1;
+			}
+			if (bodyB.orbitDriver == null)
+			{
+				Tools.PostDebugMessage(this, "bodyB.orbit is null (bodyB is the sun, returning -1");
+				return -1;
+			}
+
+			Tools.PostDebugMessage(this, "orbits are not null, carrying on");
+
+			if (bodyA.orbit.referenceBody == bodyB.orbit.referenceBody)
+			{
+				Tools.PostDebugMessage(this, "bodies share a parent, comparing SMAs");
+				return -bodyA.orbit.semiMajorAxis.CompareTo(bodyB.orbit.semiMajorAxis);
+			}
+
+			Tools.PostDebugMessage(this, "orbits do not share a parent, carrying on");
+
+			if (bodyA.hasAncestor(bodyB))
+			{
+				Tools.PostDebugMessage(this, "bodyA is a moon or sub-moon of bodyB, returning -1");
+				return -1;
+			}
+			if (bodyB.hasAncestor(bodyA))
+			{
+				Tools.PostDebugMessage(this, "bodyA is a moon or sub-moon of bodyB, returning 1");
+				return 1;
+			}
+
+			Tools.PostDebugMessage(this, "bodies do not have an obvious relationship, searching for one");
+
+			if (VOID_Tools.NearestRelatedParents(ref bodyA, ref bodyB))
+			{
+				Tools.PostDebugMessage(this, "good relation {0} and {1}, comparing", bodyA.bodyName, bodyB.bodyName);
+				return this.Compare(bodyA, bodyB);
+			}
+
+			Tools.PostDebugMessage(this, "bad relation {0} and {1}, giving up", bodyA.bodyName, bodyB.bodyName);
+
+			return 0;
+		}
+	}
 }
 
-

--- a/VOID_VesselInfo.cs
+++ b/VOID_VesselInfo.cs
@@ -148,7 +148,10 @@
 			"Resource Mass (curr / total)",
 			delegate()
 		{
-			return string.Format("{0} / {1}", stageResourceMass.ValueUnitString(), resourceMass.ValueUnitString());
+			return string.Format("{0} / {1}",
+				stageResourceMass.ValueUnitString("F3"),
+				resourceMass.ValueUnitString("F3")
+			);
 		}
 		);