Merge branch 'laptop_dev'
Merge branch 'laptop_dev'

--- a/IVOID_Module.cs
+++ b/IVOID_Module.cs
@@ -39,12 +39,12 @@
 		void _SaveToConfig(KSP.IO.PluginConfiguration config);
 	}
 
-	
-
 	public interface IVOID_BehaviorModule : IVOID_Module
 	{
 		void Update();
 		void FixedUpdate();
 	}
+
+	public interface IVOID_EditorModule : IVOID_Module {}
 }
 

file:a/Tools.cs -> file:b/Tools.cs
--- a/Tools.cs
+++ b/Tools.cs
@@ -686,6 +686,136 @@
 			GUILayout.Label((dv2 * 1000).ToString("F2") + "m/s", GUILayout.ExpandWidth(false));
 			GUILayout.EndHorizontal();
 		}
+
+		// This implementation is adapted from FARGUIUtils.ClampToScreen
+		public static Rect ClampRectToScreen(Rect window, int xMargin, int yMargin)
+		{
+			window.x = Mathf.Clamp (window.x, xMargin - window.width, Screen.width - xMargin);
+			window.y = Mathf.Clamp (window.y, yMargin - window.height, Screen.height - yMargin);
+
+			return window;
+		}
+
+		public static Rect ClampRectToScreen(Rect window, int Margin)
+		{
+			return ClampRectToScreen(window, Margin, Margin);
+		}
+
+		public static Rect ClampRectToScreen(Rect window)
+		{
+			return ClampRectToScreen (window, 30);
+		}
+
+		public static Vector2 ClampV2ToScreen(Vector2 vec, uint xMargin, uint yMargin)
+		{
+			vec.x = Mathf.Clamp (vec.x, xMargin, Screen.width - xMargin);
+			vec.y = Mathf.Clamp (vec.y, yMargin, Screen.height - yMargin);
+
+			return vec;
+		}
+
+		public static Vector2 ClampV2ToScreen(Vector2 vec, uint Margin)
+		{
+			return ClampV2ToScreen(vec, Margin, Margin);
+		}
+
+		public static Vector2 ClampV2ToScreen(Vector2 vec)
+		{
+			return ClampV2ToScreen (vec, 15);
+		}
+
+		// UNDONE: This seems messy.  Can we clean it up?
+		public static Rect DockToWindow(Rect icon, Rect window)
+		{
+			// We can't set the x and y of the center point directly, so build a new vector.
+			Vector2 center = new Vector2 ();
+
+			// If we are near the top or bottom of the screen...
+			if (window.yMax > Screen.height - icon.height ||
+			    window.yMin < icon.height
+			    )
+			{
+				// If we are in a corner...
+				if (window.xMax > Screen.width - icon.width ||
+				    window.xMin < icon.width
+				    )
+				{
+					// If it is a top corner, put the icon below the window.
+					if (window.yMax < Screen.height / 2)
+					{
+						center.y = window.yMax + icon.height / 2;
+					}
+					// If it is a bottom corner, put the icon above the window.
+					else
+					{
+						center.y = window.yMin - icon.height / 2;
+					}
+				}
+				// If we are not in a corner...
+				else
+				{
+					// If we are along the top edge, align the icon's top edge with the top edge of the window
+					if (window.yMax > Screen.height / 2)
+					{
+						center.y = window.yMax - icon.height / 2;
+					}
+					// If we are along the bottom edge, align the icon's bottom edge with the bottom edge of the window
+					else
+					{
+						center.y = window.yMin + icon.height / 2;
+					}
+				}
+
+				// At the top or bottom, if we are towards the right, put the icon to the right of the window
+				if (window.center.x < Screen.width / 2)
+				{
+					center.x = window.xMin - icon.width / 2;
+				}
+				// At the top or bottom, if we are towards the left, put the icon to the left of the window
+				else
+				{
+					center.x = window.xMax + icon.width / 2;
+				}
+
+			}
+			// If we are not along the top or bottom of the screen...
+			else
+			{
+				// By default, center the icon above the window
+				center.y = window.yMin - icon.height / 2;
+				center.x = window.center.x;
+
+				// If we are along a side...
+				if (window.xMax > Screen.width - icon.width ||
+				    window.xMin < icon.width
+				    )
+				{
+					// UNDONE: I'm not sure I like the feel of this part.
+					// If we are along a side towards the bottom, put the icon below the window
+					if (window.center.y > Screen.height / 2)
+					{
+						center.y = window.yMax + icon.height / 2;
+					}
+
+					// Along the left side, align the left edge of the icon with the left edge of the window.
+					if (window.xMax > Screen.width - icon.width)
+					{
+						center.x = window.xMax - icon.width / 2;
+					}
+					// Along the right side, align the right edge of the icon with the right edge of the window.
+					else if (window.xMin < icon.width)
+					{
+						center.x = window.xMin + icon.width / 2;
+					}
+				}
+			}
+
+			// Assign the vector to the center of the rect.
+			icon.center = center;
+
+			// Return the icon's position.
+			return icon;
+		}
 				
 		private static ScreenMessage debugmsg = new ScreenMessage("", 2f, ScreenMessageStyle.UPPER_RIGHT);
 

--- a/VOID.csproj
+++ b/VOID.csproj
@@ -22,7 +22,7 @@
     <ConsolePause>false</ConsolePause>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="xcopy /Y ${ProjectDir}\bin\Debug\*.dll ..\..\..\Games\KSP_win\GameData\VOID\Plugins\" workingdir="${ProjectDir}" externalConsole="True" />
+        <Command type="AfterBuild" command="/usr/bin/cp -fv ${ProjectDir}/bin/Debug/VOID.dll /mnt/games/ssd/KSP_linux/GameData/VOID/Plugins/" />
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -35,7 +35,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <CustomCommands>
       <CustomCommands>
-        <Command type="AfterBuild" command="xcopy /Y ${ProjectDir}\bin\Release\*.dll ..\..\..\Games\KSP_win\GameData\VOID\Plugins\" workingdir="${ProjectDir}" externalConsole="True" />
+        <Command type="AfterBuild" command="/usr/bin/cp -fv ${ProjectDir}/bin/Release/VOID.dll /mnt/games/ssd/KSP_linux/GameData/VOID/Plugins/" />
       </CustomCommands>
     </CustomCommands>
   </PropertyGroup>
@@ -56,16 +56,21 @@
     <Compile Include="VOID_Rendezvous.cs" />
     <Compile Include="VOID_VesselRegister.cs" />
     <Compile Include="VOID_DataLogger.cs" />
+    <Compile Include="VOID_EditorCore.cs" />
+    <Compile Include="VOID_EditorHUD.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="Assembly-CSharp">
-      <HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
+      <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
+      <Private>False</Private>
     </Reference>
     <Reference Include="UnityEngine">
-      <HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\UnityEngine.dll</HintPath>
+      <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\UnityEngine.dll</HintPath>
+      <Private>False</Private>
     </Reference>
     <Reference Include="System">
-      <HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\System.dll</HintPath>
+      <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\System.dll</HintPath>
+      <Private>False</Private>
     </Reference>
   </ItemGroup>
   <ItemGroup>

--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -46,14 +46,22 @@
 
 		public void Awake()
 		{
-			Tools.PostDebugMessage ("VOIDLightMaster: Waking up.");
+			Tools.PostDebugMessage ("VOIDFlightMaster: Waking up.");
 			this.Core = (VOID_Core)VOID_Core.Instance;
-			this.Core.StartGUI ();
+			this.Core.ResetGUI ();
 			Tools.PostDebugMessage ("VOIDFlightMaster: Awake.");
 		}
 
 		public void Update()
 		{
+			if (!HighLogic.LoadedSceneIsFlight && this.Core != null)
+			{
+				this.Core.SaveConfig ();
+				this.Core = null;
+				VOID_Core.Reset();
+				return;
+			}
+
 			if (this.Core == null)
 			{
 				this.Awake();
@@ -63,7 +71,8 @@
 
 			if (this.Core.vessel != null)
 			{
-				SimManager.Instance.Gravity = VOID_Core.Instance.vessel.mainBody.gravParameter / Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
+				SimManager.Instance.Gravity = VOID_Core.Instance.vessel.mainBody.gravParameter /
+					Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
 				SimManager.Instance.TryStartSimulation();
 			}
 
@@ -77,7 +86,7 @@
 
 		public void FixedUpdate()
 		{
-			if (this.Core == null)
+			if (this.Core == null || !HighLogic.LoadedSceneIsFlight)
 			{
 				return;
 			}
@@ -95,5 +104,64 @@
 			this.Core.OnGUI();
 		}
     }
+
+	[KSPAddon(KSPAddon.Startup.EditorAny, false)]
+	public class VOIDEditorMaster : MonoBehaviour
+	{
+		protected VOID_EditorCore Core;
+
+		public void Awake()
+		{
+			Tools.PostDebugMessage ("VOIDEditorMaster: Waking up.");
+			this.Core = VOID_EditorCore.Instance;
+			this.Core.ResetGUI ();
+			Tools.PostDebugMessage ("VOIDEditorMaster: Awake.");
+		}
+
+		public void Update()
+		{
+			if (!HighLogic.LoadedSceneIsEditor && this.Core != null)
+			{
+				this.Core.SaveConfig ();
+				this.Core = null;
+				VOID_EditorCore.Reset();
+				return;
+			}
+
+			if (this.Core == null)
+			{
+				this.Awake();
+			}
+
+			this.Core.Update ();
+
+			if (this.Core.factoryReset)
+			{
+				KSP.IO.File.Delete<VOID_EditorCore>("config.xml");
+				this.Core = null;
+				VOID_EditorCore.Reset();
+			}
+		}
+
+		public void FixedUpdate()
+		{
+			if (this.Core == null || !HighLogic.LoadedSceneIsEditor)
+			{
+				return;
+			}
+
+			this.Core.FixedUpdate ();
+		}
+
+		public void OnGUI()
+		{
+			if (this.Core == null)
+			{
+				return;
+			}
+
+			this.Core.OnGUI();
+		}
+	}
 }
 

--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -68,7 +68,7 @@
 		 * Fields
 		 * */
 		protected string VoidName = "VOID";
-		protected string VoidVersion = "0.9.9";
+		protected string VoidVersion = "0.9.11";
 
 		protected bool _factoryReset = false;
 
@@ -130,8 +130,9 @@
 
 		public float saveTimer = 0;
 
-		protected string defaultSkin = "KSP window 2";
-		protected VOID_SaveValue<int> _skinIdx = int.MinValue;
+		[AVOID_SaveValue("defaultSkin")]
+		protected VOID_SaveValue<string> defaultSkin = "KSP window 2";
+		protected int _skinIdx = int.MinValue;
 		protected List<GUISkin> skin_list;
 		protected string[] forbiddenSkins =
 		{
@@ -246,6 +247,13 @@
 				));
 			foreach (var voidType in types)
 			{
+				if (!HighLogic.LoadedSceneIsEditor &&
+				    typeof(IVOID_EditorModule).IsAssignableFrom(voidType)
+				    )
+				{
+					continue;
+				}
+
 				Tools.PostDebugMessage (string.Format (
 					"{0}: found Type {1}",
 					this.GetType ().Name,
@@ -287,19 +295,22 @@
 			));
 		}
 
+		protected void Preload_BeforeUpdate()
+		{
+			if (!this.bodiesLoaded)
+			{
+				this.LoadAllBodies();
+			}
+
+			if (!this.vesselTypesLoaded)
+			{
+				this.LoadVesselTypes();
+			}
+		}
+
 		public void Update()
 		{
-			this.saveTimer += Time.deltaTime;
-
-			if (!this.bodiesLoaded)
-			{
-				this.LoadAllBodies();
-			}
-
-			if (!this.vesselTypesLoaded)
-			{
-				this.LoadVesselTypes();
-			}
+			this.Preload_BeforeUpdate ();
 
 			if (!this.guiRunning)
 			{
@@ -332,11 +343,7 @@
 				}
 			}
 
-			if (this.saveTimer > 2f)
-			{
-				this.SaveConfig ();
-				this.saveTimer = 0;
-			}
+			this.CheckAndSave ();
 		}
 
 		public void FixedUpdate()
@@ -427,16 +434,48 @@
 			this.vesselTypesLoaded = true;
 		}
 
+		protected void CheckAndSave()
+		{
+			this.saveTimer += Time.deltaTime;
+
+			Tools.PostDebugMessage (string.Format (
+				"{0}: Checking if time to save; saveTimer: {1}",
+				this.GetType ().Name,
+				this.saveTimer
+			));
+
+			if (this.saveTimer > 2f)
+			{
+				Tools.PostDebugMessage (string.Format (
+					"{0}: Time to save, checking if configDirty: {1}",
+					this.GetType ().Name,
+					this.configDirty
+					));
+
+				if (!this.configDirty)
+				{
+					return;
+				}
+
+				this.SaveConfig ();
+				this.saveTimer = 0;
+			}
+		}
+
 		public void VOIDMainWindow(int _)
 		{
 			GUILayout.BeginVertical();
 			
-			if (this.powerAvailable)
-			{
-				string str = "ON";
-				if (togglePower) str = "OFF";
-				if (GUILayout.Button("Power " + str)) togglePower = !togglePower;
-			    if (togglePower)
+			if (this.powerAvailable || HighLogic.LoadedSceneIsEditor)
+			{
+				if (!HighLogic.LoadedSceneIsEditor)
+				{
+					string str = "ON";
+					if (togglePower) str = "OFF";
+					if (GUILayout.Button("Power " + str)) togglePower = !togglePower;
+				}
+
+				if (togglePower || HighLogic.LoadedSceneIsEditor)
 			    {
 					foreach (IVOID_Module module in this.Modules)
 					{
@@ -470,9 +509,12 @@
 
 		public override void DrawConfigurables()
 		{
-			this.consumeResource = GUILayout.Toggle (this.consumeResource, "Consume Resources");
-
-			this.VOIDIconLocked = GUILayout.Toggle (this.VOIDIconLocked, "Lock Icon Position");
+			if (HighLogic.LoadedSceneIsFlight)
+			{
+				this.consumeResource = GUILayout.Toggle (this.consumeResource, "Consume Resources");
+
+				this.VOIDIconLocked = GUILayout.Toggle (this.VOIDIconLocked, "Lock Icon Position");
+			}
 
 			GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 
@@ -486,7 +528,12 @@
 			{
 				this._skinIdx--;
 				if (this._skinIdx < 0) this._skinIdx = skin_list.Count - 1;
-				Tools.PostDebugMessage("[VOID] new this._skin = " + this._skinIdx + " :: skin_list.Count = " + skin_list.Count);
+				Tools.PostDebugMessage (string.Format (
+					"{0}: new this._skinIdx = {1} :: skin_list.Count = {2}",
+					this.GetType().Name,
+					this._skinIdx,
+					this.skin_list.Count
+				));
 			}
 
 			string skin_name = skin_list[this._skinIdx].name;
@@ -500,7 +547,17 @@
 			{
 				this._skinIdx++;
 				if (this._skinIdx >= skin_list.Count) this._skinIdx = 0;
-				Tools.PostDebugMessage("[VOID] new this._skin = " + this._skinIdx + " :: skin_list.Count = " + skin_list.Count);
+				Tools.PostDebugMessage (string.Format (
+					"{0}: new this._skinIdx = {1} :: skin_list.Count = {2}",
+					this.GetType().Name,
+					this._skinIdx,
+					this.skin_list.Count
+					));
+			}
+
+			if (this.Skin.name != this.defaultSkin)
+			{
+				this.defaultSkin = this.Skin.name;
 			}
 
 			GUILayout.EndHorizontal();
@@ -515,6 +572,25 @@
 
 		public void OnGUI()
 		{
+			if (Event.current.type == EventType.Repaint)
+			{
+				return;
+			}
+
+			Tools.PostDebugMessage(string.Format(
+				"Event.current.type: {0}" +
+				"\nthis.VOIDIconLocked: {1}" +
+				"\nEvent.current.mousePosition: {2}" +
+				"\nVOIDIconPos: ({3}, {4}),({5}, {6})",
+				Event.current.type,
+				this.VOIDIconLocked,
+				Event.current.mousePosition,
+				this.VOIDIconPos.value.xMin,
+				this.VOIDIconPos.value.yMin,
+				this.VOIDIconPos.value.xMax,
+				this.VOIDIconPos.value.yMax
+				));
+
 			if (!this.VOIDIconLocked &&
 			    VOIDIconPos.value.Contains(Event.current.mousePosition)
 			    && Event.current.type == EventType.mouseDrag
@@ -588,6 +664,8 @@
 					GUILayout.Height (50)
 				);
 
+				_mainWindowPos = Tools.ClampRectToScreen (_mainWindowPos);
+
 				if (_mainWindowPos != this.mainWindowPos)
 				{
 					this.mainWindowPos = _mainWindowPos;
@@ -607,6 +685,8 @@
 					GUILayout.Height (50)
 				);
 
+				_configWindowPos = Tools.ClampRectToScreen (_configWindowPos);
+
 				if (_configWindowPos != this.configWindowPos)
 				{
 					this.configWindowPos = _configWindowPos;
@@ -614,6 +694,19 @@
 			}
 		}
 
+		public void ResetGUI()
+		{
+			this.StopGUI ();
+
+			foreach (IVOID_Module module in this.Modules)
+			{
+				module.StopGUI ();
+				module.StartGUI ();
+			}
+
+			this.StartGUI ();
+		}
+
 		public override void LoadConfig()
 		{
 			base.LoadConfig ();
@@ -626,11 +719,6 @@
 
 		public void SaveConfig()
 		{
-			if (!this.configDirty)
-			{
-				return;
-			}
-
 			var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> ();
 			config.load ();
 

--- /dev/null
+++ b/VOID_EditorCore.cs
@@ -1,1 +1,136 @@
+//
+//  VOID_EditorCore.cs
+//
+//  Author:
+//       toadicus <>
+//
+//  Copyright (c) 2013 toadicus
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using Engineer.VesselSimulator;
+using KSP;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
 
+namespace VOID
+{
+	public class VOID_EditorCore : VOID_Core
+	{
+		/*
+		 * Static Members
+		 * */
+		protected new static bool _initialized = false;
+		public new static bool Initialized
+		{
+			get 
+			{
+				return _initialized;
+			}
+		}
+
+		protected new static VOID_EditorCore _instance;
+		public new static VOID_EditorCore Instance
+		{
+			get
+			{
+				if (_instance == null)
+				{
+					_instance = new VOID_EditorCore();
+					_initialized = true;
+				}
+				return _instance;
+			}
+		}
+
+		public new static void Reset()
+		{
+			if (_initialized)
+			{
+				_instance.StopGUI();
+				_instance = null;
+				_initialized = false;
+			}
+		}
+
+		public VOID_EditorCore() : base()
+		{
+			this._Name = "VOID Editor Core";
+		}
+
+		public new void OnGUI() {}
+
+		public override void DrawGUI()
+		{
+			if (!this._modulesLoaded)
+			{
+				this.LoadModulesOfType<IVOID_EditorModule>();
+			}
+
+			Rect _iconPos = Tools.DockToWindow (this.VOIDIconPos, this.mainWindowPos);
+
+			_iconPos = Tools.ClampRectToScreen (_iconPos, (int)_iconPos.width, (int)_iconPos.height);
+
+			if (_iconPos != this.VOIDIconPos)
+			{
+				this.VOIDIconPos = _iconPos;
+			}
+
+			base.DrawGUI();
+		}
+
+		public new void Update()
+		{
+			foreach (IVOID_EditorModule module in this.Modules)
+			{
+				if (EditorLogic.startPod == null)
+				{
+					module.StopGUI();
+					continue;
+				}
+				if (HighLogic.LoadedSceneIsEditor && module.toggleActive && EditorLogic.SortedShipList.Any())
+				{
+					module.StartGUI();
+				}
+				if (!HighLogic.LoadedSceneIsEditor || !module.toggleActive || !EditorLogic.SortedShipList.Any())
+				{
+					module.StopGUI();
+				}
+			}
+
+			if (EditorLogic.startPod == null || !HighLogic.LoadedSceneIsEditor)
+			{
+				this.StopGUI();
+				return;
+			}
+			else if (!this.guiRunning && HighLogic.LoadedSceneIsEditor)
+			{
+				this.StartGUI();
+			}
+
+			if (EditorLogic.SortedShipList.Count > 0)
+			{
+				SimManager.Instance.Gravity = 9.08665;
+				SimManager.Instance.TryStartSimulation();
+			}
+
+			this.CheckAndSave ();
+		}
+
+		public new void FixedUpdate() {}
+	}
+}
+
+

file:b/VOID_EditorHUD.cs (new)
--- /dev/null
+++ b/VOID_EditorHUD.cs
@@ -1,1 +1,139 @@
+//
+//  VOID_Hud.cs
+//
+//  Author:
+//       toadicus <>
+//
+//  Copyright (c) 2013 toadicus
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
 
+using Engineer.VesselSimulator;
+using KSP;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VOID
+{
+	public class VOID_EditorHUD : VOID_Module, IVOID_EditorModule
+	{
+		/*
+		 * Fields
+		 * */
+		[AVOID_SaveValue("colorIndex")]
+		protected VOID_SaveValue<int> _colorIndex = 0;
+
+		protected List<Color> textColors = new List<Color>();
+
+		protected GUIStyle labelStyle;
+
+		/*
+		 * Properties
+		 * */
+		public int ColorIndex
+		{
+			get
+			{
+				return this._colorIndex;
+			}
+			set
+			{
+				if (this._colorIndex >= this.textColors.Count - 1)
+				{
+					this._colorIndex = 0;
+					return;
+				}
+
+				this._colorIndex = value;
+			}
+		}
+
+		/* 
+		 * Methods
+		 * */
+		public VOID_EditorHUD() : base()
+		{
+			this._Name = "Heads-Up Display";
+
+			this._Active = true;
+
+			this.textColors.Add(Color.green);
+			this.textColors.Add(Color.black);
+			this.textColors.Add(Color.white);
+			this.textColors.Add(Color.red);
+			this.textColors.Add(Color.blue);
+			this.textColors.Add(Color.yellow);
+			this.textColors.Add(Color.gray);
+			this.textColors.Add(Color.cyan);
+			this.textColors.Add(Color.magenta);
+
+			this.labelStyle = new GUIStyle ();
+			// this.labelStyle.alignment = TextAnchor.UpperRight;
+			this.labelStyle.normal.textColor = this.textColors [this.ColorIndex];
+
+			Tools.PostDebugMessage (this.GetType().Name + ": Constructed.");
+		}
+
+		public override void DrawGUI()
+		{
+			SimManager.Instance.RequestSimulation();
+
+			if (SimManager.Instance.LastStage == null)
+			{
+				return;
+			}
+
+			float hudLeft;
+
+			if (EditorLogic.fetch.editorScreen == EditorLogic.EditorScreen.Parts)
+			{
+				hudLeft = EditorPanels.Instance.partsPanelWidth + 10;
+			}
+			else if (EditorLogic.fetch.editorScreen == EditorLogic.EditorScreen.Actions)
+			{
+				hudLeft = EditorPanels.Instance.actionsPanelWidth + 10;
+			}
+			else
+			{
+				return;
+			}
+
+			Rect hudPos = new Rect (hudLeft, 48, 300, 32);
+
+			// GUI.skin = AssetBase.GetGUISkin("KSP window 2");
+
+			labelStyle.normal.textColor = textColors [ColorIndex];
+
+			GUI.Label (
+				hudPos,
+				"Total Mass: " + SimManager.Instance.LastStage.totalMass.ToString("F3") + "t" +
+				" Part Count: " + EditorLogic.SortedShipList.Count +
+				"\nTotal Delta-V: " + Tools.MuMech_ToSI(SimManager.Instance.LastStage.totalDeltaV) + "m/s" +
+				"\nBottom Stage Delta-V: " + Tools.MuMech_ToSI(SimManager.Instance.LastStage.deltaV) + "m/s" +
+				"\nBottom Stage T/W Ratio: " + SimManager.Instance.LastStage.thrustToWeight.ToString("F3"),
+				labelStyle);
+		}
+
+		public override void DrawConfigurables()
+		{
+			if (GUILayout.Button ("Change HUD color", GUILayout.ExpandWidth (false)))
+			{
+				++this.ColorIndex;
+			}
+		}
+	}
+}
+

--- a/VOID_Module.cs
+++ b/VOID_Module.cs
@@ -81,7 +81,7 @@
 		 * */
 		public void StartGUI()
 		{
-			if (!this.toggleActive)
+			if (!this.toggleActive || this.guiRunning)
 			{
 				return;
 			}
@@ -93,6 +93,10 @@
 
 		public void StopGUI()
 		{
+			if (!this.guiRunning)
+			{
+				return;
+			}
 			Tools.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name));
 			RenderingManager.RemoveFromPostDrawQueue (3, this.DrawGUI);
 			this._Running = false;
@@ -204,6 +208,8 @@
 				GUILayout.Height(this.defHeight)
 			);
 
+			_Pos = Tools.ClampRectToScreen (_Pos);
+
 			if (_Pos != this.WindowPos)
 			{
 				this.WindowPos = _Pos;

--- a/VOID_SaveValue.cs
+++ b/VOID_SaveValue.cs
@@ -77,10 +77,17 @@
 			VOID_SaveValue<T> r = new VOID_SaveValue<T>();
 			r.value = v;
 			r.type = v.GetType();
+
 			if (VOID_Core.Initialized)
 			{
 				VOID_Core.Instance.configDirty = true;
 			}
+
+			if (VOID_EditorCore.Initialized)
+			{
+				VOID_EditorCore.Instance.configDirty = true;
+			}
+
 			return r;
 		}