public DemoRunner() { string searchPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // Load plugins from all assemblies the startup directory var dlls = Directory.GetFiles(searchPath, "*.dll"); var allAssemblies = dlls.Concat(Directory.GetFiles(searchPath, "*.exe")); foreach (var file in allAssemblies) { try { PluginFinder.LoadTypesFromAssembly(Assembly.LoadFile(file)); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error loading assembly: " + ex.Message); } } var appWidgetFinder = PluginFinder.CreateInstancesOf <IDemoApp>().OrderBy(a => a.Title).ToList(); TabControl tabControl = new TabControl(Orientation.Vertical); AddChild(tabControl); tabControl.AnchorAll(); int count = appWidgetFinder.Count; for (int i = 0; i < count; i++) { TabPage tabPage = new TabPage(appWidgetFinder[i].Title); tabPage.AddChild(appWidgetFinder[i] as GuiWidget); tabControl.AddTab(tabPage, tabPage.Text); } // HACK: force width/height/color/position/spacing on default tab controls double maxWidth = tabControl.TabBar.Children.Select(c => c.Width).Max(); foreach (var child in tabControl.TabBar.Children) { if (child is TextTab textTab) { foreach (var viewWidget in textTab.Children) { viewWidget.BackgroundColor = new Color(viewWidget.BackgroundColor, 180); viewWidget.HAnchor = HAnchor.Absolute; viewWidget.VAnchor = VAnchor.Fit; viewWidget.Margin = 0; viewWidget.Padding = 6; viewWidget.Position = Vector2.Zero; viewWidget.Width = maxWidth; } } } AnchorAll(); }
TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState) { StoreUiState(); advancedControls = new TabControl(); advancedControls.AnchorAll(); advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor; advancedControls.TabBar.Margin = new BorderDouble(0, 0); advancedControls.TabBar.Padding = new BorderDouble(0, 2); advancedControlsButtonFactory.invertImageLocation = false; GuiWidget manualPrinterControls = new ManualPrinterControls(); ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true); manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; manualPrinterControlsScrollArea.AnchorAll(); manualPrinterControlsScrollArea.AddChild(manualPrinterControls); //Add the tab contents for 'Advanced Controls' string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 16, ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper(); sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState); advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), 16, ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string configurationLabel = LocalizedString.Get("Configuration").ToUpper(); ScrollableWidget configurationControls = new ConfigurationPage(); advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), 16, ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); RestoreUiState(); return(advancedControls); }
public DemoRunner() { TabControl tabControl = new TabControl(Orientation.Vertical); AddChild(tabControl); tabControl.AnchorAll(); int count = appWidgetFinder.Plugins.Count; for (int i = 0; i < count; i++) { if (appWidgetFinder.Plugins[i].GetAppParameters().title != "Demo Runner") { TabPage tabPage = new TabPage(appWidgetFinder.Plugins[i].GetAppParameters().title); tabPage.AddChild(appWidgetFinder.Plugins[i].NewWidget()); tabControl.AddTab(tabPage, "Demo Runner"); } } AnchorAll(); }
public DemoRunner() { var appWidgetFinder = PluginFinder.CreateInstancesOf <IDemoApp>().OrderBy(a => a.Title).ToList(); TabControl tabControl = new TabControl(Orientation.Vertical); AddChild(tabControl); tabControl.AnchorAll(); int count = appWidgetFinder.Count; for (int i = 0; i < count; i++) { TabPage tabPage = new TabPage(appWidgetFinder[i].Title); tabPage.AddChild(appWidgetFinder[i] as GuiWidget); tabControl.AddTab(tabPage, tabPage.Text); } // HACK: force width/height/color/position/spacing on default tab controls double maxWidth = tabControl.TabBar.Children.Select(c => c.Width).Max(); foreach (var child in tabControl.TabBar.Children) { if (child is TextTab textTab) { foreach (var viewWidget in textTab.Children) { viewWidget.BackgroundColor = new Color(viewWidget.BackgroundColor, 180); viewWidget.HAnchor = HAnchor.Absolute; viewWidget.VAnchor = VAnchor.Fit; viewWidget.Margin = 0; viewWidget.Padding = 6; viewWidget.Position = Vector2.Zero; viewWidget.Width = maxWidth; } } } AnchorAll(); }
public SliceSettingsWidget() { int minSettingNameWidth = (int)(190 * TextWidget.GlobalPointSizeScaleRatio + .5); buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; buttonFactory.fontSize = 10; buttonFactory.normalFillColor = RGBA_Bytes.White; buttonFactory.normalTextColor = RGBA_Bytes.DarkGray; 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); settingsSaveBar = new SliceSettingsSaveBar(); settingsSaveBar.Visible = false; pageTopToBottomLayout.AddChild(settingsSaveBar); noConnectionMessageContainer = new AltGroupBox(new TextWidget(LocalizedString.Get("No Printer Selected"), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); noConnectionMessageContainer.Margin = new BorderDouble(top: 10); noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; noConnectionMessageContainer.Height = 90; string noConnectionString = LocalizedString.Get("No printer is currently selected. Please select a printer to edit slice settings."); noConnectionString += "\n\n" + LocalizedString.Get("NOTE: You need to select a printer, but do not need to connect to it."); TextWidget noConnectionMessage = new TextWidget(noConnectionString, pointSize: 10); 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(); sliceSettingsDetailControl = new SliceSettingsDetailControl(); 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, category.Name + " Tab", 16, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); categoryPage.AnchorAll(); categoryTabs.AddTab(textTabWidget); TabControl sideTabs = CreateSideTabsAndPages(minSettingNameWidth, category); sideTabBarsListForLayout.Add(sideTabs.TabBar); categoryPage.AddChild(sideTabs); } categoryTabs.TabBar.AddChild(new HorizontalSpacer()); categoryTabs.TabBar.AddChild(sliceSettingsDetailControl); if (sliceSettingsDetailControl.SelectedValue == "Advanced" && ActivePrinterProfile.Instance.ActiveSliceEngineType == ActivePrinterProfile.SlicingEngineTypes.Slic3r) { TabPage extraSettingsPage = new TabPage("Other"); SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, "Other Tab", 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); } if (sideTabBarsListForLayout.Count == 1) { sideTabBarsListForLayout[0].MinimumSize = new Vector2(0, 0); sideTabBarsListForLayout[0].Width = 0; } pageTopToBottomLayout.AddChild(categoryTabs); AddHandlers(); SetVisibleControls(); // Make sure we are on the right tab when we create this view { string settingsName = "SliceSettingsWidget_CurrentTab"; string selectedTab = UserSettings.Instance.get(settingsName); categoryTabs.SelectTab(selectedTab); categoryTabs.TabBar.TabIndexChanged += (object sender, EventArgs e) => { UserSettings.Instance.set(settingsName, categoryTabs.TabBar.SelectedTabName); }; } this.AnchorAll(); SetStatusDisplay(); }
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); } }
public SliceSettingsWidget(List<PrinterSettingsLayer> layerCascade = null, NamedSettingsLayers viewFilter = NamedSettingsLayers.All) { this.layerCascade = layerCascade; this.viewFilter = viewFilter; // The last layer of the layerFilters is the target persistence layer persistenceLayer = layerCascade?.First() ?? ActiveSliceSettings.Instance.UserLayer; textImageButtonFactory = new TextImageButtonFactory(); textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent; textImageButtonFactory.FixedHeight = 15 * GuiWidget.DeviceScale; textImageButtonFactory.fontSize = 8; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); this.textImageButtonFactory.disabledTextColor = RGBA_Bytes.Gray; this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.SecondaryTextColor; this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; buttonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; buttonFactory.fontSize = 10; buttonFactory.normalFillColor = RGBA_Bytes.White; buttonFactory.normalTextColor = RGBA_Bytes.DarkGray; 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() { HAnchor = HAnchor.ParentLeftRight, BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay, Padding = new BorderDouble(8, 12, 8, 8) }; pageTopToBottomLayout.AddChild(settingsControlBar); noConnectionMessageContainer = new AltGroupBox(new TextWidget("No Printer Selected".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); noConnectionMessageContainer.Margin = new BorderDouble(top: 10); noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; noConnectionMessageContainer.Height = 90; string noConnectionString = "No printer is currently selected. Please select a printer to edit slice settings.".Localize(); noConnectionString += "\n\n" + "NOTE: You need to select a printer, but do not need to connect to it.".Localize(); TextWidget noConnectionMessage = new TextWidget(noConnectionString, pointSize: 10); noConnectionMessage.Margin = new BorderDouble(5); noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessage.VAnchor = VAnchor.ParentCenter; noConnectionMessageContainer.AddChild(noConnectionMessage); pageTopToBottomLayout.AddChild(noConnectionMessageContainer); topCategoryTabs = new TabControl(); topCategoryTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor; topCategoryTabs.Margin = new BorderDouble(top: 8); topCategoryTabs.AnchorAll(); sliceSettingsDetailControl = new SliceSettingsDetailControl(layerCascade); List<TabBar> sideTabBarsListForLayout = new List<TabBar>(); for (int topCategoryIndex = 0; topCategoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; topCategoryIndex++) { OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[topCategoryIndex]; string categoryPageLabel = category.Name.Localize(); TabPage categoryPage = new TabPage(categoryPageLabel); SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, category.Name + " Tab", 16, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); categoryPage.AnchorAll(); topCategoryTabs.AddTab(textTabWidget); TabControl sideTabs = CreateSideTabsAndPages(category); sideTabBarsListForLayout.Add(sideTabs.TabBar); categoryPage.AddChild(sideTabs); } topCategoryTabs.TabBar.AddChild(new HorizontalSpacer()); topCategoryTabs.TabBar.AddChild(sliceSettingsDetailControl); if (sliceSettingsDetailControl.SelectedValue == "Advanced" && ActiveSliceSettings.Instance.Helpers.ActiveSliceEngineType() == SlicingEngineTypes.Slic3r) { TabPage extraSettingsPage = new TabPage("Other"); SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, "Other Tab", 16, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); extraSettingsPage.AnchorAll(); int count; TabControl extraSettingsSideTabs = CreateExtraSettingsSideTabsAndPages(topCategoryTabs, out count); if (count > 0) { topCategoryTabs.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); } // check if there is only one left side tab. If so hide the left tabs and expand the content. foreach(var tabList in sideTabBarsListForLayout) { if(tabList.CountVisibleChildren() == 1) { tabList.MinimumSize = new Vector2(0, 0); tabList.Width = 0; } } pageTopToBottomLayout.AddChild(topCategoryTabs); AddHandlers(); SetVisibleControls(); // Make sure we are on the right tab when we create this view { string settingsName = "SliceSettingsWidget_CurrentTab"; string selectedTab = UserSettings.Instance.get(settingsName); topCategoryTabs.SelectTab(selectedTab); topCategoryTabs.TabBar.TabIndexChanged += (object sender, EventArgs e) => { string selectedTabName = topCategoryTabs.TabBar.SelectedTabName; if (!string.IsNullOrEmpty(selectedTabName)) { if (layerCascade == null) { UserSettings.Instance.set(settingsName, selectedTabName); } } }; } this.AnchorAll(); }
void AddControls(UiState uiState) { int minSettingNameWidth = 220; showHelpBox = new CheckBox(new LocalizedString("Show Help").Translated); showHelpBox.Checked = uiState.showHelp; showAllDetails = new CheckBox(new LocalizedString("Show All Settings").Translated); showAllDetails.Checked = uiState.userLevel == "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(new LocalizedString("No Printer Selected").Translated); noConnectionMessageContainer.Margin = new BorderDouble(top: 10); noConnectionMessageContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; noConnectionMessageContainer.Height = 80; TextWidget noConnectionMessage = new TextWidget(new LocalizedString("No printer is currently selected. Select printer to edit slice settings.").Translated); 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 = RGBA_Bytes.White; 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 categoryPageLbl = new LocalizedString (category.Name).Translated; TabPage categoryPage = new TabPage(categoryPageLbl); 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 = RGBA_Bytes.White; 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 = RGBA_Bytes.White; 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); } }