Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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) * 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);
        }
		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 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);
		}
		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 GuiWidget CreatePrintLevelingControlsContainer()
        {
            Button      editButton;
            AltGroupBox printLevelingControlsContainer = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Automatic Calibration"), out editButton));

            editButton.Click += (sender, e) =>
            {
                UiThread.RunOnIdle((state) =>
                {
                    if (editLevelingSettingsWindow == null)
                    {
                        editLevelingSettingsWindow         = new EditLevelingSettingsWindow();
                        editLevelingSettingsWindow.Closed += (sender2, e2) =>
                        {
                            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  += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration);
                    });
                };

                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 EventHandler(enablePrintLeveling_Click);

                disablePrintLevelingButton         = textImageButtonFactory.Generate("Disable".Localize().ToUpper());
                disablePrintLevelingButton.Margin  = new BorderDouble(left: 6);
                disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter;
                disablePrintLevelingButton.Click  += new EventHandler(disablePrintLeveling_Click);

                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(printLevelingStatusLabel);
                buttonBar.AddChild(hSpacer);
                buttonBar.AddChild(enablePrintLevelingButton);
                buttonBar.AddChild(disablePrintLevelingButton);
                buttonBar.AddChild(runPrintLevelingButton);
                ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
                {
                    SetPrintLevelButtonVisiblity();
                }, ref unregisterEvents);

                printLevelingControlsContainer.AddChild(buttonBar);
            }
            SetPrintLevelButtonVisiblity();
            return(printLevelingControlsContainer);
        }
        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);
        }