private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(groupBoxTitle); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentCenter; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble (right: 6); Button openEePromWindow = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch (PrinterConnectionAndCommunication.Instance.FirmwareType) { case PrinterConnectionAndCommunication.FirmwareTypes.Repetier: if (openEePromRepetierWidget != null) { openEePromRepetierWidget.BringToFront(); } else { openEePromRepetierWidget = new EePromRepetierWidget(); openEePromRepetierWidget.Closed += (RepetierWidget, RepetierEvent) => { openEePromRepetierWidget = null; }; } break; case PrinterConnectionAndCommunication.FirmwareTypes.Marlin: if (openEePromMarlinWidget != null) { openEePromMarlinWidget.BringToFront(); } else { openEePromMarlinWidget = new EePromMarlinWidget(); openEePromMarlinWidget.Closed += (marlinWidget, marlinEvent) => { openEePromMarlinWidget = null; }; } break; default: UiThread.RunOnIdle((state) => { StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
private void AddMacroControls(FlowLayoutWidget controlsTopToBottomLayout) { macroControlsContainer = new MacroControls(); controlsTopToBottomLayout.AddChild(macroControlsContainer); }
private void AddMovementControls(FlowLayoutWidget controlsTopToBottomLayout) { movementControlsContainer = new MovementControls(); controlsTopToBottomLayout.AddChild(movementControlsContainer); }
private void AddPrintLevelingControls(FlowLayoutWidget controlsTopToBottomLayout) { printLevelingContainer = new DisableableWidget(); printLevelingContainer.AddChild(CreatePrintLevelingControlsContainer()); controlsTopToBottomLayout.AddChild(printLevelingContainer); }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { tuningAdjustmentControlsContainer = new AdjustmentControls(); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
private void AddActionControls(FlowLayoutWidget controlsTopToBottomLayout) { actionControlsContainer = new ActionControls(); controlsTopToBottomLayout.AddChild(actionControlsContainer); }
private void AddMacroControls(FlowLayoutWidget controlsTopToBottomLayout) { macroControlsContainer = new MacroControls(); controlsTopToBottomLayout.AddChild(macroControlsContainer); }
public ManualPrinterControlsTouchScreen() : base(Orientation.Vertical) { RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected; this.TabBar.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(0); this.TabBar.Padding = new BorderDouble(4, 4); this.AnchorAll(); this.VAnchor |= VAnchor.FitToChildren; this.Margin = new BorderDouble(0); this.TabTextSize = 13; // add action tab { GuiWidget actionContainerContainer = new GuiWidget(); actionContainerContainer.Padding = new BorderDouble(6); actionContainerContainer.AnchorAll(); actionControlsContainer = new ActionControls(); actionControlsContainer.VAnchor = VAnchor.ParentTop; if (ActiveSliceSettings.Instance.ActionMacros().Any()) { actionContainerContainer.AddChild(actionControlsContainer); } if (ActiveSliceSettings.Instance.ActionMacros().Any()) { TabPage actionTabPage = new TabPage(actionContainerContainer, "Actions".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(actionTabPage, "Actions Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } } // add temperature tab { GuiWidget temperatureContainerContainer = new GuiWidget(); temperatureContainerContainer.Padding = new BorderDouble(6); temperatureContainerContainer.AnchorAll(); temperatureControlsContainer = new TemperatureControls(); temperatureControlsContainer.VAnchor |= VAnchor.ParentTop; temperatureContainerContainer.AddChild(temperatureControlsContainer); TabPage temperatureTabPage = new TabPage(temperatureContainerContainer, "Temperature".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(temperatureTabPage, "Temperature Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add movement tab { GuiWidget movementContainerContainer = new GuiWidget(); movementContainerContainer.Padding = new BorderDouble(6); movementContainerContainer.AnchorAll(); movementControlsContainer = new MovementControls(); movementControlsContainer.VAnchor = VAnchor.ParentTop; movementContainerContainer.AddChild(movementControlsContainer); TabPage movementTabPage = new TabPage(movementContainerContainer, "Movement".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(movementTabPage, "Movement Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add macro tab { GuiWidget macrosContainerContainer = new GuiWidget(); macrosContainerContainer.Padding = new BorderDouble(6); macrosContainerContainer.AnchorAll(); macroControlsContainer = new MacroControls(); macroControlsContainer.VAnchor |= VAnchor.ParentTop; macrosContainerContainer.AddChild(macroControlsContainer); TabPage macrosTabPage = new TabPage(macrosContainerContainer, "Macros".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(macrosTabPage, "Macros Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } if (ActiveSliceSettings.Instance.GetValue <bool>("has_fan")) { // add fan tab GuiWidget fanContainerContainer = new GuiWidget(); fanContainerContainer.Padding = new BorderDouble(6); fanContainerContainer.AnchorAll(); fanControlsContainer = new FanControls(); fanControlsContainer.VAnchor = VAnchor.ParentTop; fanContainerContainer.AddChild(fanControlsContainer); TabPage fanTabPage = new TabPage(fanContainerContainer, "Fan Controls".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(fanTabPage, "Fan Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add tunning tab { GuiWidget tuningContainerContainer = new GuiWidget(); tuningContainerContainer.Padding = new BorderDouble(6); tuningContainerContainer.AnchorAll(); tuningAdjustmentControlsContainer = new AdjustmentControls(); tuningAdjustmentControlsContainer.VAnchor = VAnchor.ParentTop; tuningContainerContainer.AddChild(tuningAdjustmentControlsContainer); TabPage tuningTabPage = new TabPage(tuningContainerContainer, "Tuning Adjust".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(tuningTabPage, "Tuning Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add terminal tab { GuiWidget terminalContainerContainer = new GuiWidget(); terminalContainerContainer.Padding = new BorderDouble(6); terminalContainerContainer.AnchorAll(); terminalControlsContainer = new TerminalControls(); terminalControlsContainer.VAnchor |= VAnchor.ParentBottomTop; terminalContainerContainer.AddChild(terminalControlsContainer); TabPage terminalTabPage = new TabPage(terminalContainerContainer, "Terminal".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(terminalTabPage, "Terminal Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); SetVisibleControls(); }
private void AddActionControls(FlowLayoutWidget controlsTopToBottomLayout) { actionControlsContainer = new ActionControls(); controlsTopToBottomLayout.AddChild(actionControlsContainer); }
private void AddTemperatureControls(FlowLayoutWidget controlsTopToBottomLayout) { FlowLayoutWidget temperatureControlContainer = new FlowLayoutWidget(); temperatureControlContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; temperatureControlContainer.Margin = new BorderDouble (top: 10); extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget()); temperatureControlContainer.AddChild(extruderTemperatureControlWidget); bedTemperatureControlWidget = new DisableableWidget(); bedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget()); if (ActiveSliceSettings.Instance.HasHeatedBed()) { temperatureControlContainer.AddChild(bedTemperatureControlWidget); } controlsTopToBottomLayout.AddChild(temperatureControlContainer); }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox adjustmentControlsGroupBox = new GroupBox(LocalizedString.Get("Tuning Adjustment (while printing)")); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; adjustmentControlsGroupBox.Height = 90; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 6); tuningRatiosLayout.AnchorAll(); tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40); feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0; feedRateLeftToRight = new FlowLayoutWidget(); feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier")); feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; feedRateDescription.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); feedRateValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setFeedRateButton.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(setFeedRateButton); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40); extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0; FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.Margin = new BorderDouble(top: 10); extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier")); extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; extrusionDescription.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio); extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); extrusionValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setExtrusionButton.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(setExtrusionButton); } feedRateDescription.Width = extrusionDescription.Width; feedRateDescription.MinimumSize = new Vector2(extrusionDescription.Width, feedRateDescription.MinimumSize.y); feedRateLeftToRight.HAnchor = HAnchor.FitToChildren; feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } tuningAdjustmentControlsContainer = new DisableableWidget(); tuningAdjustmentControlsContainer.AddChild(adjustmentControlsGroupBox); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
private void AddMovementControls(FlowLayoutWidget controlsTopToBottomLayout) { Button editButton; GroupBox movementControlsGroupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit("Movement Controls".Localize(), out editButton)); editButton.Click += (sender, e) => { if (editManualMovementSettingsWindow == null) { editManualMovementSettingsWindow = new EditManualMovementSpeedsWindow("Movement Speeds".Localize(), GetMovementSpeedsString(), SetMovementSpeeds); editManualMovementSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editManualMovementSettingsWindow = null; }; } else { editManualMovementSettingsWindow.BringToFront(); } }; movementControlsGroupBox.Margin = new BorderDouble(0); movementControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; movementControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; movementControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; movementControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; { FlowLayoutWidget manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight; manualControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { manualControlsLayout.AddChild(GetHomeButtonBar()); manualControlsLayout.AddChild(CreateSeparatorLine()); manualControlsLayout.AddChild(new JogControls(new XYZColors())); manualControlsLayout.AddChild(CreateSeparatorLine()); //manualControlsLayout.AddChild(GetManualMoveBar()); } movementControlsGroupBox.AddChild(manualControlsLayout); } movementControlsContainer = new DisableableWidget(); movementControlsContainer.AddChild(movementControlsGroupBox); controlsTopToBottomLayout.AddChild(movementControlsContainer); }
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox fanControlsGroupBox = new GroupBox(LocalizedString.Get("Fan Controls")); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; { FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); fanControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight; fanControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { fanControlsLayout.AddChild(CreateFanControls()); } fanControlsGroupBox.AddChild(fanControlsLayout); } fanControlsContainer = new DisableableWidget(); fanControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; fanControlsContainer.AddChild(fanControlsGroupBox); if (ActiveSliceSettings.Instance.HasFan()) { controlsTopToBottomLayout.AddChild(fanControlsContainer); } }
public ManualPrinterControls() { SetDisplayAttributes(); HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlsTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); controlsTopToBottomLayout.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; controlsTopToBottomLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; controlsTopToBottomLayout.Name = "ManualPrinterControls.ControlsContainer"; controlsTopToBottomLayout.Padding = new BorderDouble(3, 0); AddTemperatureControls(controlsTopToBottomLayout); FlowLayoutWidget centerControlsContainer = new FlowLayoutWidget(); centerControlsContainer.HAnchor = HAnchor.ParentLeftRight; AddMovementControls(centerControlsContainer); // put in the terminal communications { FlowLayoutWidget rightColumnContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); AddFanControls(rightColumnContainer); rightColumnContainer.Width = 200; rightColumnContainer.VAnchor |= VAnchor.ParentTop; centerControlsContainer.AddChild(rightColumnContainer); } controlsTopToBottomLayout.AddChild(centerControlsContainer); macroControls = new DisableableWidget(); macroControls.AddChild(new MacroControls()); controlsTopToBottomLayout.AddChild(macroControls); AddAdjustmentControls(controlsTopToBottomLayout); this.AddChild(controlsTopToBottomLayout); AddHandlers(); SetVisibleControls(); if (!pluginsQueuedToAdd) { UiThread.RunOnIdle(AddPlugins); pluginsQueuedToAdd = true; } }
private void AddPrintLevelingControls(FlowLayoutWidget controlsTopToBottomLayout) { printLevelingContainer = new DisableableWidget(); printLevelingContainer.AddChild(CreatePrintLevelingControlsContainer()); controlsTopToBottomLayout.AddChild(printLevelingContainer); }
private void AddMovementControls(FlowLayoutWidget controlsTopToBottomLayout) { movementControlsContainer = new MovementControls(); controlsTopToBottomLayout.AddChild(movementControlsContainer); }
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 * 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>(); pointZeroOneButton = buttonFactory.GenerateRadioButton("0.02"); pointZeroOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointZeroOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(.02); } }; pointZeroOneButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(pointZeroOneButton); 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); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) { SetXYZMoveAmount(1); } }; oneButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(oneButton); 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.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(); var radioList = new ObservableCollection<GuiWidget>(); pointZeroOneButton = buttonFactory.GenerateRadioButton("0.02"); pointZeroOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; pointZeroOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.02); }; pointZeroOneButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(pointZeroOneButton); 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); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); }; oneButton.SiblingRadioButtonList = radioList; moveRadioButtons.AddChild(oneButton); 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.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; }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { tuningAdjustmentControlsContainer = new AdjustmentControls(); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
private void AddLanguageControls(FlowLayoutWidget controlsTopToBottomLayout) { DisableableWidget container = new DisableableWidget(); GroupBox languageControlsGroupBox = new GroupBox(LocalizedString.Get("Language Settings")); languageControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; languageControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; languageControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; languageControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; languageControlsGroupBox.Height = 78; FlowLayoutWidget controlsContainer = new FlowLayoutWidget(); controlsContainer.HAnchor = HAnchor.ParentLeftRight; LanguageSelector languageSelector = new LanguageSelector(); languageSelector.Margin = new BorderDouble(0); languageSelector.SelectionChanged += new EventHandler(LanguageDropList_SelectionChanged); TextWidget experimentalWidget = new TextWidget("Experimental", pointSize:10); experimentalWidget.VAnchor = Agg.UI.VAnchor.ParentCenter; experimentalWidget.Margin = new BorderDouble(left: 4); experimentalWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor; restartButton = textImageButtonFactory.Generate("Restart"); restartButton.VAnchor = Agg.UI.VAnchor.ParentCenter; restartButton.Visible = false; restartButton.Click += (sender, e) => { RestartApplication(); }; controlsContainer.AddChild(languageSelector); controlsContainer.AddChild(experimentalWidget); controlsContainer.AddChild(new HorizontalSpacer()); controlsContainer.AddChild(restartButton); languageControlsGroupBox.AddChild(controlsContainer); container.AddChild(languageControlsGroupBox); controlsTopToBottomLayout.AddChild(container); }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { AltGroupBox eePromControlsGroupBox = new AltGroupBox(groupBoxTitle); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentCenter; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble(right: 6); Button openEePromWindow = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch (PrinterConnectionAndCommunication.Instance.FirmwareType) { case PrinterConnectionAndCommunication.FirmwareTypes.Repetier: if (openEePromRepetierWidget != null) { openEePromRepetierWidget.BringToFront(); } else { openEePromRepetierWidget = new EePromRepetierWidget(); openEePromRepetierWidget.Closed += (RepetierWidget, RepetierEvent) => { openEePromRepetierWidget = null; }; } break; case PrinterConnectionAndCommunication.FirmwareTypes.Marlin: if (openEePromMarlinWidget != null) { openEePromMarlinWidget.BringToFront(); } else { openEePromMarlinWidget = new EePromMarlinWidget(); openEePromMarlinWidget.Closed += (marlinWidget, marlinEvent) => { openEePromMarlinWidget = null; }; } break; default: UiThread.RunOnIdle((state) => { StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
private void AddTerminalControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox terminalControlsContainer; terminalControlsContainer = new GroupBox(LocalizedString.Get("Communications")); terminalControlsContainer.Margin = new BorderDouble(0); terminalControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; OutputScrollWindow.HookupPrinterOutput(); { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentCenter; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(3, 0, 3, 6); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer terminalImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "terminal-24x24.png"), terminalImage); ImageWidget terminalIcon = new ImageWidget(terminalImage); terminalIcon.Margin = new BorderDouble(right: 6); Button showTerminal = textImageButtonFactory.Generate("Show Terminal".Localize().ToUpper()); showTerminal.Margin = new BorderDouble(0); showTerminal.Click += (sender, e) => { OutputScrollWindow.Show(); }; //buttonBar.AddChild(terminalIcon); buttonBar.AddChild(showTerminal); terminalControlsContainer.AddChild(buttonBar); } terminalCommunicationsContainer = new DisableableWidget(); terminalCommunicationsContainer.AddChild(terminalControlsContainer); controlsTopToBottomLayout.AddChild(terminalCommunicationsContainer); }
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout) { fanControlsContainer = new FanControls(); if (ActiveSliceSettings.Instance.HasFan()) { controlsTopToBottomLayout.AddChild(fanControlsContainer); } }
private void AddCloudMonitorControls(FlowLayoutWidget controlsTopToBottomLayout) { cloudMonitorContainer = new DisableableWidget(); cloudMonitorContainer.AddChild(CreateCloudMonitorControls()); controlsTopToBottomLayout.AddChild(cloudMonitorContainer); }
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout) { fanControlsContainer = new FanControls(); if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_fan)) { controlsTopToBottomLayout.AddChild(fanControlsContainer); } }
private void CreateEditNotificationControls(FlowLayoutWidget controlsTopToBottom) { DisableableWidget container = new DisableableWidget(); GroupBox notificationSettingsContainer = new GroupBox(LocalizedString.Get("Notification Settings")); notificationSettingsContainer.Margin = new BorderDouble(0); notificationSettingsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; notificationSettingsContainer.Height = 68; { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor |= HAnchor.ParentLeftRight; buttonRow.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonRow.Margin = new BorderDouble (0, 0, 0, 0); buttonRow.Padding = new BorderDouble (0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer notificationSettingsImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData (Path.Combine (ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "notify-24x24.png"), notificationSettingsImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness (notificationSettingsImage); } ImageWidget levelingIcon = new ImageWidget (notificationSettingsImage); levelingIcon.Margin = new BorderDouble (right: 6, bottom: 6); configureNotificationSettingsButton = textImageButtonFactory.Generate ("Configure".Localize ().ToUpper ()); configureNotificationSettingsButton.Margin = new BorderDouble (left: 6); configureNotificationSettingsButton.VAnchor = VAnchor.ParentCenter; configureNotificationSettingsButton.Click += new ButtonBase.ButtonEventHandler(configureNotificationSettingsButton_Click); notificationSettingsLabel = new TextWidget ("Notification Settings"); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; buttonRow.AddChild (levelingIcon); buttonRow.AddChild (notificationSettingsLabel); buttonRow.AddChild (new HorizontalSpacer ()); buttonRow.AddChild (configureNotificationSettingsButton); notificationSettingsContainer.AddChild (buttonRow); controlsTopToBottom.AddChild (notificationSettingsContainer); } }
private void AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout) { DisableableWidget container = new DisableableWidget(); AltGroupBox themeControlsGroupBox = new AltGroupBox(LocalizedString.Get("Theme Settings")); themeControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; themeControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; themeControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; themeControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; themeControlsGroupBox.Height = 78; FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight; GuiWidget currentColorThemeBorder = new GuiWidget(); currentColorThemeBorder.HAnchor = Agg.UI.HAnchor.ParentLeftRight; currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop; currentColorThemeBorder.Margin = new BorderDouble(top: 2, bottom: 2); currentColorThemeBorder.Padding = new BorderDouble(4); currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White; GuiWidget currentColorTheme = new GuiWidget(); currentColorTheme.HAnchor = HAnchor.ParentLeftRight; currentColorTheme.VAnchor = VAnchor.ParentBottomTop; currentColorTheme.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme); themeSelector.Margin = new BorderDouble(right: 5); themeControlsGroupBox.AddChild(colorSelectorContainer); colorSelectorContainer.AddChild(themeSelector); colorSelectorContainer.AddChild(currentColorThemeBorder); currentColorThemeBorder.AddChild(currentColorTheme); container.AddChild(themeControlsGroupBox); controlsTopToBottomLayout.AddChild(container); }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox adjustmentControlsGroupBox = new GroupBox(LocalizedString.Get("Tuning Adjustment (while printing)")); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; adjustmentControlsGroupBox.Height = 90; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 6); tuningRatiosLayout.AnchorAll(); tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(1, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40); feedRateLeftToRight = new FlowLayoutWidget(); feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier")); feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; feedRateDescription.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); feedRateValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setFeedRateButton.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(setFeedRateButton); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(1, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.Margin = new BorderDouble(top: 10); extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier")); extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; extrusionDescription.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio); extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); extrusionValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setExtrusionButton.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(setExtrusionButton); } feedRateDescription.Width = extrusionDescription.Width; feedRateDescription.MinimumSize = new Vector2(extrusionDescription.Width, feedRateDescription.MinimumSize.y); feedRateLeftToRight.HAnchor = HAnchor.FitToChildren; feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } tuningAdjustmentControlsContainer = new DisableableWidget(); tuningAdjustmentControlsContainer.AddChild(adjustmentControlsGroupBox); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }