public ViewControlsToggle() { TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory(); iconTextImageButtonFactory.AllowThemeToAdjustImage = false; BackgroundColor = new RGBA_Bytes(0, 0, 0, 120); iconTextImageButtonFactory.FixedHeight = 20; iconTextImageButtonFactory.FixedWidth = 20; string translateIconPath = Path.Combine("ViewTransformControls", "2d.png"); twoDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath); twoDimensionButton.Margin = new BorderDouble(3); AddChild(twoDimensionButton); string scaleIconPath = Path.Combine("ViewTransformControls", "3d.png"); threeDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath); threeDimensionButton.Margin = new BorderDouble(3); AddChild(threeDimensionButton); Margin = new BorderDouble(5,5,195,5); HAnchor |= Agg.UI.HAnchor.ParentRight; VAnchor = Agg.UI.VAnchor.ParentTop; string defaultView = UserSettings.Instance.get ("LayerViewDefault"); if (defaultView == null) { UserSettings.Instance.set ("LayerViewDefault", "2D Layer"); } if (defaultView == "2D Layer") { twoDimensionButton.Checked = true; } else if (defaultView == "3D Layer") { threeDimensionButton.Checked = true; } else { twoDimensionButton.Checked = true; } }
public ViewControls2D() { TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory(); iconTextImageButtonFactory.AllowThemeToAdjustImage = false; BackgroundColor = new RGBA_Bytes(0, 0, 0, 120); iconTextImageButtonFactory.FixedHeight = 20; iconTextImageButtonFactory.FixedWidth = 20; string translateIconPath = Path.Combine("ViewTransformControls", "translate.png"); translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath); translateButton.Margin = new BorderDouble(3); AddChild(translateButton); string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png"); scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath); scaleButton.Margin = new BorderDouble(3); AddChild(scaleButton); Margin = new BorderDouble(5); HAnchor |= Agg.UI.HAnchor.ParentLeft; VAnchor = Agg.UI.VAnchor.ParentTop; translateButton.Checked = true; }
private FlowLayoutWidget GetHotkeyControlContainer() { TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory(); hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; hotKeyButtonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; hotKeyButtonFactory.fontSize = 8; hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); hotkeyControlContainer.HAnchor = HAnchor.FitToChildren; hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop; hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement"; hotkeyControlContainer.Margin = new BorderDouble(left: 10); RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", "hot_key_small.png"); hotKeyButton.Margin = new BorderDouble(5); hotKeyButton.Click += (sender, e) => { if (hotKeysEnabled) { hotKeysEnabled = false; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeyButton.Checked = false; } else if (!hotKeysEnabled) { hotKeysEnabled = true; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeyButton.Checked = true; } }; hotkeyControlContainer.AddChild(hotKeyButton); return(hotkeyControlContainer); }
private FlowLayoutWidget GetHotkeyControlContainer() { TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory(); hotKeyButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; hotKeyButtonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; hotKeyButtonFactory.fontSize = 8; hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); hotkeyControlContainer.HAnchor = HAnchor.FitToChildren; hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop; hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement".Localize(); hotkeyControlContainer.Margin = new BorderDouble(left: 10); RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).InvertLightness()); hotKeyButton.Margin = new BorderDouble(5); hotKeyButton.FocusChanged += (sender, e) => { if ((sender as GuiWidget).Focused) { hotKeyButton.Checked = false; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeysEnabled = false; } else { hotKeyButton.Checked = true; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeysEnabled = true; } }; hotkeyControlContainer.AddChild(hotKeyButton); return(hotkeyControlContainer); }
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(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 FlowLayoutWidget CreateEButtons(double buttonSeparationDistance) { FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget(); eMinusControl = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0)); eMinusControl.Margin = new BorderDouble(0, 0, 5, 0); eMinusButtonAndText.AddChild(eMinusControl); TextWidget eMinusControlLabel = new TextWidget(new LocalizedString("Retract").Translated); eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; eMinusButtonAndText.AddChild(eMinusControlLabel); eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(eMinusButtonAndText); eMinusButtonAndText.HAnchor = HAnchor.FitToChildren; eMinusButtonAndText.VAnchor = VAnchor.FitToChildren; GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance); eSpacer.HAnchor = Agg.UI.HAnchor.ParentLeft; eSpacer.Margin = new BorderDouble(eMinusControl.Width / 2, 0, 0, 0); eSpacer.BackgroundColor = XYZColors.eColor; eButtons.AddChild(eSpacer); FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget(); ePlusControl = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0)); ePlusControl.Margin = new BorderDouble(0, 0, 5, 0); ePlusButtonAndText.AddChild(ePlusControl); TextWidget ePlusControlLabel = new TextWidget(new LocalizedString("Extrude").Translated); ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; ePlusButtonAndText.AddChild(ePlusControlLabel); ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.FitToChildren; ePlusButtonAndText.VAnchor = VAnchor.FitToChildren; } eButtons.AddChild(new GuiWidget(10, 6)); // 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 oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(1); }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(10); }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(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; eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom; 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 (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)); } }; // 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; }
private FlowLayoutWidget GetHotkeyControlContainer() { TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory(); hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; hotKeyButtonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; hotKeyButtonFactory.fontSize = 8; hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); hotkeyControlContainer.HAnchor = HAnchor.FitToChildren; hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop; hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement"; hotkeyControlContainer.Margin = new BorderDouble(left: 10); RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", "hot_key_small.png"); hotKeyButton.Margin = new BorderDouble(5); hotKeyButton.Click += (sender, e) => { if (hotKeysEnabled) { hotKeysEnabled = false; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeyButton.Checked = false; } else if (!hotKeysEnabled) { hotKeysEnabled = true; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeyButton.Checked = true; } }; hotkeyControlContainer.AddChild(hotKeyButton); return hotkeyControlContainer; }
void AddViewControls() { TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory(); FlowLayoutWidget transformTypeSelector = new FlowLayoutWidget(); transformTypeSelector.BackgroundColor = new RGBA_Bytes(0, 0, 0, 120); iconTextImageButtonFactory.FixedHeight = 20; iconTextImageButtonFactory.FixedWidth = 20; string translateIconPath = Path.Combine("Icons", "ViewTransformControls", "translate.png"); RadioButton translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath); translateButton.Margin = new BorderDouble(3); transformTypeSelector.AddChild(translateButton); translateButton.Click += (sender, e) => { gcodeViewWidget.TransformState = GCodeViewWidget.ETransformState.Move; }; string scaleIconPath = Path.Combine("Icons", "ViewTransformControls", "scale.png"); RadioButton scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath); scaleButton.Margin = new BorderDouble(3); transformTypeSelector.AddChild(scaleButton); scaleButton.Click += (sender, e) => { gcodeViewWidget.TransformState = GCodeViewWidget.ETransformState.Scale; }; transformTypeSelector.Margin = new BorderDouble(5); transformTypeSelector.HAnchor |= Agg.UI.HAnchor.ParentLeft; transformTypeSelector.VAnchor = Agg.UI.VAnchor.ParentTop; AddChild(transformTypeSelector); translateButton.Checked = true; }
private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance) { FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget(); eMinusControl = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0)); eMinusControl.Margin = new BorderDouble(0, 0, 5, 0); eMinusButtonAndText.AddChild(eMinusControl); TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11); eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; eMinusButtonAndText.AddChild(eMinusControlLabel); eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(eMinusButtonAndText); eMinusButtonAndText.HAnchor = HAnchor.FitToChildren; eMinusButtonAndText.VAnchor = VAnchor.FitToChildren; GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance); eSpacer.HAnchor = Agg.UI.HAnchor.ParentLeft; eSpacer.Margin = new BorderDouble(eMinusControl.Width / 2, 0, 0, 0); eSpacer.BackgroundColor = XYZColors.eColor; eButtons.AddChild(eSpacer); FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget(); ePlusControl = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0)); ePlusControl.Margin = new BorderDouble(0, 0, 5, 0); ePlusButtonAndText.AddChild(ePlusControl); TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11); ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; ePlusButtonAndText.AddChild(ePlusControlLabel); ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.FitToChildren; ePlusButtonAndText.VAnchor = VAnchor.FitToChildren; } eButtons.AddChild(new GuiWidget(10, 6)); // 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 oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(1); } }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(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: 10); mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; setMoveDistanceControl.AddChild(mmLabel); setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom; return(eButtons); }
private FlowLayoutWidget GetHotkeyControlContainer() { TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory(); hotKeyButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; hotKeyButtonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; hotKeyButtonFactory.fontSize = 8; hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); hotkeyControlContainer.HAnchor = HAnchor.FitToChildren; hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop; hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement"; hotkeyControlContainer.Margin = new BorderDouble(left: 10); RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).InvertLightness()); hotKeyButton.Margin = new BorderDouble(5); hotKeyButton.FocusChanged += (sender, e) => { if ((sender as GuiWidget).Focused) { hotKeyButton.Checked = false; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeysEnabled = false; } else { hotKeyButton.Checked = true; hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; hotKeysEnabled = true; } }; hotkeyControlContainer.AddChild(hotKeyButton); return hotkeyControlContainer; }
private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance) { int extruderCount = ActiveSliceSettings.Instance.ExtruderCount; FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget(); BorderDouble extrusionMargin = new BorderDouble(4, 0, 4, 0); if (extruderCount == 1) { ExtrudeButton eMinusControl = moveButtonFactory.Generate("E-", MovementControls.EFeedRate(0), 0); eMinusControl.Margin = extrusionMargin; eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton eMinusControl = moveButtonFactory.Generate(string.Format("E{0}-", i + 1), MovementControls.EFeedRate(0), i); eMinusControl.Margin = extrusionMargin; eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } } TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11); eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; eMinusButtonAndText.AddChild(eMinusControlLabel); eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(eMinusButtonAndText); eMinusButtonAndText.HAnchor = HAnchor.FitToChildren; eMinusButtonAndText.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget buttonSpacerContainer = new FlowLayoutWidget(); for (int i = 0; i < extruderCount; i++) { GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance); double buttonWidth = eMinusButtons[i].Width + 6; eSpacer.Margin = new BorderDouble((buttonWidth / 2), 0, ((buttonWidth) / 2), 0); eSpacer.BackgroundColor = XYZColors.eColor; buttonSpacerContainer.AddChild(eSpacer); } buttonSpacerContainer.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(buttonSpacerContainer); buttonSpacerContainer.HAnchor = HAnchor.FitToChildren; buttonSpacerContainer.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget(); if (extruderCount == 1) { ExtrudeButton ePlusControl = moveButtonFactory.Generate("E+", MovementControls.EFeedRate(0), 0); ePlusControl.Margin = extrusionMargin; ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton ePlusControl = moveButtonFactory.Generate(string.Format("E{0}+", i + 1), MovementControls.EFeedRate(0), i); ePlusControl.Margin = extrusionMargin; ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } } TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11); ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; ePlusButtonAndText.AddChild(ePlusControlLabel); ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft; eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.FitToChildren; ePlusButtonAndText.VAnchor = VAnchor.FitToChildren; } eButtons.AddChild(new GuiWidget(10, 6)); // 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 oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(1); } }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(10); } }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetEMoveAmount(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; eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom; return(eButtons); }
private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance) { int extruderCount = ActiveSliceSettings.Instance.ExtruderCount; FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget(); BorderDouble extrusionMargin = new BorderDouble(4, 0, 4, 0); if (extruderCount == 1) { ExtrudeButton eMinusControl = moveButtonFactory.Generate("E-", MovementControls.EFeedRate(0), 0); eMinusControl.Margin = extrusionMargin; eMinusControl.ToolTipText = "Retract filament"; eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton eMinusControl = moveButtonFactory.Generate(string.Format("E{0}-", i + 1), MovementControls.EFeedRate(0), i); eMinusControl.ToolTipText = "Retract filament"; eMinusControl.Margin = extrusionMargin; eMinusButtonAndText.AddChild(eMinusControl); eMinusButtons.Add(eMinusControl); } } TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11); eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; eMinusButtonAndText.AddChild(eMinusControlLabel); eButtons.AddChild(eMinusButtonAndText); eMinusButtonAndText.HAnchor = HAnchor.FitToChildren; eMinusButtonAndText.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget buttonSpacerContainer = new FlowLayoutWidget(); for (int i = 0; i < extruderCount; i++) { GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance); double buttonWidth = eMinusButtons[i].Width + 6; eSpacer.Margin = new BorderDouble((buttonWidth / 2), 0, ((buttonWidth) / 2), 0); eSpacer.BackgroundColor = XYZColors.eColor; buttonSpacerContainer.AddChild(eSpacer); } eButtons.AddChild(buttonSpacerContainer); buttonSpacerContainer.HAnchor = HAnchor.FitToChildren; buttonSpacerContainer.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget(); if (extruderCount == 1) { ExtrudeButton ePlusControl = moveButtonFactory.Generate("E+", MovementControls.EFeedRate(0), 0); ePlusControl.Margin = extrusionMargin; ePlusControl.ToolTipText = "Extrude filament"; ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } else { for (int i = 0; i < extruderCount; i++) { ExtrudeButton ePlusControl = moveButtonFactory.Generate(string.Format("E{0}+", i + 1), MovementControls.EFeedRate(0), i); ePlusControl.Margin = extrusionMargin; ePlusControl.ToolTipText = "Extrude filament"; ePlusButtonAndText.AddChild(ePlusControl); ePlusButtons.Add(ePlusControl); } } TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11); ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; ePlusButtonAndText.AddChild(ePlusControlLabel); eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.FitToChildren; ePlusButtonAndText.VAnchor = VAnchor.FitToChildren; } eButtons.AddChild(new GuiWidget(10, 6)); // 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 oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(1); }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(10); }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(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; eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.FitToChildren; eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom; 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); } // 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 ViewControls3D(MeshViewerWidget meshViewerWidget) { this.meshViewerWidget = meshViewerWidget; TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; BackgroundColor = new RGBA_Bytes(0, 0, 0, 120); textImageButtonFactory.FixedHeight = 20; textImageButtonFactory.FixedWidth = 20; textImageButtonFactory.AllowThemeToAdjustImage = false; string rotateIconPath = Path.Combine("ViewTransformControls", "rotate.png"); rotateButton = textImageButtonFactory.GenerateRadioButton("", rotateIconPath); rotateButton.Margin = new BorderDouble(3); AddChild(rotateButton); rotateButton.Click += (sender, e) => { meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; }; string translateIconPath = Path.Combine("ViewTransformControls", "translate.png"); translateButton = textImageButtonFactory.GenerateRadioButton("", translateIconPath); translateButton.Margin = new BorderDouble(3); AddChild(translateButton); translateButton.Click += (sender, e) => { meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Translation; }; string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png"); RadioButton scaleButton = textImageButtonFactory.GenerateRadioButton("", scaleIconPath); scaleButton.Margin = new BorderDouble(3); AddChild(scaleButton); scaleButton.Click += (sender, e) => { meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Scale; }; partSelectSeparator = new GuiWidget(2, 32); partSelectSeparator.BackgroundColor = RGBA_Bytes.White; partSelectSeparator.Margin = new BorderDouble(3); AddChild(partSelectSeparator); string partSelectIconPath = Path.Combine("ViewTransformControls", "partSelect.png"); partSelectButton = textImageButtonFactory.GenerateRadioButton("", partSelectIconPath); partSelectButton.Margin = new BorderDouble(3); AddChild(partSelectButton); partSelectButton.Click += (sender, e) => { meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.None; }; Margin = new BorderDouble(5); HAnchor |= Agg.UI.HAnchor.ParentLeft; VAnchor = Agg.UI.VAnchor.ParentTop; rotateButton.Checked = true; SetMeshViewerDisplayTheme(); partSelectButton.CheckedStateChanged += SetMeshViewerDisplayTheme; ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents); }