Added cloneable readouts and separator module.
Added cloneable readouts and separator module.

--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Misc/Separator.cs
@@ -1,1 +1,51 @@
-
+// 

+//     Kerbal Engineer Redux

+// 

+//     Copyright (C) 2014 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

+//     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/>.

+// 

+

+#region Using Directives

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.Flight.Readouts.Misc

+{

+    public class Separator : ReadoutModule

+    {

+        private readonly Texture2D texture;

+

+        public Separator()

+        {

+            this.Name = "Separator";

+            this.Category = ReadoutCategory.Misc;

+            this.HelpString = string.Empty;

+            this.IsDefault = false;

+            this.Cloneable = true;

+

+            this.texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);

+            this.texture.SetPixel(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.5f));

+            this.texture.Apply();

+        }

+

+        public override void Draw()

+        {

+            GUILayout.Box(string.Empty, GUIStyle.none, new[] {GUILayout.Width(this.ContentWidth), GUILayout.Height(1.0f)});

+            GUI.DrawTexture(GUILayoutUtility.GetLastRect(), this.texture, ScaleMode.StretchToFill);

+        }

+    }

+}

--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -126,6 +126,7 @@
             this.readoutModules.Add(new Rendezvous.OrbitalPeriod());

 

             // Misc

+            this.readoutModules.Add(new Separator());

             this.readoutModules.Add(new  ChangeGuiSize());

 

             this.LoadHelpStrings();


--- a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
@@ -54,6 +54,8 @@
         public bool ResizeRequested { get; set; }

 

         public bool IsDefault { get; set; }

+

+        public bool Cloneable { get; set; }

 

         /// <summary>

         ///     Gets ans sets the readout category.


--- a/KerbalEngineer/Flight/Sections/SectionEditor.cs
+++ b/KerbalEngineer/Flight/Sections/SectionEditor.cs
@@ -18,8 +18,6 @@
 // 

 

 #region Using Directives

-

-using System;

 

 using KerbalEngineer.Extensions;

 using KerbalEngineer.Flight.Readouts;

@@ -41,10 +39,10 @@
 

         #region Fields

 

-        private int windowId;

         private Vector2 scrollPositionAvailable;

         private Vector2 scrollPositionInstalled;

         private ReadoutCategory selectedCategory = ReadoutCategory.Orbital;

+        private int windowId;

         private Rect windowPosition;

 

         #endregion

@@ -292,7 +290,7 @@
 

             foreach (var readout in ReadoutLibrary.Instance.GetCategory(this.selectedCategory))

             {

-                if (!this.ParentSection.ReadoutModules.Contains(readout))

+                if (!this.ParentSection.ReadoutModules.Contains(readout) || readout.Cloneable)

                 {

                     GUILayout.BeginHorizontal(GUILayout.Height(30.0f));

                     GUILayout.Label(readout.Name, this.readoutNameStyle);

@@ -320,33 +318,36 @@
             GUI.skin = null;

 

             GUILayout.Label("INSTALLED", this.panelTitleStyle);

-            ReadoutModule removeReadout = null;

-            foreach (var readout in this.ParentSection.ReadoutModules)

-            {

+            var removeReadout = false;

+            var removeReadoutIndex = 0;

+

+            for (var i = 0; i < this.ParentSection.ReadoutModules.Count; i++)

+            {

+                var readout = this.ParentSection.ReadoutModules[i];

+

                 GUILayout.BeginHorizontal(GUILayout.Height(30.0f));

                 GUILayout.Label(readout.Name, this.readoutNameStyle);

                 if (GUILayout.Button("▲", this.readoutButtonStyle, GUILayout.Width(30.0f)))

                 {

-                    var index = this.ParentSection.ReadoutModules.IndexOf(readout);

-                    if (index > 0)

+                    if (i > 0)

                     {

-                        this.ParentSection.ReadoutModules[index] = this.ParentSection.ReadoutModules[index - 1];

-                        this.ParentSection.ReadoutModules[index - 1] = readout;

+                        this.ParentSection.ReadoutModules[i] = this.ParentSection.ReadoutModules[i - 1];

+                        this.ParentSection.ReadoutModules[i - 1] = readout;

                     }

                 }

                 if (GUILayout.Button("▼", this.readoutButtonStyle, GUILayout.Width(30.0f)))

                 {

-                    var index = this.ParentSection.ReadoutModules.IndexOf(readout);

-                    if (index < this.ParentSection.ReadoutModules.Count - 1)

+                    if (i < this.ParentSection.ReadoutModules.Count - 1)

                     {

-                        this.ParentSection.ReadoutModules[index] = this.ParentSection.ReadoutModules[index + 1];

-                        this.ParentSection.ReadoutModules[index + 1] = readout;

+                        this.ParentSection.ReadoutModules[i] = this.ParentSection.ReadoutModules[i + 1];

+                        this.ParentSection.ReadoutModules[i + 1] = readout;

                     }

                 }

                 readout.ShowHelp = GUILayout.Toggle(readout.ShowHelp, "?", this.readoutButtonStyle, GUILayout.Width(30.0f));

                 if (GUILayout.Button("REMOVE", this.readoutButtonStyle, GUILayout.Width(125.0f)))

                 {

-                    removeReadout = readout;

+                    removeReadout = true;

+                    removeReadoutIndex = i;

                 }

                 GUILayout.EndHorizontal();

 

@@ -355,9 +356,9 @@
 

             GUILayout.EndScrollView();

 

-            if (removeReadout != null)

-            {

-                this.ParentSection.ReadoutModules.Remove(removeReadout);

+            if (removeReadout)

+            {

+                this.ParentSection.ReadoutModules.RemoveAt(removeReadoutIndex);

             }

         }

 


--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -61,6 +61,7 @@
     <Compile Include="CelestialBodies.cs" />

     <Compile Include="Editor\BuildToolbar.cs" />

     <Compile Include="Flight\FlightEngineerPartless.cs" />

+    <Compile Include="Flight\Readouts\Misc\Separator.cs" />

     <Compile Include="Flight\Readouts\Misc\ChangeGuiSize.cs" />

     <Compile Include="Flight\Readouts\Surface\ImpactBiome.cs" />

     <Compile Include="Flight\Readouts\Surface\Slope.cs" />


 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ