public HardwareSettingsWidget() : base("Hardware".Localize()) { eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(GetEEPromControl()); terminalCommunicationsContainer = new DisableableWidget(); terminalCommunicationsContainer.AddChild(GetGcodeTerminalControl()); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(eePromControlsContainer); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(terminalCommunicationsContainer); DisableableWidget cameraContainer = new DisableableWidget(); cameraContainer.AddChild(GetCameraControl()); if (ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true") { mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(cameraContainer); } AddChild(mainContainer); AddHandlers(); SetEnabledStates(); }
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 (ActivePrinterProfile.Instance.ActivePrinter == null || ActivePrinterProfile.Instance.ActivePrinter.GetFeatures().HasFan()) { controlsTopToBottomLayout.AddChild(fanControlsContainer); } }
/// <summary> /// Helper method to create DisableableWidget containers and populate the DisableableWidgets local property. /// </summary> /// <param name="widget">The widget to wrap.</param> private DisableableWidget CreateDisableableContainer(GuiWidget widget) { var container = new DisableableWidget(); container.AddChild(widget); DisableableWidgets.Add(container); return(container); }
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); sdCardManagerContainer = new DisableableWidget(); sdCardManagerContainer.AddChild(CreateSdCardManagerContainer()); if (false)// || ActivePrinterProfile.Instance.ActivePrinter == null || ActivePrinterProfile.Instance.ActivePrinter.GetFeatures().HasSdCard()) { controlsTopToBottomLayout.AddChild(sdCardManagerContainer); } macroControls = new DisableableWidget(); macroControls.AddChild(new MacroControls()); controlsTopToBottomLayout.AddChild(macroControls); AddAdjustmentControls(controlsTopToBottomLayout); this.AddChild(controlsTopToBottomLayout); AddHandlers(); SetVisibleControls(); if (!pluginsQueuedToAdd) { UiThread.RunOnIdle(AddPlugins); pluginsQueuedToAdd = true; } }
protected override void AddChildElements() { AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); temperatureGroupBox.Margin = new BorderDouble(0); FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); mainContainer.HAnchor = HAnchor.ParentLeftRight; mainContainer.Margin = new BorderDouble(left: 0); TextWidget subheader = new TextWidget("Temporarily override target temperature", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader.Margin = new BorderDouble(bottom: 6); mainContainer.AddChild(subheader); temperatureGroupBox.AddChild(mainContainer); RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100); int numberOfHeatedExtruders = 1; if (!ActiveSliceSettings.Instance.ExtrudersShareTemperature) { numberOfHeatedExtruders = ActiveSliceSettings.Instance.ExtruderCount; } if (numberOfHeatedExtruders > 1) { for (int i = 0; i < numberOfHeatedExtruders; i++) { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i)); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } } else { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget()); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } BedTemperatureControlWidget = new DisableableWidget(); BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget()); if (ActiveSliceSettings.Instance.HasHeatedBed()) { mainContainer.AddChild(BedTemperatureControlWidget); } this.AddChild(temperatureGroupBox); }
public CloudSettingsWidget() : base(LocalizedString.Get("Cloud Settings")) { mainContainer.AddChild(new HorizontalLine(separatorLineColor)); notificationSettingsContainer = new DisableableWidget(); notificationSettingsContainer.AddChild(GetNotificationControls()); mainContainer.AddChild(notificationSettingsContainer); AddChild(mainContainer); AddHandlers(); }
public CloudSettingsWidget() : base("Cloud".Localize()) { mainContainer.AddChild(new HorizontalLine(separatorLineColor)); notificationSettingsContainer = new DisableableWidget(); notificationSettingsContainer.AddChild(GetNotificationControls()); mainContainer.AddChild(notificationSettingsContainer); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); cloudSyncContainer = new DisableableWidget(); cloudSyncContainer.AddChild(GetCloudSyncDashboardControls()); mainContainer.AddChild(cloudSyncContainer); AddChild(mainContainer); AddHandlers(); }
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 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); }
public TemperatureControls() { AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); temperatureGroupBox.Margin = new BorderDouble(0); FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); mainContainer.HAnchor = HAnchor.ParentLeftRight; mainContainer.Margin = new BorderDouble(left: 0); temperatureGroupBox.AddChild(mainContainer); RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100); int numberOfHeatedExtruders = ActiveSliceSettings.Instance.Helpers.NumberOfHotEnds(); if (numberOfHeatedExtruders > 1) { for (int i = 0; i < numberOfHeatedExtruders; i++) { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i)); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } } else { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget()); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } BedTemperatureControlWidget = new DisableableWidget(); BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget()); if (ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.has_heated_bed)) { mainContainer.AddChild(BedTemperatureControlWidget); } this.AddChild(temperatureGroupBox); }
public CalibrationSettingsWidget() : base("Calibration Settings".Localize()) { printLevelingContainer = new DisableableWidget(); if (!ActiveSliceSettings.Instance.HasHardwareLeveling()) { printLevelingContainer.AddChild(GetAutoLevelControl()); mainContainer.AddChild(printLevelingContainer); } mainContainer.AddChild(new HorizontalLine(separatorLineColor)); AddChild(mainContainer); AddHandlers(); SetVisibleControls(); }
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 AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout) { DisableableWidget container = new DisableableWidget(); GroupBox themeControlsGroupBox = new GroupBox(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; ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(); themeSelector.Margin = new BorderDouble(right: 5); 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; themeControlsGroupBox.AddChild(colorSelectorContainer); colorSelectorContainer.AddChild(themeSelector); colorSelectorContainer.AddChild(currentColorThemeBorder); currentColorThemeBorder.AddChild(currentColorTheme); container.AddChild(themeControlsGroupBox); controlsTopToBottomLayout.AddChild(container); }
public CalibrationSettingsWidget() : base("Calibration".Localize()) { printLevelingContainer = new DisableableWidget(); if (!ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.has_hardware_leveling)) { printLevelingContainer.AddChild(GetAutoLevelControl()); mainContainer.AddChild(printLevelingContainer); } mainContainer.AddChild(new HorizontalLine(separatorLineColor)); AddChild(mainContainer); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents); SetVisibleControls(); }
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 (ActivePrinterProfile.Instance.ActivePrinter == null || ActivePrinterProfile.Instance.ActivePrinter.GetFeatures().HasHeatedBed()) { temperatureControlContainer.AddChild(bedTemperatureControlWidget); } controlsTopToBottomLayout.AddChild(temperatureControlContainer); }
public HardwareSettingsWidget() : base(LocalizedString.Get("Hardware Settings")) { eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(GetEEPromControl()); terminalCommunicationsContainer = new DisableableWidget(); terminalCommunicationsContainer.AddChild(GetGcodeTerminalControl()); printLevelingContainer = new DisableableWidget(); printLevelingContainer.AddChild(GetAutoLevelControl()); mainContainer.AddChild(printLevelingContainer); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(eePromControlsContainer); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(terminalCommunicationsContainer); AddChild(mainContainer); AddHandlers(); SetVisibleControls(); }
public HardwareSettingsWidget() : base(LocalizedString.Get("Hardware Settings")) { eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(GetEEPromControl()); terminalCommunicationsContainer = new DisableableWidget(); terminalCommunicationsContainer.AddChild(GetGcodeTerminalControl()); printLevelingContainer = new DisableableWidget(); if (!ActiveSliceSettings.Instance.HasHardwareLeveling()) { printLevelingContainer.AddChild(GetAutoLevelControl()); mainContainer.AddChild(printLevelingContainer); } mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(eePromControlsContainer); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(terminalCommunicationsContainer); DisableableWidget cameraContainer = new DisableableWidget(); cameraContainer.AddChild(GetCameraControl()); if (ApplicationSettings.Instance.get("HardwareHasCamera") == "true") { mainContainer.AddChild(new HorizontalLine(separatorLineColor)); mainContainer.AddChild(cameraContainer); } AddChild(mainContainer); AddHandlers(); SetVisibleControls(); }
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); }
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 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 AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(LocalizedString.Get("EEProm Settings")); 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 (PrinterCommunication.Instance.FirmwareType) { case PrinterCommunication.FirmwareTypes.Repetier: new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); break; case PrinterCommunication.FirmwareTypes.Marlin: new MatterHackers.MatterControl.EeProm.EePromMarlinWidget(); break; default: UiThread.RunOnIdle((state) => { string message = LocalizedString.Get("Oops! There is no eeprom mapping for your printer's firmware."); StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", 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 AddPrintLevelingControls(FlowLayoutWidget controlsTopToBottomLayout) { printLevelContainer = new DisableableWidget(); printLevelContainer.AddChild(CreatePrintLevelingControlsContainer()); controlsTopToBottomLayout.AddChild(printLevelContainer); }
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 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 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 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); }
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 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 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; }
private void AddPrintLevelingControls(FlowLayoutWidget controlsTopToBottomLayout) { printLevelingContainer = new DisableableWidget(); printLevelingContainer.AddChild(CreatePrintLevelingControlsContainer()); controlsTopToBottomLayout.AddChild(printLevelingContainer); }
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 AddCloudMonitorControls(FlowLayoutWidget controlsTopToBottomLayout) { cloudMonitorContainer = new DisableableWidget(); cloudMonitorContainer.AddChild(CreateCloudMonitorControls()); controlsTopToBottomLayout.AddChild(cloudMonitorContainer); }
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; } }