private const string _noteTextKey = @"edtNote";
private const string _swAutostart = @"swAutostart";
private const string _btnRunKey = @"btnRun";
+ private const string _btnSnapKey = @"btnSnap";
private ILogger Logger;
private PersistedConfiguration configuration;
public AutomapGUIDialog(ICoreClientAPI capi, AutomapSystem ams, PersistedConfiguration cfg) : base(capi)
{
-
+ configuration = cfg;
Logger = capi.Logger;
SetupDialog();
capi.Event.RegisterEventBusListener(AutomapStatusMsg, 1.0D, AutomapSystem.AutomapStatusEventKey);
- configuration = cfg;
}
public AutomapGUIDialog(ICoreClientAPI capi) : base(capi)
txtNoteArea.fixedHeight = 24;
txtNoteArea.fixedWidth = 256;
+ ElementBounds btnSnapshotArea = btnNoteArea.CopyOffsetedSibling(0, 64, 2, 5);
+ btnNoteArea.fixedHeight = 24;
+ btnNoteArea.fixedWidth = 28;
+
this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
.AddShadedDialogBG(bgBounds)
.AddDynamicText("Idle.", CairoFont.WhiteSmallText().WithFontSize(12), EnumTextOrientation.Left, txtStatusBounds, _statusTextKey)
.AddTextInput(txtNoteArea, null, CairoFont.WhiteMediumText().WithFontSize(16), _noteTextKey)
.AddButton("Note:", CreateNote, btnNoteArea, CairoFont.ButtonText())
+ .AddButton("Snapshot!", TriggerSnapshot, btnSnapshotArea, CairoFont.ButtonText( ), key: _btnSnapKey)
.Compose();
//Controls for ALL Block & Entity Designators (Enable/Disable) <-- block edits while in 'Run' state
//_automapSystem.Entity_Designators
//Renderer selection
//Message verbosity? Speed?
-
-
+ var swAutostart = this.SingleComposer.GetSwitch(_swAutostart);
+ swAutostart.On = this.configuration.Autostart;
}
var txtNote = this.SingleComposer.GetTextInput(_noteTextKey);
if (!String.IsNullOrWhiteSpace(txtNote.GetText()))
{
- noteCmd.Notation = txtNote.GetText();
+ noteCmd.Notation = txtNote.GetText().Replace("\n", " ");
txtNote.SetValue(string.Empty);
capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, noteCmd);
return true;//FINDOUT: What does this DO?
}
+ private bool TriggerSnapshot( )
+ {
+ var snappyCmd = new CommandData(CommandType.Snapshot);
+
+ capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, snappyCmd);
+
+ return true;//FINDOUT: What does this DO?
+ }
+
private void AutostartChange(bool startValue)
{
configuration.Autostart = startValue;
statusText.SetNewText($"State: {lastState}, Total: {totalShards}, Delta: ±{changesThisTick} Nulls: {voidShards} ");
if (!btnRun.On) btnRun.SetValue(true);
-
- LockGUIElements(true);
+
}
else if (lastState == CommandType.Stop && btnRun.Enabled) {
statusText.SetNewText($"State: {lastState}, Total: {totalShards}, Nulls: {voidShards} ");
if (btnRun.On) btnRun.SetValue(false);
-
- LockGUIElements(true);
+
}
}
- private void LockGUIElements(bool state)
- {
- var swAutostart = this.SingleComposer.GetSwitch(_swAutostart);
-
- swAutostart.Enabled = state;
- }
}
}