// private as you can't make one private OutputScrollWindow() : base(400, 300) { 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.Checked = false; filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(SetCorrectFilterOutputBehavior); 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 = true; autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); manualEntryTopToBottomLayout.AddChild(topBarControls); } { outputScrollWidget = new OutputScroll(); //outputScrollWidget.Height = 100; outputScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; outputScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; outputScrollWidget.HAnchor = HAnchor.ParentLeftRight; outputScrollWidget.VAnchor = VAnchor.ParentBottomTop; outputScrollWidget.Margin = new BorderDouble(0,5); outputScrollWidget.Padding = new BorderDouble(3, 0); manualEntryTopToBottomLayout.AddChild(outputScrollWidget); } 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) => { 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); } AddHandlers(); AddChild(topLeftToRightLayout); SetCorrectFilterOutputBehavior(this, null); this.AnchorAll(); Title = LocalizedString.Get("MatterControl - Terminal"); this.ShowAsSystemWindow(); MinimumSize = new Vector2(Width, Height); }
// private as you can't make one private OutputScrollWindow() : base(400, 300) { this.BackgroundColor = backgroundColor; this.Padding = new BorderDouble(5); FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget(); topLeftToRightLayout.AnchorAll(); { FlowLayoutWidget manualEntryTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualEntryTopToBottomLayout.VAnchor |= Agg.UI.VAnchor.ParentTop; manualEntryTopToBottomLayout.Padding = new BorderDouble(5); { FlowLayoutWidget OutputWindowsLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); OutputWindowsLayout.HAnchor |= HAnchor.ParentLeft; string filterOutputChkTxt = new LocalizedString("Filter Output").Translated; filterOutput = new CheckBox(filterOutputChkTxt); filterOutput.Margin = new BorderDouble(5, 5, 5, 2); filterOutput.Checked = false; filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(SetCorrectFilterOutputBehavior); OutputWindowsLayout.AddChild(filterOutput); string autoUpperCaseChkTxt = new LocalizedString("Auto Uppercase").Translated; autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = true; autoUppercase.TextColor = this.textColor; OutputWindowsLayout.AddChild(autoUppercase); monitorPrinterTemperature = new CheckBox("Monitor Temperature"); monitorPrinterTemperature.Margin = new BorderDouble(5, 5, 5, 2); monitorPrinterTemperature.Checked = PrinterCommunication.Instance.MonitorPrinterTemperature; monitorPrinterTemperature.TextColor = this.textColor; monitorPrinterTemperature.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(monitorPrinterTemperature_CheckedStateChanged); manualEntryTopToBottomLayout.AddChild(OutputWindowsLayout); } { FlowLayoutWidget OutputWindowsLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); OutputWindowsLayout.VAnchor = VAnchor.ParentBottomTop; outputScrollWidget = new OutputScroll(); outputScrollWidget.Height = 100; outputScrollWidget.BackgroundColor = RGBA_Bytes.White; outputScrollWidget.HAnchor = HAnchor.ParentLeftRight; outputScrollWidget.VAnchor = VAnchor.ParentBottomTop; outputScrollWidget.Margin = new BorderDouble(0, 5); OutputWindowsLayout.AddChild(outputScrollWidget); manualEntryTopToBottomLayout.AddChild(outputScrollWidget); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget(""); manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White; manualCommandTextEdit.HAnchor = HAnchor.ParentLeftRight; manualCommandTextEdit.VAnchor = VAnchor.ParentCenter; manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed); manualCommandTextEdit.ActualTextEditWidget.KeyDown += new KeyEventHandler(manualCommandTextEdit_KeyDown); manualEntryLayout.AddChild(manualCommandTextEdit); sendCommand = controlButtonFactory.Generate(new LocalizedString("Send").Translated); sendCommand.Margin = new BorderDouble(5, 0); sendCommand.Click += new ButtonBase.ButtonEventHandler(sendManualCommandToPrinter_Click); manualEntryLayout.AddChild(sendCommand); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddHandlers(); AddChild(topLeftToRightLayout); SetCorrectFilterOutputBehavior(this, null); this.AnchorAll(); Title = new LocalizedString("MatterControl - Terminal").Translated; this.ShowAsSystemWindow(); MinimumSize = new Vector2(Width, Height); }