private GuiWidget CreateXYGridControl(XYZColors colors, double distanceBetweenControls, double buttonSeparationDistance) { ActiveSliceSettings.SettingChanged.RegisterEvent(Printer_SettingChanged, ref unregisterEvents); GuiWidget xyGrid = new GuiWidget(); { FlowLayoutWidget xButtons = new FlowLayoutWidget(); { xButtons.HAnchor |= HAnchor.Center; xButtons.VAnchor |= VAnchor.Center; xMinusControl = theme.CreateMoveButton(printer, "X-", PrinterConnection.Axis.X, printer.Settings.XSpeed()); xMinusControl.ToolTipText = "Move X negative".Localize(); xButtons.AddChild(xMinusControl); // spacer xButtons.AddChild(new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 1) { VAnchor = VAnchor.Center, BackgroundColor = colors.XColor }); xPlusControl = theme.CreateMoveButton(printer, "X+", PrinterConnection.Axis.X, printer.Settings.XSpeed()); xPlusControl.ToolTipText = "Move X positive".Localize(); xButtons.AddChild(xPlusControl); } xyGrid.AddChild(xButtons); FlowLayoutWidget yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { yButtons.HAnchor |= HAnchor.Center; yButtons.VAnchor |= VAnchor.Center; yPlusControl = theme.CreateMoveButton(printer, "Y+", PrinterConnection.Axis.Y, printer.Settings.YSpeed()); yPlusControl.ToolTipText = "Move Y positive".Localize(); yButtons.AddChild(yPlusControl); // spacer yButtons.AddChild(new GuiWidget(1, buttonSeparationDistance) { HAnchor = HAnchor.Center, BackgroundColor = colors.YColor }); yMinusControl = theme.CreateMoveButton(printer, "Y-", PrinterConnection.Axis.Y, printer.Settings.YSpeed()); yMinusControl.ToolTipText = "Move Y negative".Localize(); yButtons.AddChild(yMinusControl); } xyGrid.AddChild(yButtons); } xyGrid.HAnchor = HAnchor.Fit; xyGrid.VAnchor = VAnchor.Fit; xyGrid.VAnchor = VAnchor.Bottom; xyGrid.Margin = new BorderDouble(0, 5, distanceBetweenControls, 5); return(xyGrid); }
private GuiWidget CreateXYGridControl(XYZColors colors, double distanceBetweenControls, double buttonSeparationDistance) { xyGrid = new GuiWidget { HAnchor = HAnchor.Fit, VAnchor = VAnchor.Fit | VAnchor.Bottom, Margin = new BorderDouble(0, 5, distanceBetweenControls, 5) }; var xButtons = new FlowLayoutWidget(); xButtons.HAnchor = HAnchor.Fit | HAnchor.Center; xButtons.VAnchor = VAnchor.Fit | VAnchor.Center; xyGrid.AddChild(xButtons); xMinusControl = theme.CreateMoveButton(printer, "X-", PrinterAxis.X, printer.Settings.XSpeed()); xMinusControl.ToolTipText = "Move X negative".Localize(); xButtons.AddChild(xMinusControl); // spacer xButtons.AddChild(new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 1) { VAnchor = VAnchor.Center, BackgroundColor = colors.XColor }); xPlusControl = theme.CreateMoveButton(printer, "X+", PrinterAxis.X, printer.Settings.XSpeed()); xPlusControl.ToolTipText = "Move X positive".Localize(); xButtons.AddChild(xPlusControl); var yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Fit | HAnchor.Center, VAnchor = VAnchor.Fit | VAnchor.Center }; xyGrid.AddChild(yButtons); yPlusControl = theme.CreateMoveButton(printer, "Y+", PrinterAxis.Y, printer.Settings.YSpeed()); yPlusControl.ToolTipText = "Move Y positive".Localize(); yButtons.AddChild(yPlusControl); // spacer yButtons.AddChild(new GuiWidget(1, buttonSeparationDistance) { HAnchor = HAnchor.Center, BackgroundColor = colors.YColor }); yMinusControl = theme.CreateMoveButton(printer, "Y-", PrinterAxis.Y, printer.Settings.YSpeed()); yMinusControl.ToolTipText = "Move Y negative".Localize(); yButtons.AddChild(yMinusControl); return(xyGrid); }
private GuiWidget CreateXYGridControl(XYZColors colors, double distanceBetweenControls, double buttonSeparationDistance) { GuiWidget xyGrid = new GuiWidget(); { FlowLayoutWidget xButtons = new FlowLayoutWidget(); { moveButtonFactory.Colors.Fill.Normal = XYZColors.xColor; xButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; xButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; xMinusControl = CreateMoveButton("X-", PrinterConnectionAndCommunication.Axis.X, MovementControls.XSpeed, false, moveButtonFactory); xMinusControl.ToolTipText = "Move X negative".Localize(); xButtons.AddChild(xMinusControl); GuiWidget spacer = new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2); spacer.VAnchor = Agg.UI.VAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.xColor; xButtons.AddChild(spacer); xPlusControl = CreateMoveButton("X+", PrinterConnectionAndCommunication.Axis.X, MovementControls.XSpeed, false, moveButtonFactory); xPlusControl.ToolTipText = "Move X positive".Localize(); xButtons.AddChild(xPlusControl); } xyGrid.AddChild(xButtons); FlowLayoutWidget yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { moveButtonFactory.Colors.Fill.Normal = XYZColors.yColor; yButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; yButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; yPlusControl = CreateMoveButton("Y+", PrinterConnectionAndCommunication.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory); yPlusControl.ToolTipText = "Move Y positive".Localize(); yButtons.AddChild(yPlusControl); GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance); spacer.HAnchor = Agg.UI.HAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.yColor; yButtons.AddChild(spacer); yMinusControl = CreateMoveButton("Y-", PrinterConnectionAndCommunication.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory); yMinusControl.ToolTipText = "Move Y negative".Localize(); yButtons.AddChild(yMinusControl); } xyGrid.AddChild(yButtons); } xyGrid.HAnchor = HAnchor.FitToChildren; xyGrid.VAnchor = VAnchor.FitToChildren; xyGrid.VAnchor = Agg.UI.VAnchor.ParentBottom; xyGrid.Margin = new BorderDouble(0, 5, distanceBetweenControls, 5); return(xyGrid); }
private GuiWidget CreateXYGridControl(XYZColors colors, double distanceBetweenControls, double buttonSeparationDistance) { GuiWidget xyGrid = new GuiWidget(); { FlowLayoutWidget xButtons = new FlowLayoutWidget(); { moveButtonFactory.normalFillColor = XYZColors.xColor; xButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; xButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; xMinusControl = moveButtonFactory.Generate("X-", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed); xButtons.AddChild(xMinusControl); GuiWidget spacer = new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2); spacer.VAnchor = Agg.UI.VAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.xColor; xButtons.AddChild(spacer); xPlusControl = moveButtonFactory.Generate("X+", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed); xButtons.AddChild(xPlusControl); } xyGrid.AddChild(xButtons); FlowLayoutWidget yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { moveButtonFactory.normalFillColor = XYZColors.yColor; yButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; yButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; yPlusControl = moveButtonFactory.Generate("Y+", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed); yButtons.AddChild(yPlusControl); GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance); spacer.HAnchor = Agg.UI.HAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.yColor; yButtons.AddChild(spacer); yMinusControl = moveButtonFactory.Generate("Y-", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed); yButtons.AddChild(yMinusControl); } xyGrid.AddChild(yButtons); } xyGrid.HAnchor = HAnchor.FitToChildren; xyGrid.VAnchor = VAnchor.FitToChildren; xyGrid.VAnchor = Agg.UI.VAnchor.ParentBottom; xyGrid.Margin = new BorderDouble(0, 5, distanceBetweenControls, 5); return(xyGrid); }
public JogControls(XYZColors colors) { moveButtonFactory.normalTextColor = RGBA_Bytes.Black; double distanceBetweenControls = 12; double buttonSeparationDistance = 10; FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget xYZControls = new FlowLayoutWidget(); { GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); xYZControls.AddChild(xyGrid); FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl); zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); } // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White); buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; //setMoveDistanceControl.AddChild(buttonsLabel); { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; buttonFactory.fontSize = 8; buttonFactory.Margin = new BorderDouble(0); buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget(); RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1"); pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(.1); } }; moveRadioButtons.AddChild(pointOneButton); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(1); } }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(100); } }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; moveRadioButtons.Margin = new BorderDouble(0, 3); setMoveDistanceControl.AddChild(moveRadioButtons); } TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8); mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; setMoveDistanceControl.AddChild(mmLabel); setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft; xYZWithDistance.AddChild(setMoveDistanceControl); } allControlsLeftToRight.AddChild(xYZWithDistance); GuiWidget barBetweenZAndE = new GuiWidget(2, 2); barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop; barBetweenZAndE.BackgroundColor = RGBA_Bytes.White; barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5); allControlsLeftToRight.AddChild(barBetweenZAndE); moveButtonFactory.normalFillColor = XYZColors.eColor; FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance); eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop; allControlsLeftToRight.AddChild(eButtons); allControlsTopToBottom.AddChild(allControlsLeftToRight); } this.AddChild(allControlsTopToBottom); HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; Margin = new BorderDouble(3); this.HAnchor |= HAnchor.ParentLeftRight; }
public JogControls(XYZColors colors) { moveButtonFactory.Colors.Text.Normal = RGBA_Bytes.Black; double distanceBetweenControls = 12; double buttonSeparationDistance = 10; FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget xYZControls = new FlowLayoutWidget(); { GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); xYZControls.AddChild(xyGrid); FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl); zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); } this.KeyDown += (sender, e) => { if (!hotKeyButton.Checked) { return; } double moveAmountPositive = AxisMoveAmount; double moveAmountNegative = -AxisMoveAmount; int eMoveAmountPositive = EAxisMoveAmount; int eMoveAmountNegative = -EAxisMoveAmount; if (OsInformation.OperatingSystem == OSType.Windows || OsInformation.OperatingSystem == OSType.Mac) { if (e.KeyCode == Keys.Z) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z); } else if (e.KeyCode == Keys.Y) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y); } else if (e.KeyCode == Keys.X) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X); } else if (e.KeyCode == Keys.Left) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Right) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Up) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed); } else if (e.KeyCode == Keys.Down) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed); } else if (e.KeyCode == Keys.E) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0)); } else if (e.KeyCode == Keys.R) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0)); } } if (OsInformation.OperatingSystem == OSType.Windows) { if (e.KeyCode == Keys.Home) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ); } else if (e.KeyCode == Keys.PageUp) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.PageDown) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed); } } else if (OsInformation.OperatingSystem == OSType.Mac) { if (e.KeyCode == (Keys.Back | Keys.Cancel)) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.Clear) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed); } } }; // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White); buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; //setMoveDistanceControl.AddChild(buttonsLabel); { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); buttonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; buttonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; buttonFactory.fontSize = 8; buttonFactory.Margin = new BorderDouble(0); buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget(); var radioList = new ObservableCollection <GuiWidget>(); movePointZeroTwoMmButton = buttonFactory.GenerateRadioButton("0.02"); movePointZeroTwoMmButton.VAnchor = Agg.UI.VAnchor.ParentCenter; movePointZeroTwoMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(.02); } }; movePointZeroTwoMmButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(movePointZeroTwoMmButton); RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1"); pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(.1); } }; pointOneButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(pointOneButton); moveOneMmButton = buttonFactory.GenerateRadioButton("1"); moveOneMmButton.VAnchor = Agg.UI.VAnchor.ParentCenter; moveOneMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(1); } }; moveOneMmButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(moveOneMmButton); tooBigForBabyStepping = new DisableableWidget() { VAnchor = VAnchor.FitToChildren, HAnchor = HAnchor.FitToChildren }; var tooBigFlowLayout = new FlowLayoutWidget(); tooBigForBabyStepping.AddChild(tooBigFlowLayout); tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(10); } }; tenButton.SiblingRadioButtonList = radioList; tooBigFlowLayout.AddChild(tenButton); oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(100); } }; oneHundredButton.SiblingRadioButtonList = radioList; tooBigFlowLayout.AddChild(oneHundredButton); moveRadioButtons.AddChild(tooBigForBabyStepping); tenButton.Checked = true; moveRadioButtons.Margin = new BorderDouble(0, 3); setMoveDistanceControl.AddChild(moveRadioButtons); TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8); mmLabel.Margin = new BorderDouble(left: 10); mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; tooBigFlowLayout.AddChild(mmLabel); } setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft; xYZWithDistance.AddChild(setMoveDistanceControl); } allControlsLeftToRight.AddChild(xYZWithDistance); #if !__ANDROID__ allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); #endif GuiWidget barBetweenZAndE = new GuiWidget(2, 2); barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop; barBetweenZAndE.BackgroundColor = RGBA_Bytes.White; barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5); allControlsLeftToRight.AddChild(barBetweenZAndE); FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance); disableableEButtons = new DisableableWidget() { HAnchor = HAnchor.FitToChildren, VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop, }; disableableEButtons.AddChild(eButtons); allControlsLeftToRight.AddChild(disableableEButtons); allControlsTopToBottom.AddChild(allControlsLeftToRight); } this.AddChild(allControlsTopToBottom); this.HAnchor = HAnchor.FitToChildren; this.VAnchor = VAnchor.FitToChildren; Margin = new BorderDouble(3); // this.HAnchor |= HAnchor.ParentLeftRight; }
public JogControls(PrinterConfig printer, XYZColors colors, ThemeConfig theme) { this.theme = theme; this.printer = printer; double distanceBetweenControls = 12; double buttonSeparationDistance = 10; var allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Stretch }; var allControlsLeftToRight = new FlowLayoutWidget(); using (allControlsLeftToRight.LayoutLock()) { var xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { var xYZControls = new FlowLayoutWidget(); xYZControls.AddChild(this.CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance)); FlowLayoutWidget zButtons = JogControls.CreateZButtons(printer, buttonSeparationDistance, out zPlusControl, out zMinusControl, colors, theme); zButtons.VAnchor = VAnchor.Bottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); // add in some movement radio buttons var setMoveDistanceControl = new FlowLayoutWidget { HAnchor = HAnchor.Left | HAnchor.Fit, VAnchor = VAnchor.Fit }; { var moveRadioButtons = new FlowLayoutWidget(); var radioList = new List <GuiWidget>(); movePointZeroTwoMmButton = theme.CreateMicroRadioButton("0.02", radioList); movePointZeroTwoMmButton.CheckedStateChanged += (s, e) => { if (movePointZeroTwoMmButton.Checked) { SetXYZMoveAmount(.02); } }; moveRadioButtons.AddChild(movePointZeroTwoMmButton); var pointOneButton = theme.CreateMicroRadioButton("0.1", radioList); pointOneButton.CheckedStateChanged += (s, e) => { if (pointOneButton.Checked) { SetXYZMoveAmount(.1); } }; moveRadioButtons.AddChild(pointOneButton); moveOneMmButton = theme.CreateMicroRadioButton("1", radioList); moveOneMmButton.CheckedStateChanged += (s, e) => { if (moveOneMmButton.Checked) { SetXYZMoveAmount(1); } }; moveRadioButtons.AddChild(moveOneMmButton); tenButton = theme.CreateMicroRadioButton("10", radioList); tenButton.CheckedStateChanged += (s, e) => { if (tenButton.Checked) { SetXYZMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); oneHundredButton = theme.CreateMicroRadioButton("100", radioList); oneHundredButton.CheckedStateChanged += (s, e) => { if (oneHundredButton.Checked) { SetXYZMoveAmount(100); } }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; SetXYZMoveAmount(10); moveRadioButtons.Margin = new BorderDouble(0, 3); setMoveDistanceControl.AddChild(moveRadioButtons); moveRadioButtons.AddChild(new TextWidget("mm", textColor: theme.TextColor, pointSize: 8) { Margin = new BorderDouble(left: 10), VAnchor = VAnchor.Center }); } xYZWithDistance.AddChild(setMoveDistanceControl); } allControlsLeftToRight.AddChild(xYZWithDistance); #if !__ANDROID__ allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); #endif // Bar between Z And E allControlsLeftToRight.AddChild(new GuiWidget(1, 1) { VAnchor = VAnchor.Stretch, BackgroundColor = colors.ZColor, Margin = new BorderDouble(distanceBetweenControls, 5) }); // EButtons disableableEButtons = CreateEButtons(buttonSeparationDistance, colors); disableableEButtons.Name = "disableableEButtons"; disableableEButtons.HAnchor = HAnchor.Fit; disableableEButtons.VAnchor = VAnchor.Fit | VAnchor.Top; allControlsLeftToRight.AddChild(disableableEButtons); allControlsTopToBottom.AddChild(allControlsLeftToRight); } allControlsLeftToRight.PerformLayout(); using (this.LayoutLock()) { this.AddChild(allControlsTopToBottom); this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; Margin = new BorderDouble(3); } this.PerformLayout(); // Register listeners printer.Settings.SettingChanged += Printer_SettingChanged; }
public static FlowLayoutWidget CreateZButtons(PrinterConfig printer, double buttonSeparationDistance, out MoveButton zPlusControl, out MoveButton zMinusControl, XYZColors colors, ThemeConfig theme, bool levelingButtons = false) { var zButtons = new FlowLayoutWidget(FlowDirection.TopToBottom) { Margin = new BorderDouble(0, 5), }; zPlusControl = theme.CreateMoveButton(printer, "Z+", PrinterConnection.Axis.Z, printer.Settings.ZSpeed(), levelingButtons); zPlusControl.Name = "Move Z positive".Localize(); zPlusControl.ToolTipText = "Move Z positive".Localize(); zButtons.AddChild(zPlusControl); // spacer zButtons.AddChild(new GuiWidget(1, buttonSeparationDistance) { HAnchor = HAnchor.Center, BackgroundColor = colors.ZColor }); zMinusControl = theme.CreateMoveButton(printer, "Z-", PrinterConnection.Axis.Z, printer.Settings.ZSpeed(), levelingButtons); zMinusControl.ToolTipText = "Move Z negative".Localize(); zButtons.AddChild(zMinusControl); return(zButtons); }
private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance, XYZColors colors) { int extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget(); BorderDouble extrusionMargin = new BorderDouble(4, 0, 4, 0); if (extruderCount == 1) { ExtrudeButton eMinusControl = theme.CreateExtrudeButton(printer, "E-", printer.Settings.EFeedRate(0), 0); eMinusControl.MoveAmount = -eMinusControl.MoveAmount; eMinusControl.Margin = extrusionMargin; eMinusControl.ToolTipText = "Retract filament".Localize(); eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton eMinusControl = theme.CreateExtrudeButton(printer, $"E{i + 1}-", printer.Settings.EFeedRate(0), i); eMinusControl.MoveAmount = -eMinusControl.MoveAmount; eMinusControl.ToolTipText = "Retract filament".Localize(); eMinusControl.Margin = extrusionMargin; eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } } TextWidget eMinusControlLabel = new TextWidget("Retract".Localize(), pointSize: 11) { TextColor = theme.TextColor, VAnchor = VAnchor.Center }; eMinusButtonAndText.AddChild(eMinusControlLabel); eButtons.AddChild(eMinusButtonAndText); eMinusButtonAndText.HAnchor = HAnchor.Fit; eMinusButtonAndText.VAnchor = VAnchor.Fit; FlowLayoutWidget buttonSpacerContainer = new FlowLayoutWidget(); for (int i = 0; i < extruderCount; i++) { double buttonWidth = eMinusButtons[i].Width + 6; var eSpacer = new GuiWidget(1, buttonSeparationDistance) { Margin = new BorderDouble((buttonWidth / 2), 0, ((buttonWidth) / 2), 0), BackgroundColor = colors.EColor }; buttonSpacerContainer.AddChild(eSpacer); } eButtons.AddChild(buttonSpacerContainer); buttonSpacerContainer.HAnchor = HAnchor.Fit; buttonSpacerContainer.VAnchor = VAnchor.Fit; FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget(); if (extruderCount == 1) { ExtrudeButton ePlusControl = theme.CreateExtrudeButton(printer, "E+", printer.Settings.EFeedRate(0), 0); ePlusControl.Margin = extrusionMargin; ePlusControl.ToolTipText = "Extrude filament".Localize(); ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton ePlusControl = theme.CreateExtrudeButton(printer, $"E{i + 1}+", printer.Settings.EFeedRate(0), i); ePlusControl.Margin = extrusionMargin; ePlusControl.ToolTipText = "Extrude filament".Localize(); ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } } TextWidget ePlusControlLabel = new TextWidget("Extrude".Localize(), pointSize: 11); ePlusControlLabel.TextColor = theme.TextColor; ePlusControlLabel.VAnchor = VAnchor.Center; ePlusButtonAndText.AddChild(ePlusControlLabel); eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.Fit; ePlusButtonAndText.VAnchor = VAnchor.Fit; } eButtons.AddChild(new GuiWidget(10, 6)); // add in some movement radio buttons var setMoveDistanceControl = new FlowLayoutWidget { HAnchor = HAnchor.Fit }; { var moveRadioButtons = new FlowLayoutWidget { Margin = new BorderDouble(0, 3) }; var oneButton = theme.CreateMicroRadioButton("1"); oneButton.CheckedStateChanged += (s, e) => { if (oneButton.Checked) { SetEMoveAmount(1); } }; moveRadioButtons.AddChild(oneButton); var tenButton = theme.CreateMicroRadioButton("10"); tenButton.CheckedStateChanged += (s, e) => { if (tenButton.Checked) { SetEMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); var oneHundredButton = theme.CreateMicroRadioButton("100"); oneHundredButton.CheckedStateChanged += (s, e) => { if (oneHundredButton.Checked) { SetEMoveAmount(100); } }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; setMoveDistanceControl.AddChild(moveRadioButtons); } setMoveDistanceControl.AddChild( new TextWidget("mm", textColor: theme.TextColor, pointSize: 8) { VAnchor = VAnchor.Center, Margin = new BorderDouble(left: 10) }); eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.Fit; eButtons.VAnchor = VAnchor.Fit | VAnchor.Bottom; return(eButtons); }
public JogControls(XYZColors colors) { moveButtonFactory.normalTextColor = RGBA_Bytes.Black; double distanceBetweenControls = 12; double buttonSeparationDistance = 10; FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget xYZControls = new FlowLayoutWidget(); { GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); xYZControls.AddChild(xyGrid); FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl); zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); } this.KeyDown += (sender, e) => { double moveAmountPositive = AxisMoveAmount; double moveAmountNegative = -AxisMoveAmount; int eMoveAmountPositive = EAxisMoveAmount; int eMoveAmountNegative = -EAxisMoveAmount; if (OsInformation.OperatingSystem == OSType.Windows) { if (e.KeyCode == Keys.Home && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ); } else if (e.KeyCode == Keys.Z && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z); } else if (e.KeyCode == Keys.Y && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y); } else if (e.KeyCode == Keys.X && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X); } else if (e.KeyCode == Keys.Left && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Right && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Up && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed); } else if (e.KeyCode == Keys.Down && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed); } else if (e.KeyCode == Keys.PageUp && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.PageDown && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.E && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0)); } else if (e.KeyCode == Keys.R && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0)); } } else if (OsInformation.OperatingSystem == OSType.Mac) { if (e.KeyCode == Keys.LButton && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ); } else if (e.KeyCode == Keys.Z && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z); } else if (e.KeyCode == Keys.Y && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y); } else if (e.KeyCode == Keys.X && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X); } else if (e.KeyCode == Keys.Left && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Right && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed); } else if (e.KeyCode == Keys.Up && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed); } else if (e.KeyCode == Keys.Down && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed); } else if (e.KeyCode == (Keys.Back | Keys.Cancel) && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.Clear && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed); } else if (e.KeyCode == Keys.E && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0)); } else if (e.KeyCode == Keys.R && hotKeysEnabled) { PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0)); } } }; // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White); buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; //setMoveDistanceControl.AddChild(buttonsLabel); { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; buttonFactory.fontSize = 8; buttonFactory.Margin = new BorderDouble(0); buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget(); RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1"); pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(.1); } }; moveRadioButtons.AddChild(pointOneButton); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(1); } }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(100); } }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; moveRadioButtons.Margin = new BorderDouble(0, 3); setMoveDistanceControl.AddChild(moveRadioButtons); } TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8); mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; setMoveDistanceControl.AddChild(mmLabel); setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft; xYZWithDistance.AddChild(setMoveDistanceControl); } allControlsLeftToRight.AddChild(xYZWithDistance); #if !__ANDROID__ allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); #endif GuiWidget barBetweenZAndE = new GuiWidget(2, 2); barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop; barBetweenZAndE.BackgroundColor = RGBA_Bytes.White; barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5); allControlsLeftToRight.AddChild(barBetweenZAndE); //moveButtonFactory.normalFillColor = XYZColors.eColor; FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance); eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop; allControlsLeftToRight.AddChild(eButtons); allControlsTopToBottom.AddChild(allControlsLeftToRight); } this.AddChild(allControlsTopToBottom); this.HAnchor = HAnchor.FitToChildren; this.VAnchor = VAnchor.FitToChildren; Margin = new BorderDouble(3); // this.HAnchor |= HAnchor.ParentLeftRight; }
public JogControls(XYZColors colors) { moveButtonFactory.normalTextColor = RGBA_Bytes.Black; double distanceBetweenControls = 20; double buttonSeparationDistance = 10; FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget xYZControls = new FlowLayoutWidget(); { GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); xYZControls.AddChild(xyGrid); FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl); zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); } // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White); buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; //setMoveDistanceControl.AddChild(buttonsLabel); { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); buttonFactory.FixedHeight = 20; buttonFactory.FixedWidth = 30; buttonFactory.fontSize = 10; buttonFactory.Margin = new BorderDouble(0); FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget(); RadioButton pointOneButton = buttonFactory.GenerateRadioButton(".1"); pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.1); }; moveRadioButtons.AddChild(pointOneButton); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(10); }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(100); }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; moveRadioButtons.Margin = new BorderDouble(0,3); setMoveDistanceControl.AddChild(moveRadioButtons); } TextWidget mmLabel = new TextWidget("mm", textColor: RGBA_Bytes.White, pointSize:10); mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; setMoveDistanceControl.AddChild(mmLabel); setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft; xYZWithDistance.AddChild(setMoveDistanceControl); } allControlsLeftToRight.AddChild(xYZWithDistance); GuiWidget barBetweenZAndE = new GuiWidget(2, 2); barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop; barBetweenZAndE.BackgroundColor = RGBA_Bytes.White; barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5); allControlsLeftToRight.AddChild(barBetweenZAndE); moveButtonFactory.normalFillColor = XYZColors.eColor; FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance); eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop; allControlsLeftToRight.AddChild(eButtons); allControlsTopToBottom.AddChild(allControlsLeftToRight); } this.AddChild(allControlsTopToBottom); HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; Margin = new BorderDouble(3); this.HAnchor |= HAnchor.ParentLeftRight; }
private GuiWidget CreateXYGridControl(XYZColors colors, double distanceBetweenControls, double buttonSeparationDistance) { GuiWidget xyGrid = new GuiWidget(); { FlowLayoutWidget xButtons = new FlowLayoutWidget(); { moveButtonFactory.normalFillColor = XYZColors.xColor; xButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; xButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; xMinusControl = moveButtonFactory.Generate("X-", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed); xButtons.AddChild(xMinusControl); GuiWidget spacer = new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2); spacer.VAnchor = Agg.UI.VAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.xColor; xButtons.AddChild(spacer); xPlusControl = moveButtonFactory.Generate("X+", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed); xButtons.AddChild(xPlusControl); } xyGrid.AddChild(xButtons); FlowLayoutWidget yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { moveButtonFactory.normalFillColor = XYZColors.yColor; yButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; yButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter; yPlusControl = moveButtonFactory.Generate("Y+", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed); yButtons.AddChild(yPlusControl); GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance); spacer.HAnchor = Agg.UI.HAnchor.ParentCenter; spacer.BackgroundColor = XYZColors.yColor; yButtons.AddChild(spacer); yMinusControl = moveButtonFactory.Generate("Y-", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed); yButtons.AddChild(yMinusControl); } xyGrid.AddChild(yButtons); } xyGrid.HAnchor = HAnchor.FitToChildren; xyGrid.VAnchor = VAnchor.FitToChildren; xyGrid.VAnchor = Agg.UI.VAnchor.ParentBottom; xyGrid.Margin = new BorderDouble(0, 5, distanceBetweenControls, 5); return xyGrid; }