Example #1
0
        public OrganizerCategory NewAndAddSettingsGroup(string settingsGroupName)
        {
            OrganizerCategory newCategoriesGroup = new OrganizerCategory(settingsGroupName);

            CategoriesList.Add(newCategoriesGroup);
            return(newCategoriesGroup);
        }
        void PopulateLayoutDictionary()
        {
            string UserLevel = "Advanced"; //Show all settings

            for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
            {
                OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];

                for (int groupIndex = 0; groupIndex < category.GroupsList.Count; groupIndex++)
                {
                    OrganizerGroup group = category.GroupsList[groupIndex];

                    for (int subGroupIndex = 0; subGroupIndex < group.SubGroupsList.Count; subGroupIndex++)
                    {
                        OrganizerSubGroup subgroup = group.SubGroupsList[subGroupIndex];
                        for (int settingIndex = 0; settingIndex < subgroup.SettingDataList.Count; settingIndex++)
                        {
                            OrganizerSettingsData setting = subgroup.SettingDataList[settingIndex];
                            string settingDisplayName     = "{0} > {1} > {2}".FormatWith(category.Name, group.Name, setting.PresentationName).Replace("\\n", "").Replace(":", "");
                            settingLayoutData[setting.SlicerConfigName] = settingDisplayName;
                        }
                    }
                }
            }
        }
Example #3
0
        private void LoadAndParseSettingsFiles()
        {
            string propertiesFileContents = StaticData.Instance.ReadAllText(Path.Combine("SliceSettings", "Properties.json"));

            settingsData = JsonConvert.DeserializeObject <List <OrganizerSettingsData> >(propertiesFileContents) as List <OrganizerSettingsData>;

            OrganizerUserLevel userLevelToAddTo = null;
            OrganizerCategory  categoryToAddTo  = null;
            OrganizerGroup     groupToAddTo     = null;
            OrganizerSubGroup  subGroupToAddTo  = null;

            foreach (string line in StaticData.Instance.ReadAllLines(Path.Combine("SliceSettings", "Layouts.txt")))
            {
                if (line.Length > 0)
                {
                    string sanitizedLine = line.Replace('"', ' ').Trim();
                    switch (CountLeadingSpaces(line))
                    {
                    case 0:
                        userLevelToAddTo = new OrganizerUserLevel(sanitizedLine);
                        UserLevels.Add(sanitizedLine, userLevelToAddTo);
                        break;

                    case 2:
                        categoryToAddTo = new OrganizerCategory(sanitizedLine);
                        userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
                        break;

                    case 4:
                        groupToAddTo = new OrganizerGroup(sanitizedLine);
                        categoryToAddTo.GroupsList.Add(groupToAddTo);
                        break;

                    case 6:
                        subGroupToAddTo = new OrganizerSubGroup(sanitizedLine);
                        groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
                        break;

                    case 8:
                        OrganizerSettingsData data = GetSettingsData(sanitizedLine);
                        if (data != null)
                        {
                            subGroupToAddTo.SettingDataList.Add(data);
                        }

                        break;

                    default:
                        throw new Exception("Bad file, too many spaces (must be 0, 2, 4 or 6).");
                    }
                }
            }
        }
		private void LoadAndParseSettingsFiles()
		{
			string propertiesFileContents = StaticData.Instance.ReadAllText(Path.Combine("SliceSettings", "Properties.json"));
			SettingsData = JsonConvert.DeserializeObject<List<SliceSettingData>>(propertiesFileContents) as List<SliceSettingData>;

			OrganizerUserLevel userLevelToAddTo = null;
			OrganizerCategory categoryToAddTo = null;
			OrganizerGroup groupToAddTo = null;
			OrganizerSubGroup subGroupToAddTo = null;

			foreach (string line in StaticData.Instance.ReadAllLines(Path.Combine("SliceSettings", "Layouts.txt")))
			{
				if (line.Length > 0)
				{
					string sanitizedLine = line.Replace('"', ' ').Trim();
					switch (CountLeadingSpaces(line))
					{
						case 0:
							userLevelToAddTo = new OrganizerUserLevel(sanitizedLine);
							UserLevels.Add(sanitizedLine, userLevelToAddTo);
							break;

						case 2:
							categoryToAddTo = new OrganizerCategory(sanitizedLine);
							userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
							break;

						case 4:
							groupToAddTo = new OrganizerGroup(sanitizedLine);
							categoryToAddTo.GroupsList.Add(groupToAddTo);
							break;

						case 6:
							subGroupToAddTo = new OrganizerSubGroup(sanitizedLine);
							groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
							break;

						case 8:
							SliceSettingData data = GetSettingsData(sanitizedLine);
							if (data != null)
							{
								subGroupToAddTo.SettingDataList.Add(data);
							}

							break;

						default:
							throw new Exception("Bad file, too many spaces (must be 0, 2, 4 or 6).");
					}
				}
			}
		}
		public OrganizerCategory NewAndAddSettingsGroup(string settingsGroupName)
		{
			OrganizerCategory newCategoriesGroup = new OrganizerCategory(settingsGroupName);
			CategoriesList.Add(newCategoriesGroup);
			return newCategoriesGroup;
		}
        void PopulateAddSettingRow(int categoryDefaultIndex = -1, int groupDefaultIndex = -1, string settingDefaultConfigName = "-1")
        {
            errorMessageContainer.Visible = false;

            categoryDropDownList             = new SettingsDropDownList("- Select Category -");
            categoryDropDownList.Margin      = new BorderDouble(right: 3);
            categoryDropDownList.MinimumSize = new Vector2(categoryDropDownList.LocalBounds.Width, categoryDropDownList.LocalBounds.Height);
            categoryDropDownList.VAnchor     = Agg.UI.VAnchor.ParentCenter;
            categoryDropDownList.Height      = 24;

            groupDropDownList             = new SettingsDropDownList("- Select Group -");
            groupDropDownList.Margin      = new BorderDouble(right: 3);
            groupDropDownList.MinimumSize = new Vector2(groupDropDownList.LocalBounds.Width, groupDropDownList.LocalBounds.Height);
            groupDropDownList.VAnchor     = Agg.UI.VAnchor.ParentCenter;
            groupDropDownList.Height      = 24;

            settingDropDownList                  = new SettingsDropDownList("- Select Setting -");
            settingDropDownList.Margin           = new BorderDouble(right: 3);
            settingDropDownList.MinimumSize      = new Vector2(settingDropDownList.LocalBounds.Width, settingDropDownList.LocalBounds.Height);
            settingDropDownList.VAnchor          = Agg.UI.VAnchor.ParentCenter;
            settingDropDownList.HAnchor          = Agg.UI.HAnchor.ParentLeftRight;
            settingDropDownList.AlignToRightEdge = true;
            settingDropDownList.Height           = 24;

            string selectedCategoryValue = "{0}:-1:-1".FormatWith(categoryDefaultIndex);
            string selectedGroupValue    = "{0}:{1}:-1".FormatWith(categoryDefaultIndex, groupDefaultIndex);
            string selectedSettingValue  = "{0}:{1}:{2}".FormatWith(categoryDefaultIndex, groupDefaultIndex, settingDefaultConfigName);

            string UserLevel = "Advanced"; //Show all settings

            for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
            {
                OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];

                //Always add all categories
                MenuItem categoryMenuItem = categoryDropDownList.AddItem(category.Name, "{0}:-1:-1".FormatWith(categoryIndex));
                categoryMenuItem.Selected += new EventHandler(OnItemSelected);

                for (int groupIndex = 0; groupIndex < category.GroupsList.Count; groupIndex++)
                {
                    OrganizerGroup group      = category.GroupsList[groupIndex];
                    string         groupValue = "{0}:{1}:-1".FormatWith(categoryIndex, groupIndex);

                    //Add groups if within selected category or no category selected
                    if (categoryIndex == categoryDefaultIndex || categoryDefaultIndex == -1)
                    {
                        MenuItem groupMenuItem = groupDropDownList.AddItem(group.Name, groupValue);
                        groupMenuItem.Selected += new EventHandler(OnItemSelected);
                    }

                    for (int subGroupIndex = 0; subGroupIndex < group.SubGroupsList.Count; subGroupIndex++)
                    {
                        OrganizerSubGroup subgroup = group.SubGroupsList[subGroupIndex];
                        for (int settingIndex = 0; settingIndex < subgroup.SettingDataList.Count; settingIndex++)
                        {
                            //Add settings if within selected category and group or no category selected
                            if (selectedGroupValue == groupValue || (groupDefaultIndex == -1 && categoryIndex == categoryDefaultIndex) || categoryDefaultIndex == -1)
                            {
                                OrganizerSettingsData setting = subgroup.SettingDataList[settingIndex];
                                string itemValue = "{0}:{1}:{2}".FormatWith(categoryIndex, groupIndex, setting.SlicerConfigName);
                                string itemName  = setting.PresentationName.Replace("\\n", "").Replace(":", "");
                                if (setting.ExtraSettings.Trim() != "" && setting.DataEditType != OrganizerSettingsData.DataEditTypes.LIST)
                                {
                                    itemName = "{0} ({1})".FormatWith(itemName, setting.ExtraSettings.Replace("\\n", " "));
                                }

                                MenuItem settingMenuItem = settingDropDownList.AddItem(itemName, itemValue);
                                settingMenuItem.Selected += new EventHandler(OnItemSelected);
                                settingMenuItem.Selected += new EventHandler(OnSettingSelected);
                            }
                        }
                    }
                }
            }

            if (categoryDefaultIndex != -1)
            {
                categoryDropDownList.SelectedValue = selectedCategoryValue;
            }
            if (groupDefaultIndex != -1)
            {
                groupDropDownList.SelectedValue = selectedGroupValue;
            }
            if (settingDefaultConfigName != "-1")
            {
                settingDropDownList.SelectedValue = selectedSettingValue;
            }

            addSettingsContainer.RemoveAllChildren();
            addSettingsContainer.AddChild(categoryDropDownList);
            addSettingsContainer.AddChild(groupDropDownList);
            addSettingsContainer.AddChild(settingDropDownList);
            //addSettingsContainer.AddChild(addButton);
        }
		private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category)
		{
			TabControl groupTabs = new TabControl(Orientation.Vertical);
			groupTabs.Margin = new BorderDouble(0, 0, 0, 5);
			groupTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			foreach (OrganizerGroup group in category.GroupsList)
			{
				tabIndexForItem = 0;
				string groupTabLabel = LocalizedString.Get(group.Name);
				TabPage groupTabPage = new TabPage(groupTabLabel);
				groupTabPage.HAnchor = HAnchor.ParentLeftRight;

				SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, group.Name + " Tab", 14,
				   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
				groupTabWidget.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

				FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
				subGroupLayoutTopToBottom.AnchorAll();

				bool needToAddSubGroup = false;
				foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
				{
					string subGroupTitle = subGroup.Name;
					int numberOfCopies = 1;
					if (subGroup.Name == "Extruder X")
					{
						numberOfCopies = ActiveSliceSettings.Instance.ExtruderCount;
					}

					for (int copyIndex = 0; copyIndex < numberOfCopies; copyIndex++)
					{
						if (subGroup.Name == "Extruder X")
						{
							subGroupTitle = "{0} {1}".FormatWith("Extruder".Localize(), copyIndex + 1);
						}

						bool addedSettingToSubGroup = false;
						FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
						topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

						foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
						{
							if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName))
							{
								addedSettingToSubGroup = true;
								GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth, copyIndex);
								topToBottomSettings.AddChild(controlsForThisSetting);

								if (sliceSettingsDetailControl.ShowingHelp)
								{
									AddInHelpText(topToBottomSettings, settingInfo);
								}
							}
						}

						if (addedSettingToSubGroup)
						{
							needToAddSubGroup = true;
							string groupBoxLabel = subGroupTitle;
							AltGroupBox groupBox = new AltGroupBox(groupBoxLabel);
							groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
							groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
							groupBox.AddChild(topToBottomSettings);
							groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
							groupBox.Margin = new BorderDouble(3, 3, 3, 0);

							subGroupLayoutTopToBottom.AddChild(groupBox);
						}
					}
				}

				if (needToAddSubGroup)
				{
					SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();

					subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;
					subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

					scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
					groupTabPage.AddChild(scrollOnGroupTab);
					groupTabs.AddTab(groupTabWidget);


					// Make sure we have the right scroll position when we create this view
					// This code is not working yet. Scroll widgets get a scroll event when the tab becomes visible that is always reseting them.
					// So it is not usefull to enable this and in fact makes the tabs inconsistently scrolled. It is just here for reference. // 2015 04 16, LBB
					if(false) 
					{
						string settingsScrollPosition = "SliceSettingsWidget_{0}_{1}_ScrollPosition".FormatWith(category.Name, group.Name);

						UiThread.RunOnIdle(()=>
						{
							int scrollPosition = UserSettings.Instance.Fields.GetInt(settingsScrollPosition, -100000);
							if (scrollPosition != -100000)
							{
								scrollOnGroupTab.ScrollPosition = new Vector2(0, scrollPosition);
							}
						});

						scrollOnGroupTab.ScrollPositionChanged += (object sender, EventArgs e) =>
						{
							if (scrollOnGroupTab.CanSelect)
							{
								UserSettings.Instance.Fields.SetInt(settingsScrollPosition, (int)scrollOnGroupTab.ScrollPosition.y);
							}
						};
					}
				}
			}

			// Make sure we are on the right tab when we create this view
			{
				string settingsTypeName = "SliceSettingsWidget_{0}_CurrentTab".FormatWith(category.Name);
				string selectedTab = UserSettings.Instance.get(settingsTypeName);
				groupTabs.SelectTab(selectedTab);

				groupTabs.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
				{
					UserSettings.Instance.set(settingsTypeName, groupTabs.TabBar.SelectedTabName);
				};
			}

			return groupTabs;
		}
Example #8
0
        void LoadAndParseSettingsFiles(string properties, string layout)
        {
            {
                string propertiesFileContents = "";
                using (FileStream fileStream = new FileStream(properties, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (StreamReader propertiesReader = new StreamReader(fileStream))
                    {
                        propertiesFileContents = propertiesReader.ReadToEnd();
                    }
                }

                string[] lines = propertiesFileContents.Split('\n');
                foreach (string line in lines)
                {
                    if (line.Trim().Length > 0)
                    {
                        settingsData.Add(OrganizerSettingsData.NewOrganizerSettingData(line));
                    }
                }
            }

            {
                string layoutFileContents = "";
                using (FileStream fileStream = new FileStream(layout, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (StreamReader layoutReader = new StreamReader(fileStream))
                    {
                        layoutFileContents = layoutReader.ReadToEnd();
                    }
                }

                OrganizerUserLevel userLevelToAddTo = null;
                OrganizerCategory  categoryToAddTo  = null;
                OrganizerGroup     groupToAddTo     = null;
                OrganizerSubGroup  subGroupToAddTo  = null;
                string[]           lines            = layoutFileContents.Split('\n');
                foreach (string line in lines)
                {
                    if (line.Length > 0)
                    {
                        switch (CountLeadingSpaces(line))
                        {
                        case 0:
                            string userLevelText = line.Replace('"', ' ').Trim();
                            userLevelToAddTo = new OrganizerUserLevel(userLevelText);
                            UserLevels.Add(userLevelText, userLevelToAddTo);
                            break;

                        case 2:
                            categoryToAddTo = new OrganizerCategory(line.Replace('"', ' ').Trim());
                            userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
                            break;

                        case 4:
                            groupToAddTo = new OrganizerGroup(line.Replace('"', ' ').Trim());
                            categoryToAddTo.GroupsList.Add(groupToAddTo);
                            break;

                        case 6:
                            subGroupToAddTo = new OrganizerSubGroup(line.Replace('"', ' ').Trim());
                            groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
                            break;

                        case 8:
                            subGroupToAddTo.SettingDataList.Add(GetSettingsData(line.Replace('"', ' ').Trim()));
                            break;

                        default:
                            throw new Exception("Bad file, too many spaces (must be 0, 2, 4 or 6).");
                        }
                    }
                }
            }
        }
        public SliceSettingsWidget(UiState uiState)
        {
            int minSettingNameWidth = 220;

            buttonFactory.FixedHeight     = 20;
            buttonFactory.fontSize        = 10;
            buttonFactory.normalFillColor = RGBA_Bytes.White;
            buttonFactory.normalTextColor = RGBA_Bytes.DarkGray;

            showHelpBox         = new CheckBox(0, 0, LocalizedString.Get("Show Help"), textSize: 10);
            showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";

            showAllDetails         = new CheckBox(0, 0, LocalizedString.Get("Show All Settings"), textSize: 10);
            showAllDetails.Checked = UserSettings.Instance.get(SliceSettingsLevelEntry) == "Advanced";

            FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);

            pageTopToBottomLayout.AnchorAll();
            pageTopToBottomLayout.Padding = new BorderDouble(3, 0);
            this.AddChild(pageTopToBottomLayout);

            settingsControlBar = new SettingsControlBar();
            pageTopToBottomLayout.AddChild(settingsControlBar);

            noConnectionMessageContainer             = new GroupBox(LocalizedString.Get("No Printer Selected"));
            noConnectionMessageContainer.Margin      = new BorderDouble(top: 10);
            noConnectionMessageContainer.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessageContainer.HAnchor     = Agg.UI.HAnchor.ParentLeftRight;
            noConnectionMessageContainer.Height      = 80;

            TextWidget noConnectionMessage = new TextWidget(LocalizedString.Get("No printer is currently selected. Select printer to edit slice settings."));

            noConnectionMessage.Margin    = new BorderDouble(5);
            noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessage.VAnchor   = VAnchor.ParentCenter;

            noConnectionMessageContainer.AddChild(noConnectionMessage);
            pageTopToBottomLayout.AddChild(noConnectionMessageContainer);

            categoryTabs = new TabControl();
            categoryTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            categoryTabs.Margin             = new BorderDouble(top: 8);
            categoryTabs.AnchorAll();
            List <TabBar> sideTabBarsListForLayout = new List <TabBar>();

            for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
            {
                OrganizerCategory   category          = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];
                string              categoryPageLabel = LocalizedString.Get(category.Name);
                TabPage             categoryPage      = new TabPage(categoryPageLabel);
                SimpleTextTabWidget textTabWidget     = new SimpleTextTabWidget(categoryPage, 16,
                                                                                ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                categoryPage.AnchorAll();
                categoryTabs.AddTab(textTabWidget);

                TabControl sideTabs = CreateSideTabsAndPages(minSettingNameWidth, category, uiState);
                sideTabBarsListForLayout.Add(sideTabs.TabBar);

                categoryPage.AddChild(sideTabs);
            }

            if (showAllDetails.Checked && ActivePrinterProfile.Instance.ActiveSliceEngineType == ActivePrinterProfile.SlicingEngineTypes.Slic3r)
            {
                TabPage             extraSettingsPage          = new TabPage("Other");
                SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, 16,
                                                                                         ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                extraSettingsPage.AnchorAll();
                int        count;
                TabControl extraSettingsSideTabs = CreateExtraSettingsSideTabsAndPages(minSettingNameWidth, categoryTabs, out count);
                if (count > 0)
                {
                    categoryTabs.AddTab(extraSettingsTextTabWidget);
                    sideTabBarsListForLayout.Add(extraSettingsSideTabs.TabBar);
                    extraSettingsPage.AddChild(extraSettingsSideTabs);
                }
            }

            double sideTabBarsMinimumWidth = 0;

            foreach (TabBar tabBar in sideTabBarsListForLayout)
            {
                sideTabBarsMinimumWidth = Math.Max(sideTabBarsMinimumWidth, tabBar.Width);
            }
            foreach (TabBar tabBar in sideTabBarsListForLayout)
            {
                tabBar.MinimumSize = new Vector2(sideTabBarsMinimumWidth, tabBar.MinimumSize.y);
            }

            // space before checkboxes (hold the right aligned)
            {
                GuiWidget hSpacer = new GuiWidget();
                hSpacer.HAnchor = HAnchor.ParentLeftRight;

                categoryTabs.TabBar.AddChild(hSpacer);
            }

            // add in the ability to turn on and off all details settings
            {
                showAllDetails.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                showAllDetails.Margin               = new BorderDouble(right: 8);
                showAllDetails.VAnchor              = VAnchor.ParentCenter;
                showAllDetails.Cursor               = Cursors.Hand;
                showAllDetails.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);

                categoryTabs.TabBar.AddChild(showAllDetails);
            }

            // 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 += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);

                categoryTabs.TabBar.AddChild(showHelpBox);
            }

            pageTopToBottomLayout.AddChild(categoryTabs);
            AddHandlers();
            SetVisibleControls();

            if (!categoryTabs.SelectTab(uiState.selectedCategory.name))
            {
                categoryTabs.SelectTab(uiState.selectedCategory.index);
            }
        }
        private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category, UiState uiState)
        {
            TabControl groupTabs = new TabControl(Orientation.Vertical);

            groupTabs.Margin             = new BorderDouble(0, 0, 0, 5);
            groupTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            foreach (OrganizerGroup group in category.GroupsList)
            {
                tabIndexForItem = 0;
                string  groupTabLabel = LocalizedString.Get(group.Name);
                TabPage groupTabPage  = new TabPage(groupTabLabel);
                groupTabPage.HAnchor = HAnchor.ParentLeftRight;

                SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
                                                                             ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                groupTabWidget.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
                subGroupLayoutTopToBottom.AnchorAll();

                bool needToAddSubGroup = false;
                foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
                {
                    bool             addedSettingToSubGroup = false;
                    FlowLayoutWidget topToBottomSettings    = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
                    {
                        if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName))
                        {
                            addedSettingToSubGroup = true;
                            GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth);
                            topToBottomSettings.AddChild(controlsForThisSetting);

                            if (showHelpBox.Checked)
                            {
                                AddInHelpText(topToBottomSettings, settingInfo);
                            }
                        }
                    }

                    if (addedSettingToSubGroup)
                    {
                        needToAddSubGroup = true;
                        string   groupBoxLabel = LocalizedString.Get(subGroup.Name);
                        GroupBox groupBox      = new GroupBox(groupBoxLabel);
                        groupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.AddChild(topToBottomSettings);
                        groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                        subGroupLayoutTopToBottom.AddChild(groupBox);
                    }
                }

                if (needToAddSubGroup)
                {
                    SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();

                    subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;
                    subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    //subGroupLayoutTopToBottom.DebugShowBounds = true;
                    //scrollOnGroupTab.DebugShowBounds = true;
                    scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                    groupTabPage.AddChild(scrollOnGroupTab);
                    groupTabs.AddTab(groupTabWidget);
                }
            }

            if (!groupTabs.SelectTab(uiState.selectedGroup.name))
            {
                groupTabs.SelectTab(uiState.selectedGroup.index);
            }
            return(groupTabs);
        }
		void LoadAndParseSettingsFiles(string properties, string layout)
        {
            {
                string propertiesFileContents = "";
                using (FileStream fileStream = new FileStream(properties, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (StreamReader propertiesReader = new StreamReader(fileStream))
                    {
                        propertiesFileContents = propertiesReader.ReadToEnd();
                    }
                }

                string[] lines = propertiesFileContents.Split('\n');
                foreach (string line in lines)
                {
                    if (line.Trim().Length > 0)
                    {
                        settingsData.Add(OrganizerSettingsData.NewOrganizerSettingData(line));
                    }
                }
            }

            {
				string layoutFileContents = "";
				using (FileStream fileStream = new FileStream(layout, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (StreamReader layoutReader = new StreamReader(fileStream))
                    {
                        layoutFileContents = layoutReader.ReadToEnd();
                    }
				}

                OrganizerUserLevel userLevelToAddTo = null;
                OrganizerCategory categoryToAddTo = null;
                OrganizerGroup groupToAddTo = null;
                OrganizerSubGroup subGroupToAddTo = null;
                string[] lines = layoutFileContents.Split('\n');
                foreach (string line in lines)
                {
                    if (line.Length > 0)
                    {
                        switch (CountLeadingSpaces(line))
                        {
                            case 0:
                                string userLevelText = line.Replace('"', ' ').Trim();
                                userLevelToAddTo = new OrganizerUserLevel(userLevelText);
                                UserLevels.Add(userLevelText, userLevelToAddTo);
                                break;

                            case 2:
                                categoryToAddTo = new OrganizerCategory(line.Replace('"', ' ').Trim());
                                userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
                                break;

                            case 4:
                                groupToAddTo = new OrganizerGroup(line.Replace('"', ' ').Trim());
                                categoryToAddTo.GroupsList.Add(groupToAddTo);
                                break;

                            case 6:
                                subGroupToAddTo = new OrganizerSubGroup(line.Replace('"', ' ').Trim());
                                groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
                                break;

                            case 8:
                                subGroupToAddTo.SettingDataList.Add(GetSettingsData(line.Replace('"', ' ').Trim()));
                                break;

                            default:
                                throw new Exception("Bad file, too many spaces (must be 0, 2, 4 or 6).");
                        }
                    }
                }
            }
        }
        private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category, UiState uiState)
        {
            TabControl groupTabs = new TabControl(Orientation.Vertical);
            groupTabs.Margin = new BorderDouble(0, 0, 0, 5);
            groupTabs.TabBar.BorderColor = RGBA_Bytes.White;
            foreach (OrganizerGroup group in category.GroupsList)
            {
                tabIndexForItem = 0;
				string groupTabLbl = new LocalizedString (group.Name).Translated;
				TabPage groupTabPage = new TabPage(groupTabLbl);
                SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
                   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());

                FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
                subGroupLayoutTopToBottom.AnchorAll();

                bool needToAddSubGroup = false;
                foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
                {
                    bool addedSettingToSubGroup = false;
                    FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                    foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
                    {
                        if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName))
                        {
                            addedSettingToSubGroup = true;
                            GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth);
                            topToBottomSettings.AddChild(controlsForThisSetting);

                            if (showHelpBox.Checked)
                            {
                                AddInHelpText(topToBottomSettings, settingInfo);
                            }
                        }
                    }

                    if (addedSettingToSubGroup)
                    {
                        needToAddSubGroup = true;
						string groupBoxLbl = new LocalizedString (subGroup.Name).Translated;
						GroupBox groupBox = new GroupBox (groupBoxLbl);
                        groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.AddChild(topToBottomSettings);

                        groupBox.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                        subGroupLayoutTopToBottom.AddChild(groupBox);
                    }
                }

                if (needToAddSubGroup)
                {
                    ScrollableWidget scrollOnGroupTab = new ScrollableWidget(true);
                    scrollOnGroupTab.AnchorAll();
                    subGroupLayoutTopToBottom.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
                    subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;
                    //subGroupLayoutTopToBottom.DebugShowBounds = true;
                    //scrollOnGroupTab.DebugShowBounds = true;
                    scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                    groupTabPage.AddChild(scrollOnGroupTab);
                    groupTabs.AddTab(groupTabWidget);
                }
            }

            if (!groupTabs.SelectTab(uiState.selectedGroup.name))
            {
                groupTabs.SelectTab(uiState.selectedGroup.index);
            }
            return groupTabs;
        }