Exemple #1
0
        StyledDropDownList CreateSliceEngineDropdown()
        {
            StyledDropDownList engineMenuDropList = new StyledDropDownList("Engine   ");

            engineMenuDropList.Margin = new BorderDouble(top: 3, left: 0);
            {
                MenuItem slic3rMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.Slic3r.ToString());
                slic3rMenuItem.Selected += (sender, e) =>
                {
                    ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.Slic3r;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };

                MenuItem curaEnginMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.CuraEngine.ToString());
                curaEnginMenuItem.Selected += (sender, e) =>
                {
                    ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.CuraEngine;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };

#if false
                MenuItem matterSliceMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngine.MatterSlice.ToString());
                matterSliceMenuItem.Selected += (sender, e) =>
                {
                    PrinterCommunication.Instance.ActiveSliceEngine = ActivePrinterProfile.SlicingEngine.MatterSlice;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };
#endif

                engineMenuDropList.SelectedValue = ActivePrinterProfile.Instance.ActiveSliceEngineType.ToString();
            }
            engineMenuDropList.MinimumSize = new Vector2(engineMenuDropList.LocalBounds.Width, engineMenuDropList.LocalBounds.Height);
            return(engineMenuDropList);
        }
        private FlowLayoutWidget GetModeControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget("Interface Mode".Localize());

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList interfaceModeDropList = new StyledDropDownList("Standard", maxHeight: 200);

            interfaceModeDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(interfaceModeDropList);
            optionsContainer.Width = 200;

            MenuItem standardModeDropDownItem = interfaceModeDropList.AddItem("Standard".Localize(), "True");
            MenuItem advancedModeDropDownItem = interfaceModeDropList.AddItem("Advanced".Localize(), "False");

            interfaceModeDropList.SelectedValue     = UserSettings.Instance.Fields.IsSimpleMode.ToString();
            interfaceModeDropList.SelectionChanged += new EventHandler(InterfaceModeDropList_SelectionChanged);

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
Exemple #3
0
        private FlowLayoutWidget GetUpdateControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            configureUpdateFeedButton         = textImageButtonFactory.Generate("Configure".Localize().ToUpper());
            configureUpdateFeedButton.Margin  = new BorderDouble(left: 6);
            configureUpdateFeedButton.VAnchor = VAnchor.ParentCenter;

            TextWidget settingsLabel = new TextWidget(LocalizedString.Get("Update Notification Feed"));

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(releaseOptionsDropList);
            optionsContainer.Width = 200;

            MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem(LocalizedString.Get("Stable"), "release");

            releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem(LocalizedString.Get("Beta"), "pre-release");

            preReleaseDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem(LocalizedString.Get("Alpha"), "development");

            developmentDropDownItem.Selected += new EventHandler(FixTabDot);

            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);

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
Exemple #4
0
        private FlowLayoutWidget GetDisplayControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);


            TextWidget settingsLabel = new TextWidget(LocalizedString.Get("Change Display Mode"));

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            displayControlRestartButton         = textImageButtonFactory.Generate("Restart");
            displayControlRestartButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
            displayControlRestartButton.Visible = false;
            displayControlRestartButton.Margin  = new BorderDouble(right: 6);
            displayControlRestartButton.Click  += (sender, e) =>
            {
                RestartApplication();
            };


            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(releaseOptionsDropList);
            optionsContainer.Width = 200;

            MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem(LocalizedString.Get("Normal"), "responsive");
            MenuItem preReleaseDropDownItem     = releaseOptionsDropList.AddItem(LocalizedString.Get("Touchscreen"), "touchscreen");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "responsive", "touchscreen"
            };
            string currentUpdateFeedType = UserSettings.Instance.get("ApplicationDisplayMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1)
            {
                UserSettings.Instance.set("ApplicationDisplayMode", "responsive");
            }

            releaseOptionsDropList.SelectedValue     = UserSettings.Instance.get("ApplicationDisplayMode");
            releaseOptionsDropList.SelectionChanged += new EventHandler(DisplayOptionsDropList_SelectionChanged);

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(displayControlRestartButton);
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
Exemple #5
0
        private FlowLayoutWidget GetThumbnailRenderingControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(interfaceOptionsDropList);
            optionsContainer.Width = 200;

            MenuItem responsizeOptionsDropDownItem  = interfaceOptionsDropList.AddItem("Flat".Localize(), "orthographic");
            MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem("3D".Localize(), "raytraced");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "orthographic", "raytraced"
            };
            string currentThumbnailRenderingMode = UserSettings.Instance.get("ThumbnailRenderingMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentThumbnailRenderingMode) == -1)
            {
                UserSettings.Instance.set("ThumbnailRenderingMode", "orthographic");
            }

            interfaceOptionsDropList.SelectedValue     = UserSettings.Instance.get("ThumbnailRenderingMode");
            interfaceOptionsDropList.SelectionChanged += (sender, e) =>
            {
                string releaseCode = ((StyledDropDownList)sender).SelectedValue;
                if (releaseCode != UserSettings.Instance.get("ThumbnailRenderingMode"))
                {
                    UserSettings.Instance.set("ThumbnailRenderingMode", releaseCode);
                }
            };

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
Exemple #6
0
        private FlowLayoutWidget GetModeControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget(LocalizedString.Get("Change Mode"));

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList releaseOptionsDropList = new StyledDropDownList("Standard", maxHeight: 200);

            releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(releaseOptionsDropList);
            optionsContainer.Width = 200;

            MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem(LocalizedString.Get("Standard"), "true");
            MenuItem preReleaseDropDownItem     = releaseOptionsDropList.AddItem(LocalizedString.Get("Advanced"), "false");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "true", "false"
            };
            string currentUpdateFeedType = UserSettings.Instance.get("IsSimpleMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1)
            {
                UserSettings.Instance.set("IsSimpleMode", "true");
            }

            releaseOptionsDropList.SelectedValue     = UserSettings.Instance.get("IsSimpleMode");
            releaseOptionsDropList.SelectionChanged += new EventHandler(ModeOptionsDropList_SelectionChanged);

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
		public SliceSettingsDetailControl()
		{
			showHelpBox = new CheckBox(0, 0, "Show Help".Localize(), textSize: 10);
			showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
			// add in the ability to turn on and off help text
			showHelpBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			showHelpBox.Margin = new BorderDouble(right: 3);
			showHelpBox.VAnchor = VAnchor.ParentCenter;
			showHelpBox.Cursor = Cursors.Hand;
			showHelpBox.CheckedStateChanged += (s, e) =>
			{
				UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower());
				ShowHelpChanged?.Invoke(this, null);
			};

			this.AddChild(showHelpBox);

			settingsDetailSelector = new StyledDropDownList("Basic", maxHeight: 200);
			settingsDetailSelector.Name = "User Level Dropdown";
			settingsDetailSelector.AddItem("Basic".Localize(), "Simple");
			settingsDetailSelector.AddItem("Standard".Localize(), "Intermediate");
			settingsDetailSelector.AddItem("Advanced".Localize(), "Advanced");
			if (UserSettings.Instance.get(SliceSettingsLevelEntry) != null
				&& SliceSettingsOrganizer.Instance.UserLevels.ContainsKey(UserSettings.Instance.get(SliceSettingsLevelEntry)))
			{
				settingsDetailSelector.SelectedValue = UserSettings.Instance.get(SliceSettingsLevelEntry);
			}

			settingsDetailSelector.SelectionChanged += new EventHandler(SettingsDetail_SelectionChanged);
			settingsDetailSelector.VAnchor = VAnchor.ParentCenter;
			settingsDetailSelector.Margin = new BorderDouble(5, 3);
			settingsDetailSelector.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100);

			this.AddChild(settingsDetailSelector);
			this.AddChild(GetSliceOptionsMenuDropList());
		}
Exemple #8
0
        public SliceSettingsDetailControl()
        {
            showHelpBox         = new CheckBox(0, 0, "Show Help".Localize(), textSize: 10);
            showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
            // add in the ability to turn on and off help text
            showHelpBox.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
            showHelpBox.Margin               = new BorderDouble(right: 3);
            showHelpBox.VAnchor              = VAnchor.ParentCenter;
            showHelpBox.Cursor               = Cursors.Hand;
            showHelpBox.CheckedStateChanged += (s, e) =>
            {
                UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower());
                ShowHelpChanged?.Invoke(this, null);
            };

            this.AddChild(showHelpBox);

            settingsDetailSelector      = new StyledDropDownList("Basic", maxHeight: 200);
            settingsDetailSelector.Name = "User Level Dropdown";
            settingsDetailSelector.AddItem("Basic".Localize(), "Simple");
            settingsDetailSelector.AddItem("Standard".Localize(), "Intermediate");
            settingsDetailSelector.AddItem("Advanced".Localize(), "Advanced");
            if (UserSettings.Instance.get(SliceSettingsLevelEntry) != null &&
                SliceSettingsOrganizer.Instance.UserLevels.ContainsKey(UserSettings.Instance.get(SliceSettingsLevelEntry)))
            {
                settingsDetailSelector.SelectedValue = UserSettings.Instance.get(SliceSettingsLevelEntry);
            }

            settingsDetailSelector.SelectionChanged += new EventHandler(SettingsDetail_SelectionChanged);
            settingsDetailSelector.VAnchor           = VAnchor.ParentCenter;
            settingsDetailSelector.Margin            = new BorderDouble(5, 3);
            settingsDetailSelector.BorderColor       = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100);

            this.AddChild(settingsDetailSelector);
            this.AddChild(GetSliceOptionsMenuDropList());
        }
		private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth, int extruderIndex)
		{
			GuiWidget container = new GuiWidget();
			this.HAnchor = HAnchor.ParentLeftRight;

			string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);

			var settingsRow = new SettingsRow()
			{
				SettingsKey = settingData.SlicerConfigName,
				SettingsValue = sliceSettingValue
			};

			if (!ActiveSliceSettings.Instance.InBaseConfig(settingData.SlicerConfigName))
			{
				// the setting we think we are adding is not in the config.ini it may have been deprecated
				TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
				settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
				settingsRow.AddChild(settingName);
				settingsRow.BackgroundColor = RGBA_Bytes.Red;
			}
			else
			{
				int intEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				int doubleEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				if (settingData.QuickMenuSettings.Count > 0)
				{
					doubleEditWidth = (int)(35 * TextWidget.GlobalPointSizeScaleRatio + .5);
				}
				int vectorXYEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				int multiLineEditHeight = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);


				if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
				{
					var nameHolder = new GuiWidget(HAnchor.AbsolutePosition, VAnchor.FitToChildren | VAnchor.ParentCenter)
					{
						Width = minSettingNameWidth,
						Padding = new BorderDouble(0, 0, 5, 0),
					};

					nameHolder.AddChild(new WrappedTextWidget(
						settingData.PresentationName.Localize(), 
						minSettingNameWidth, 
						pointSize: 10, 
						textColor: ActiveTheme.Instance.PrimaryTextColor));

					settingsRow.AddChild(nameHolder);
				}

				switch (settingData.DataEditType)
				{
					case OrganizerSettingsData.DataEditTypes.INT:
						{
							int currentValue;
							int.TryParse(sliceSettingValue, out currentValue);

							var intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};
							intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							settingsRow.AddChild(intEditWidget);
							settingsRow.AddChild(GetExtraSettingsWidget(settingData));

							settingsRow.ValueChanged = (text) => intEditWidget.Text = text;
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE:
						{
							double currentValue;
							double.TryParse(sliceSettingValue, out currentValue);

							var doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(doubleEditWidget);
							settingsRow.AddChild(GetExtraSettingsWidget(settingData));

							settingsRow.ValueChanged = (text) =>
							{
								double currentValue2 = 0;
								double.TryParse(text, out currentValue2);
								doubleEditWidget.ActuallNumberEdit.Value = currentValue2;
							};
						}
						break;

					case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
						{
							const string multiValuesAreDiffernt = "-";
							FlowLayoutWidget content = new FlowLayoutWidget();

							var doubleEditWidget = new MHNumberEdit(0, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								Name = settingData.PresentationName + " Textbox",
								SelectAllOnFocus = true
							};

							double currentValue;
							bool ChangesMultipleOtherSettings = settingData.SetSettingsOnChange.Count > 0;
							if (ChangesMultipleOtherSettings)
							{
								bool allTheSame = true;
								string setting = ActiveSliceSettings.Instance.GetActiveValue(settingData.SetSettingsOnChange[0]);
								for (int i = 1; i < settingData.SetSettingsOnChange.Count; i++)
								{
									string nextSetting = ActiveSliceSettings.Instance.GetActiveValue(settingData.SetSettingsOnChange[i]);
									if (setting != nextSetting)
									{
										allTheSame = false;
										break;
									}
								}

								if (allTheSame && setting.EndsWith("mm"))
								{
									double.TryParse(setting.Substring(0, setting.Length - 2), out currentValue);
									doubleEditWidget.ActuallNumberEdit.Value = currentValue;
								}
								else
								{
									doubleEditWidget.ActuallNumberEdit.InternalNumberEdit.Text = multiValuesAreDiffernt;
								}
							}
							else // just set the setting normally
							{
								double.TryParse(sliceSettingValue, out currentValue);
								doubleEditWidget.ActuallNumberEdit.Value = currentValue;
							}
							doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget.MarkAsStartingState();
							
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								NumberEdit numberEdit = (NumberEdit)sender;
								// If this setting sets other settings, then do that.
								if (ChangesMultipleOtherSettings
									&& numberEdit.Text != multiValuesAreDiffernt)
								{
									foreach (string setting in settingData.SetSettingsOnChange)
									{
										SaveSetting(setting, numberEdit.Value.ToString() + "mm");
									}
								}

								// also always save to the local setting
								SaveSetting(settingData.SlicerConfigName, numberEdit.Value.ToString());
								settingsRow.UpdateStyle();
								OnSettingsChanged(settingData);
							};
							content.AddChild(doubleEditWidget);
							content.AddChild(GetExtraSettingsWidget(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								settingsRow.AddChild(CreateQuickMenu(settingData, content, doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget));
							}
							else
							{
								settingsRow.AddChild(content);
							}

							settingsRow.ValueChanged = (text) =>
							{
								double currentValue2 = 0;
								double.TryParse(text, out currentValue2);
								doubleEditWidget.ActuallNumberEdit.Value = currentValue2;
							};
						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET:
						{
							double currentValue;
							double.TryParse(sliceSettingValue, out currentValue);
							var doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true

							};
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								settingsRow.UpdateStyle();
								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(doubleEditWidget);
							settingsRow.AddChild(GetExtraSettingsWidget(settingData));

							settingsRow.ValueChanged = (text) =>
							{
								double currentValue2;
								double.TryParse(text, out currentValue2);
								doubleEditWidget.ActuallNumberEdit.Value = currentValue2;
							};
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							var stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								var textEditWidget = (TextEditWidget)sender;
								string text = textEditWidget.Text.Trim();

								bool isPercent = text.Contains("%");
								if (isPercent)
								{
									text = text.Substring(0, text.IndexOf("%"));
								}
								double result;
								double.TryParse(text, out result);
								text = result.ToString();
								if (isPercent)
								{
									text += "%";
								}
								textEditWidget.Text = text;
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select everything up to the % (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int percentIndex = textEditWidget.Text.IndexOf("%");
								if (percentIndex != -1)
								{
									textEditWidget.SetSelection(0, percentIndex - 1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(GetExtraSettingsWidget(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								settingsRow.AddChild(CreateQuickMenu(settingData, content, stringEdit.ActualTextEditWidget.InternalTextEditWidget));
							}
							else
							{
								settingsRow.AddChild(content);
							}

							settingsRow.ValueChanged = (text) => stringEdit.Text = text;
						}
						break;

					case OrganizerSettingsData.DataEditTypes.INT_OR_MM:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							var stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};

							string startingText = stringEdit.Text;
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								TextEditWidget textEditWidget = (TextEditWidget)sender;
								// only validate when we lose focus
								if (!textEditWidget.ContainsFocus)
								{
									string text = textEditWidget.Text;
									text = text.Trim();
									bool isMm = text.Contains("mm");
									if (isMm)
									{
										text = text.Substring(0, text.IndexOf("mm"));
									}
									double result;
									double.TryParse(text, out result);
									text = result.ToString();
									if (isMm)
									{
										text += "mm";
									}
									else
									{
										result = (int)result;
										text = result.ToString();
									}
									textEditWidget.Text = text;
									startingText = stringEdit.Text;
								}
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);

								OnSettingsChanged(settingData);

								// make sure we are still looking for the final validation before saving.
								if (textEditWidget.ContainsFocus)
								{
									UiThread.RunOnIdle(() =>
									{
										string currentText = textEditWidget.Text;
										int cursorIndex = textEditWidget.InternalTextEditWidget.CharIndexToInsertBefore;
										textEditWidget.Text = startingText;
										textEditWidget.InternalTextEditWidget.MarkAsStartingState();
										textEditWidget.Text = currentText;
										textEditWidget.InternalTextEditWidget.CharIndexToInsertBefore = cursorIndex;
									});
								}
							};

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select everything up to the mm (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int mMIndex = textEditWidget.Text.IndexOf("mm");
								if (mMIndex != -1)
								{
									textEditWidget.SetSelection(0, mMIndex - 1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(GetExtraSettingsWidget(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								settingsRow.AddChild(CreateQuickMenu(settingData, content, stringEdit.ActualTextEditWidget.InternalTextEditWidget));
							}
							else
							{
								settingsRow.AddChild(content);
							}

							settingsRow.ValueChanged = (text) => stringEdit.Text = text;
						}
						break;

					case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
						{
							var checkBoxWidget = new CheckBox("")
							{
								Name = settingData.PresentationName + " Checkbox",
								ToolTipText = settingData.HelpText,
								VAnchor = Agg.UI.VAnchor.ParentBottom,
								TextColor = ActiveTheme.Instance.PrimaryTextColor,
								Checked = sliceSettingValue == "1"
							};
							checkBoxWidget.CheckedStateChanged += (sender, e) =>
							{
								bool isChecked = ((CheckBox)sender).Checked;
								SaveSetting(settingData.SlicerConfigName, isChecked ? "1" : "0");
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							settingsRow.AddChild(checkBoxWidget);

							settingsRow.ValueChanged = (text) => checkBoxWidget.Checked = text == "1";
						}
						break;

					case OrganizerSettingsData.DataEditTypes.STRING:
						{
							var stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
							stringEdit.ToolTipText = settingData.HelpText;
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text);
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							settingsRow.AddChild(stringEdit);

							settingsRow.ValueChanged = (text) => stringEdit.Text = text;
						}
						break;

					case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
						{
							string convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
							var stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
							
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n"));
								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							settingsRow.AddChild(stringEdit);

							settingsRow.ValueChanged = (text) => stringEdit.Text = text.Replace("\\n", "\n");
						}
						break;

					case OrganizerSettingsData.DataEditTypes.LIST:
						{
							var selectableOptions = new StyledDropDownList("None", maxHeight: 200)
							{
								ToolTipText = settingData.HelpText,
								Margin = new BorderDouble()
							};

							foreach (string listItem in settingData.ExtraSettings.Split(','))
							{
								MenuItem newItem = selectableOptions.AddItem(listItem);
								if (newItem.Text == sliceSettingValue)
								{
									selectableOptions.SelectedLabel = sliceSettingValue;
								}

								newItem.Selected += (sender, e) =>
								{
									MenuItem menuItem = ((MenuItem)sender);
									SaveSetting(settingData.SlicerConfigName, menuItem.Text);

									settingsRow.UpdateStyle();

									OnSettingsChanged(settingData);
								};
							}

							settingsRow.AddChild(selectableOptions);

							settingsRow.ValueChanged = (text) => selectableOptions.SelectedLabel = text;
						}
						break;

					case OrganizerSettingsData.DataEditTypes.HARDWARE_PRESENT:
						{
							var checkBoxWidget = new CheckBox("")
							{
								Name = settingData.PresentationName + " Checkbox",
								ToolTipText = settingData.HelpText,
								VAnchor = Agg.UI.VAnchor.ParentBottom,
								TextColor = ActiveTheme.Instance.PrimaryTextColor,
								Checked = sliceSettingValue == "1"
							};

							checkBoxWidget.CheckedStateChanged += (sender, e) =>
							{
								bool isChecked = ((CheckBox)sender).Checked;
								SaveSetting(settingData.SlicerConfigName, isChecked ? "1" : "0");

								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};

							settingsRow.AddChild(checkBoxWidget);

							settingsRow.ValueChanged = (text) => checkBoxWidget.Checked = text == "1";
						}
						break;

					case OrganizerSettingsData.DataEditTypes.VECTOR2:
						{
							string[] xyValueStrings = sliceSettingValue.Split(',');
							if (xyValueStrings.Length != 2)
							{
								xyValueStrings = new string[] { "0", "0" };
							}

							double currentXValue;
							double.TryParse(xyValueStrings[0], out currentXValue);

							var xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								Margin = new BorderDouble(0, 0, 30 * TextWidget.GlobalPointSizeScaleRatio, 0),
								SelectAllOnFocus = true
							};

							double currentYValue;
							double.TryParse(xyValueStrings[1], out currentYValue);

							var yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};

							xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());

								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(xEditWidget);

							yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());

								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(yEditWidget);

							settingsRow.ValueChanged = (text) =>
							{
								double currentValue2;
								string[] xyValueStrings2 = text.Split(',');
								if (xyValueStrings2.Length != 2)
								{
									xyValueStrings2 = new string[] { "0", "0" };
								}

								double.TryParse(xyValueStrings2[0], out currentValue2);
								xEditWidget.ActuallNumberEdit.Value = currentValue2;

								double.TryParse(xyValueStrings2[1], out currentValue2);
								yEditWidget.ActuallNumberEdit.Value = currentValue2;
							};

						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET2:
						{
							Vector2 offset = ActiveSliceSettings.Instance.GetOffset(extruderIndex);

							var xEditWidget = new MHNumberEdit(offset.x, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true,
								Margin = new BorderDouble(0, 0, 30 * TextWidget.GlobalPointSizeScaleRatio, 0)
							};

							var yEditWidget = new MHNumberEdit(offset.y, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++)
							{
								ToolTipText = settingData.HelpText,
								SelectAllOnFocus = true
							};

							xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								int extruderIndexLocal = extruderIndex;
								SaveCommaSeparatedIndexSetting(extruderIndexLocal, settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());

								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(xEditWidget);


							yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								int extruderIndexLocal = extruderIndex;
								SaveCommaSeparatedIndexSetting(extruderIndexLocal, settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());

								settingsRow.UpdateStyle();

								OnSettingsChanged(settingData);
							};
							settingsRow.AddChild(yEditWidget);

							settingsRow.ValueChanged = (text) =>
							{
								Vector2 offset2 = ActiveSliceSettings.Instance.GetOffset(extruderIndex);
								xEditWidget.ActuallNumberEdit.Value = offset2.x;
								yEditWidget.ActuallNumberEdit.Value = offset2.y;
							};

						}
						break;

					default:
						var missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()))
						{
							TextColor = ActiveTheme.Instance.PrimaryTextColor,
							BackgroundColor = RGBA_Bytes.Red
						};
						settingsRow.AddChild(missingSetting);
						break;
				}
			}

			container.HAnchor = HAnchor.ParentLeftRight;
			container.VAnchor = VAnchor.FitToChildren;

			var restoreButton = new Button(new ButtonViewStates(new ImageWidget(restoreNormal), new ImageWidget(restoreHover), new ImageWidget(restorePressed), new ImageWidget(restoreNormal)))
			{
				Name = "Restore " + settingData.SlicerConfigName,
				VAnchor = VAnchor.ParentCenter,
				Margin = new BorderDouble(0, 0, 5, 0),
				ToolTipText = "Restore Default".Localize()
			};

			restoreButton.Click += (sender, e) =>
			{
				// Revert the user override 
				if (persistenceLayer == null)
				{
					ActiveSliceSettings.Instance.ClearValue(settingData.SlicerConfigName);
				}
				else
				{
					ActiveSliceSettings.Instance.ClearValue(settingData.SlicerConfigName, persistenceLayer);
				}

				settingsRow.RefreshValue();
			};

			settingsRow.AddChild(new GuiWidget(HAnchor.ParentLeftRight));
			settingsRow.AddChild(restoreButton);

			container.AddChild(settingsRow);

			// Define the UpdateStyle implementation
			settingsRow.UpdateStyle = () =>
			{
				if (persistenceLayer.ContainsKey(settingData.SlicerConfigName))
				{
					switch (this.viewFilter)
					{
						case NamedSettingsLayers.All:
							settingsRow.BackgroundColor = userSettingBackgroundColor;
							break;
						case NamedSettingsLayers.Material:
							settingsRow.BackgroundColor = materialSettingBackgroundColor;
							break;
						case NamedSettingsLayers.Quality:
							settingsRow.BackgroundColor = qualitySettingBackgroundColor;
							break;
					}

					restoreButton.Visible = true;
				}
				else if (layerFilters == null)
				{
					if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, NamedSettingsLayers.Material))
					{
						settingsRow.BackgroundColor = materialSettingBackgroundColor;
					}
					else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, NamedSettingsLayers.Quality))
					{
						settingsRow.BackgroundColor = qualitySettingBackgroundColor;
					}
					else
					{
						settingsRow.BackgroundColor = RGBA_Bytes.Transparent;
					}

					restoreButton.Visible = false;
				}
				else
				{
					restoreButton.Visible = false;
					settingsRow.BackgroundColor = RGBA_Bytes.Transparent;
				}
			};

			// Invoke the UpdateStyle implementation
			settingsRow.UpdateStyle();

			return container;
		}
		private FlowLayoutWidget GetSettingsRow(OrganizerSettingsData settingData, string sliceSettingValue = null)
		{
			FlowLayoutWidget container = new FlowLayoutWidget();
			container.HAnchor = HAnchor.ParentLeftRight;

			double minSettingNameWidth = 400;

			if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
			{
				int intEditWidth = 60;
				int doubleEditWidth = 60;
				int vectorXYEditWidth = 60;
				int multiLineEditHeight = 60;

				//Get the current value as a default value
				if (sliceSettingValue == null)
				{
					sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
				}

				//Get the presentation name from the SettingNameLookup
				TextWidget settingName = new TextWidget(SettingNameLookup[settingData.SlicerConfigName], pointSize: 10);
				settingName.AutoExpandBoundsToText = false;
				settingName.EllipsisIfClipped = true;
				settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				settingName.VAnchor = Agg.UI.VAnchor.ParentCenter;
				settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.Height);
				settingName.Width = minSettingNameWidth;

				container.AddChild(settingName);

				switch (settingData.DataEditType)
				{
					case OrganizerSettingsData.DataEditTypes.INT:
						{
							int currentValue = 0;
							int.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
							intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
							container.AddChild(intEditWidget);
							container.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE:
						{
							double currentValue = 0;
							double.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
							container.AddChild(doubleEditWidget);
							container.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
						{
							double currentValue = 0;
							double.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
							container.AddChild(doubleEditWidget);
							container.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET:
						{
							double currentValue = 0;
							double.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
							container.AddChild(doubleEditWidget);
							container.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++);
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								TextEditWidget textEditWidget = (TextEditWidget)sender;
								string text = textEditWidget.Text;
								text = text.Trim();
								bool isPercent = text.Contains("%");
								if (isPercent)
								{
									text = text.Substring(0, text.IndexOf("%"));
								}
								double result;
								double.TryParse(text, out result);
								text = result.ToString();
								if (isPercent)
								{
									text += "%";
								}
								textEditWidget.Text = text;
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
							};
							stringEdit.SelectAllOnFocus = true;

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select evrything up to the % (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int percentIndex = textEditWidget.Text.IndexOf("%");
								if (percentIndex != -1)
								{
									textEditWidget.SetSelection(0, percentIndex - 1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(getSettingInfoData(settingData));

							container.AddChild(content);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.INT_OR_MM:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++);
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								TextEditWidget textEditWidget = (TextEditWidget)sender;
								string text = textEditWidget.Text;
								text = text.Trim();
								bool isMm = text.Contains("mm");
								if (isMm)
								{
									text = text.Substring(0, text.IndexOf("mm"));
								}
								double result;
								double.TryParse(text, out result);
								text = result.ToString();
								if (isMm)
								{
									text += "mm";
								}
								else
								{
									result = (int)result;
									text = result.ToString();
								}
								textEditWidget.Text = text;
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
							};
							stringEdit.SelectAllOnFocus = true;

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select evrything up to the mm (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int mMIndex = textEditWidget.Text.IndexOf("mm");
								if (mMIndex != -1)
								{
									textEditWidget.SetSelection(0, mMIndex - 1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(getSettingInfoData(settingData));

							container.AddChild(content);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
						{
							CheckBox checkBoxWidget = new CheckBox("");
							checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
							checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
							checkBoxWidget.Checked = (sliceSettingValue == "1");
							checkBoxWidget.CheckedStateChanged += (sender, e) =>
							{
								if (((CheckBox)sender).Checked)
								{
									SaveSetting(settingData.SlicerConfigName, "1");
								}
								else
								{
									SaveSetting(settingData.SlicerConfigName, "0");
								}
							};
							container.AddChild(checkBoxWidget);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.STRING:
						{
							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text); };
							container.AddChild(stringEdit);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
						{
							string convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
							MHTextEditWidget stringEdit = new MHTextEditWidget(convertedNewLines, pointSize: 10, pixelWidth: 280, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n")); };
							container.AddChild(stringEdit);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.LIST:
						{
							StyledDropDownList selectableOptions = new StyledDropDownList("None", Direction.Down);
							selectableOptions.Margin = new BorderDouble();

							string[] listItems = settingData.ExtraSettings.Split(',');
							foreach (string listItem in listItems)
							{
								MenuItem newItem = selectableOptions.AddItem(listItem);
								if (newItem.Text == sliceSettingValue)
								{
									selectableOptions.SelectedLabel = sliceSettingValue;
								}

								newItem.Selected += (sender, e) =>
								{
									MenuItem menuItem = ((MenuItem)sender);
									SaveSetting(settingData.SlicerConfigName, menuItem.Text);
								};
							}
							container.AddChild(selectableOptions);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.HARDWARE_PRESENT:
						// this is not editable for a detail setting (quality or material)
						break;

					case OrganizerSettingsData.DataEditTypes.VECTOR2:
						{
							string[] xyValueStrings = sliceSettingValue.Split(',');
							if (xyValueStrings.Length != 2)
							{
								xyValueStrings = new string[] { "0", "0" };
							}
							double currentXValue = 0;
							double.TryParse(xyValueStrings[0], out currentXValue);
							MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

							double currentYValue = 0;
							double.TryParse(xyValueStrings[1], out currentYValue);
							MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							{
								xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
								container.AddChild(xEditWidget);
								TextWidget xText = new TextWidget("x");
								xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
								xText.Margin = new BorderDouble(5, 0);
								container.AddChild(xText);
							}
							{
								yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
								container.AddChild(yEditWidget);
								TextWidget yText = new TextWidget("y");
								yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
								yText.Margin = new BorderDouble(5, 0);
								container.AddChild(yText);
							}
						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET2:
						{
							string[] xyValueStrings = sliceSettingValue.Split('x');
							if (xyValueStrings.Length != 2)
							{
								xyValueStrings = new string[] { "0", "0" };
							}
							double currentXValue = 0;
							double.TryParse(xyValueStrings[0], out currentXValue);
							MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

							double currentYValue = 0;
							double.TryParse(xyValueStrings[1], out currentYValue);
							MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							{
								xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
								container.AddChild(xEditWidget);
								TextWidget xText = new TextWidget("x");
								xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
								xText.Margin = new BorderDouble(5, 0);
								container.AddChild(xText);
							}
							{
								yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
								container.AddChild(yEditWidget);
								TextWidget yText = new TextWidget("y");
								yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
								yText.Margin = new BorderDouble(5, 0);
								container.AddChild(yText);
							}
						}
						break;

					default:
						TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
						missingSetting.TextColor = ActiveTheme.Instance.PrimaryTextColor;
						missingSetting.BackgroundColor = RGBA_Bytes.Red;
						container.AddChild(missingSetting);
						break;
				}
			}
			else // the setting we think we are adding is not in the config.ini it may have been depricated
			{
				TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
				settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
				container.AddChild(settingName);
				container.BackgroundColor = RGBA_Bytes.Red;
			}
			container.AddChild(new HorizontalSpacer());
			Button removeLink = linkButtonFactory.Generate("remove");
			removeLink.Click += (sender, e) =>
			{
				RemoveSetting(settingData.SlicerConfigName);
			};
			removeLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
			container.AddChild(removeLink);

			return container;
		}
        private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth)
        {
            FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();
            if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
            {
                int intEditWidth = 60;
                int doubleEditWidth = 60;
                int vectorXYEditWidth = 60;
                int multiLineEditHeight = 60;

                string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
                leftToRightLayout.Margin = new BorderDouble(0, 5);
                leftToRightLayout.HAnchor |= Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
                {
                    string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
                    convertedNewLines = convertedNewLines.Replace("\\n", "\n");
					convertedNewLines = new LocalizedString (convertedNewLines).Translated;
                    TextWidget settingName = new TextWidget(convertedNewLines);
                    settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                    settingName.Width = minSettingNameWidth;
                    //settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                    leftToRightLayout.AddChild(settingName);
                }
                
                switch (settingData.DataEditType)
                {
                    case OrganizerSettingsData.DataEditTypes.INT:
                        {
                            int currentValue = 0;
                            int.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
                            intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                            leftToRightLayout.AddChild(intEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.DOUBLE:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.POSITVE_DOUBLE:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.OFFSET:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
                        {
                            MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 60, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                            {
                                TextEditWidget textEditWidget = (TextEditWidget)sender;
                                string text = textEditWidget.Text;
                                text = text.Trim();
                                bool isPercent = text.Contains("%");
                                if(isPercent)
                                {
                                    text = text.Substring(0, text.IndexOf("%"));
                                }
                                double result;
                                double.TryParse(text, out result);
                                text = result.ToString();
                                if (isPercent)
                                {
                                    text += "%";
                                }
                                textEditWidget.Text = text;
                                SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
                            };

                            leftToRightLayout.AddChild(stringEdit);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
                        {
                            CheckBox checkBoxWidget = new CheckBox("");
                            checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
                            checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                            checkBoxWidget.Checked = (sliceSettingValue == "1");
                            checkBoxWidget.CheckedStateChanged += (sender, e) =>
                            {
                                if (((CheckBox)sender).Checked)
                                {
                                    SaveSetting(settingData.SlicerConfigName, "1");
                                }
                                else
                                {
                                    SaveSetting(settingData.SlicerConfigName, "0");
                                }
                            };
                            leftToRightLayout.AddChild(checkBoxWidget);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.STRING:
                        {
                            MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text); };
                            leftToRightLayout.AddChild(stringEdit);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
                        {
                            string convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
                            MHTextEditWidget stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n")); };
                            leftToRightLayout.AddChild(stringEdit);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.LIST:
                        {
                            StyledDropDownList selectableOptions = new StyledDropDownList("None", Direction.Up);
                            selectableOptions.Margin = new BorderDouble();
                            
                            string[] listItems = settingData.ExtraSettings.Split(',');
                            foreach (string listItem in listItems)
                            {
                                MenuItem newItem = selectableOptions.AddItem(listItem);
                                if (newItem.Text == sliceSettingValue)
                                {
                                    selectableOptions.SelectedValue = sliceSettingValue;
                                }

                                newItem.Selected += (sender, e) =>
                                {
                                    MenuItem menuItem = ((MenuItem)sender);
                                    SaveSetting(settingData.SlicerConfigName, menuItem.Text);
                                };
                            }
                            leftToRightLayout.AddChild(selectableOptions);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.VECTOR2:
                        {
                            string[] xyValueStrings = sliceSettingValue.Split(',');
                            if (xyValueStrings.Length != 2)
                            {
                                xyValueStrings = new string[] { "0", "0" };
                            }
                                double currentXValue = 0;
                                double.TryParse(xyValueStrings[0], out currentXValue);
                                MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                                double currentYValue = 0;
                                double.TryParse(xyValueStrings[1], out currentYValue);
                                MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                            {
                                xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                                leftToRightLayout.AddChild(xEditWidget);
                                TextWidget xText = new TextWidget("x");
                                xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                xText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(xText);
                            }
                            {
                                yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                                leftToRightLayout.AddChild(yEditWidget);
                                TextWidget yText = new TextWidget("y");
                                yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                yText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(yText);
                            }
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.OFFSET2:
                        {
                            string[] xyValueStrings = sliceSettingValue.Split('x');
                            if (xyValueStrings.Length != 2)
                            {
                                xyValueStrings = new string[] { "0", "0" };
                            }
                            double currentXValue = 0;
                            double.TryParse(xyValueStrings[0], out currentXValue);
                            MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                            double currentYValue = 0;
                            double.TryParse(xyValueStrings[1], out currentYValue);
                            MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                            {
                                xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                                leftToRightLayout.AddChild(xEditWidget);
                                TextWidget xText = new TextWidget("x");
                                xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                xText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(xText);
                            }
                            {
                                yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                                leftToRightLayout.AddChild(yEditWidget);
                                TextWidget yText = new TextWidget("y");
                                yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                yText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(yText);
                            }
                        }
                        break;

                    default:
                        TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
                        missingSetting.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        missingSetting.BackgroundColor = RGBA_Bytes.Red;
                        leftToRightLayout.AddChild(missingSetting);
                        break;
                }
            }
            else // the setting we think we are adding is not in the config.ini it may have been depricated
            {
                TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
                settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                leftToRightLayout.AddChild(settingName);
                leftToRightLayout.BackgroundColor = RGBA_Bytes.Red;
            }

            return leftToRightLayout;
        }
		private FlowLayoutWidget GetModeControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(top: 4);

			TextWidget settingsLabel = new TextWidget("Interface Mode".Localize());
			settingsLabel.AutoExpandBoundsToText = true;
			settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingsLabel.VAnchor = VAnchor.ParentTop;

			FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			optionsContainer.Margin = new BorderDouble(bottom: 6);

			StyledDropDownList interfaceModeDropList = new StyledDropDownList("Standard", maxHeight: 200);
			interfaceModeDropList.HAnchor = HAnchor.ParentLeftRight;

			optionsContainer.AddChild(interfaceModeDropList);
			optionsContainer.Width = 200;

			MenuItem standardModeDropDownItem = interfaceModeDropList.AddItem("Standard".Localize(), "True");
			MenuItem advancedModeDropDownItem = interfaceModeDropList.AddItem("Advanced".Localize(), "False");

			interfaceModeDropList.SelectedValue = UserSettings.Instance.Fields.IsSimpleMode.ToString();
			interfaceModeDropList.SelectionChanged += new EventHandler(InterfaceModeDropList_SelectionChanged);

			buttonRow.AddChild(settingsLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(optionsContainer);
			return buttonRow;
		}
		private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth, int extruderIndex)
		{
			GuiWidget container = new GuiWidget();
			FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();

			bool addQualityOverlay = false;
			bool addMaterialOverlay = false;

			RGBA_Bytes qualityOverlayColor = new RGBA_Bytes(255, 255, 0, 40);
			RGBA_Bytes materialOverlayColor = new RGBA_Bytes(255, 127, 0, 40);

			if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
			{
				int intEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				int doubleEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				if (settingData.QuickMenuSettings.Count > 0)
				{
					doubleEditWidth = (int)(35 * TextWidget.GlobalPointSizeScaleRatio + .5);
				}
				int vectorXYEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);
				int multiLineEditHeight = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5);

				string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
				leftToRightLayout.Margin = new BorderDouble(0, 2);
				leftToRightLayout.Padding = new BorderDouble(3);
				leftToRightLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

				if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
				{
					string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
					convertedNewLines = convertedNewLines.Replace("\\n", "\n");
					convertedNewLines = LocalizedString.Get(convertedNewLines);
					TextWidget settingName = new TextWidget(convertedNewLines, pointSize: 10);
					settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
					settingName.VAnchor = Agg.UI.VAnchor.ParentCenter;

#if DO_IN_PLACE_EDIT
                    if (SettingsIndexBeingEdited != 0)
                    {
                        if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, SettingsIndexBeingEdited))
                        {
                            CheckBox removeFromSettingCheckBox = new CheckBox("");
                            removeFromSettingCheckBox.Checked = true;
                            removeFromSettingCheckBox.VAnchor = VAnchor.ParentCenter;
                            leftToRightLayout.AddChild(removeFromSettingCheckBox);
                        }
                        else
                        {
                            CheckBox addToSettingCheckBox = new CheckBox("");
                            addToSettingCheckBox.VAnchor = VAnchor.ParentCenter;
                            leftToRightLayout.AddChild(addToSettingCheckBox);
                        }
                    }
#endif
					settingName.Width = minSettingNameWidth;
					//settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
					leftToRightLayout.AddChild(settingName);
				}

				if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
				{
					addMaterialOverlay = true;
				}
				else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
				{
					addQualityOverlay = true;
				}

				switch (settingData.DataEditType)
				{
					case OrganizerSettingsData.DataEditTypes.INT:
						{
							int currentValue = 0;
							int.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
							intEditWidget.ToolTipText = settingData.HelpText;
							intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							intEditWidget.SelectAllOnFocus = true;

							leftToRightLayout.AddChild(intEditWidget);
							leftToRightLayout.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE:
						{
							double currentValue = 0;
							double.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ToolTipText = settingData.HelpText;
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							doubleEditWidget.SelectAllOnFocus = true;
							leftToRightLayout.AddChild(doubleEditWidget);
							leftToRightLayout.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
						{
							const string multiValuesAreDiffernt = "-";
							FlowLayoutWidget content = new FlowLayoutWidget();

							MHNumberEdit doubleEditWidget = new MHNumberEdit(0, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ToolTipText = settingData.HelpText;

							double currentValue = 0;
							bool ChangesMultipleOtherSettings = settingData.SetSettingsOnChange.Count > 0;
							if (ChangesMultipleOtherSettings)
							{
								bool allTheSame = true;
								string setting = ActiveSliceSettings.Instance.GetActiveValue(settingData.SetSettingsOnChange[0]);								
								for (int i = 1; i < settingData.SetSettingsOnChange.Count; i++)
								{
									string nextSetting = ActiveSliceSettings.Instance.GetActiveValue(settingData.SetSettingsOnChange[i]);
									if (setting != nextSetting)
									{
										allTheSame = false;
										break;
									}
								}

								if (allTheSame && setting.EndsWith("mm"))
								{
									double.TryParse(setting.Substring(0, setting.Length-2), out currentValue);
									doubleEditWidget.ActuallNumberEdit.Value = currentValue;
								}
								else
								{
									doubleEditWidget.ActuallNumberEdit.InternalNumberEdit.Text = multiValuesAreDiffernt;
								}
							}
							else // just set the setting nomrmaly
							{
								double.TryParse(sliceSettingValue, out currentValue);
								doubleEditWidget.ActuallNumberEdit.Value = currentValue;
							}
							doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget.MarkAsStartingState();

							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								NumberEdit numberEdit = (NumberEdit)sender;
								// If this setting sets other settings, then do that.
								if (ChangesMultipleOtherSettings
									&& numberEdit.Text != multiValuesAreDiffernt)
								{
									foreach (string setting in settingData.SetSettingsOnChange)
									{
										SaveSetting(setting, numberEdit.Value.ToString() + "mm");
									}
								}

								// also always save to the local setting
								SaveSetting(settingData.SlicerConfigName, numberEdit.Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							doubleEditWidget.SelectAllOnFocus = true;

							content.AddChild(doubleEditWidget);
							content.AddChild(getSettingInfoData(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								leftToRightLayout.AddChild(CreateQuickMenu(settingData, content, doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget));
							}
							else
							{
								leftToRightLayout.AddChild(content);
							}
						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET:
						{
							double currentValue = 0;
							double.TryParse(sliceSettingValue, out currentValue);
							MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
							doubleEditWidget.ToolTipText = settingData.HelpText;
							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							doubleEditWidget.SelectAllOnFocus = true;
							leftToRightLayout.AddChild(doubleEditWidget);
							leftToRightLayout.AddChild(getSettingInfoData(settingData));
						}
						break;

					case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++);
							stringEdit.ToolTipText = settingData.HelpText;
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								TextEditWidget textEditWidget = (TextEditWidget)sender;
								string text = textEditWidget.Text;
								text = text.Trim();
								bool isPercent = text.Contains("%");
								if (isPercent)
								{
									text = text.Substring(0, text.IndexOf("%"));
								}
								double result;
								double.TryParse(text, out result);
								text = result.ToString();
								if (isPercent)
								{
									text += "%";
								}
								textEditWidget.Text = text;
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
								CallEventsOnSettingsChange(settingData);
							};
							stringEdit.SelectAllOnFocus = true;

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select evrything up to the % (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int percentIndex = textEditWidget.Text.IndexOf("%");
								if (percentIndex != -1)
								{
									textEditWidget.SetSelection(0, percentIndex-1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(getSettingInfoData(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								leftToRightLayout.AddChild(CreateQuickMenu(settingData, content, stringEdit.ActualTextEditWidget.InternalTextEditWidget));
							}
							else
							{
								leftToRightLayout.AddChild(content);
							}
						}
						break;

					case OrganizerSettingsData.DataEditTypes.INT_OR_MM:
						{
							FlowLayoutWidget content = new FlowLayoutWidget();

							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++);
							stringEdit.ToolTipText = settingData.HelpText;
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								TextEditWidget textEditWidget = (TextEditWidget)sender;
								string text = textEditWidget.Text;
								text = text.Trim();
								bool isMm = text.Contains("mm");
								if (isMm)
								{
									text = text.Substring(0, text.IndexOf("mm"));
								}
								double result;
								double.TryParse(text, out result);
								text = result.ToString();
								if (isMm)
								{
									text += "mm";
								}
								else
								{
									result = (int)result;
									text = result.ToString();
								}
								textEditWidget.Text = text;
								SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
								CallEventsOnSettingsChange(settingData);
							};
							stringEdit.SelectAllOnFocus = true;

							stringEdit.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (sender, e) =>
							{
								// select evrything up to the mm (if present)
								InternalTextEditWidget textEditWidget = (InternalTextEditWidget)sender;
								int mMIndex = textEditWidget.Text.IndexOf("mm");
								if (mMIndex != -1)
								{
									textEditWidget.SetSelection(0, mMIndex-1);
								}
							};

							content.AddChild(stringEdit);
							content.AddChild(getSettingInfoData(settingData));

							if (settingData.QuickMenuSettings.Count > 0)
							{
								leftToRightLayout.AddChild(CreateQuickMenu(settingData, content, stringEdit.ActualTextEditWidget.InternalTextEditWidget));
							}
							else
							{
								leftToRightLayout.AddChild(content);
							}
						}
						break;

					case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
						{
							CheckBox checkBoxWidget = new CheckBox("");
							checkBoxWidget.ToolTipText = settingData.HelpText;
							checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
							checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
							checkBoxWidget.Checked = (sliceSettingValue == "1");
							checkBoxWidget.CheckedStateChanged += (sender, e) =>
							{
								if (((CheckBox)sender).Checked)
								{
									SaveSetting(settingData.SlicerConfigName, "1");
								}
								else
								{
									SaveSetting(settingData.SlicerConfigName, "0");
								}
								CallEventsOnSettingsChange(settingData);
							};
							leftToRightLayout.AddChild(checkBoxWidget);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.STRING:
						{
							MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
							stringEdit.ToolTipText = settingData.HelpText;
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text);
								CallEventsOnSettingsChange(settingData);
							};
							leftToRightLayout.AddChild(stringEdit);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
						{
							string convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
							MHTextEditWidget stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
							stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n"));
								CallEventsOnSettingsChange(settingData);
							};
							leftToRightLayout.AddChild(stringEdit);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.LIST:
						{
							StyledDropDownList selectableOptions = new StyledDropDownList("None", maxHeight: 200);
							selectableOptions.ToolTipText = settingData.HelpText;
							selectableOptions.Margin = new BorderDouble();

							string[] listItems = settingData.ExtraSettings.Split(',');

							foreach (string listItem in listItems)
							{
								MenuItem newItem = selectableOptions.AddItem(listItem);
								if (newItem.Text == sliceSettingValue)
								{
									selectableOptions.SelectedLabel = sliceSettingValue;
								}

								newItem.Selected += (sender, e) =>
								{
									MenuItem menuItem = ((MenuItem)sender);
									SaveSetting(settingData.SlicerConfigName, menuItem.Text);
									CallEventsOnSettingsChange(settingData);
								};
							}
							leftToRightLayout.AddChild(selectableOptions);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.HARDWARE_PRESENT:
						{
							CheckBox checkBoxWidget = new CheckBox("");
							checkBoxWidget.ToolTipText = settingData.HelpText;
							checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
							checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
							checkBoxWidget.Checked = (sliceSettingValue == "1");
							checkBoxWidget.CheckedStateChanged += (sender, e) =>
							{
								if (((CheckBox)sender).Checked)
								{
									SaveSetting(settingData.SlicerConfigName, "1");
									// Now show all of the settings that this control is associated with.
								}
								else
								{
									SaveSetting(settingData.SlicerConfigName, "0");
									// Now hide all of the settings that this control is associated with.
								}
								CallEventsOnSettingsChange(settingData);
							};
							leftToRightLayout.AddChild(checkBoxWidget);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.VECTOR2:
						{
							string[] xyValueStrings = sliceSettingValue.Split(',');
							if (xyValueStrings.Length != 2)
							{
								xyValueStrings = new string[] { "0", "0" };
							}
							double currentXValue = 0;
							double.TryParse(xyValueStrings[0], out currentXValue);
							MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							xEditWidget.ToolTipText = settingData.HelpText;

							double currentYValue = 0;
							double.TryParse(xyValueStrings[1], out currentYValue);
							MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							yEditWidget.ToolTipText = settingData.HelpText;

							xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							xEditWidget.SelectAllOnFocus = true;

							leftToRightLayout.AddChild(xEditWidget);
							leftToRightLayout.AddChild(new HorizontalSpacer());

							yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
							{
								SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());
								CallEventsOnSettingsChange(settingData);
							};
							yEditWidget.SelectAllOnFocus = true;
							leftToRightLayout.AddChild(yEditWidget);
						}
						break;

					case OrganizerSettingsData.DataEditTypes.OFFSET2:
						{
							Vector2 offset = ActiveSliceSettings.Instance.GetOffset(extruderIndex);
							MHNumberEdit xEditWidget = new MHNumberEdit(offset.x, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							xEditWidget.ToolTipText = settingData.HelpText;
							MHNumberEdit yEditWidget = new MHNumberEdit(offset.y, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
							yEditWidget.ToolTipText = settingData.HelpText;
							{
								xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
								{
									int extruderIndexLocal = extruderIndex;
									SaveCommaSeparatedIndexSetting(extruderIndexLocal, settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());
									CallEventsOnSettingsChange(settingData);
								};
								xEditWidget.SelectAllOnFocus = true;
								leftToRightLayout.AddChild(xEditWidget);
								leftToRightLayout.AddChild(new HorizontalSpacer());
							}
							{
								yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
								{
									int extruderIndexLocal = extruderIndex;
									SaveCommaSeparatedIndexSetting(extruderIndexLocal, settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());
									CallEventsOnSettingsChange(settingData);
								};
								yEditWidget.SelectAllOnFocus = true;
								leftToRightLayout.AddChild(yEditWidget);
							}
						}
						break;

					default:
						TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
						missingSetting.TextColor = ActiveTheme.Instance.PrimaryTextColor;
						missingSetting.BackgroundColor = RGBA_Bytes.Red;
						leftToRightLayout.AddChild(missingSetting);
						break;
				}
			}
			else // the setting we think we are adding is not in the config.ini it may have been depricated
			{
				TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
				settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
				leftToRightLayout.AddChild(settingName);
				leftToRightLayout.BackgroundColor = RGBA_Bytes.Red;
			}

			container.HAnchor = HAnchor.ParentLeftRight;
			container.VAnchor = VAnchor.FitToChildren;

			container.AddChild(leftToRightLayout);

			if (addQualityOverlay || addMaterialOverlay)
			{
				SettingPresetOverlay overlay = new SettingPresetOverlay();
				overlay.HAnchor = HAnchor.ParentLeftRight;
				overlay.VAnchor = Agg.UI.VAnchor.ParentBottomTop;

				SettingPresetClick clickToEdit = new SettingPresetClick();
				clickToEdit.HAnchor = HAnchor.ParentLeftRight;
				clickToEdit.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
				clickToEdit.Visible = false;

				Button editButton = buttonFactory.Generate("Edit Preset".Localize().ToUpper());
				editButton.HAnchor = Agg.UI.HAnchor.ParentCenter;
				editButton.VAnchor = Agg.UI.VAnchor.ParentCenter;

				clickToEdit.AddChild(editButton);

				if (addQualityOverlay)
				{
					overlay.OverlayColor = qualityOverlayColor;
					clickToEdit.OverlayColor = qualityOverlayColor;
					editButton.Click += (sender, e) =>
					{
						if (ApplicationController.Instance.EditQualityPresetsWindow == null)
						{
							ApplicationController.Instance.EditQualityPresetsWindow = new SlicePresetsWindow(ReloadOptions, "Quality", "quality", false, ActivePrinterProfile.Instance.ActiveQualitySettingsID);
							ApplicationController.Instance.EditQualityPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditQualityPresetsWindow = null; };
						}
						else
						{
							ApplicationController.Instance.EditQualityPresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.ActiveQualitySettingsID);
							ApplicationController.Instance.EditQualityPresetsWindow.BringToFront();
						}
					};
				}
				else if (addMaterialOverlay)
				{
					overlay.OverlayColor = materialOverlayColor;
					clickToEdit.OverlayColor = materialOverlayColor;
					editButton.Click += (sender, e) =>
					{
						if (ApplicationController.Instance.EditMaterialPresetsWindow == null)
						{
							ApplicationController.Instance.EditMaterialPresetsWindow = new SlicePresetsWindow(ReloadOptions, "Material", "material", false, ActivePrinterProfile.Instance.GetMaterialSetting(1));
							ApplicationController.Instance.EditMaterialPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditMaterialPresetsWindow = null; };
						}
						else
						{
							ApplicationController.Instance.EditMaterialPresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.GetMaterialSetting(1));
							ApplicationController.Instance.EditMaterialPresetsWindow.BringToFront();
						}
					};
				}

				container.MouseEnterBounds += (sender, e) =>
				{
					UiThread.RunOnIdle(() =>
					{
						overlay.Visible = false;
						clickToEdit.Visible = true;
					});
				};

				container.MouseLeaveBounds += (sender, e) =>
				{
					UiThread.RunOnIdle(() =>
					{
						overlay.Visible = true;
						clickToEdit.Visible = false;
					});
				};

				container.AddChild(overlay);
				container.AddChild(clickToEdit);
			}

			return container;
		}
        private StyledDropDownList CreateDropdown()
        {
            var dropDownList = new StyledDropDownList("- default -", maxHeight: 300, useLeftIcons: true)
            {
                HAnchor          = HAnchor.ParentLeftRight,
                MenuItemsPadding = new BorderDouble(10, 4, 10, 6),
            };

            dropDownList.Margin      = new BorderDouble(0, 3);
            dropDownList.MinimumSize = new Vector2(dropDownList.LocalBounds.Width, dropDownList.LocalBounds.Height);

            MenuItem defaultMenuItem = dropDownList.AddItem("- default -", "");

            defaultMenuItem.Selected += MenuItem_Selected;

            var listSource = (layerType == NamedSettingsLayers.Material) ? ActiveSliceSettings.Instance.MaterialLayers : ActiveSliceSettings.Instance.QualityLayers;

            foreach (var layer in listSource)
            {
                if (string.IsNullOrEmpty(layer.Value.Name))
                {
                    layer.Value.Name = layer.Key;
                }

                MenuItem menuItem = dropDownList.AddItem(layer.Value.Name, layer.Value.ID);
                menuItem.Selected += MenuItem_Selected;
            }

            MenuItem addNewPreset = dropDownList.AddItem(StaticData.Instance.LoadIcon("icon_plus.png", 32, 32), "Add New Setting...", "new");

            addNewPreset.Selected += (s, e) =>
            {
                var newLayer = new SettingsLayer();
                if (layerType == NamedSettingsLayers.Quality)
                {
                    newLayer.Name = "Quality" + ActiveSliceSettings.Instance.QualityLayers.Count;
                    ActiveSliceSettings.Instance.QualityLayers[newLayer.Name] = newLayer;
                    ActiveSliceSettings.Instance.ActiveQualityKey             = newLayer.ID;
                }
                else
                {
                    newLayer.Name = "Material" + ActiveSliceSettings.Instance.MaterialLayers.Count;
                    ActiveSliceSettings.Instance.MaterialLayers[newLayer.Name] = newLayer;
                    ActiveSliceSettings.Instance.ActiveMaterialKey             = newLayer.ID;
                    ActiveSliceSettings.Instance.SetMaterialPreset(this.extruderIndex, newLayer.Name);
                }

                // TODO: Consider adding a .Replace(existingWidget, newWidget) to GuiWidget
                // Replace existing list with updated list
                var parent = this.dropDownList.Parent;
                parent.RemoveChild(this.dropDownList);
                this.dropDownList.Close();

                this.dropDownList = CreateDropdown();
                parent.AddChild(this.dropDownList);

                editButton.ClickButton(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
            };

            try
            {
                string settingsKey;

                if (layerType == NamedSettingsLayers.Material)
                {
                    settingsKey = ActiveSliceSettings.Instance.MaterialPresetKey(extruderIndex);
                }
                else
                {
                    settingsKey = ActiveSliceSettings.Instance.ActiveQualityKey;
                }

                if (!string.IsNullOrEmpty(settingsKey))
                {
                    dropDownList.SelectedValue = settingsKey;
                }
            }
            catch (Exception ex)
            {
                GuiWidget.BreakInDebugger(ex.Message);
            }

            return(dropDownList);
        }
        public CheckForUpdateWindow()
            : base (540, 350)
        {
            linkButtonFactory.fontSize = 10;
            linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;

            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottom.AnchorAll();
            topToBottom.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            Padding = new BorderDouble(left: 5, right: 5);

            FlowLayoutWidget mainLabelContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
            mainLabelContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            mainLabelContainer.VAnchor = VAnchor.FitToChildren;
            mainLabelContainer.HAnchor = HAnchor.ParentLeftRight;
            
            FlowLayoutWidget currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
            currentFeedAndDropDownContainer.VAnchor = VAnchor.FitToChildren;
            currentFeedAndDropDownContainer.HAnchor = HAnchor.ParentLeftRight;
            currentFeedAndDropDownContainer.Margin = new BorderDouble(0,5,0,0);
            currentFeedAndDropDownContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
           
            TextWidget checkUpdateLabel = new TextWidget("Check for Update".Localize(), pointSize: 20);
            checkUpdateLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            checkUpdateLabel.Margin = new BorderDouble(2, 10, 10, 5);
            
            UpdateControlView updateStatusWidget = new UpdateControlView();
            
            String fullCurrentFeedLabel = "Update Channel".Localize();
            TextWidget feedLabel = new TextWidget(fullCurrentFeedLabel, pointSize: 12);
            feedLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            feedLabel.VAnchor = VAnchor.ParentCenter;
            feedLabel.Margin = new BorderDouble(left: 5);

            releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
            releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Stable".Localize(), "release");
            releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release");
            preReleaseDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem("Alpha".Localize(), "development");
            developmentDropDownItem.Selected += new EventHandler(FixTabDot);

            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);

			string currentBuildNo = VersionInfo.Instance.BuildVersion;
			string currentBuildInfoLabel = String.Format("Current Build : {0}", currentBuildNo);
			currentBuildInfo = new TextWidget(currentBuildInfoLabel.Localize());
			currentBuildInfo.HAnchor = HAnchor.ParentLeftRight;
			currentBuildInfo.Margin = new BorderDouble(left: 5,bottom: 15, top: 20);
			currentBuildInfo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			

            FlowLayoutWidget additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            additionalInfoContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            additionalInfoContainer.HAnchor = HAnchor.ParentLeftRight;
            additionalInfoContainer.Padding = new BorderDouble(left: 6, top: 6);

            string aboutUpdateChannel = "Changing your update channnel will change the version of MatterControl  \nthat you recieve when updating:";
            updateChannelLabel = new TextWidget(aboutUpdateChannel);
            updateChannelLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            updateChannelLabel.HAnchor = HAnchor.ParentLeftRight;
            updateChannelLabel.Margin = new BorderDouble(bottom: 20);
            additionalInfoContainer.AddChild(updateChannelLabel);
            
             
            string stableFeedInfoText = "Stable: The current release version of MatterControl (recommended).".Localize();
            stableInfoLabel = new TextWidget(stableFeedInfoText);
            stableInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            stableInfoLabel.HAnchor = HAnchor.ParentLeftRight;
            stableInfoLabel.Margin = new BorderDouble(bottom:10);
            additionalInfoContainer.AddChild(stableInfoLabel);

            string betaFeedInfoText = "Beta: The release candidate version of MatterControl.".Localize();
            betaInfoLabel = new TextWidget(betaFeedInfoText);
            betaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            betaInfoLabel.HAnchor = HAnchor.ParentLeftRight;
            betaInfoLabel.Margin = new BorderDouble(bottom: 10);
            additionalInfoContainer.AddChild(betaInfoLabel);

            string alphaFeedInfoText = "Alpha: The in development version of MatterControl.".Localize();
            alphaInfoLabel = new TextWidget(alphaFeedInfoText);
            alphaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            alphaInfoLabel.HAnchor = HAnchor.ParentLeftRight;
            alphaInfoLabel.Margin = new BorderDouble(bottom: 10);
            additionalInfoContainer.AddChild(alphaInfoLabel);

            FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
            buttonContainer.HAnchor = HAnchor.ParentLeftRight;
            buttonContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            
            Button closeButton = textImageButtonFactory.Generate("Close".Localize(), centerText: true);
            closeButton.Click += (sender, e) =>
            {
                CloseOnIdle();
            };

            Button whatsThisLink = linkButtonFactory.Generate("What's this?".Localize());
            whatsThisLink.VAnchor = VAnchor.ParentCenter;
            whatsThisLink.Margin = new BorderDouble(left: 6);
            whatsThisLink.Click += (sender, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    if (!additionalInfoContainer.Visible)
                    {
                        additionalInfoContainer.Visible = true;
                    }
                    else
                    {
                        additionalInfoContainer.Visible = false;
                    }
                });
            };


            mainLabelContainer.AddChild(checkUpdateLabel);
            topToBottom.AddChild(mainLabelContainer);
            topToBottom.AddChild(updateStatusWidget);
			topToBottom.AddChild(currentBuildInfo);
            currentFeedAndDropDownContainer.AddChild(feedLabel);
            currentFeedAndDropDownContainer.AddChild(whatsThisLink);
            currentFeedAndDropDownContainer.AddChild(new HorizontalSpacer());
            currentFeedAndDropDownContainer.AddChild(releaseOptionsDropList);
            topToBottom.AddChild(currentFeedAndDropDownContainer);
			
            topToBottom.AddChild(additionalInfoContainer);
            buttonContainer.AddChild(new HorizontalSpacer());
            buttonContainer.AddChild(closeButton);
            topToBottom.AddChild(new VerticalSpacer());
            topToBottom.AddChild(buttonContainer);
            this.AddChild(topToBottom);

            additionalInfoContainer.Visible = false;
            this.Title = "Check for Update".Localize();
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.ShowAsSystemWindow();
            this.AlwaysOnTopOfMain = true;

        }
		private void AddGridSnapSettings(GuiWidget widgetToAddTo)
		{
			FlowLayoutWidget container = new FlowLayoutWidget()
			{
				Margin = new BorderDouble(5, 0) * TextWidget.GlobalPointSizeScaleRatio,
			};

			TextWidget snapGridLabel = new TextWidget("Snap Grid".Localize())
			{
				TextColor = ActiveTheme.Instance.PrimaryTextColor,
				VAnchor = VAnchor.ParentCenter,
				Margin = new BorderDouble(3, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio,
			};

			container.AddChild(snapGridLabel);

			StyledDropDownList selectableOptions = new StyledDropDownList("Custom", Direction.Up)
			{
				VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren,
			};

			Dictionary<double, string> snapSettings = new Dictionary<double, string>()
			{
				{ 0, "Off" },
				{ .1, "0.1" },
				{ .25, "0.25" },
				{ .5, "0.5" },
				{ 1, "1" },
				{ 2, "2" },
				{ 5, "5" },
			};

			foreach (KeyValuePair<double, string> snapSetting in snapSettings)
			{
				double valueLocal = snapSetting.Key;

				MenuItem newItem = selectableOptions.AddItem(snapSetting.Value);
				if (meshViewerWidget.SnapGridDistance == valueLocal)
				{
					selectableOptions.SelectedLabel = snapSetting.Value;
				}

				newItem.Selected += (sender, e) =>
				{
					meshViewerWidget.SnapGridDistance = snapSetting.Key;
				};
			}

			container.AddChild(selectableOptions);

			widgetToAddTo.AddChild(container);
		}
        private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth)
        {
            FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();

            if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
            {
                int intEditWidth        = 60;
                int doubleEditWidth     = 60;
                int vectorXYEditWidth   = 60;
                int multiLineEditHeight = 60;

                string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
                leftToRightLayout.Margin   = new BorderDouble(0, 5);
                leftToRightLayout.HAnchor |= Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
                {
                    string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
                    convertedNewLines = convertedNewLines.Replace("\\n", "\n");
                    convertedNewLines = new LocalizedString(convertedNewLines).Translated;
                    TextWidget settingName = new TextWidget(convertedNewLines);
                    settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                    settingName.Width     = minSettingNameWidth;
                    //settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                    leftToRightLayout.AddChild(settingName);
                }

                switch (settingData.DataEditType)
                {
                case OrganizerSettingsData.DataEditTypes.INT:
                {
                    int currentValue = 0;
                    int.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
                    intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(intEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.POSITVE_DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 60, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                    {
                        TextEditWidget textEditWidget = (TextEditWidget)sender;
                        string         text           = textEditWidget.Text;
                        text = text.Trim();
                        bool isPercent = text.Contains("%");
                        if (isPercent)
                        {
                            text = text.Substring(0, text.IndexOf("%"));
                        }
                        double result;
                        double.TryParse(text, out result);
                        text = result.ToString();
                        if (isPercent)
                        {
                            text += "%";
                        }
                        textEditWidget.Text = text;
                        SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
                    };

                    leftToRightLayout.AddChild(stringEdit);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
                {
                    CheckBox checkBoxWidget = new CheckBox("");
                    checkBoxWidget.VAnchor              = Agg.UI.VAnchor.ParentBottom;
                    checkBoxWidget.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                    checkBoxWidget.Checked              = (sliceSettingValue == "1");
                    checkBoxWidget.CheckedStateChanged += (sender, e) =>
                    {
                        if (((CheckBox)sender).Checked)
                        {
                            SaveSetting(settingData.SlicerConfigName, "1");
                        }
                        else
                        {
                            SaveSetting(settingData.SlicerConfigName, "0");
                        }
                    };
                    leftToRightLayout.AddChild(checkBoxWidget);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.STRING:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text); };
                    leftToRightLayout.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
                {
                    string           convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
                    MHTextEditWidget stringEdit        = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n")); };
                    leftToRightLayout.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.LIST:
                {
                    StyledDropDownList selectableOptions = new StyledDropDownList("None", Direction.Up);
                    selectableOptions.Margin = new BorderDouble();

                    string[] listItems = settingData.ExtraSettings.Split(',');
                    foreach (string listItem in listItems)
                    {
                        MenuItem newItem = selectableOptions.AddItem(listItem);
                        if (newItem.Text == sliceSettingValue)
                        {
                            selectableOptions.SelectedValue = sliceSettingValue;
                        }

                        newItem.Selected += (sender, e) =>
                        {
                            MenuItem menuItem = ((MenuItem)sender);
                            SaveSetting(settingData.SlicerConfigName, menuItem.Text);
                        };
                    }
                    leftToRightLayout.AddChild(selectableOptions);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.VECTOR2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split(',');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(yText);
                    }
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split('x');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(yText);
                    }
                }
                break;

                default:
                    TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
                    missingSetting.TextColor       = ActiveTheme.Instance.PrimaryTextColor;
                    missingSetting.BackgroundColor = RGBA_Bytes.Red;
                    leftToRightLayout.AddChild(missingSetting);
                    break;
                }
            }
            else // the setting we think we are adding is not in the config.ini it may have been depricated
            {
                TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
                settingName.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                leftToRightLayout.AddChild(settingName);
                leftToRightLayout.BackgroundColor = RGBA_Bytes.Red;
            }

            return(leftToRightLayout);
        }
        private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth)
        {
            GuiWidget        container         = new GuiWidget();
            FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();

            bool addQualityOverlay  = false;
            bool addMaterialOverlay = false;

            RGBA_Bytes qualityOverlayColor  = new RGBA_Bytes(255, 255, 0, 40);
            RGBA_Bytes materialOverlayColor = new RGBA_Bytes(255, 127, 0, 40);

            if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
            {
                int intEditWidth        = 60;
                int doubleEditWidth     = 60;
                int vectorXYEditWidth   = 60;
                int multiLineEditHeight = 60;



                string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
                leftToRightLayout.Margin  = new BorderDouble(0, 2);
                leftToRightLayout.Padding = new BorderDouble(3);
                leftToRightLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
                {
                    string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
                    convertedNewLines = convertedNewLines.Replace("\\n", "\n");
                    convertedNewLines = LocalizedString.Get(convertedNewLines);
                    TextWidget settingName = new TextWidget(convertedNewLines);
                    settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                    if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
                    {
                        addMaterialOverlay = true;
                    }
                    else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
                    {
                        addQualityOverlay = true;
                    }

                    settingName.Width = minSettingNameWidth;
                    //settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                    leftToRightLayout.AddChild(settingName);
                }

                switch (settingData.DataEditType)
                {
                case OrganizerSettingsData.DataEditTypes.INT:
                {
                    int currentValue = 0;
                    int.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
                    intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(intEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    leftToRightLayout.AddChild(doubleEditWidget);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 60, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                    {
                        TextEditWidget textEditWidget = (TextEditWidget)sender;
                        string         text           = textEditWidget.Text;
                        text = text.Trim();
                        bool isPercent = text.Contains("%");
                        if (isPercent)
                        {
                            text = text.Substring(0, text.IndexOf("%"));
                        }
                        double result;
                        double.TryParse(text, out result);
                        text = result.ToString();
                        if (isPercent)
                        {
                            text += "%";
                        }
                        textEditWidget.Text = text;
                        SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
                    };

                    leftToRightLayout.AddChild(stringEdit);
                    leftToRightLayout.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
                {
                    CheckBox checkBoxWidget = new CheckBox("");
                    checkBoxWidget.VAnchor              = Agg.UI.VAnchor.ParentBottom;
                    checkBoxWidget.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                    checkBoxWidget.Checked              = (sliceSettingValue == "1");
                    checkBoxWidget.CheckedStateChanged += (sender, e) =>
                    {
                        if (((CheckBox)sender).Checked)
                        {
                            SaveSetting(settingData.SlicerConfigName, "1");
                        }
                        else
                        {
                            SaveSetting(settingData.SlicerConfigName, "0");
                        }
                    };
                    leftToRightLayout.AddChild(checkBoxWidget);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.STRING:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text); };
                    leftToRightLayout.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
                {
                    string           convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
                    MHTextEditWidget stringEdit        = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n")); };
                    leftToRightLayout.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.LIST:
                {
                    StyledDropDownList selectableOptions = new StyledDropDownList("None", maxHeight: 200);
                    selectableOptions.Margin = new BorderDouble();

                    string[] listItems = settingData.ExtraSettings.Split(',');
                    foreach (string listItem in listItems)
                    {
                        MenuItem newItem = selectableOptions.AddItem(listItem);
                        if (newItem.Text == sliceSettingValue)
                        {
                            selectableOptions.SelectedLabel = sliceSettingValue;
                        }

                        newItem.Selected += (sender, e) =>
                        {
                            MenuItem menuItem = ((MenuItem)sender);
                            SaveSetting(settingData.SlicerConfigName, menuItem.Text);
                        };
                    }
                    leftToRightLayout.AddChild(selectableOptions);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.VECTOR2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split(',');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(yText);
                    }
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split('x');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        leftToRightLayout.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        leftToRightLayout.AddChild(yText);
                    }
                }
                break;

                default:
                    TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
                    missingSetting.TextColor       = ActiveTheme.Instance.PrimaryTextColor;
                    missingSetting.BackgroundColor = RGBA_Bytes.Red;
                    leftToRightLayout.AddChild(missingSetting);
                    break;
                }
            }
            else // the setting we think we are adding is not in the config.ini it may have been depricated
            {
                TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
                settingName.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                leftToRightLayout.AddChild(settingName);
                leftToRightLayout.BackgroundColor = RGBA_Bytes.Red;
            }

            container.HAnchor = HAnchor.ParentLeftRight;
            container.VAnchor = VAnchor.FitToChildren;

            container.AddChild(leftToRightLayout);

            if (addQualityOverlay || addMaterialOverlay)
            {
                SettingPresetOverlay overlay = new SettingPresetOverlay();
                overlay.HAnchor = HAnchor.ParentLeftRight;
                overlay.VAnchor = Agg.UI.VAnchor.ParentBottomTop;

                SettingPresetClick clickToEdit = new SettingPresetClick();
                clickToEdit.HAnchor = HAnchor.ParentLeftRight;
                clickToEdit.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                clickToEdit.Visible = false;

                Button editButton = buttonFactory.Generate("Edit Preset".Localize().ToUpper());
                editButton.HAnchor = Agg.UI.HAnchor.ParentCenter;
                editButton.VAnchor = Agg.UI.VAnchor.ParentCenter;

                clickToEdit.AddChild(editButton);

                if (addQualityOverlay)
                {
                    overlay.OverlayColor     = qualityOverlayColor;
                    clickToEdit.OverlayColor = qualityOverlayColor;
                    editButton.Click        += (sender, e) =>
                    {
                        if (ApplicationWidget.Instance.EditSlicePresetsWindow == null)
                        {
                            ApplicationWidget.Instance.EditSlicePresetsWindow         = new SlicePresetsWindow(ReloadOptions, "Quality", "quality", false, ActivePrinterProfile.Instance.ActiveQualitySettingsID);
                            ApplicationWidget.Instance.EditSlicePresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationWidget.Instance.EditSlicePresetsWindow = null; };
                        }
                        else
                        {
                            ApplicationWidget.Instance.EditSlicePresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.ActiveQualitySettingsID);
                            ApplicationWidget.Instance.EditSlicePresetsWindow.BringToFront();
                        }
                    };
                }
                else if (addMaterialOverlay)
                {
                    overlay.OverlayColor     = materialOverlayColor;
                    clickToEdit.OverlayColor = materialOverlayColor;
                    editButton.Click        += (sender, e) =>
                    {
                        if (ApplicationWidget.Instance.EditSlicePresetsWindow == null)
                        {
                            ApplicationWidget.Instance.EditSlicePresetsWindow         = new SlicePresetsWindow(ReloadOptions, "Material", "material", false, ActivePrinterProfile.Instance.GetMaterialSetting(1));
                            ApplicationWidget.Instance.EditSlicePresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationWidget.Instance.EditSlicePresetsWindow = null; };
                        }
                        else
                        {
                            ApplicationWidget.Instance.EditSlicePresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.GetMaterialSetting(1));
                            ApplicationWidget.Instance.EditSlicePresetsWindow.BringToFront();
                        }
                    };
                }

                container.MouseEnterBounds += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        overlay.Visible     = false;
                        clickToEdit.Visible = true;
                    });
                };

                container.MouseLeaveBounds += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        overlay.Visible     = true;
                        clickToEdit.Visible = false;
                    });
                };

                container.AddChild(overlay);
                container.AddChild(clickToEdit);
            }



            return(container);
        }
		private FlowLayoutWidget GetUpdateControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(top: 4);

			configureUpdateFeedButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper());
			configureUpdateFeedButton.Margin = new BorderDouble(left: 6);
			configureUpdateFeedButton.VAnchor = VAnchor.ParentCenter;

			TextWidget settingsLabel = new TextWidget("Update Notification Feed".Localize());
			settingsLabel.AutoExpandBoundsToText = true;
			settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingsLabel.VAnchor = VAnchor.ParentTop;

			FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			optionsContainer.Margin = new BorderDouble(bottom: 6);

			releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
			releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

			optionsContainer.AddChild(releaseOptionsDropList);
			optionsContainer.Width = 200;

			MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Stable".Localize(), "release");
			releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot);

			MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release");
			preReleaseDropDownItem.Selected += new EventHandler(FixTabDot);

			MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem("Alpha".Localize(), "development");
			developmentDropDownItem.Selected += new EventHandler(FixTabDot);

			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);

			buttonRow.AddChild(settingsLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(optionsContainer);
			return buttonRow;
		}
		public SliceSettingsDetailControl()
		{
			showHelpBox = new CheckBox(0, 0, LocalizedString.Get("Show Help"), textSize: 10);
			showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
			// add in the ability to turn on and off help text
			{
				showHelpBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				showHelpBox.Margin = new BorderDouble(right: 3);
				showHelpBox.VAnchor = VAnchor.ParentCenter;
				showHelpBox.Cursor = Cursors.Hand;
				showHelpBox.CheckedStateChanged += RebuildSlicerSettings;

				this.AddChild(showHelpBox);
			}

			settingsDetailSelector = new StyledDropDownList("Simple", maxHeight: 200);
			settingsDetailSelector.AddItem(LocalizedString.Get("Basic"), "Simple");
			settingsDetailSelector.AddItem(LocalizedString.Get("Standard"), "Intermediate");
			settingsDetailSelector.AddItem(LocalizedString.Get("Advanced"), "Advanced");
			if (UserSettings.Instance.get(SliceSettingsLevelEntry) != null
				&& SliceSettingsOrganizer.Instance.UserLevels.ContainsKey(UserSettings.Instance.get(SliceSettingsLevelEntry)))
			{
				settingsDetailSelector.SelectedValue = UserSettings.Instance.get(SliceSettingsLevelEntry);
			}

			settingsDetailSelector.SelectionChanged += new EventHandler(SettingsDetail_SelectionChanged);
			settingsDetailSelector.VAnchor = VAnchor.ParentCenter;
			settingsDetailSelector.Margin = new BorderDouble(5, 3);

			this.AddChild(settingsDetailSelector);
			this.AddChild(GetSliceOptionsMenuDropList());
		}
		private FlowLayoutWidget GetThumbnailRenderingControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(top: 4);

			TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());
			settingsLabel.AutoExpandBoundsToText = true;
			settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingsLabel.VAnchor = VAnchor.ParentTop;

			FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			optionsContainer.Margin = new BorderDouble(bottom: 6);

			StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
			interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

			optionsContainer.AddChild(interfaceOptionsDropList);
			optionsContainer.Width = 200;

			interfaceOptionsDropList.AddItem("Flat".Localize(), "orthographic");
			interfaceOptionsDropList.AddItem("3D".Localize(), "raytraced");

			List<string> acceptableUpdateFeedTypeValues = new List<string>() { "orthographic", "raytraced" };
			string currentThumbnailRenderingMode = UserSettings.Instance.get("ThumbnailRenderingMode");

			if (acceptableUpdateFeedTypeValues.IndexOf(currentThumbnailRenderingMode) == -1)
			{
				UserSettings.Instance.set("ThumbnailRenderingMode", "orthographic");
			}

			interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get("ThumbnailRenderingMode");
			interfaceOptionsDropList.SelectionChanged += (sender, e) =>
			{
				string thumbnailRenderingMode = ((StyledDropDownList)sender).SelectedValue;
				if (thumbnailRenderingMode != UserSettings.Instance.get("ThumbnailRenderingMode"))
				{
					UserSettings.Instance.set("ThumbnailRenderingMode", thumbnailRenderingMode);

					// Ask if the usrer would like to rebaild all their thumbnails
					Action<bool> removeThumbnails = (bool shouldRebuildThumbnails) =>
					{
						if (shouldRebuildThumbnails)
						{
							string directoryToRemove = PartThumbnailWidget.ThumbnailPath();
							try
							{
								if (Directory.Exists(directoryToRemove))
								{
									Directory.Delete(directoryToRemove, true);
								}
							}
							catch (Exception)
							{
								GuiWidget.BreakInDebugger();
							}
						}

						ApplicationController.Instance.ReloadAll(null, null);
					};

					UiThread.RunOnIdle(() =>
					{
						StyledMessageBox.ShowMessageBox(removeThumbnails, rebuildThumbnailsMessage, rebuildThumbnailsTitle, StyledMessageBox.MessageType.YES_NO, "Rebuild".Localize());
					});
				}
			};

			buttonRow.AddChild(settingsLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(optionsContainer);
			return buttonRow;
		}
        public virtual FlowLayoutWidget GetPulldownContainer()
        {
            dropDownList = CreateDropdown();

            FlowLayoutWidget container = new FlowLayoutWidget();

            container.HAnchor = HAnchor.ParentLeftRight;
            container.Padding = new BorderDouble(6, 0);

            editButton = TextImageButtonFactory.GetThemedEditButton();

            editButton.ToolTipText = "Edit Selected Setting".Localize();

            editButton.VAnchor = VAnchor.ParentCenter;
            editButton.Margin  = new BorderDouble(left: 6);
            editButton.Click  += (sender, e) =>
            {
                if (layerType == NamedSettingsLayers.Material)
                {
                    if (ApplicationController.Instance.EditMaterialPresetsWindow == null)
                    {
                        string presetsKey = ActiveSliceSettings.Instance.MaterialPresetKey(extruderIndex);
                        if (string.IsNullOrEmpty(presetsKey))
                        {
                            return;
                        }

                        var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.MaterialLayers, presetsKey)
                        {
                            LayerType   = NamedSettingsLayers.Material,
                            SetAsActive = (materialKey) =>
                            {
                                ActiveSliceSettings.Instance.ActiveMaterialKey = materialKey;
                                ActiveSliceSettings.Instance.SetMaterialPreset(this.extruderIndex, materialKey);
                            }
                        };

                        ApplicationController.Instance.EditMaterialPresetsWindow         = new SlicePresetsWindow(presetsContext);
                        ApplicationController.Instance.EditMaterialPresetsWindow.Closed += (s, e2) =>
                        {
                            ApplicationController.Instance.EditMaterialPresetsWindow = null;
                            ApplicationController.Instance.ReloadAdvancedControlsPanel();
                        };
                        ApplicationController.Instance.EditMaterialPresetsWindow.ShowAsSystemWindow();
                    }
                    else
                    {
                        ApplicationController.Instance.EditMaterialPresetsWindow.BringToFront();
                    }
                }

                if (layerType == NamedSettingsLayers.Quality)
                {
                    if (ApplicationController.Instance.EditQualityPresetsWindow == null)
                    {
                        string presetsKey = ActiveSliceSettings.Instance.ActiveQualityKey;
                        if (string.IsNullOrEmpty(presetsKey))
                        {
                            return;
                        }

                        var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.QualityLayers, presetsKey)
                        {
                            LayerType   = NamedSettingsLayers.Quality,
                            SetAsActive = (qualityKey) => ActiveSliceSettings.Instance.ActiveQualityKey = qualityKey
                        };

                        ApplicationController.Instance.EditQualityPresetsWindow         = new SlicePresetsWindow(presetsContext);
                        ApplicationController.Instance.EditQualityPresetsWindow.Closed += (s, e2) =>
                        {
                            ApplicationController.Instance.EditQualityPresetsWindow = null;
                            ApplicationController.Instance.ReloadAdvancedControlsPanel();
                        };
                        ApplicationController.Instance.EditQualityPresetsWindow.ShowAsSystemWindow();
                    }
                    else
                    {
                        ApplicationController.Instance.EditQualityPresetsWindow.BringToFront();
                    }
                }
            };

            container.AddChild(dropDownList);
            container.AddChild(editButton);

            return(container);
        }
        StyledDropDownList CreateSliceEngineDropdown()
        {
            StyledDropDownList engineMenuDropList = new StyledDropDownList("Engine   ");
            engineMenuDropList.Margin = new BorderDouble(top: 3, left:0);
            {
                MenuItem slic3rMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.Slic3r.ToString());
                slic3rMenuItem.Selected += (sender, e) =>
                {
                    ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.Slic3r;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };

                MenuItem curaEnginMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngineTypes.CuraEngine.ToString());
                curaEnginMenuItem.Selected += (sender, e) =>
                {
                    ActivePrinterProfile.Instance.ActiveSliceEngineType = ActivePrinterProfile.SlicingEngineTypes.CuraEngine;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };

#if false
                MenuItem matterSliceMenuItem = engineMenuDropList.AddItem(ActivePrinterProfile.SlicingEngine.MatterSlice.ToString());
                matterSliceMenuItem.Selected += (sender, e) =>
                {
                    PrinterCommunication.Instance.ActiveSliceEngine = ActivePrinterProfile.SlicingEngine.MatterSlice;
                    MainSlidePanel.Instance.ReloadBackPanel();
                };
#endif

                engineMenuDropList.SelectedValue = ActivePrinterProfile.Instance.ActiveSliceEngineType.ToString();
            }
            engineMenuDropList.MinimumSize = new Vector2(engineMenuDropList.LocalBounds.Width, engineMenuDropList.LocalBounds.Height);
            return engineMenuDropList;
        }
		private GuiWidget CreateQuickMenu(OrganizerSettingsData settingData, GuiWidget content, InternalTextEditWidget internalTextWidget)
		{
			string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
			FlowLayoutWidget totalContent = new FlowLayoutWidget();

			StyledDropDownList selectableOptions = new StyledDropDownList("Custom", maxHeight: 200);
			selectableOptions.Margin = new BorderDouble(0, 0, 10, 0);

			foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings)
			{
				string valueLocal = nameValue.Value;

				MenuItem newItem = selectableOptions.AddItem(nameValue.MenuName);
				if (sliceSettingValue == valueLocal)
				{
					selectableOptions.SelectedLabel = nameValue.MenuName;
				}

				newItem.Selected += (sender, e) =>
				{
					SaveSetting(settingData.SlicerConfigName, valueLocal);
					CallEventsOnSettingsChange(settingData);
					internalTextWidget.Text = valueLocal;
					internalTextWidget.OnEditComplete(null);
				};
			}

			// put in the custom menu to allow direct editing
			MenuItem customMenueItem = selectableOptions.AddItem("Custom");

			totalContent.AddChild(selectableOptions);
			content.VAnchor = VAnchor.ParentCenter;
			totalContent.AddChild(content);

			internalTextWidget.EditComplete += (sender, e) =>
			{
				bool foundSetting = false;
				foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings)
				{
					string localName = nameValue.MenuName;
					string newSliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
					if (newSliceSettingValue == nameValue.Value)
					{
						selectableOptions.SelectedLabel = localName;
						foundSetting = true;
						break;
					}
				}

				if (!foundSetting)
				{
					selectableOptions.SelectedLabel = "Custom";
				}
			};

			return totalContent;
		}
        void AddChildElements()
        {
            FlowLayoutWidget settingsStatusLabelContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop;
            settingsStatusLabelContainer.Margin = new BorderDouble(0);
            {
				string activeSettingsLabelText = new LocalizedString ("Active Settings").Translated;
				string activeSettingsLabelTextFull = string.Format ("{0}:", activeSettingsLabelText);


				TextWidget settingsStatusLabel = new TextWidget(string.Format(activeSettingsLabelTextFull), pointSize: 10);
                settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusDescription = new TextWidget("", pointSize: 14);
                settingsStatusDescription.Margin = new BorderDouble(top: 4);
                settingsStatusDescription.AutoExpandBoundsToText = true;
                settingsStatusDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;

				string unsavedChangesTxtBeg = new  LocalizedString("unsaved changes").Translated;
				string unsavedChangesTxtFull = string.Format ("({0})", unsavedChangesTxtBeg);
				unsavedChangesIndicator = new TextWidget(unsavedChangesTxtFull, pointSize: 10);
                unsavedChangesIndicator.AutoExpandBoundsToText = true;
                unsavedChangesIndicator.Visible = false;
                unsavedChangesIndicator.Margin = new BorderDouble(left: 4);
                unsavedChangesIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusLabelContainer.AddChild(settingsStatusLabel);
                settingsStatusLabelContainer.AddChild(settingsStatusDescription);
                settingsStatusLabelContainer.AddChild(unsavedChangesIndicator);
            }

			saveButton = textImageButtonFactory.Generate(new LocalizedString("Save").Translated);
            saveButton.VAnchor = VAnchor.ParentTop;
            saveButton.Visible = false;
            saveButton.Margin = new BorderDouble(0, 0, 0, 10);
            saveButton.Click += new ButtonBase.ButtonEventHandler(saveButton_Click);

			revertbutton = textImageButtonFactory.Generate(new LocalizedString("Revert").Translated);
            revertbutton.VAnchor = VAnchor.ParentTop;
            revertbutton.Visible = false;
            revertbutton.Margin = new BorderDouble(0,0,0,10);
            revertbutton.Click += new ButtonBase.ButtonEventHandler(revertbutton_Click);

			SliceOptionsMenuDropList = new DropDownMenu(new LocalizedString("Options   ").Translated);
            SliceOptionsMenuDropList.Margin = new BorderDouble(top: 11);
            SliceOptionsMenuDropList.VAnchor |= VAnchor.ParentTop;
            SliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50);
            SliceOptionsMenuDropList.NormalColor = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0);
            this.SliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);

            SetMenuItems();

            FlowLayoutWidget sliceEngineContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            sliceEngineContainer.Margin = new BorderDouble(0,0,10,0);
            sliceEngineContainer.VAnchor |= VAnchor.ParentTop;
            {
				string sliceEngineLabelText = new LocalizedString ("Slice Engine").Translated;
				string sliceEngineLabelTextFull = string.Format ("{0}:", sliceEngineLabelText);
				TextWidget sliceEngineLabel = new TextWidget(string.Format(sliceEngineLabelTextFull), pointSize: 10);
                sliceEngineLabel.Margin = new BorderDouble(0);
                sliceEngineLabel.HAnchor = HAnchor.ParentLeft;
                sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                
                EngineMenuDropList = CreateSliceEngineDropdown();                

                sliceEngineContainer.AddChild(sliceEngineLabel);
                sliceEngineContainer.AddChild(EngineMenuDropList);
            }

            this.AddChild(sliceEngineContainer);
            this.AddChild(settingsStatusLabelContainer);

            GuiWidget spacer = new GuiWidget(HAnchor.ParentLeftRight);
            this.AddChild(spacer);

            this.AddChild(saveButton);
            this.AddChild(revertbutton);
            this.AddChild(SliceOptionsMenuDropList);

            SetStatusDisplay();
        }
		private FlowLayoutWidget GetDisplayControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(top: 4);

			TextWidget settingsLabel = new TextWidget("Change Display Mode".Localize());
			settingsLabel.AutoExpandBoundsToText = true;
			settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingsLabel.VAnchor = VAnchor.ParentTop;

			Button displayControlRestartButton = textImageButtonFactory.Generate("Restart");
			displayControlRestartButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
			displayControlRestartButton.Visible = false;
			displayControlRestartButton.Margin = new BorderDouble(right: 6);
			displayControlRestartButton.Click += (sender, e) =>
			{
				RestartApplication();
			};

			FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			optionsContainer.Margin = new BorderDouble(bottom: 6);

			StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
			interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

			optionsContainer.AddChild(interfaceOptionsDropList);
			optionsContainer.Width = 200;

			MenuItem responsizeOptionsDropDownItem = interfaceOptionsDropList.AddItem("Normal".Localize(), "responsive");
			MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem("Touchscreen".Localize(), "touchscreen");

			List<string> acceptableUpdateFeedTypeValues = new List<string>() { "responsive", "touchscreen" };
			string currentDisplayModeType = UserSettings.Instance.get("ApplicationDisplayMode");

			if (acceptableUpdateFeedTypeValues.IndexOf(currentDisplayModeType) == -1)
			{
				UserSettings.Instance.set("ApplicationDisplayMode", "responsive");
			}

			interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get("ApplicationDisplayMode");
			interfaceOptionsDropList.SelectionChanged += (sender, e) =>
			{
				string releaseCode = ((StyledDropDownList)sender).SelectedValue;
				if (releaseCode != UserSettings.Instance.get("ApplicationDisplayMode"))
				{
					UserSettings.Instance.set("ApplicationDisplayMode", releaseCode);
					displayControlRestartButton.Visible = true;
				}
			};

			buttonRow.AddChild(settingsLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(displayControlRestartButton);
			buttonRow.AddChild(optionsContainer);
			return buttonRow;
		}
Exemple #27
0
        public CheckForUpdateWindow()
            : base(540, 350)
        {
            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;

            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.AnchorAll();
            topToBottom.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            Padding = new BorderDouble(left: 5, right: 5);

            FlowLayoutWidget mainLabelContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            mainLabelContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            mainLabelContainer.VAnchor         = VAnchor.FitToChildren;
            mainLabelContainer.HAnchor         = HAnchor.ParentLeftRight;

            FlowLayoutWidget currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            currentFeedAndDropDownContainer.VAnchor         = VAnchor.FitToChildren;
            currentFeedAndDropDownContainer.HAnchor         = HAnchor.ParentLeftRight;
            currentFeedAndDropDownContainer.Margin          = new BorderDouble(0, 5, 0, 0);
            currentFeedAndDropDownContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;

            TextWidget checkUpdateLabel = new TextWidget("Check for Update".Localize(), pointSize: 20);

            checkUpdateLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            checkUpdateLabel.Margin    = new BorderDouble(2, 10, 10, 5);

            UpdateControlView updateStatusWidget = new UpdateControlView();

            String     fullCurrentFeedLabel = "Update Channel".Localize();
            TextWidget feedLabel            = new TextWidget(fullCurrentFeedLabel, pointSize: 12);

            feedLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            feedLabel.VAnchor   = VAnchor.ParentCenter;
            feedLabel.Margin    = new BorderDouble(left: 5);

            releaseOptionsDropList         = new StyledDropDownList("Development", maxHeight: 200);
            releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Stable".Localize(), "release");

            releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release");

            preReleaseDropDownItem.Selected += new EventHandler(FixTabDot);

            MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem("Alpha".Localize(), "development");

            developmentDropDownItem.Selected += new EventHandler(FixTabDot);

            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);

            string currentBuildNo        = VersionInfo.Instance.BuildVersion;
            string currentBuildInfoLabel = String.Format("Current Build : {0}", currentBuildNo);

            currentBuildInfo           = new TextWidget(currentBuildInfoLabel.Localize());
            currentBuildInfo.HAnchor   = HAnchor.ParentLeftRight;
            currentBuildInfo.Margin    = new BorderDouble(left: 5, bottom: 15, top: 20);
            currentBuildInfo.TextColor = ActiveTheme.Instance.PrimaryTextColor;


            FlowLayoutWidget additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            additionalInfoContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            additionalInfoContainer.HAnchor         = HAnchor.ParentLeftRight;
            additionalInfoContainer.Padding         = new BorderDouble(left: 6, top: 6);

            string aboutUpdateChannel = "Changing your update channnel will change the version of MatterControl  \nthat you recieve when updating:";

            updateChannelLabel           = new TextWidget(aboutUpdateChannel);
            updateChannelLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            updateChannelLabel.HAnchor   = HAnchor.ParentLeftRight;
            updateChannelLabel.Margin    = new BorderDouble(bottom: 20);
            additionalInfoContainer.AddChild(updateChannelLabel);


            string stableFeedInfoText = "Stable: The current release version of MatterControl (recommended).".Localize();

            stableInfoLabel           = new TextWidget(stableFeedInfoText);
            stableInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            stableInfoLabel.HAnchor   = HAnchor.ParentLeftRight;
            stableInfoLabel.Margin    = new BorderDouble(bottom: 10);
            additionalInfoContainer.AddChild(stableInfoLabel);

            string betaFeedInfoText = "Beta: The release candidate version of MatterControl.".Localize();

            betaInfoLabel           = new TextWidget(betaFeedInfoText);
            betaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            betaInfoLabel.HAnchor   = HAnchor.ParentLeftRight;
            betaInfoLabel.Margin    = new BorderDouble(bottom: 10);
            additionalInfoContainer.AddChild(betaInfoLabel);

            string alphaFeedInfoText = "Alpha: The in development version of MatterControl.".Localize();

            alphaInfoLabel           = new TextWidget(alphaFeedInfoText);
            alphaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            alphaInfoLabel.HAnchor   = HAnchor.ParentLeftRight;
            alphaInfoLabel.Margin    = new BorderDouble(bottom: 10);
            additionalInfoContainer.AddChild(alphaInfoLabel);

            FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            buttonContainer.HAnchor         = HAnchor.ParentLeftRight;
            buttonContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            Button closeButton = textImageButtonFactory.Generate("Close".Localize(), centerText: true);

            closeButton.Click += (sender, e) =>
            {
                CloseOnIdle();
            };

            Button whatsThisLink = linkButtonFactory.Generate("What's this?".Localize());

            whatsThisLink.VAnchor = VAnchor.ParentCenter;
            whatsThisLink.Margin  = new BorderDouble(left: 6);
            whatsThisLink.Click  += (sender, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    if (!additionalInfoContainer.Visible)
                    {
                        additionalInfoContainer.Visible = true;
                    }
                    else
                    {
                        additionalInfoContainer.Visible = false;
                    }
                });
            };


            mainLabelContainer.AddChild(checkUpdateLabel);
            topToBottom.AddChild(mainLabelContainer);
            topToBottom.AddChild(updateStatusWidget);
            topToBottom.AddChild(currentBuildInfo);
            currentFeedAndDropDownContainer.AddChild(feedLabel);
            currentFeedAndDropDownContainer.AddChild(whatsThisLink);
            currentFeedAndDropDownContainer.AddChild(new HorizontalSpacer());
            currentFeedAndDropDownContainer.AddChild(releaseOptionsDropList);
            topToBottom.AddChild(currentFeedAndDropDownContainer);

            topToBottom.AddChild(additionalInfoContainer);
            buttonContainer.AddChild(new HorizontalSpacer());
            buttonContainer.AddChild(closeButton);
            topToBottom.AddChild(new VerticalSpacer());
            topToBottom.AddChild(buttonContainer);
            this.AddChild(topToBottom);

            additionalInfoContainer.Visible = false;
            this.Title           = "Check for Update".Localize();
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.ShowAsSystemWindow();
            this.AlwaysOnTopOfMain = true;
        }
		private FlowLayoutWidget GetThumbnailRenderingControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(top: 4);

			TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());
			settingsLabel.AutoExpandBoundsToText = true;
			settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingsLabel.VAnchor = VAnchor.ParentTop;

			FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			optionsContainer.Margin = new BorderDouble(bottom: 6);

			StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
			interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

			optionsContainer.AddChild(interfaceOptionsDropList);
			optionsContainer.Width = 200;

			MenuItem responsizeOptionsDropDownItem = interfaceOptionsDropList.AddItem("Flat".Localize(), "orthographic");
			MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem("3D".Localize(), "raytraced");

			List<string> acceptableUpdateFeedTypeValues = new List<string>() { "orthographic", "raytraced" };
			string currentThumbnailRenderingMode = UserSettings.Instance.get("ThumbnailRenderingMode");

			if (acceptableUpdateFeedTypeValues.IndexOf(currentThumbnailRenderingMode) == -1)
			{
				UserSettings.Instance.set("ThumbnailRenderingMode", "orthographic");
			}

			interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get("ThumbnailRenderingMode");
			interfaceOptionsDropList.SelectionChanged += (sender, e) =>
			{
				string releaseCode = ((StyledDropDownList)sender).SelectedValue;
				if (releaseCode != UserSettings.Instance.get("ThumbnailRenderingMode"))
				{
					UserSettings.Instance.set("ThumbnailRenderingMode", releaseCode);
				}
			};

			buttonRow.AddChild(settingsLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(optionsContainer);
			return buttonRow;
		}
        private FlowLayoutWidget GetDisplayControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget("Display Mode".Localize());

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            Button displayControlRestartButton = textImageButtonFactory.Generate("Restart");

            displayControlRestartButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
            displayControlRestartButton.Visible = false;
            displayControlRestartButton.Margin  = new BorderDouble(right: 6);
            displayControlRestartButton.Click  += (sender, e) =>
            {
                if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
                {
                    StyledMessageBox.ShowMessageBox(null, cannotRestartWhilePrintIsActiveMessage, cannotRestartWhileActive);
                }
                else
                {
                    RestartApplication();
                }
            };

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(interfaceOptionsDropList);
            optionsContainer.Width = 200;

            MenuItem responsizeOptionsDropDownItem  = interfaceOptionsDropList.AddItem("Normal".Localize(), "responsive");
            MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem("Touchscreen".Localize(), "touchscreen");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "responsive", "touchscreen"
            };
            string currentDisplayModeType = UserSettings.Instance.get("ApplicationDisplayMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentDisplayModeType) == -1)
            {
                UserSettings.Instance.set("ApplicationDisplayMode", "responsive");
            }

            interfaceOptionsDropList.SelectedValue     = UserSettings.Instance.get("ApplicationDisplayMode");
            interfaceOptionsDropList.SelectionChanged += (sender, e) =>
            {
                string releaseCode = ((StyledDropDownList)sender).SelectedValue;
                if (releaseCode != UserSettings.Instance.get("ApplicationDisplayMode"))
                {
                    UserSettings.Instance.set("ApplicationDisplayMode", releaseCode);
                    displayControlRestartButton.Visible = true;
                }
            };

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(displayControlRestartButton);
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
Exemple #30
0
        void AddChildElements()
        {
            FlowLayoutWidget settingsStatusLabelContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop;
            settingsStatusLabelContainer.Margin   = new BorderDouble(0);
            {
                string activeSettingsLabelText     = new LocalizedString("Active Settings").Translated;
                string activeSettingsLabelTextFull = string.Format("{0}:", activeSettingsLabelText);


                TextWidget settingsStatusLabel = new TextWidget(string.Format(activeSettingsLabelTextFull), pointSize: 10);
                settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusDescription        = new TextWidget("", pointSize: 14);
                settingsStatusDescription.Margin = new BorderDouble(top: 4);
                settingsStatusDescription.AutoExpandBoundsToText = true;
                settingsStatusDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                string unsavedChangesTxtBeg  = new  LocalizedString("unsaved changes").Translated;
                string unsavedChangesTxtFull = string.Format("({0})", unsavedChangesTxtBeg);
                unsavedChangesIndicator = new TextWidget(unsavedChangesTxtFull, pointSize: 10);
                unsavedChangesIndicator.AutoExpandBoundsToText = true;
                unsavedChangesIndicator.Visible   = false;
                unsavedChangesIndicator.Margin    = new BorderDouble(left: 4);
                unsavedChangesIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusLabelContainer.AddChild(settingsStatusLabel);
                settingsStatusLabelContainer.AddChild(settingsStatusDescription);
                settingsStatusLabelContainer.AddChild(unsavedChangesIndicator);
            }

            saveButton         = textImageButtonFactory.Generate(new LocalizedString("Save").Translated);
            saveButton.VAnchor = VAnchor.ParentTop;
            saveButton.Visible = false;
            saveButton.Margin  = new BorderDouble(0, 0, 0, 10);
            saveButton.Click  += new ButtonBase.ButtonEventHandler(saveButton_Click);

            revertbutton         = textImageButtonFactory.Generate(new LocalizedString("Revert").Translated);
            revertbutton.VAnchor = VAnchor.ParentTop;
            revertbutton.Visible = false;
            revertbutton.Margin  = new BorderDouble(0, 0, 0, 10);
            revertbutton.Click  += new ButtonBase.ButtonEventHandler(revertbutton_Click);

            SliceOptionsMenuDropList                        = new DropDownMenu(new LocalizedString("Options   ").Translated);
            SliceOptionsMenuDropList.Margin                 = new BorderDouble(top: 11);
            SliceOptionsMenuDropList.VAnchor               |= VAnchor.ParentTop;
            SliceOptionsMenuDropList.HoverColor             = new RGBA_Bytes(0, 0, 0, 50);
            SliceOptionsMenuDropList.NormalColor            = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BorderColor            = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BackgroundColor        = new RGBA_Bytes(0, 0, 0, 0);
            this.SliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);

            SetMenuItems();

            FlowLayoutWidget sliceEngineContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            sliceEngineContainer.Margin   = new BorderDouble(0, 0, 10, 0);
            sliceEngineContainer.VAnchor |= VAnchor.ParentTop;
            {
                string     sliceEngineLabelText     = new LocalizedString("Slice Engine").Translated;
                string     sliceEngineLabelTextFull = string.Format("{0}:", sliceEngineLabelText);
                TextWidget sliceEngineLabel         = new TextWidget(string.Format(sliceEngineLabelTextFull), pointSize: 10);
                sliceEngineLabel.Margin    = new BorderDouble(0);
                sliceEngineLabel.HAnchor   = HAnchor.ParentLeft;
                sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                EngineMenuDropList = CreateSliceEngineDropdown();

                sliceEngineContainer.AddChild(sliceEngineLabel);
                sliceEngineContainer.AddChild(EngineMenuDropList);
            }

            this.AddChild(sliceEngineContainer);
            this.AddChild(settingsStatusLabelContainer);

            GuiWidget spacer = new GuiWidget(HAnchor.ParentLeftRight);

            this.AddChild(spacer);

            this.AddChild(saveButton);
            this.AddChild(revertbutton);
            this.AddChild(SliceOptionsMenuDropList);

            SetStatusDisplay();
        }
        private FlowLayoutWidget GetThumbnailRenderingControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(interfaceOptionsDropList);
            optionsContainer.Width = 200;

            interfaceOptionsDropList.AddItem("Flat".Localize(), "orthographic");
            interfaceOptionsDropList.AddItem("3D".Localize(), "raytraced");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "orthographic", "raytraced"
            };
            string currentThumbnailRenderingMode = UserSettings.Instance.get("ThumbnailRenderingMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentThumbnailRenderingMode) == -1)
            {
                UserSettings.Instance.set("ThumbnailRenderingMode", "orthographic");
            }

            interfaceOptionsDropList.SelectedValue     = UserSettings.Instance.get("ThumbnailRenderingMode");
            interfaceOptionsDropList.SelectionChanged += (sender, e) =>
            {
                string thumbnailRenderingMode = ((StyledDropDownList)sender).SelectedValue;
                if (thumbnailRenderingMode != UserSettings.Instance.get("ThumbnailRenderingMode"))
                {
                    UserSettings.Instance.set("ThumbnailRenderingMode", thumbnailRenderingMode);

                    // Ask if the user would like to rebuild all their thumbnails
                    Action <bool> removeThumbnails = (bool shouldRebuildThumbnails) =>
                    {
                        if (shouldRebuildThumbnails)
                        {
                            string directoryToRemove = PartThumbnailWidget.ThumbnailPath();
                            try
                            {
                                if (Directory.Exists(directoryToRemove))
                                {
                                    Directory.Delete(directoryToRemove, true);
                                }
                            }
                            catch (Exception)
                            {
                                GuiWidget.BreakInDebugger();
                            }
                        }

                        ApplicationController.Instance.ReloadAll(null, null);
                    };

                    UiThread.RunOnIdle(() =>
                    {
                        StyledMessageBox.ShowMessageBox(removeThumbnails, rebuildThumbnailsMessage, rebuildThumbnailsTitle, StyledMessageBox.MessageType.YES_NO, "Rebuild".Localize());
                    });
                }
            };

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
        private FlowLayoutWidget GetSettingsRow(OrganizerSettingsData settingData, string sliceSettingValue = null)
        {
            FlowLayoutWidget container = new FlowLayoutWidget();

            container.HAnchor = HAnchor.ParentLeftRight;

            double minSettingNameWidth = 400;

            if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
            {
                int intEditWidth        = 60;
                int doubleEditWidth     = 60;
                int vectorXYEditWidth   = 60;
                int multiLineEditHeight = 60;

                //Get the current value as a default value
                if (sliceSettingValue == null)
                {
                    sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
                }

                //Get the presentation name from the SettingNameLookup
                TextWidget settingName = new TextWidget(SettingNameLookup[settingData.SlicerConfigName], pointSize: 10);
                settingName.AutoExpandBoundsToText = false;
                settingName.EllipsisIfClipped      = true;
                settingName.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                settingName.VAnchor     = Agg.UI.VAnchor.ParentCenter;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.Height);
                settingName.Width       = minSettingNameWidth;

                container.AddChild(settingName);


                switch (settingData.DataEditType)
                {
                case OrganizerSettingsData.DataEditTypes.INT:
                {
                    int currentValue = 0;
                    int.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
                    intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    container.AddChild(intEditWidget);
                    container.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    container.AddChild(doubleEditWidget);
                    container.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    container.AddChild(doubleEditWidget);
                    container.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET:
                {
                    double currentValue = 0;
                    double.TryParse(sliceSettingValue, out currentValue);
                    MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                    doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); };
                    container.AddChild(doubleEditWidget);
                    container.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 60, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                    {
                        TextEditWidget textEditWidget = (TextEditWidget)sender;
                        string         text           = textEditWidget.Text;
                        text = text.Trim();
                        bool isPercent = text.Contains("%");
                        if (isPercent)
                        {
                            text = text.Substring(0, text.IndexOf("%"));
                        }
                        double result;
                        double.TryParse(text, out result);
                        text = result.ToString();
                        if (isPercent)
                        {
                            text += "%";
                        }
                        textEditWidget.Text = text;
                        SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
                    };

                    container.AddChild(stringEdit);
                    container.AddChild(getSettingInfoData(settingData));
                }
                break;

                case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
                {
                    CheckBox checkBoxWidget = new CheckBox("");
                    checkBoxWidget.VAnchor              = Agg.UI.VAnchor.ParentBottom;
                    checkBoxWidget.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                    checkBoxWidget.Checked              = (sliceSettingValue == "1");
                    checkBoxWidget.CheckedStateChanged += (sender, e) =>
                    {
                        if (((CheckBox)sender).Checked)
                        {
                            SaveSetting(settingData.SlicerConfigName, "1");
                        }
                        else
                        {
                            SaveSetting(settingData.SlicerConfigName, "0");
                        }
                    };
                    container.AddChild(checkBoxWidget);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.STRING:
                {
                    MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text); };
                    container.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
                {
                    string           convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
                    MHTextEditWidget stringEdit        = new MHTextEditWidget(convertedNewLines, pointSize: 10, pixelWidth: 280, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
                    stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n")); };
                    container.AddChild(stringEdit);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.LIST:
                {
                    StyledDropDownList selectableOptions = new StyledDropDownList("None", Direction.Down);
                    selectableOptions.Margin = new BorderDouble();

                    string[] listItems = settingData.ExtraSettings.Split(',');
                    foreach (string listItem in listItems)
                    {
                        MenuItem newItem = selectableOptions.AddItem(listItem);
                        if (newItem.Text == sliceSettingValue)
                        {
                            selectableOptions.SelectedLabel = sliceSettingValue;
                        }

                        newItem.Selected += (sender, e) =>
                        {
                            MenuItem menuItem = ((MenuItem)sender);
                            SaveSetting(settingData.SlicerConfigName, menuItem.Text);
                        };
                    }
                    container.AddChild(selectableOptions);
                }
                break;

                case OrganizerSettingsData.DataEditTypes.VECTOR2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split(',');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        container.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        container.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        container.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        container.AddChild(yText);
                    }
                }
                break;

                case OrganizerSettingsData.DataEditTypes.OFFSET2:
                {
                    string[] xyValueStrings = sliceSettingValue.Split('x');
                    if (xyValueStrings.Length != 2)
                    {
                        xyValueStrings = new string[] { "0", "0" };
                    }
                    double currentXValue = 0;
                    double.TryParse(xyValueStrings[0], out currentXValue);
                    MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                    double currentYValue = 0;
                    double.TryParse(xyValueStrings[1], out currentYValue);
                    MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                    {
                        xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        container.AddChild(xEditWidget);
                        TextWidget xText = new TextWidget("x");
                        xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        xText.Margin    = new BorderDouble(5, 0);
                        container.AddChild(xText);
                    }
                    {
                        yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); };
                        container.AddChild(yEditWidget);
                        TextWidget yText = new TextWidget("y");
                        yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        yText.Margin    = new BorderDouble(5, 0);
                        container.AddChild(yText);
                    }
                }
                break;

                default:
                    TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
                    missingSetting.TextColor       = ActiveTheme.Instance.PrimaryTextColor;
                    missingSetting.BackgroundColor = RGBA_Bytes.Red;
                    container.AddChild(missingSetting);
                    break;
                }
            }
            else // the setting we think we are adding is not in the config.ini it may have been depricated
            {
                TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
                settingName.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                container.AddChild(settingName);
                container.BackgroundColor = RGBA_Bytes.Red;
            }
            container.AddChild(new HorizontalSpacer());
            Button removeLink = linkButtonFactory.Generate("remove");

            removeLink.Click += (sender, e) => {
                RemoveSetting(settingData.SlicerConfigName);
            };
            removeLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
            container.AddChild(removeLink);

            return(container);
        }
        private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth)
        {
            GuiWidget container = new GuiWidget();
            FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();

            bool addQualityOverlay = false;
            bool addMaterialOverlay = false;

            RGBA_Bytes qualityOverlayColor = new RGBA_Bytes(255, 255, 0, 40);
            RGBA_Bytes materialOverlayColor = new RGBA_Bytes(255, 127, 0, 40);


            if (ActiveSliceSettings.Instance.Contains(settingData.SlicerConfigName))
            {
                int intEditWidth = 60;
                int doubleEditWidth = 60;
                int vectorXYEditWidth = 60;
                int multiLineEditHeight = 60;

                string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName);
                leftToRightLayout.Margin = new BorderDouble(0, 2);
                leftToRightLayout.Padding = new BorderDouble(3);
                leftToRightLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT)
                {
                    string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
                    convertedNewLines = convertedNewLines.Replace("\\n", "\n");
                    convertedNewLines = LocalizedString.Get(convertedNewLines);
                    TextWidget settingName = new TextWidget(convertedNewLines);
                    settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                    if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
                    {
                        addMaterialOverlay = true;
                    }
                    else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
                    {
                        addQualityOverlay = true;
                    }

                    settingName.Width = minSettingNameWidth;
                    //settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                    leftToRightLayout.AddChild(settingName);
                }

                switch (settingData.DataEditType)
                {
                    case OrganizerSettingsData.DataEditTypes.INT:
                        {
                            int currentValue = 0;
                            int.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++);
                            intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(intEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.DOUBLE:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowNegatives: true, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                                {
                                    SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
                                    CallEventsOnSettingsChange(settingData);
                                };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.OFFSET:
                        {
                            double currentValue = 0;
                            double.TryParse(sliceSettingValue, out currentValue);
                            MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, allowNegatives: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++);
                            doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString());
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(doubleEditWidget);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT:
                        {
                            MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 60, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                            {
                                TextEditWidget textEditWidget = (TextEditWidget)sender;
                                string text = textEditWidget.Text;
                                text = text.Trim();
                                bool isPercent = text.Contains("%");
                                if (isPercent)
                                {
                                    text = text.Substring(0, text.IndexOf("%"));
                                }
                                double result;
                                double.TryParse(text, out result);
                                text = result.ToString();
                                if (isPercent)
                                {
                                    text += "%";
                                }
                                textEditWidget.Text = text;
                                SaveSetting(settingData.SlicerConfigName, textEditWidget.Text);
                                CallEventsOnSettingsChange(settingData);
                            };

                            leftToRightLayout.AddChild(stringEdit);
                            leftToRightLayout.AddChild(getSettingInfoData(settingData));
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
                        {
                            CheckBox checkBoxWidget = new CheckBox("");
                            checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
                            checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                            checkBoxWidget.Checked = (sliceSettingValue == "1");
                            checkBoxWidget.CheckedStateChanged += (sender, e) =>
                            {
                                if (((CheckBox)sender).Checked)
                                {
                                    SaveSetting(settingData.SlicerConfigName, "1");
                                }
                                else
                                {
                                    SaveSetting(settingData.SlicerConfigName, "0");
                                }
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(checkBoxWidget);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.STRING:
                        {
                            MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text);
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(stringEdit);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT:
                        {
                            string convertedNewLines = sliceSettingValue.Replace("\\n", "\n");
                            MHTextEditWidget stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++);
                            stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n"));
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(stringEdit);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.LIST:
                        {
                            StyledDropDownList selectableOptions = new StyledDropDownList("None", maxHeight: 200);
                            selectableOptions.Margin = new BorderDouble();

                            string[] listItems = settingData.ExtraSettings.Split(',');

                            foreach (string listItem in listItems)
                            {
                                MenuItem newItem = selectableOptions.AddItem(listItem);
                                if (newItem.Text == sliceSettingValue)
                                {
                                    selectableOptions.SelectedLabel = sliceSettingValue;
                                }

                                newItem.Selected += (sender, e) =>
                                {
                                    MenuItem menuItem = ((MenuItem)sender);
                                    SaveSetting(settingData.SlicerConfigName, menuItem.Text);
                                    CallEventsOnSettingsChange(settingData);
                                };
                            }
                            leftToRightLayout.AddChild(selectableOptions);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.HARDWARE_PRESENT:
                        {
                            CheckBox checkBoxWidget = new CheckBox("");
                            checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
                            checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                            checkBoxWidget.Checked = (sliceSettingValue == "1");
                            checkBoxWidget.CheckedStateChanged += (sender, e) =>
                            {
                                if (((CheckBox)sender).Checked)
                                {
                                    SaveSetting(settingData.SlicerConfigName, "1");
                                    // Now show all of the settings that this control is associated with.
                                }
                                else
                                {
                                    SaveSetting(settingData.SlicerConfigName, "0");
                                    // Now hide all of the settings that this control is associated with.
                                }
                                CallEventsOnSettingsChange(settingData);
                            };
                            leftToRightLayout.AddChild(checkBoxWidget);
                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.VECTOR2:
                        {
                            string[] xyValueStrings = sliceSettingValue.Split(',');
                            if (xyValueStrings.Length != 2)
                            {
                                xyValueStrings = new string[] { "0", "0" };
                            }
                            double currentXValue = 0;
                            double.TryParse(xyValueStrings[0], out currentXValue);
                            MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                            double currentYValue = 0;
                            double.TryParse(xyValueStrings[1], out currentYValue);
                            MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                            xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                            {
                                SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());
                                CallEventsOnSettingsChange(settingData);
                            };

                            leftToRightLayout.AddChild(xEditWidget);
                            TextWidget xText = new TextWidget("x");
                            xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                            xText.Margin = new BorderDouble(5, 0);
                            leftToRightLayout.AddChild(xText);

                            yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                                {
                                    SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "," + yEditWidget.ActuallNumberEdit.Value.ToString());
                                    CallEventsOnSettingsChange(settingData);
                                };
                            leftToRightLayout.AddChild(yEditWidget);
                            TextWidget yText = new TextWidget("y");
                            yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                            yText.Margin = new BorderDouble(5, 0);
                            leftToRightLayout.AddChild(yText);

                        }
                        break;

                    case OrganizerSettingsData.DataEditTypes.OFFSET2:
                        {
                            string[] xyValueStrings = sliceSettingValue.Split('x');
                            if (xyValueStrings.Length != 2)
                            {
                                xyValueStrings = new string[] { "0", "0" };
                            }
                            double currentXValue = 0;
                            double.TryParse(xyValueStrings[0], out currentXValue);
                            MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);

                            double currentYValue = 0;
                            double.TryParse(xyValueStrings[1], out currentYValue);
                            MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++);
                            {
                                xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                                {
                                    SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());
                                    CallEventsOnSettingsChange(settingData);
                                };
                                leftToRightLayout.AddChild(xEditWidget);
                                TextWidget xText = new TextWidget("x");
                                xText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                xText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(xText);
                            }
                            {
                                yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
                                {
                                    SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString());
                                    CallEventsOnSettingsChange(settingData);
                                };
                                leftToRightLayout.AddChild(yEditWidget);
                                TextWidget yText = new TextWidget("y");
                                yText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                                yText.Margin = new BorderDouble(5, 0);
                                leftToRightLayout.AddChild(yText);
                            }
                        }
                        break;

                    default:
                        TextWidget missingSetting = new TextWidget(String.Format("Missing the setting for '{0}'.", settingData.DataEditType.ToString()));
                        missingSetting.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        missingSetting.BackgroundColor = RGBA_Bytes.Red;
                        leftToRightLayout.AddChild(missingSetting);
                        break;
                }
            }
            else // the setting we think we are adding is not in the config.ini it may have been depricated
            {
                TextWidget settingName = new TextWidget(String.Format("Setting '{0}' not found in config.ini", settingData.SlicerConfigName));
                settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
                leftToRightLayout.AddChild(settingName);
                leftToRightLayout.BackgroundColor = RGBA_Bytes.Red;
            }

            container.HAnchor = HAnchor.ParentLeftRight;
            container.VAnchor = VAnchor.FitToChildren;

            container.AddChild(leftToRightLayout);

            if (addQualityOverlay || addMaterialOverlay)
            {
                SettingPresetOverlay overlay = new SettingPresetOverlay();
                overlay.HAnchor = HAnchor.ParentLeftRight;
                overlay.VAnchor = Agg.UI.VAnchor.ParentBottomTop;

                SettingPresetClick clickToEdit = new SettingPresetClick();
                clickToEdit.HAnchor = HAnchor.ParentLeftRight;
                clickToEdit.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                clickToEdit.Visible = false;

                Button editButton = buttonFactory.Generate("Edit Preset".Localize().ToUpper());
                editButton.HAnchor = Agg.UI.HAnchor.ParentCenter;
                editButton.VAnchor = Agg.UI.VAnchor.ParentCenter;

                clickToEdit.AddChild(editButton);

                if (addQualityOverlay)
                {
                    overlay.OverlayColor = qualityOverlayColor;
                    clickToEdit.OverlayColor = qualityOverlayColor;
                    editButton.Click += (sender, e) =>
                    {
                        if (ApplicationWidget.Instance.EditQualityPresetsWindow == null)
                        {
                            ApplicationWidget.Instance.EditQualityPresetsWindow = new SlicePresetsWindow(ReloadOptions, "Quality", "quality", false, ActivePrinterProfile.Instance.ActiveQualitySettingsID);
                            ApplicationWidget.Instance.EditQualityPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationWidget.Instance.EditQualityPresetsWindow = null; };
                        }
                        else
                        {
                            ApplicationWidget.Instance.EditQualityPresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.ActiveQualitySettingsID);
                            ApplicationWidget.Instance.EditQualityPresetsWindow.BringToFront();
                        }
                    };
                }
                else if (addMaterialOverlay)
                {
                    overlay.OverlayColor = materialOverlayColor;
                    clickToEdit.OverlayColor = materialOverlayColor;
                    editButton.Click += (sender, e) =>
                    {
                        if (ApplicationWidget.Instance.EditMaterialPresetsWindow == null)
                        {
                            ApplicationWidget.Instance.EditMaterialPresetsWindow = new SlicePresetsWindow(ReloadOptions, "Material", "material", false, ActivePrinterProfile.Instance.GetMaterialSetting(1));
                            ApplicationWidget.Instance.EditMaterialPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationWidget.Instance.EditMaterialPresetsWindow = null; };
                        }
                        else
                        {
                            ApplicationWidget.Instance.EditMaterialPresetsWindow.ChangeToSlicePresetFromID(ActivePrinterProfile.Instance.GetMaterialSetting(1));
                            ApplicationWidget.Instance.EditMaterialPresetsWindow.BringToFront();
                        }
                    };
                }

                container.MouseEnterBounds += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        overlay.Visible = false;
                        clickToEdit.Visible = true;
                    });
                };

                container.MouseLeaveBounds += (sender, e) =>
                {
                    UiThread.RunOnIdle((state) =>
                    {
                        overlay.Visible = true;
                        clickToEdit.Visible = false;
                    });
                };

                container.AddChild(overlay);
                container.AddChild(clickToEdit);
            }



            return container;
        }