protected override void AddChildElements() { AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("Fan".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; this.AddChild(fanControlsGroupBox); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { fanControlsLayout.AddChild(CreateFanControls()); } leftToRight.AddChild(fanControlsLayout); SetDisplayAttributes(); fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%"); fanSpeedDisplay.EditComplete += (sender, e) => { PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100); }; leftToRight.AddChild(fanSpeedDisplay); fanControlsGroupBox.AddChild(leftToRight); }
public PowerControls() { AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("ATX Power Control".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; this.AddChild(fanControlsGroupBox); atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false); atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6); atxPowertoggleSwitch.CheckedStateChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked; }; FlowLayoutWidget paddingContainer = new FlowLayoutWidget(); paddingContainer.Padding = new BorderDouble(3, 5, 3, 0); { paddingContainer.AddChild(atxPowertoggleSwitch); } fanControlsGroupBox.AddChild(paddingContainer); UpdateControlVisibility(null, null); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(this.UpdateControlVisibility, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.AtxPowerStateChanged.RegisterEvent(this.UpdatePowerSwitch, ref unregisterEvents); this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; this.HAnchor = HAnchor.ParentLeftRight; this.VAnchor = VAnchor.ParentBottomTop; }
protected override void AddChildElements() { AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); temperatureGroupBox.Margin = new BorderDouble(0); FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); mainContainer.HAnchor = HAnchor.ParentLeftRight; mainContainer.Margin = new BorderDouble(left: 0); TextWidget subheader = new TextWidget("Temporarily override target temperature", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader.Margin = new BorderDouble(bottom: 6); mainContainer.AddChild(subheader); temperatureGroupBox.AddChild(mainContainer); RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100); int numberOfHeatedExtruders = 1; if (!ActiveSliceSettings.Instance.ExtrudersShareTemperature) { numberOfHeatedExtruders = ActiveSliceSettings.Instance.ExtruderCount; } if (numberOfHeatedExtruders > 1) { for (int i = 0; i < numberOfHeatedExtruders; i++) { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i)); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } } else { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget()); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } BedTemperatureControlWidget = new DisableableWidget(); BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget()); if (ActiveSliceSettings.Instance.HasHeatedBed()) { mainContainer.AddChild(BedTemperatureControlWidget); } this.AddChild(temperatureGroupBox); }
public TemperatureControls() { AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); temperatureGroupBox.Margin = new BorderDouble(0); FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); mainContainer.HAnchor = HAnchor.ParentLeftRight; mainContainer.Margin = new BorderDouble(left: 0); temperatureGroupBox.AddChild(mainContainer); RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100); int numberOfHeatedExtruders = ActiveSliceSettings.Instance.Helpers.NumberOfHotEnds(); if (numberOfHeatedExtruders > 1) { for (int i = 0; i < numberOfHeatedExtruders; i++) { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i)); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } } else { DisableableWidget extruderTemperatureControlWidget = new DisableableWidget(); extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget()); mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); } BedTemperatureControlWidget = new DisableableWidget(); BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget()); if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed)) { mainContainer.AddChild(BedTemperatureControlWidget); } this.AddChild(temperatureGroupBox); }
public MacroControlsWidget() : base(FlowDirection.TopToBottom) { this.textImageButtonFactory.normalFillColor = RGBA_Bytes.White; this.textImageButtonFactory.FixedHeight = 24 * GuiWidget.DeviceScale; this.textImageButtonFactory.fontSize = 12; this.textImageButtonFactory.borderWidth = 1; this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); this.textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); this.textImageButtonFactory.disabledTextColor = RGBA_Bytes.Gray; this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; this.textImageButtonFactory.normalTextColor = RGBA_Bytes.Black; this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; this.HAnchor = HAnchor.ParentLeftRight; // add the widgets to this window Button editButton; AltGroupBox groupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(new TextWidget("Macros".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor), out editButton)); editButton.Click += (sender, e) => { EditMacrosWindow.Show(); }; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { this.presetButtonsContainer = GetMacroButtonContainer(); controlRow.AddChild(this.presetButtonsContainer); } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
public NoSettingsWidget() : base (FlowDirection.TopToBottom, vAnchor: VAnchor.ParentTop) { this.AnchorAll(); this.Padding = new BorderDouble(3, 0); var 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); this.AddChild(noConnectionMessageContainer); }
protected override void AddChildElements() { AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("ATX Power Control".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; this.AddChild(fanControlsGroupBox); atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false); atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6); atxPowertoggleSwitch.CheckedStateChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked; }; FlowLayoutWidget paddingContainer = new FlowLayoutWidget(); paddingContainer.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; { paddingContainer.AddChild(atxPowertoggleSwitch); } fanControlsGroupBox.AddChild(paddingContainer); UpdateControlVisibility(null, null); }
private void AddChildElements() { Button editButton; AltGroupBox groupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(new TextWidget("Macros".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor), out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditMacrosWindow(ReloadMacros); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { { this.presetButtonsContainer = GetMacroButtonContainer(); controlRow.AddChild(this.presetButtonsContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
private TabControl CreateExtraSettingsSideTabsAndPages(int minSettingNameWidth, TabControl categoryTabs, out int count) { count = 0; TabControl sideTabs = new TabControl(Orientation.Vertical); sideTabs.Margin = new BorderDouble(0, 0, 0, 5); sideTabs.TabBar.BorderColor = RGBA_Bytes.White; { TabPage groupTabPage = new TabPage("Extra Settings"); SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, "Extra Settings Tab", 14, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); sideTabs.AddTab(groupTabWidget); FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; foreach (KeyValuePair<string, DataStorage.SliceSetting> item in ActiveSliceSettings.Instance.DefaultSettings) { if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, item.Key)) { OrganizerSettingsData settingInfo = new OrganizerSettingsData(item.Key, item.Key, OrganizerSettingsData.DataEditTypes.STRING); GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth, 0); topToBottomSettings.AddChild(controlsForThisSetting); count++; } } AltGroupBox groupBox = new AltGroupBox(LocalizedString.Get("Extra")); groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.AddChild(topToBottomSettings); groupBox.VAnchor = VAnchor.FitToChildren; groupBox.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; subGroupLayoutTopToBottom.AddChild(groupBox); SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl(); scrollOnGroupTab.AnchorAll(); scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom); groupTabPage.AddChild(scrollOnGroupTab); } return sideTabs; }
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; }
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(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(); }
public AdjustmentControls() { var adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)) { Margin = 0, BorderColor = ActiveTheme.Instance.PrimaryTextColor, HAnchor = HAnchor.ParentLeftRight }; var topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom) { Margin = new BorderDouble(0, 0, 0, 0), HAnchor = HAnchor.ParentLeftRight, Padding = new BorderDouble(3, 0, 3, 0) }; double sliderWidth = 300 * GuiWidget.DeviceScale; double sliderThumbWidth = 10 * GuiWidget.DeviceScale; if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen) { sliderThumbWidth = 15 * GuiWidget.DeviceScale; } var subheader = new TextWidget("", pointSize: 4, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader.Margin = new BorderDouble(bottom: 6); topToBottom.AddChild(subheader); { var row = new FlowLayoutWidget() { HAnchor = HAnchor.ParentLeftRight, Margin = 0, VAnchor = VAnchor.FitToChildren }; var feedRateDescription = new TextWidget("Speed Multiplier".Localize()) { MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale, TextColor = ActiveTheme.Instance.PrimaryTextColor, VAnchor = VAnchor.ParentCenter, }; row.AddChild(feedRateDescription); double feedrateRatio = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.feedrate_ratio); feedRateRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio) { Name = "Feed Rate Slider", Margin = new BorderDouble(5, 0), Value = feedrateRatio, HAnchor = HAnchor.ParentLeftRight, TotalWidthInPixels = sliderWidth, }; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { feedRateValue.ActuallNumberEdit.Value = Math.Round(feedRateRatioSlider.Value, 2); }; feedRateRatioSlider.SliderReleased += (s, e) => { ActiveSliceSettings.Instance.SetValue(SettingsKey.feedrate_ratio, Math.Round(feedRateRatioSlider.Value, 2).ToString()); }; row.AddChild(feedRateRatioSlider); feedRateValue = new MHNumberEdit(Math.Round(feedrateRatio, 2), allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * GuiWidget.DeviceScale) { Name = "Feed Rate NumberEdit", SelectAllOnFocus = true, Margin = new BorderDouble(0, 0, 5, 0), VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren, Padding = 0 }; feedRateValue.ActuallNumberEdit.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.ActuallNumberEdit.Value; ActiveSliceSettings.Instance.SetValue(SettingsKey.feedrate_ratio, Math.Round(feedRateRatioSlider.Value, 2).ToString()); }; row.AddChild(feedRateValue); topToBottom.AddChild(row); textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); Button setButton = textImageButtonFactory.Generate("Set".Localize()); setButton.VAnchor = VAnchor.ParentCenter; row.AddChild(setButton); } { var row = new FlowLayoutWidget() { HAnchor = HAnchor.ParentLeftRight, Margin = new BorderDouble(top: 10), VAnchor = VAnchor.FitToChildren }; var extrusionDescription = new TextWidget("Extrusion Multiplier".Localize()) { MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale, TextColor = ActiveTheme.Instance.PrimaryTextColor, VAnchor = VAnchor.ParentCenter }; row.AddChild(extrusionDescription); double extrusionRatio = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.extrusion_ratio); extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal) { Name = "Extrusion Multiplier Slider", TotalWidthInPixels = sliderWidth, HAnchor = HAnchor.ParentLeftRight, Margin = new BorderDouble(5, 0), Value = extrusionRatio }; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { extrusionValue.ActuallNumberEdit.Value = Math.Round(extrusionRatioSlider.Value, 2); }; extrusionRatioSlider.SliderReleased += (s, e) => { ActiveSliceSettings.Instance.SetValue(SettingsKey.extrusion_ratio, Math.Round(extrusionRatioSlider.Value, 2).ToString()); }; extrusionValue = new MHNumberEdit(Math.Round(extrusionRatio, 2), allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * GuiWidget.DeviceScale) { Name = "Extrusion Multiplier NumberEdit", SelectAllOnFocus = true, Margin = new BorderDouble(0, 0, 5, 0), VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren, Padding = 0 }; extrusionValue.ActuallNumberEdit.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.ActuallNumberEdit.Value; ActiveSliceSettings.Instance.SetValue(SettingsKey.extrusion_ratio, Math.Round(extrusionRatioSlider.Value, 2).ToString()); }; row.AddChild(extrusionRatioSlider); row.AddChild(extrusionValue); topToBottom.AddChild(row); textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; Button setButton = textImageButtonFactory.Generate("Set".Localize()); setButton.VAnchor = VAnchor.ParentCenter; row.AddChild(setButton); } adjustmentControlsGroupBox.AddChild(topToBottom); this.AddChild(adjustmentControlsGroupBox); ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) => { var eventArgs = e as StringEventArgs; if (eventArgs?.Data == SettingsKey.extrusion_ratio) { double extrusionRatio = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.extrusion_ratio); extrusionRatioSlider.Value = extrusionRatio; extrusionValue.ActuallNumberEdit.Value = Math.Round(extrusionRatio, 2); } else if (eventArgs?.Data == SettingsKey.feedrate_ratio) { double feedrateRatio = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.feedrate_ratio); feedRateRatioSlider.Value = feedrateRatio; feedRateValue.ActuallNumberEdit.Value = Math.Round(feedrateRatio, 2); } }, ref unregisterEvents); }
protected override void AddChildElements() { AltGroupBox adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0); tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight; tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0); double sliderWidth = 300 * GuiWidget.DeviceScale; double sliderThumbWidth = 10 * GuiWidget.DeviceScale; if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen) { sliderThumbWidth = 15 * GuiWidget.DeviceScale; } TextWidget subheader = new TextWidget("", pointSize: 4, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader.Margin = new BorderDouble(bottom: 6); tuningRatiosLayout.AddChild(subheader); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * GuiWidget.DeviceScale); feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0; feedRateLeftToRight = new FlowLayoutWidget(); feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight; feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier")); feedRateDescription.MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale; feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; feedRateDescription.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio; feedRateRatioSlider.TotalWidthInPixels = sliderWidth; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); feedRateValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setFeedRateButton.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(setFeedRateButton); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * GuiWidget.DeviceScale); extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0; FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.HAnchor = HAnchor.ParentLeftRight; leftToRight.Margin = new BorderDouble(top: 10); extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier")); extrusionDescription.MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale; extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; extrusionDescription.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal); extrusionRatioSlider.TotalWidthInPixels = sliderWidth; extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); extrusionValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setExtrusionButton.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(setExtrusionButton); } feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } this.AddChild(adjustmentControlsGroupBox); }
protected override void AddChildElements() { Button editButton; movementControlsGroupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(new TextWidget("Movement Controls".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor), out editButton)); editButton.Click += (sender, e) => { if (editManualMovementSettingsWindow == null) { editManualMovementSettingsWindow = new EditManualMovementSpeedsWindow("Movement Speeds".Localize(), GetMovementSpeedsString(), SetMovementSpeeds); editManualMovementSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editManualMovementSettingsWindow = null; }; } else { editManualMovementSettingsWindow.BringToFront(); } }; movementControlsGroupBox.Margin = new BorderDouble(0); movementControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; movementControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; movementControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; jogControls = new JogControls(new XYZColors()); jogControls.Margin = new BorderDouble(0); { manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight; manualControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; { FlowLayoutWidget leftToRightContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); manualControlsLayout.AddChild(GetHomeButtonBar()); manualControlsLayout.AddChild(CreateSeparatorLine()); manualControlsLayout.AddChild(jogControls); //manualControlsLayout.AddChild(leftToRightContainer); manualControlsLayout.AddChild(CreateSeparatorLine()); manualControlsLayout.AddChild(GetHWDestinationBar()); manualControlsLayout.AddChild(CreateSeparatorLine()); } movementControlsGroupBox.AddChild(manualControlsLayout); } this.AddChild(movementControlsGroupBox); }
private TabControl CreateExtraSettingsSideTabsAndPages(TabControl categoryTabs, out int count) { int rightContentWidth = (int)(280 * GuiWidget.DeviceScale + .5); count = 0; TabControl leftSideGroupTabs = new TabControl(Orientation.Vertical); leftSideGroupTabs.Margin = new BorderDouble(0, 0, 0, 5); leftSideGroupTabs.TabBar.BorderColor = RGBA_Bytes.White; { TabPage groupTabPage = new TabPage("Extra Settings"); SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, "Extra Settings Tab", 14, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); leftSideGroupTabs.AddTab(groupTabWidget); FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren; FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; this.HAnchor = HAnchor.ParentLeftRight; foreach (var keyValue in ActiveSliceSettings.Instance.BaseLayer) { if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, keyValue.Key)) { SliceSettingData settingData = new SliceSettingData(keyValue.Key, keyValue.Key, SliceSettingData.DataEditTypes.STRING); if (ActiveSliceSettings.Instance.Helpers.ActiveSliceEngine().MapContains(settingData.SlicerConfigName)) { bool addControl; GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingData, layerCascade, persistenceLayer, viewFilter, 0, out addControl, ref tabIndexForItem); if (addControl) { topToBottomSettings.AddChild(controlsForThisSetting); } count++; } } } AltGroupBox groupBox = new AltGroupBox("Extra".Localize()); groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.AddChild(topToBottomSettings); groupBox.VAnchor = VAnchor.FitToChildren; groupBox.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; subGroupLayoutTopToBottom.AddChild(groupBox); SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl(); scrollOnGroupTab.AnchorAll(); scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom); groupTabPage.AddChild(scrollOnGroupTab); } return leftSideGroupTabs; }