OSDN Git Service

indentation
[automap/automap.git] / Automap / Subsystems / AutomapGUIDialog.cs
index 3958d03..c46e6aa 100644 (file)
@@ -6,84 +6,74 @@ using Vintagestory.API.Common;
 
 namespace Automap
 {
-       public class AutomapGUIDialog : GuiDialog
-       {
-               public const string _automapControlPanelKey = "automapControlPanelKey";
-
-               private ILogger Logger;
-               private AutomapSystem _automapSystem;
-
-               public override string ToggleKeyCombinationCode {
-                       get
-                       {
-                               return _automapControlPanelKey;
-                       }
-               }
-
-               public AutomapGUIDialog(ICoreClientAPI capi,AutomapSystem ams) : base(capi)
-       {
-               _automapSystem = ams;
-               Logger = capi.Logger;
-               SetupDialog( );
-               }
-
-               //Event for GUI status display
-
-               private void SetupDialog( )
-               {
-               ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithAlignment(EnumDialogArea.CenterMiddle);
-                                       
-               ElementBounds textBounds = ElementBounds.Fixed(0, 40, 500, 300);
-               
-               ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);
-               bgBounds.BothSizing = ElementSizing.FitToChildren;
-               bgBounds.WithChildren(textBounds);
-
-               ElementBounds toggleBounds = textBounds.CopyOffsetedSibling(3, 26, 5, 2);
-               toggleBounds.fixedHeight = 24;
-               toggleBounds.fixedWidth = 64;
-
-               ElementBounds txtStatusBounds = textBounds.CopyOffsetedSibling(0, 20, 2, 4);
-               txtStatusBounds.fixedHeight = 16;
-               txtStatusBounds.percentWidth = 1;
-
-
-               this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
-                       .AddShadedDialogBG(bgBounds)
-                       .AddDialogTitleBar("Automap Controls", OnTitleBarCloseClicked)
-                       .AddStaticText("Configure Automap settings:", CairoFont.WhiteDetailText( ), textBounds)
-                       .AddToggleButton("Run", CairoFont.ButtonText( ), RunToggle, toggleBounds, "btnRun")
-                       .AddStaticText("Idle.", CairoFont.WhiteSmallText( ).WithFontSize(12), txtStatusBounds, "txtStatus")
-                       .Compose( );
-
-                       //Controls for ALL Block & Entity Designators (Enable/Disable)
-                       //_automapSystem.BlockID_Designators
-                       //_automapSystem.Entity_Designators
-                       //Renderer selection
-                       //Message verbosity? Speed?
-
-                       //A Button to add POI - notes manually (when AM running)
-
-               }
-
-               private void OnTitleBarCloseClicked( )
-               {
-               TryClose( );
-               }
-
-               /// <summary>
-               /// Toggle Automap from/to RUN state
-               /// </summary>
-               /// <returns>The toggle.</returns>
-               /// <param name="t1">T1.</param>
-               internal void RunToggle(bool toggle)
-               {
-               _automapSystem.Enabled = toggle;
-               Logger.VerboseDebug("Dialog Changed; [ Automap Enabled: {0} ]", toggle);
-               var statusText = this.SingleComposer.GetStaticText("txtStatus");
-               statusText.SetValue($"Running: {this._automapSystem.Enabled}, Total: {this._automapSystem.updatedChunksTotal}, Nulls: {this._automapSystem.nullChunkCount} " );
-
-               }
-       }
+    public class AutomapGUIDialog : GuiDialog
+    {
+        public const string _automapControlPanelKey = "automapControlPanelKey";
+
+        private ILogger Logger;
+        private AutomapSystem _automapSystem;
+
+        public override string ToggleKeyCombinationCode
+        {
+            get
+            {
+                return _automapControlPanelKey;
+            }
+        }
+
+        public AutomapGUIDialog(ICoreClientAPI capi, AutomapSystem ams) : base(capi)
+        {
+            _automapSystem = ams;
+            Logger = capi.Logger;
+            SetupDialog();
+        }
+
+        private void SetupDialog()
+        {
+            ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithAlignment(EnumDialogArea.CenterMiddle);
+
+            ElementBounds textBounds = ElementBounds.Fixed(0, 40, 500, 300);
+
+            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);
+            bgBounds.BothSizing = ElementSizing.FitToChildren;
+            bgBounds.WithChildren(textBounds);
+
+            ElementBounds toggleBounds = textBounds.CopyOffsetedSibling(3, 5, 5, 2);
+            toggleBounds.fixedHeight = 18;
+            toggleBounds.fixedWidth = 50;
+
+            ElementBounds txtStatusBounds = textBounds.CopyOffsetedSibling(0, 20, 2, 4);
+            txtStatusBounds.fixedHeight = 16;
+            txtStatusBounds.percentWidth = 1;
+
+
+            this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
+                .AddShadedDialogBG(bgBounds)
+                .AddDialogTitleBar("Automap Controls", OnTitleBarCloseClicked)
+                .AddStaticText("Configure Automap settings:", CairoFont.WhiteDetailText(), textBounds)
+                .AddToggleButton("Run", CairoFont.ButtonText(), RunToggle, toggleBounds, "btnRun")
+                .AddStaticText("Idle.", CairoFont.WhiteSmallText().WithFontSize(12), txtStatusBounds, "txtStatus")
+                .Compose();
+        }
+
+        private void OnTitleBarCloseClicked()
+        {
+            TryClose();
+        }
+
+        /// <summary>
+        /// Toggle Automap from/to RUN state
+        /// </summary>
+        /// <returns>The toggle.</returns>
+        /// <param name="t1">T1.</param>
+        internal void RunToggle(bool toggle)
+        {
+            _automapSystem.Enabled = toggle;
+            Logger.VerboseDebug("Dialog Changed; [ Automap Enabled: {0} ]", toggle);
+            var statusText = this.SingleComposer.GetStaticText("txtStatus");
+            statusText.SetValue($"Running: {this._automapSystem.Enabled}, Total: {this._automapSystem.updatedChunksTotal}, Nulls: {this._automapSystem.nullChunkCount} ");
+
+        }
+    }
 }