public TerminalWidget(bool showInWindow) { this.BackgroundColor = backgroundColor; 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(top: 8); { FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight); topBarControls.HAnchor |= HAnchor.ParentLeft; string autoUpperCaseChkTxt = LocalizedString.Get("Auto Uppercase"); autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = true; autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); manualEntryTopToBottomLayout.AddChild(topBarControls); } { FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.AnchorAll(); textScrollWidget = new TextScrollWidget(PrinterOutputCache.Instance.PrinterLines); //outputScrollWidget.Height = 100; textScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; textScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; textScrollWidget.HAnchor = HAnchor.ParentLeftRight; textScrollWidget.VAnchor = VAnchor.ParentBottomTop; textScrollWidget.Margin = new BorderDouble(0, 5); textScrollWidget.Padding = new BorderDouble(3, 0); leftToRight.AddChild(textScrollWidget); TextScrollBar textScrollBar = new TextScrollBar(textScrollWidget, 15); leftToRight.AddChild(textScrollBar); manualEntryTopToBottomLayout.AddChild(leftToRight); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget(""); //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); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear")); clearConsoleButton.Margin = new BorderDouble(0); clearConsoleButton.Click += (sender, e) => { PrinterOutputCache.Instance.Clear(); }; //Output Console text to screen Button exportConsoleTextButton = controlButtonFactory.Generate(LocalizedString.Get("Export...")); exportConsoleTextButton.Click += (sender, mouseEvent) => { UiThread.RunOnIdle(DoExportExportLog_Click); }; Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close")); closeButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseWindow); }; sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send")); sendCommand.Click += new EventHandler(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(exportConsoleTextButton); bottomRowContainer.AddChild(new HorizontalSpacer()); if (showInWindow) { bottomRowContainer.AddChild(closeButton); } manualEntryTopToBottomLayout.AddChild(bottomRowContainer); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddChild(topLeftToRightLayout); this.AnchorAll(); }
public TerminalWidget(bool showInWindow) { this.Name = "TerminalWidget"; this.BackgroundColor = backgroundColor; 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(top: 8); { FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight); topBarControls.HAnchor |= HAnchor.ParentLeft; { string filterOutputChkTxt = LocalizedString.Get("Filter Output"); filterOutput = new CheckBox(filterOutputChkTxt); filterOutput.Margin = new BorderDouble(5, 5, 5, 2); filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += (object sender, EventArgs e) => { if (filterOutput.Checked) { textScrollWidget.SetLineStartFilter(new string[] { "<-wait", "<-ok", "->M105", "<-T" }); } else { textScrollWidget.SetLineStartFilter(null); } UserSettings.Instance.Fields.SetBool(TerminalFilterOutputKey, filterOutput.Checked); }; filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(filterOutput); } { string autoUpperCaseChkTxt = LocalizedString.Get("Auto Uppercase"); autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = UserSettings.Instance.Fields.GetBool(TerminalAutoUppercaseKey, true); autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); autoUppercase.CheckedStateChanged += (sender, e) => { UserSettings.Instance.Fields.SetBool(TerminalAutoUppercaseKey, autoUppercase.Checked); }; manualEntryTopToBottomLayout.AddChild(topBarControls); } } { FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.AnchorAll(); textScrollWidget = new TextScrollWidget(PrinterOutputCache.Instance.PrinterLines); //outputScrollWidget.Height = 100; Debug.WriteLine(PrinterOutputCache.Instance.PrinterLines); textScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; textScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; textScrollWidget.HAnchor = HAnchor.ParentLeftRight; textScrollWidget.VAnchor = VAnchor.ParentBottomTop; textScrollWidget.Margin = new BorderDouble(0, 5); textScrollWidget.Padding = new BorderDouble(3, 0); leftToRight.AddChild(textScrollWidget); TextScrollBar textScrollBar = new TextScrollBar(textScrollWidget, 15); leftToRight.AddChild(textScrollBar); manualEntryTopToBottomLayout.AddChild(leftToRight); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget("", typeFace: ApplicationController.MonoSpacedTypeFace); //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); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear")); clearConsoleButton.Margin = new BorderDouble(0); clearConsoleButton.Click += (sender, e) => { PrinterOutputCache.Instance.Clear(); }; //Output Console text to screen Button exportConsoleTextButton = controlButtonFactory.Generate(LocalizedString.Get("Export...")); exportConsoleTextButton.Click += (sender, mouseEvent) => { UiThread.RunOnIdle(DoExportExportLog_Click); }; Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close")); closeButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseWindow); }; sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send")); sendCommand.Click += new EventHandler(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(exportConsoleTextButton); bottomRowContainer.AddChild(new HorizontalSpacer()); if (showInWindow) { bottomRowContainer.AddChild(closeButton); } manualEntryTopToBottomLayout.AddChild(bottomRowContainer); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddChild(topLeftToRightLayout); this.AnchorAll(); }
public TerminalWidget(bool showInWindow) { this.BackgroundColor = backgroundColor; 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(top: 8); { FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight); topBarControls.HAnchor |= HAnchor.ParentLeft; { string filterOutputChkTxt = LocalizedString.Get("Filter Output"); filterOutput = new CheckBox(filterOutputChkTxt); filterOutput.Margin = new BorderDouble(5, 5, 5, 2); filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += (object sender, EventArgs e) => { if (filterOutput.Checked) { textScrollWidget.SetLineStartFilter(new string[] { "<-wait", "<-ok", "->M105", "<-T" }); } else { textScrollWidget.SetLineStartFilter(null); } UserSettings.Instance.Fields.SetBool(TerminalFilterOutputKey, filterOutput.Checked); }; filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(filterOutput); } { string autoUpperCaseChkTxt = LocalizedString.Get("Auto Uppercase"); autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = UserSettings.Instance.Fields.GetBool(TerminalAutoUppercaseKey, true); autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); autoUppercase.CheckedStateChanged += (sender, e) => { UserSettings.Instance.Fields.SetBool(TerminalAutoUppercaseKey, autoUppercase.Checked); }; manualEntryTopToBottomLayout.AddChild(topBarControls); } } { FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.AnchorAll(); textScrollWidget = new TextScrollWidget(PrinterOutputCache.Instance.PrinterLines); //outputScrollWidget.Height = 100; textScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; textScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; textScrollWidget.HAnchor = HAnchor.ParentLeftRight; textScrollWidget.VAnchor = VAnchor.ParentBottomTop; textScrollWidget.Margin = new BorderDouble(0, 5); textScrollWidget.Padding = new BorderDouble(3, 0); leftToRight.AddChild(textScrollWidget); TextScrollBar textScrollBar = new TextScrollBar(textScrollWidget, 15); leftToRight.AddChild(textScrollBar); manualEntryTopToBottomLayout.AddChild(leftToRight); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget(""); //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); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear")); clearConsoleButton.Margin = new BorderDouble(0); clearConsoleButton.Click += (sender, e) => { PrinterOutputCache.Instance.Clear(); }; //Output Console text to screen Button exportConsoleTextButton = controlButtonFactory.Generate(LocalizedString.Get("Export...")); exportConsoleTextButton.Click += (sender, mouseEvent) => { UiThread.RunOnIdle(DoExportExportLog_Click); }; Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close")); closeButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseWindow); }; sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send")); sendCommand.Click += new EventHandler(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(exportConsoleTextButton); bottomRowContainer.AddChild(new HorizontalSpacer()); if (showInWindow) { bottomRowContainer.AddChild(closeButton); } manualEntryTopToBottomLayout.AddChild(bottomRowContainer); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddChild(topLeftToRightLayout); this.AnchorAll(); }