Show part info tooltips for highlighted parts.
Show part info tooltips for highlighted parts.

--- a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
+++ b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
@@ -1,7 +1,7 @@
 // 
 //     Kerbal Engineer Redux
 // 
-//     Copyright (C) 2014 CYBUTEK
+//     Copyright (C) 2016 CYBUTEK
 // 
 //     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
@@ -12,10 +12,9 @@
 //     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/>.
-// 
+//  
 
 namespace KerbalEngineer.Editor
 {
@@ -102,7 +101,7 @@
                     return;
                 }
 
-                position = GUILayout.Window(GetInstanceID(), position, Window, String.Empty, BuildOverlay.WindowStyle);
+                position = GUILayout.Window(GetInstanceID(), position, Window, string.Empty, BuildOverlay.WindowStyle);
             }
             catch (Exception ex)
 
@@ -131,7 +130,16 @@
                     position.x = Input.mousePosition.x - 3 - position.width;
                 }
 
-                part = EditorLogic.fetch.ship.parts.Find(p => p.stackIcon.Highlighted) ?? EditorLogic.SelectedPart;
+                RaycastHit rayHit;
+                if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out rayHit))
+                {
+                    part = rayHit.transform.GetComponent<Part>();
+                }
+                else
+                {
+                    part = EditorLogic.fetch.ship.parts.Find(p => p.highlighter.highlighted) ?? EditorLogic.SelectedPart;
+                }
+
                 if (part != null)
                 {
                     if (!part.Equals(selectedPart))

--- a/KerbalEngineer/Logger.cs
+++ b/KerbalEngineer/Logger.cs
@@ -19,31 +19,30 @@
 
 #region Using Directives
 
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-
-using UnityEngine;
-
 #endregion
 
 namespace KerbalEngineer
 {
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.IO;
+    using System.Reflection;
+    using UnityEngine;
+
     [KSPAddon(KSPAddon.Startup.Instantly, false)]
     public class Logger : MonoBehaviour
     {
+        #region Fields
+
+        private static readonly List<string[]> messages = new List<string[]>();
+
+        #endregion
+
         #region Constants
 
         private static readonly string fileName;
         private static readonly AssemblyName assemblyName;
-
-        #endregion
-
-        #region Fields
-
-        private static readonly List<string[]> messages = new List<string[]>();
 
         #endregion
 
@@ -86,50 +85,58 @@
             {
                 try
                 {
-                    if (obj is IEnumerable)
+                    messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, GetObjString(obj)});
+                }
+                catch (Exception ex)
+                {
+                    Exception(ex);
+                }
+            }
+        }
+
+        public static void Log(string name, object obj)
+        {
+            lock (messages)
+            {
+                try
+                {
+                    messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, name + "\n" + GetObjString(obj)});
+                }
+                catch (Exception ex)
+                {
+                    Exception(ex);
+                }
+            }
+        }
+
+        private static string GetObjString(object obj, int tabs = 0)
+        {
+            string objString;
+            string tabString = string.Empty;
+            for (int i = 0; i < tabs; i++)
+            {
+                tabString += " ";
+            }
+
+            if (obj != null)
+            {
+                objString = tabString + obj;
+
+                IEnumerable items = obj as IEnumerable;
+                if (items != null)
+                {
+                    foreach (object item in items)
                     {
-                        messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, obj.ToString()});
-                        foreach (var o in obj as IEnumerable)
-                        {
-                            messages.Add(new[] {"\t", o.ToString()});
-                        }
+                        objString += "\n" + GetObjString(item, tabs + 1);
                     }
-                    else
-                    {
-                        messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, obj.ToString()});
-                    }
-                }
-                catch (Exception ex)
-                {
-                    Exception(ex);
-                }
-            }
-        }
-
-        public static void Log(string name, object obj)
-        {
-            lock (messages)
-            {
-                try
-                {
-                    if (obj is IEnumerable)
-                    {
-                        messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, name});
-                        foreach (var o in obj as IEnumerable)
-                        {
-                            messages.Add(new[] {"\t", o.ToString()});
-                        }
-                    }
-                    else
-                    {
-                        messages.Add(new[] {"Log " + DateTime.Now.TimeOfDay, obj.ToString()});
-                    }
-                }
-                catch (Exception ex)
-                {
-                    Exception(ex);
-                }
-            }
+                }
+            }
+            else
+            {
+                objString = "Null";
+            }
+
+            return objString;
         }
 
         public static void Log(string message)
@@ -186,9 +193,9 @@
             {
                 if (messages.Count > 0)
                 {
-                    using (var file = File.AppendText(fileName))
+                    using (StreamWriter file = File.AppendText(fileName))
                     {
-                        foreach (var message in messages)
+                        foreach (string[] message in messages)
                         {
                             file.WriteLine(message.Length > 0 ? message.Length > 1 ? "[" + message[0] + "]: " + message[1] : message[0] : string.Empty);
                             if (message.Length > 0)