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); }
void AddChildElements() { Button editButton; GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Macros"), out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditMacrosWindow(ReloadMacros); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { { this.presetButtonsContainer = GetMacroButtonContainer(); controlRow.AddChild(this.presetButtonsContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
protected void AddChildElements() { Button editButton; AltGroupBox groupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(label, out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditTemperaturePresetsWindow(editWindowLabel, GetTemperaturePresets(), SetTemperaturePresets); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 2) * TextWidget.GlobalPointSizeScaleRatio; controlRow.HAnchor |= HAnchor.ParentLeftRight; { // put in the temperature slider and preset buttons tempSliderContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); { GuiWidget sliderLabels = GetSliderLabels(); tempSliderContainer.HAnchor = HAnchor.ParentLeftRight; tempSliderContainer.AddChild(sliderLabels); tempSliderContainer.Visible = false; } GuiWidget spacer = new GuiWidget(0, 10); spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; // put in the temperature indicators { FlowLayoutWidget temperatureIndicator = new FlowLayoutWidget(); temperatureIndicator.HAnchor = Agg.UI.HAnchor.ParentLeftRight; temperatureIndicator.Margin = new BorderDouble(bottom: 0) * TextWidget.GlobalPointSizeScaleRatio; temperatureIndicator.Padding = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; // put in the actual temperature controls { FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); extruderActualIndicator.Margin = new BorderDouble(3, 0) * TextWidget.GlobalPointSizeScaleRatio; string extruderActualLabelTxt = LocalizedString.Get("Actual"); string extruderActualLabelTxtFull = string.Format("{0}: ", extruderActualLabelTxt); TextWidget extruderActualLabel = new TextWidget(extruderActualLabelTxtFull, pointSize: 10); extruderActualLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; extruderActualLabel.VAnchor = VAnchor.ParentCenter; actualTempIndicator = new TextWidget(string.Format("{0:0.0}°C", GetActualTemperature()), pointSize: 12); actualTempIndicator.AutoExpandBoundsToText = true; actualTempIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor; actualTempIndicator.VAnchor = VAnchor.ParentCenter; extruderActualIndicator.AddChild(extruderActualLabel); extruderActualIndicator.AddChild(actualTempIndicator); string extruderAboutLabelTxt = LocalizedString.Get("Target"); string extruderAboutLabelTxtFull = string.Format("{0}: ", extruderAboutLabelTxt); TextWidget extruderTargetLabel = new TextWidget(extruderAboutLabelTxtFull, pointSize: 10); extruderTargetLabel.Margin = new BorderDouble(left: 10) * TextWidget.GlobalPointSizeScaleRatio; extruderTargetLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; extruderTargetLabel.VAnchor = VAnchor.ParentCenter; extruderActualIndicator.AddChild(extruderTargetLabel); temperatureIndicator.AddChild(extruderActualIndicator); } // put in the target temperature controls temperatureIndicator.AddChild(GetTargetTemperatureDisplay()); FlowLayoutWidget helperTextWidget = GetHelpTextWidget(); GuiWidget hspacer = new GuiWidget(); hspacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; LinkButtonFactory linkFactory = new LinkButtonFactory(); linkFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkFactory.fontSize = 10; Button helpTextLink = linkFactory.Generate("?"); helpTextLink.Click += (sender, e) => { helperTextWidget.Visible = !helperTextWidget.Visible; }; //temperatureIndicator.AddChild(hspacer); //temperatureIndicator.AddChild(helpTextLink); this.presetButtonsContainer = GetPresetsContainer(); temperatureIndicator.AddChild(new HorizontalSpacer()); temperatureIndicator.AddChild(presetButtonsContainer); controlRow.AddChild(temperatureIndicator); //controlRow.AddChild(helperTextWidget); //controlRow.AddChild(this.presetButtonsContainer); //controlRow.AddChild(tempSliderContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
private GuiWidget CreatePrintLevelingControlsContainer() { Button editButton; GroupBox printLevelingControlsContainer = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Automatic Calibration"), out editButton)); editButton.Click += (sender, e) => { if (editLevelingSettingsWindow == null) { editLevelingSettingsWindow = new EditLevelingSettingsWindow(); editLevelingSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editLevelingSettingsWindow = null; }; } else { editLevelingSettingsWindow.BringToFront(); } }; printLevelingControlsContainer.Margin = new BorderDouble(0); printLevelingControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; printLevelingControlsContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Button runPrintLevelingButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); runPrintLevelingButton.Margin = new BorderDouble(left: 6); runPrintLevelingButton.VAnchor = VAnchor.ParentCenter; runPrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(runPrintLeveling_Click); Agg.Image.ImageBuffer levelingImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(levelingImage); } ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble(right: 6); enablePrintLevelingButton = textImageButtonFactory.Generate("Enable".Localize().ToUpper()); enablePrintLevelingButton.Margin = new BorderDouble(left: 6); enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click); disablePrintLevelingButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disablePrintLevelingButton.Margin = new BorderDouble(left: 6); disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click); CheckBox doLevelingCheckBox = new CheckBox(LocalizedString.Get("Enable Automatic Print Leveling")); doLevelingCheckBox.Margin = new BorderDouble(left: 3); doLevelingCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; doLevelingCheckBox.VAnchor = VAnchor.ParentCenter; doLevelingCheckBox.Checked = ActivePrinterProfile.Instance.DoPrintLeveling; printLevelingStatusLabel = new TextWidget(""); printLevelingStatusLabel.AutoExpandBoundsToText = true; printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(levelingIcon); //buttonBar.AddChild(doLevelingCheckBox); buttonBar.AddChild(printLevelingStatusLabel); buttonBar.AddChild(hSpacer); buttonBar.AddChild(enablePrintLevelingButton); buttonBar.AddChild(disablePrintLevelingButton); buttonBar.AddChild(runPrintLevelingButton); doLevelingCheckBox.CheckedStateChanged += (sender, e) => { ActivePrinterProfile.Instance.DoPrintLeveling = doLevelingCheckBox.Checked; }; ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); }, ref unregisterEvents); printLevelingControlsContainer.AddChild(buttonBar); } SetPrintLevelButtonVisiblity(); return(printLevelingControlsContainer); }