OSDN Git Service

indentation
[automap/automap.git] / Automap / Subsystems / AutomapGUIDialog.cs
index 615aa30..3fbdac1 100644 (file)
@@ -17,9 +17,9 @@ namespace Automap
 
                private long dashTickHandle;
 
-               public override string ToggleKeyCombinationCode {
-                       get
-                       {
+               public override string ToggleKeyCombinationCode
+               {
+                       get {
                                return _automapControlPanelKey;
                        }
                }
@@ -28,53 +28,53 @@ namespace Automap
                private RunState lastState;
 
 
-               public AutomapGUIDialog(ICoreClientAPI capi,AutomapSystem ams) : base(capi)
-       {
+               public AutomapGUIDialog(ICoreClientAPI capi, AutomapSystem ams) : base(capi)
+               {
+
+                       Logger = capi.Logger;
+                       SetupDialog();
+                       capi.Event.RegisterEventBusListener(AutomapStatusMsg, 1.0D, AutomapSystem.AutomapStatusEventKey);
 
-               Logger = capi.Logger;
-               SetupDialog( );
-               capi.Event.RegisterEventBusListener(AutomapStatusMsg, 1.0D, AutomapSystem.AutomapStatusEventKey);
-               
                }
 
                //Event for GUI status display
 
-               private void 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(0, 72, 5, 2);
-               toggleBounds.fixedHeight = 24;
-               toggleBounds.fixedWidth = 64;
-
-               ElementBounds txtStatusBounds = textBounds.CopyOffsetedSibling(0, 26, 2, 4);
-               txtStatusBounds.fixedHeight = 16;
-               txtStatusBounds.percentWidth = 1;
-
-               ElementBounds btnNoteArea = textBounds.CopyOffsetedSibling(0, 42, 2, 5);
-               btnNoteArea.fixedHeight = 24;
-               btnNoteArea.fixedWidth = 20;
-
-               ElementBounds txtNoteArea = btnNoteArea.CopyOffsetedSibling(64, 0, 1, 6);
-               txtNoteArea.fixedHeight = 24;
-               txtNoteArea.fixedWidth = 256;
-
-
-               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")
-                       .AddDynamicText("Idle.", CairoFont.WhiteSmallText( ).WithFontSize(12), EnumTextOrientation.Left, txtStatusBounds, _statusTextKey)
-                       .AddTextInput(txtNoteArea,null,CairoFont.WhiteMediumText().WithFontSize(16),_noteTextKey)
-                       .AddButton("Note:",CreateNote,btnNoteArea,CairoFont.ButtonText())
-                       .Compose( );
+                       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(0, 72, 5, 2);
+                       toggleBounds.fixedHeight = 24;
+                       toggleBounds.fixedWidth = 64;
+
+                       ElementBounds txtStatusBounds = textBounds.CopyOffsetedSibling(0, 26, 2, 4);
+                       txtStatusBounds.fixedHeight = 16;
+                       txtStatusBounds.percentWidth = 1;
+
+                       ElementBounds btnNoteArea = textBounds.CopyOffsetedSibling(0, 42, 2, 5);
+                       btnNoteArea.fixedHeight = 24;
+                       btnNoteArea.fixedWidth = 20;
+
+                       ElementBounds txtNoteArea = btnNoteArea.CopyOffsetedSibling(64, 0, 1, 6);
+                       txtNoteArea.fixedHeight = 24;
+                       txtNoteArea.fixedWidth = 256;
+
+
+                       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")
+                               .AddDynamicText("Idle.", CairoFont.WhiteSmallText().WithFontSize(12), EnumTextOrientation.Left, txtStatusBounds, _statusTextKey)
+                               .AddTextInput(txtNoteArea, null, CairoFont.WhiteMediumText().WithFontSize(16), _noteTextKey)
+                               .AddButton("Note:", CreateNote, btnNoteArea, CairoFont.ButtonText())
+                               .Compose();
 
                        //Controls for ALL Block & Entity Designators (Enable/Disable)
                        //_automapSystem.BlockID_Designators
@@ -86,9 +86,9 @@ namespace Automap
 
                }
 
-               private void OnTitleBarCloseClicked( )
+               private void OnTitleBarCloseClicked()
                {
-               TryClose( );
+                       TryClose();
                }
 
                /// <summary>
@@ -98,51 +98,54 @@ namespace Automap
                /// <param name="toggle">Run.</param>
                internal void RunToggle(bool toggle)
                {
-               Logger.VerboseDebug("Dialog Changed; [ Automap Enabled: {0} ]", toggle);
-               var statusText = this.SingleComposer.GetDynamicText(_statusTextKey);
-                       statusText.SetNewText($"State: {(toggle? "Run": "Halt" )}, Total: {totalShards}, Nulls: {voidShards} " );
+                       Logger.VerboseDebug("Dialog Changed; [ Automap Enabled: {0} ]", toggle);
+                       var statusText = this.SingleComposer.GetDynamicText(_statusTextKey);
+                       statusText.SetNewText($"State: {(toggle ? "Run" : "Halt")}, Total: {totalShards}, Nulls: {voidShards} ");
 
-               CommandData cmd;
+                       CommandData cmd;
 
-               if (toggle) {
-               dashTickHandle = capi.Event.RegisterGameTickListener(UpdateDashDisplay, 6001);
-               cmd = new CommandData(toggle ? RunState.Run : RunState.Stop, new bool[ ] { true, true, true, true, true });
-               }
-               else {
-               capi.Event.UnregisterGameTickListener(dashTickHandle);
-               cmd = new CommandData(toggle ? RunState.Run : RunState.Stop);
-               }
-                                       
-               capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, cmd);
+                       if (toggle)
+                       {
+                               dashTickHandle = capi.Event.RegisterGameTickListener(UpdateDashDisplay, 6001);
+                               cmd = new CommandData(toggle ? RunState.Run : RunState.Stop, new bool[] { true, true, true, true, true });
+                       }
+                       else
+                       {
+                               capi.Event.UnregisterGameTickListener(dashTickHandle);
+                               cmd = new CommandData(toggle ? RunState.Run : RunState.Stop);
+                       }
+
+                       capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, cmd);
                }
 
-               private bool CreateNote( )
+               private bool CreateNote()
                {
-               var noteCmd = new CommandData(RunState.Notation);
-               var txtNote = this.SingleComposer.GetTextInput(_noteTextKey);
-               if (!String.IsNullOrWhiteSpace(txtNote.GetText( ))) {
-               noteCmd.Notation = txtNote.GetText( );
-               txtNote.SetValue(string.Empty);
+                       var noteCmd = new CommandData(RunState.Notation);
+                       var txtNote = this.SingleComposer.GetTextInput(_noteTextKey);
+                       if (!String.IsNullOrWhiteSpace(txtNote.GetText()))
+                       {
+                               noteCmd.Notation = txtNote.GetText();
+                               txtNote.SetValue(string.Empty);
 
-               capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, noteCmd);
-               }
-               return false;//???
+                               capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, noteCmd);
+                       }
+                       return false;//???
                }
 
                private void AutomapStatusMsg(string eventName, ref EnumHandling handling, IAttribute data)
                {
-               Logger.VerboseDebug("MsgBus RX: AutomapStatusMsg");
-               StatusData realData = data as StatusData;
-               totalShards = realData.TotalUpdates;
-               voidShards = realData.VoidChunks;
-               changesThisTick = realData.Delta;
-               lastState = realData.CurrentState;
+                       Logger.VerboseDebug("MsgBus RX: AutomapStatusMsg");
+                       StatusData realData = data as StatusData;
+                       totalShards = realData.TotalUpdates;
+                       voidShards = realData.VoidChunks;
+                       changesThisTick = realData.Delta;
+                       lastState = realData.CurrentState;
                }
 
-               private void UpdateDashDisplay(float delay )
+               private void UpdateDashDisplay(float delay)
                {
-               var statusText = this.SingleComposer.GetDynamicText(_statusTextKey);
-               statusText.SetNewText($"State: {lastState}, Total: {totalShards}, Delta: {changesThisTick} Nulls: {voidShards} ");
+                       var statusText = this.SingleComposer.GetDynamicText(_statusTextKey);
+                       statusText.SetNewText($"State: {lastState}, Total: {totalShards}, Delta: {changesThisTick} Nulls: {voidShards} ");
 
 
                }