Organised the key binding system and implemented saving/loading of set key binds.
[VesselSimulator.git] / KerbalEngineer / Editor / BuildAdvanced.cs
blob:a/KerbalEngineer/Editor/BuildAdvanced.cs -> blob:b/KerbalEngineer/Editor/BuildAdvanced.cs
--- a/KerbalEngineer/Editor/BuildAdvanced.cs
+++ b/KerbalEngineer/Editor/BuildAdvanced.cs
@@ -24,6 +24,7 @@
     using KeyBinding;
     using Settings;
     using UIControls;
+    using Unity;
     using UnityEngine;
     using VesselSimulator;
 
@@ -547,6 +548,14 @@
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
+            GUILayout.Label("Key Bindings:", settingStyle);
+            if (GUILayout.Button("EDIT KEY BINDINGS", buttonStyle, GUILayout.Width(200.0f * GuiDisplaySize.Offset)))
+            {
+                KeyBinder.Show();
+            }
+            GUILayout.EndHorizontal();
+
+            GUILayout.BeginHorizontal();
             GUILayout.Label("GUI Size: " + GuiDisplaySize.Increment, settingStyle);
             if (GUILayout.Button("<", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)))
             {
@@ -561,17 +570,6 @@
             GUILayout.Label("Minimum delay between simulations: " + SimManager.minSimTime.TotalMilliseconds + "ms", settingStyle);
             GUI.skin = HighLogic.Skin;
             SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f));
-
-            GUILayout.BeginHorizontal();
-            if (GUILayout.Button("Editor Show/Hide Key: " + KeyBinder.EditorShowHide, buttonStyle, GUILayout.Width(200.0f * GuiDisplaySize.Offset)))
-            {
-                KeyBindPopup.Show("Flight Show/Hide", KeyBinder.EditorShowHide, keyCode => KeyBinder.EditorShowHide = keyCode);
-            }
-            if (GUILayout.Button("Flight Show/Hide Key: " + KeyBinder.FlightShowHide, buttonStyle, GUILayout.Width(200.0f * GuiDisplaySize.Offset)))
-            {
-                KeyBindPopup.Show("Flight Show/Hide", KeyBinder.FlightShowHide, keyCode => KeyBinder.FlightShowHide = keyCode);
-            }
-            GUILayout.EndHorizontal();
 
             GUI.skin = null;
         }
@@ -814,11 +812,15 @@
                 // When not in compact mode draw the 'All Stages' and 'Atmospheric' toggles.
                 if (!compactMode)
                 {
-                    if (GUI.Toggle(new Rect(position.width - 143.0f * GuiDisplaySize.Offset, 5.0f, 70.0f * GuiDisplaySize.Offset, 20.0f), showSettings, "SETTINGS", buttonStyle) != showSettings)
+                    if (GUI.Button(new Rect(position.width - 143.0f * GuiDisplaySize.Offset, 5.0f, 70.0f * GuiDisplaySize.Offset, 20.0f), "SETTINGS", buttonStyle))
                     {
-                        hasChanged = true;
-                        showSettings = !showSettings;
+                        SettingsWindow.Open();
                     }
+                    //if (GUI.Toggle(new Rect(position.width - 143.0f * GuiDisplaySize.Offset, 5.0f, 70.0f * GuiDisplaySize.Offset, 20.0f), showSettings, "SETTINGS", buttonStyle) != showSettings)
+                    //{
+                    //    hasChanged = true;
+                    //    showSettings = !showSettings;
+                    //}
 
                     if (GUI.Toggle(new Rect(position.width - 226.0f * GuiDisplaySize.Offset, 5.0f, 80.0f * GuiDisplaySize.Offset, 20.0f), showAllStages, "ALL STAGES", buttonStyle) != showAllStages)
                     {