VOID_HUD.cs: Added Experiment Situation indication to the Biome line.
VOID_HUD.cs: Added Experiment Situation indication to the Biome line.

--- a/ToolbarButtonWrapper.cs
+++ b/ToolbarButtonWrapper.cs
@@ -134,7 +134,8 @@
 		protected PropertyInfo ButtonEnalbed;
 		protected PropertyInfo ButtonImportant;
 		protected EventInfo ButtonOnClick;
-		protected System.Type ClickHandlerType;
+		protected EventInfo ButtonOnMouseEnter;
+		protected EventInfo ButtonOnMouseLeave;
 		protected MethodInfo ButtonDestroy;
 		protected System.Type GameScenesVisibilityType;
 
@@ -368,13 +369,28 @@
 			));
 
 			this.ButtonOnClick = this.IButton.GetEvent("OnClick");
-			this.ClickHandlerType = this.ButtonOnClick.EventHandlerType;
-
-			Tools.PostDebugMessage(string.Format(
-				"{0}: Got 'OnClick' event '{1}'.  Getting 'Destroy' method.",
+
+			Tools.PostDebugMessage(string.Format(
+				"{0}: Got 'OnClick' event '{1}'.  Getting 'OnMouseEnter' event.",
 				this.GetType().Name,
 				this.ButtonOnClick.ToString()
 			));
+
+			this.ButtonOnMouseEnter = this.IButton.GetEvent("OnMouseEnter");
+
+			Tools.PostDebugMessage(string.Format(
+				"{0}: Got 'OnMouseEnter' event '{1}'.  Getting 'OnMouseLeave' event.",
+				this.GetType().Name,
+				this.ButtonOnClick.ToString()
+				));
+
+			this.ButtonOnMouseLeave = this.IButton.GetEvent("OnMouseLeave");
+
+			Tools.PostDebugMessage(string.Format(
+				"{0}: Got 'OnMouseLeave' event '{1}'.  Getting 'Destroy' method.",
+				this.GetType().Name,
+				this.ButtonOnClick.ToString()
+				));
 
 			this.ButtonDestroy = this.IButton.GetMethod("Destroy");
 
@@ -415,9 +431,47 @@
 		/// <param name="Handler">Delegate to handle "on click" events</param>
 		public void AddButtonClickHandler(Action<object> Handler)
 		{
-			Delegate d = Delegate.CreateDelegate(this.ClickHandlerType, Handler.Target, Handler.Method);
-			MethodInfo addHandler = this.ButtonOnClick.GetAddMethod();
-			addHandler.Invoke(this.Button, new object[] { d });
+			this.AddButtonEventHandler(this.ButtonOnClick, Handler);
+		}
+
+		/// <summary>
+		/// Adds event handler that can be registered with to receive "on mouse enter" events.
+		/// </summary>
+		/// <example>
+		/// <code>
+		/// ToolbarWrapperButton button = ...
+		/// button.AddButtonOnMouseEnterHandler(
+		/// 	(e) =>
+		/// 	{
+		/// 		Debug.Log("mouse entered button");
+		/// 	}
+		/// );
+		/// </code>
+		/// </example>
+		/// <param name="Handler">Delegate to handle "OnMouseEnter" events.</param>
+		public void AddButtonOnMouseEnterHandler(Action<object> Handler)
+		{
+			this.AddButtonEventHandler(this.ButtonOnMouseEnter, Handler);
+		}
+
+		/// <summary>
+		/// Adds event handler that can be registered with to receive "on mouse leave" events.
+		/// </summary>
+		/// <example>
+		/// <code>
+		/// ToolbarWrapperButton button = ...
+		/// button.AddButtonOnMouseLeaveHandler(
+		/// 	(e) =>
+		/// 	{
+		/// 		Debug.Log("mouse left button");
+		/// 	}
+		/// );
+		/// </code>
+		/// </example>
+		/// <param name="Handler">Delegate to handle "OnMouseLeave" events.</param>
+		public void AddButtonOnMouseLeaveHandler(Action<object> Handler)
+		{
+			this.AddButtonEventHandler(this.ButtonOnMouseLeave, Handler);
 		}
 
 		/// <summary>
@@ -438,6 +492,14 @@
 		{
 			this.ButtonDestroy.Invoke(this.Button, null);
 		}
+
+		// Utility method for use with the AddButton<event>Handler API methods.
+		protected void AddButtonEventHandler(EventInfo Event, Action<object> Handler)
+		{
+			Delegate d = Delegate.CreateDelegate(Event.EventHandlerType, Handler.Target, Handler.Method);
+			MethodInfo addHandler = Event.GetAddMethod();
+			addHandler.Invoke(this.Button, new object[] { d });
+		}
 	}
 }
 

file:a/Tools.cs -> file:b/Tools.cs
--- a/Tools.cs
+++ b/Tools.cs
@@ -959,6 +959,59 @@
 			return icon;
 		}
 
+		public static ExperimentSituations GetExperimentSituation(this Vessel vessel)
+		{
+			Vessel.Situations situation = vessel.situation;
+
+			switch (situation)
+			{
+				case Vessel.Situations.PRELAUNCH:
+				case Vessel.Situations.LANDED:
+					return ExperimentSituations.SrfLanded;
+				case Vessel.Situations.SPLASHED:
+					return ExperimentSituations.SrfSplashed;
+				case Vessel.Situations.FLYING:
+					if (vessel.altitude < (double)vessel.mainBody.scienceValues.flyingAltitudeThreshold)
+					{
+						return ExperimentSituations.FlyingLow;
+					}
+					else
+					{
+						return ExperimentSituations.FlyingHigh;
+					}
+			}
+
+			if (vessel.altitude < (double)vessel.mainBody.scienceValues.spaceAltitudeThreshold)
+			{
+				return ExperimentSituations.InSpaceLow;
+			}
+			else
+			{
+				return ExperimentSituations.InSpaceHigh;
+			}
+		}
+
+		public static string HumanString(this ExperimentSituations situation)
+		{
+			switch (situation)
+			{
+				case ExperimentSituations.FlyingHigh:
+					return "Upper Atmosphere";
+				case ExperimentSituations.FlyingLow:
+					return "Flying";
+				case ExperimentSituations.SrfLanded:
+					return "Surface";
+				case ExperimentSituations.InSpaceLow:
+					return "Near in Space";
+				case ExperimentSituations.InSpaceHigh:
+					return "High in Space";
+				case ExperimentSituations.SrfSplashed:
+					return "Splashed Down";
+				default:
+					return "Unknown";
+			}
+		}
+
 		private static ScreenMessage debugmsg = new ScreenMessage("", 2f, ScreenMessageStyle.UPPER_RIGHT);
 
 		[System.Diagnostics.Conditional("DEBUG")]

--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -113,7 +113,8 @@
 					" Lon: " + Tools.GetLongitudeString (vessel, "F3") +
 					"\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " +
 					Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) +
-					"\nBiome: " + Tools.Toadicus_GetAtt (vessel).name,
+					"\nBiome: " + Tools.Toadicus_GetAtt (vessel).name +
+					" Sit: " + vessel.GetExperimentSituation().HumanString(),
 					VOID_Core.Instance.LabelStyles["hud"]);
 			}
 			else