Added close and clear button to terminal window. Terminal window ui cleanup.
This commit is contained in:
parent
9e623a2f4a
commit
c2721f5ef5
3 changed files with 61 additions and 25 deletions
|
|
@ -81,15 +81,14 @@ namespace MatterHackers.MatterControl
|
|||
: base(400, 300)
|
||||
{
|
||||
this.BackgroundColor = backgroundColor;
|
||||
this.Padding = new BorderDouble(5);
|
||||
|
||||
this.Padding = new BorderDouble(5, 0);
|
||||
FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget();
|
||||
topLeftToRightLayout.AnchorAll();
|
||||
|
||||
{
|
||||
FlowLayoutWidget manualEntryTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
manualEntryTopToBottomLayout.VAnchor |= Agg.UI.VAnchor.ParentTop;
|
||||
manualEntryTopToBottomLayout.Padding = new BorderDouble(5);
|
||||
manualEntryTopToBottomLayout.Padding = new BorderDouble(top:8);
|
||||
|
||||
{
|
||||
FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
|
|
@ -113,28 +112,19 @@ namespace MatterHackers.MatterControl
|
|||
autoUppercase.TextColor = this.textColor;
|
||||
autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||
topBarControls.AddChild(autoUppercase);
|
||||
|
||||
topBarControls.AddChild(new HorizontalSpacer());
|
||||
|
||||
Button clearConsol = controlButtonFactory.Generate(LocalizedString.Get("Clear"));
|
||||
clearConsol.Margin = new BorderDouble(5, 0);
|
||||
clearConsol.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||
clearConsol.Click += (sender, e) =>
|
||||
{
|
||||
outputScrollWidget.Clear();
|
||||
};
|
||||
topBarControls.AddChild(clearConsol);
|
||||
|
||||
manualEntryTopToBottomLayout.AddChild(topBarControls);
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
outputScrollWidget = new OutputScroll();
|
||||
outputScrollWidget.Height = 100;
|
||||
outputScrollWidget.BackgroundColor = RGBA_Bytes.White;
|
||||
//outputScrollWidget.Height = 100;
|
||||
outputScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
outputScrollWidget.TextColor = ActiveTheme.Instance.SecondaryTextColor;
|
||||
outputScrollWidget.HAnchor = HAnchor.ParentLeftRight;
|
||||
outputScrollWidget.VAnchor = VAnchor.ParentBottomTop;
|
||||
outputScrollWidget.Margin = new BorderDouble(0, 5);
|
||||
outputScrollWidget.Margin = new BorderDouble(0,5);
|
||||
outputScrollWidget.Padding = new BorderDouble(3, 0);
|
||||
|
||||
manualEntryTopToBottomLayout.AddChild(outputScrollWidget);
|
||||
}
|
||||
|
|
@ -144,20 +134,47 @@ namespace MatterHackers.MatterControl
|
|||
manualEntryLayout.HAnchor = HAnchor.ParentLeftRight;
|
||||
{
|
||||
manualCommandTextEdit = new MHTextEditWidget("");
|
||||
manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White;
|
||||
//manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White;
|
||||
manualCommandTextEdit.Margin = new BorderDouble(right: 3);
|
||||
manualCommandTextEdit.HAnchor = HAnchor.ParentLeftRight;
|
||||
manualCommandTextEdit.VAnchor = VAnchor.ParentBottom;
|
||||
manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed);
|
||||
manualCommandTextEdit.ActualTextEditWidget.KeyDown += new KeyEventHandler(manualCommandTextEdit_KeyDown);
|
||||
manualEntryLayout.AddChild(manualCommandTextEdit);
|
||||
|
||||
sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send"));
|
||||
sendCommand.Margin = new BorderDouble(5, 0);
|
||||
sendCommand.Click += new ButtonBase.ButtonEventHandler(sendManualCommandToPrinter_Click);
|
||||
manualEntryLayout.AddChild(sendCommand);
|
||||
manualEntryLayout.AddChild(manualCommandTextEdit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
manualEntryTopToBottomLayout.AddChild(manualEntryLayout);
|
||||
|
||||
Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear"));
|
||||
clearConsoleButton.Margin = new BorderDouble(0);
|
||||
clearConsoleButton.Click += (sender, e) =>
|
||||
{
|
||||
outputScrollWidget.Clear();
|
||||
};
|
||||
|
||||
|
||||
Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close"));
|
||||
closeButton.Click += (sender, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(CloseWindow);
|
||||
};
|
||||
|
||||
sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send"));
|
||||
sendCommand.Click += new ButtonBase.ButtonEventHandler(sendManualCommandToPrinter_Click);
|
||||
|
||||
FlowLayoutWidget bottomRowContainer = new FlowLayoutWidget();
|
||||
bottomRowContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
bottomRowContainer.Margin = new BorderDouble(0, 3);
|
||||
|
||||
bottomRowContainer.AddChild(sendCommand);
|
||||
bottomRowContainer.AddChild(clearConsoleButton);
|
||||
bottomRowContainer.AddChild(new HorizontalSpacer());
|
||||
bottomRowContainer.AddChild(closeButton);
|
||||
|
||||
manualEntryTopToBottomLayout.AddChild(bottomRowContainer);
|
||||
manualEntryTopToBottomLayout.AnchorAll();
|
||||
|
||||
topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout);
|
||||
|
|
@ -180,6 +197,13 @@ namespace MatterHackers.MatterControl
|
|||
PrinterConnectionAndCommunication.Instance.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CloseWindow(object state)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
// make sure we are not holding onto this window (keeping a pointer that can't be garbage collected).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue