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); }
public void AddReleaseOptions(FlowLayoutWidget controlsTopToBottom) { AltGroupBox releaseOptionsGroupBox = new AltGroupBox(LocalizedString.Get("Update Feed")); releaseOptionsGroupBox.Margin = new BorderDouble(0); releaseOptionsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; releaseOptionsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; releaseOptionsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; releaseOptionsGroupBox.VAnchor = Agg.UI.VAnchor.ParentTop; releaseOptionsGroupBox.Height = 68; FlowLayoutWidget controlsContainer = new FlowLayoutWidget(); controlsContainer.HAnchor |= HAnchor.ParentCenter; AnchoredDropDownList releaseOptionsDropList = new AnchoredDropDownList("Development"); releaseOptionsDropList.Margin = new BorderDouble(0, 3); MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Release", "release"); releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot); MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem("Pre-Release", "pre-release"); preReleaseDropDownItem.Selected += new EventHandler(FixTabDot); MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem("Development", "development"); developmentDropDownItem.Selected += new EventHandler(FixTabDot); releaseOptionsDropList.MinimumSize = new Vector2(releaseOptionsDropList.LocalBounds.Width, releaseOptionsDropList.LocalBounds.Height); List<string> acceptableUpdateFeedTypeValues = new List<string>() { "release", "pre-release", "development" }; string currentUpdateFeedType = UserSettings.Instance.get("UpdateFeedType"); if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1) { UserSettings.Instance.set("UpdateFeedType", "release"); } releaseOptionsDropList.SelectedValue = UserSettings.Instance.get("UpdateFeedType"); releaseOptionsDropList.SelectionChanged += new EventHandler(ReleaseOptionsDropList_SelectionChanged); controlsContainer.AddChild(releaseOptionsDropList); releaseOptionsGroupBox.AddChild(controlsContainer); controlsTopToBottom.AddChild(releaseOptionsGroupBox); }
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); }
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); 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); temperatureIndicator.Padding = new BorderDouble(0, 3); // put in the actual temperature controls { FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); extruderActualIndicator.Margin = new BorderDouble(3, 0); 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); 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(); LinkButtonFactory linkFactory = new LinkButtonFactory(); linkFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkFactory.fontSize = 10; Button helpTextLink = linkFactory.Generate("?"); helpTextLink.Click += (sender, e) => { helperTextWidget.Visible = !helperTextWidget.Visible; }; this.presetButtonsContainer = GetPresetsContainer(); temperatureIndicator.AddChild(new HorizontalSpacer()); temperatureIndicator.AddChild(presetButtonsContainer); controlRow.AddChild(temperatureIndicator); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }