public WindowPage() : base("Window") { WindowWidget widow = new WindowWidget(new RectangleDouble(20, 20, 400, 400)); AddChild(widow); GroupBox groupBox = new GroupBox("Radio Group"); groupBox.LocalBounds = new RectangleDouble(0, 0, 300, 100); groupBox.OriginRelativeParent = new Vector2(0, 0); groupBox.AddChild(new RadioButton(0, 40, "Simple Radio Button 1")); groupBox.AddChild(new RadioButton(0, 20, "Simple Radio Button 2")); groupBox.AddChild(new RadioButton(0, 0, "Simple Radio Button 3")); widow.AddChild(groupBox); }
public ButtonsPage() : base("Radio and Check Buttons") { FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AddChild(new CheckBox("Simple Check Box")); CheckBoxViewStates fourStates = new CheckBoxViewStates(new TextWidget("normal"), new TextWidget("normal"), new TextWidget("switch n->p"), new TextWidget("pressed"), new TextWidget("pressed"), new TextWidget("switch p->n"), new TextWidget("disabled")); topToBottom.AddChild(new CheckBox(fourStates)); GuiWidget normalPressed = new TextWidget("0 4state"); normalPressed.BackgroundColor = RGBA_Bytes.Gray; GuiWidget downPressed = new TextWidget("1 4state"); downPressed.BackgroundColor = RGBA_Bytes.Gray; GuiWidget normalHover = new TextWidget("0 4state"); normalHover.BackgroundColor = RGBA_Bytes.Yellow; GuiWidget downHover = new TextWidget("1 4state"); downHover.BackgroundColor = RGBA_Bytes.Yellow; CheckBoxViewStates fourStates2 = new CheckBoxViewStates(new TextWidget("0 4state"), normalHover, normalPressed, new TextWidget("1 4state"), downHover, downPressed, new TextWidget("disabled")); topToBottom.AddChild(new CheckBox(fourStates2)); topToBottom.AddChild(new RadioButton("Simple Radio Button 1")); topToBottom.AddChild(new RadioButton("Simple Radio Button 2")); topToBottom.AddChild(new RadioButton(new RadioButtonViewText("Simple Radio Button 3"))); topToBottom.AddChild(new RadioButton(new RadioButtonViewStates(new TextWidget("O - unchecked"), new TextWidget("O - unchecked hover"), new TextWidget("O - checking"), new TextWidget("X - checked"), new TextWidget("disabled")))); groupBox = new GroupBox("Radio Group"); //groupBox.LocalBounds = new RectangleDouble(0, 0, 300, 150); groupBox.OriginRelativeParent = new Vector2(200, 350); FlowLayoutWidget topToBottomRadios = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomRadios.AnchorAll(); topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 1")); topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 2")); topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 3")); topToBottomRadios.SetBoundsToEncloseChildren(); groupBox.AddChild(topToBottomRadios); topToBottom.AddChild(groupBox); AddChild(topToBottom); topToBottom.VAnchor = UI.VAnchor.ParentTop; }
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox fanControlsGroupBox = new GroupBox(new LocalizedString("Fan Controls").Translated); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; { FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); fanControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight; fanControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { fanControlsLayout.AddChild(CreateFanControls()); } fanControlsGroupBox.AddChild(fanControlsLayout); } fanControlsContainer = new DisableableWidget(); fanControlsContainer.AddChild(fanControlsGroupBox); if (ActivePrinterProfile.Instance.ActivePrinter == null || ActivePrinterProfile.Instance.ActivePrinter.GetFeatures().HasFan()) { controlsTopToBottomLayout.AddChild(fanControlsContainer); } }
void AddChildElements() { Button editButton; GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(label, out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditTemperaturePresetsWindow(editWindowLabel, GetTemperaturePresets(), SetTemperaturePresets); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { // put in the temperature slider and preset buttons tempSliderContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); { GuiWidget sliderLabels = GetSliderLabels(); tempSliderContainer.HAnchor = HAnchor.ParentLeftRight; tempSliderContainer.AddChild(sliderLabels); tempSliderContainer.Visible = false; } GuiWidget spacer = new GuiWidget(0, 10); spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; // put in the temperature indicators { FlowLayoutWidget temperatureIndicator = new FlowLayoutWidget(); temperatureIndicator.HAnchor = Agg.UI.HAnchor.ParentLeftRight; temperatureIndicator.Margin = new BorderDouble(bottom: 6); temperatureIndicator.Padding = new BorderDouble(0, 3); // put in the actual temperature controls { FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); extruderActualIndicator.Margin = new BorderDouble(3, 0); string extruderActualLabelTxt = new LocalizedString ("Actual").Translated; string extruderActualLabelTxtFull = string.Format ("{0}: ", extruderActualLabelTxt); TextWidget extruderActualLabel = new TextWidget(extruderActualLabelTxtFull, pointSize: 10); extruderActualLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; extruderActualLabel.VAnchor = VAnchor.ParentCenter; actualTempIndicator = new TextWidget(string.Format("{0:0.0}°C", GetActualTemperature()), pointSize: 12); actualTempIndicator.AutoExpandBoundsToText = true; actualTempIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor; actualTempIndicator.VAnchor = VAnchor.ParentCenter; extruderActualIndicator.AddChild(extruderActualLabel); extruderActualIndicator.AddChild(actualTempIndicator); string extruderAboutLabelTxt = new LocalizedString ("Target").Translated; string extruderAboutLabelTxtFull = string.Format ("{0}: ", extruderAboutLabelTxt); TextWidget extruderTargetLabel = new TextWidget(extruderAboutLabelTxtFull, pointSize: 10); extruderTargetLabel.Margin = new BorderDouble(left: 10); extruderTargetLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; extruderTargetLabel.VAnchor = VAnchor.ParentCenter; extruderActualIndicator.AddChild(extruderTargetLabel); temperatureIndicator.AddChild(extruderActualIndicator); } // put in the target temperature controls temperatureIndicator.AddChild(GetTargetTemperatureDisplay()); FlowLayoutWidget helperTextWidget = GetHelpTextWidget(); GuiWidget hspacer = new GuiWidget(); hspacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; LinkButtonFactory linkFactory = new LinkButtonFactory(); linkFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkFactory.fontSize = 10; Button helpTextLink = linkFactory.Generate("?"); helpTextLink.Click += (sender, e) => { helperTextWidget.Visible = !helperTextWidget.Visible; }; //temperatureIndicator.AddChild(hspacer); //temperatureIndicator.AddChild(helpTextLink); this.presetButtonsContainer = GetPresetsContainer(); controlRow.AddChild(temperatureIndicator); //controlRow.AddChild(helperTextWidget); controlRow.AddChild(this.presetButtonsContainer); //controlRow.AddChild(tempSliderContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
void AddChildElements() { Button editButton; GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(new LocalizedString("Macros").Translated, out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditMacrosWindow(GetMacros(), ReloadMacros); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { { this.presetButtonsContainer = GetMacroButtonContainer(); controlRow.AddChild(this.presetButtonsContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
private GuiWidget CreatePrintLevelingControlsContainer() { Button editButton; GroupBox printLevelingControlsContainer = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Automatic Calibration"), out editButton)); editButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { if (editLevelingSettingsWindow == null) { editLevelingSettingsWindow = new EditLevelingSettingsWindow(); editLevelingSettingsWindow.Closed += (sender2, e2) => { editLevelingSettingsWindow = null; }; } else { editLevelingSettingsWindow.BringToFront(); } }); }; printLevelingControlsContainer.Margin = new BorderDouble(0); printLevelingControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; printLevelingControlsContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Button runPrintLevelingButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); runPrintLevelingButton.Margin = new BorderDouble(left:6); runPrintLevelingButton.VAnchor = VAnchor.ParentCenter; runPrintLevelingButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration); }); }; Agg.Image.ImageBuffer levelingImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(levelingImage); } ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble (right: 6); enablePrintLevelingButton = textImageButtonFactory.Generate("Enable".Localize().ToUpper()); enablePrintLevelingButton.Margin = new BorderDouble(left:6); enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click); disablePrintLevelingButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disablePrintLevelingButton.Margin = new BorderDouble(left:6); disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click); printLevelingStatusLabel = new TextWidget (""); printLevelingStatusLabel.AutoExpandBoundsToText = true; printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget (); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(levelingIcon); buttonBar.AddChild (printLevelingStatusLabel); buttonBar.AddChild (hSpacer); buttonBar.AddChild(enablePrintLevelingButton); buttonBar.AddChild(disablePrintLevelingButton); buttonBar.AddChild(runPrintLevelingButton); ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); }, ref unregisterEvents); printLevelingControlsContainer.AddChild(buttonBar); } SetPrintLevelButtonVisiblity (); return printLevelingControlsContainer; }
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); } }
private GuiWidget CreateTerminalControlsContainer() { GroupBox terminalControlsContainer; terminalControlsContainer = new GroupBox(new LocalizedString("Communications").Translated); terminalControlsContainer.Margin = new BorderDouble(0); terminalControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; OutputScrollWindow.HookupPrinterOutput(); { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(3, 0, 3, 6); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer terminalImage = new Agg.Image.ImageBuffer(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "terminal-24x24.png"), terminalImage); ImageWidget terminalIcon = new ImageWidget(terminalImage); terminalIcon.Margin = new BorderDouble (right: 6); Button showTerminal = textImageButtonFactory.Generate(new LocalizedString("SHOW TERMINAL").Translated); showTerminal.Margin = new BorderDouble(0); showTerminal.Click += (sender, e) => { OutputScrollWindow.Show(); }; //buttonBar.AddChild(terminalIcon); buttonBar.AddChild(showTerminal); terminalControlsContainer.AddChild(buttonBar); } return terminalControlsContainer; }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox adjustmentControlsGroupBox = new GroupBox(new LocalizedString("Tuning Adjustment (while printing)").Translated); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; adjustmentControlsGroupBox.Height = 93; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 6); tuningRatiosLayout.AnchorAll(); tuningRatiosLayout.Padding = new BorderDouble(3, 5, 3, 0); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(1, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40); feedRateLeftToRight = new FlowLayoutWidget(); feedRateDescription = new TextWidget(new LocalizedString("Speed Multiplier").Translated); feedRateDescription.TextColor = RGBA_Bytes.White; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterCommunication.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); textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; feedRateLeftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(1, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); extrusionDescription = new TextWidget(new LocalizedString("Extrusion Multiplier").Translated); extrusionDescription.TextColor = RGBA_Bytes.White; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio); extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterCommunication.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); textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; leftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } feedRateDescription.Width = extrusionDescription.Width; feedRateDescription.MinimumSize = new Vector2(extrusionDescription.Width, feedRateDescription.MinimumSize.y); feedRateLeftToRight.HAnchor = HAnchor.FitToChildren; feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } tuningAdjustmentControlsContainer = new DisableableWidget(); tuningAdjustmentControlsContainer.AddChild(adjustmentControlsGroupBox); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
public void AddReleaseOptions(FlowLayoutWidget controlsTopToBottom) { GroupBox releaseOptionsGroupBox = new GroupBox(LocalizedString.Get("Update Feed")); releaseOptionsGroupBox.Margin = new BorderDouble(0); releaseOptionsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; releaseOptionsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; releaseOptionsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; releaseOptionsGroupBox.Height = 68; FlowLayoutWidget controlsContainer = new FlowLayoutWidget(); controlsContainer.HAnchor |= HAnchor.ParentCenter; AnchoredDropDownList releaseOptionsDropList = new AnchoredDropDownList("Development"); releaseOptionsDropList.Margin = new BorderDouble (0, 3); MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Release", "release"); releaseOptionsDropDownItem.Selected += new EventHandler(FixTabDot); MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem("Pre-Release", "pre-release"); preReleaseDropDownItem.Selected += new EventHandler(FixTabDot); MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem("Development", "development"); developmentDropDownItem.Selected += new EventHandler(FixTabDot); releaseOptionsDropList.MinimumSize = new Vector2(releaseOptionsDropList.LocalBounds.Width, releaseOptionsDropList.LocalBounds.Height); List<string> acceptableUpdateFeedTypeValues = new List<string> (){ "release", "pre-release", "development" }; string currentUpdateFeedType = UserSettings.Instance.get ("UpdateFeedType"); if (acceptableUpdateFeedTypeValues.IndexOf (currentUpdateFeedType) == -1) { UserSettings.Instance.set ("UpdateFeedType", "release"); } releaseOptionsDropList.SelectedValue = UserSettings.Instance.get ("UpdateFeedType"); releaseOptionsDropList.SelectionChanged += new EventHandler (ReleaseOptionsDropList_SelectionChanged); controlsContainer.AddChild(releaseOptionsDropList); releaseOptionsGroupBox.AddChild(controlsContainer); controlsTopToBottom.AddChild(releaseOptionsGroupBox); }
private void AddLanguageControls(FlowLayoutWidget controlsTopToBottomLayout) { DisableableWidget container = new DisableableWidget(); GroupBox languageControlsGroupBox = new GroupBox(LocalizedString.Get("Language Settings")); languageControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; languageControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; languageControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; languageControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; languageControlsGroupBox.Height = 78; FlowLayoutWidget controlsContainer = new FlowLayoutWidget(); controlsContainer.HAnchor = HAnchor.ParentLeftRight; LanguageSelector languageSelector = new LanguageSelector(); languageSelector.Margin = new BorderDouble(0); languageSelector.SelectionChanged += new EventHandler(LanguageDropList_SelectionChanged); TextWidget experimentalWidget = new TextWidget("Experimental", pointSize:10); experimentalWidget.VAnchor = Agg.UI.VAnchor.ParentCenter; experimentalWidget.Margin = new BorderDouble(left: 4); experimentalWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor; restartButton = textImageButtonFactory.Generate("Restart"); restartButton.VAnchor = Agg.UI.VAnchor.ParentCenter; restartButton.Visible = false; restartButton.Click += (sender, e) => { RestartApplication(); }; controlsContainer.AddChild(languageSelector); controlsContainer.AddChild(experimentalWidget); controlsContainer.AddChild(new HorizontalSpacer()); controlsContainer.AddChild(restartButton); languageControlsGroupBox.AddChild(controlsContainer); container.AddChild(languageControlsGroupBox); controlsTopToBottomLayout.AddChild(container); }
private void AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout) { DisableableWidget container = new DisableableWidget(); GroupBox themeControlsGroupBox = new GroupBox(LocalizedString.Get("Theme Settings")); themeControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; themeControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; themeControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; themeControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; themeControlsGroupBox.Height = 78; FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight; GuiWidget currentColorThemeBorder = new GuiWidget(); currentColorThemeBorder.HAnchor = Agg.UI.HAnchor.ParentLeftRight; currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop; currentColorThemeBorder.Margin = new BorderDouble (top: 2, bottom: 2); currentColorThemeBorder.Padding = new BorderDouble(4); currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White; GuiWidget currentColorTheme = new GuiWidget(); currentColorTheme.HAnchor = HAnchor.ParentLeftRight; currentColorTheme.VAnchor = VAnchor.ParentBottomTop; currentColorTheme.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme); themeSelector.Margin = new BorderDouble(right: 5); themeControlsGroupBox.AddChild(colorSelectorContainer); colorSelectorContainer.AddChild(themeSelector); colorSelectorContainer.AddChild(currentColorThemeBorder); currentColorThemeBorder.AddChild(currentColorTheme); container.AddChild(themeControlsGroupBox); controlsTopToBottomLayout.AddChild(container); }
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, 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); topToBottomSettings.AddChild(controlsForThisSetting); count++; } } GroupBox groupBox = new GroupBox(new LocalizedString("Extra").Translated); 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); ScrollableWidget scrollOnGroupTab = new ScrollableWidget(true); scrollOnGroupTab.AnchorAll(); scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom); groupTabPage.AddChild(scrollOnGroupTab); } return sideTabs; }
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; }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(new LocalizedString("EEProm Settings").Translated); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentLeftRight; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble (right: 6); Button openEePromWindow = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch(PrinterCommunication.Instance.FirmwareType) { case PrinterCommunication.FirmwareTypes.Repetier: new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); break; case PrinterCommunication.FirmwareTypes.Marlin: new MatterHackers.MatterControl.EeProm.EePromMarlinWidget(); break; default: UiThread.RunOnIdle((state) => { string message = new LocalizedString("Oops! There is no eeprom mapping for your printer's firmware.").Translated; StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
private void AddMovementControls(FlowLayoutWidget controlsTopToBottomLayout) { Button editButton; GroupBox movementControlsGroupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(new LocalizedString("Movement Controls").Translated, out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditManualMovementSpeedsWindow("Movement Speeds", GetMovementSpeedsString(), SetMovementSpeeds); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; movementControlsGroupBox.Margin = new BorderDouble(0); movementControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; movementControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; movementControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; movementControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; { FlowLayoutWidget 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); { manualControlsLayout.AddChild(GetHomeButtonBar()); manualControlsLayout.AddChild(CreateSeparatorLine()); manualControlsLayout.AddChild(new JogControls(new XYZColors())); manualControlsLayout.AddChild(CreateSeparatorLine()); //manualControlsLayout.AddChild(GetManualMoveBar()); } movementControlsGroupBox.AddChild(manualControlsLayout); } movementControlsContainer = new DisableableWidget(); movementControlsContainer.AddChild(movementControlsGroupBox); controlsTopToBottomLayout.AddChild(movementControlsContainer); }
private GuiWidget CreateCloudMonitorControls() { GroupBox cloudMonitorContainer = new GroupBox(LocalizedString.Get("Cloud Services")); cloudMonitorContainer.Margin = new BorderDouble(0); cloudMonitorContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; cloudMonitorContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer cloudMonitorImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "cloud-24x24.png"), cloudMonitorImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cloudMonitorImage); } ImageWidget cloudMonitoringIcon = new ImageWidget(cloudMonitorImage); cloudMonitoringIcon.Margin = new BorderDouble(right: 6); enableCloudMonitorButton = textImageButtonFactory.Generate("Enable".Localize().ToUpper()); enableCloudMonitorButton.Margin = new BorderDouble(left: 6); enableCloudMonitorButton.VAnchor = VAnchor.ParentCenter; enableCloudMonitorButton.Click += new ButtonBase.ButtonEventHandler(enableCloudMonitor_Click); disableCloudMonitorButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disableCloudMonitorButton.Margin = new BorderDouble(left: 6); disableCloudMonitorButton.VAnchor = VAnchor.ParentCenter; disableCloudMonitorButton.Click += new ButtonBase.ButtonEventHandler(disableCloudMonitor_Click); cloudMonitorInstructionsLink = linkButtonFactory.Generate("More Info".Localize().ToUpper()); cloudMonitorInstructionsLink.VAnchor = VAnchor.ParentCenter; cloudMonitorInstructionsLink.Click += new ButtonBase.ButtonEventHandler(goCloudMonitoringInstructionsButton_Click); cloudMonitorInstructionsLink.Margin = new BorderDouble (left: 6); goCloudMonitoringWebPageButton = linkButtonFactory.Generate("View Status".Localize().ToUpper()); goCloudMonitoringWebPageButton.VAnchor = VAnchor.ParentCenter; goCloudMonitoringWebPageButton.Click += new ButtonBase.ButtonEventHandler(goCloudMonitoringWebPageButton_Click); goCloudMonitoringWebPageButton.Margin = new BorderDouble(left: 6); cloudMonitorStatusLabel = new TextWidget(""); cloudMonitorStatusLabel.AutoExpandBoundsToText = true; cloudMonitorStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(cloudMonitoringIcon); buttonBar.AddChild(cloudMonitorStatusLabel); buttonBar.AddChild (cloudMonitorInstructionsLink); buttonBar.AddChild(goCloudMonitoringWebPageButton); buttonBar.AddChild(hSpacer); buttonBar.AddChild(enableCloudMonitorButton); buttonBar.AddChild(disableCloudMonitorButton); cloudMonitorContainer.AddChild(buttonBar); } SetCloudButtonVisiblity(); return cloudMonitorContainer; }
private GuiWidget CreatePrintLevelingControlsContainer() { GroupBox printLevelingControlsContainer; printLevelingControlsContainer = new GroupBox(new LocalizedString("Automatic Calibration").Translated); printLevelingControlsContainer.Margin = new BorderDouble(0); printLevelingControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; printLevelingControlsContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Button runPrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated); runPrintLevelingButton.Margin = new BorderDouble(left:6); runPrintLevelingButton.VAnchor = VAnchor.ParentCenter; runPrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(runPrintLeveling_Click); Agg.Image.ImageBuffer levelingImage = new Agg.Image.ImageBuffer(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage); ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble (right: 6); enablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("ENABLE").Translated); enablePrintLevelingButton.Margin = new BorderDouble(left:6); enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click); disablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("DISABLE").Translated); disablePrintLevelingButton.Margin = new BorderDouble(left:6); disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click); CheckBox doLevelingCheckBox = new CheckBox(new LocalizedString("Enable Automatic Print Leveling").Translated); doLevelingCheckBox.Margin = new BorderDouble(left: 3); doLevelingCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; doLevelingCheckBox.VAnchor = VAnchor.ParentCenter; doLevelingCheckBox.Checked = ActivePrinterProfile.Instance.DoPrintLeveling; printLevelingStatusLabel = new TextWidget (""); printLevelingStatusLabel.AutoExpandBoundsToText = true; printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget (); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(levelingIcon); //buttonBar.AddChild(doLevelingCheckBox); buttonBar.AddChild (printLevelingStatusLabel); buttonBar.AddChild (hSpacer); buttonBar.AddChild(enablePrintLevelingButton); buttonBar.AddChild(disablePrintLevelingButton); buttonBar.AddChild(runPrintLevelingButton); doLevelingCheckBox.CheckedStateChanged += (sender, e) => { ActivePrinterProfile.Instance.DoPrintLeveling = doLevelingCheckBox.Checked; }; ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); }, ref unregisterEvents); printLevelingControlsContainer.AddChild(buttonBar); } SetPrintLevelButtonVisiblity (); return printLevelingControlsContainer; }
private void CreateEditNotificationControls(FlowLayoutWidget controlsTopToBottom) { DisableableWidget container = new DisableableWidget(); GroupBox notificationSettingsContainer = new GroupBox(LocalizedString.Get("Notification Settings")); notificationSettingsContainer.Margin = new BorderDouble(0); notificationSettingsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; notificationSettingsContainer.Height = 68; { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor |= HAnchor.ParentLeftRight; buttonRow.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonRow.Margin = new BorderDouble (0, 0, 0, 0); buttonRow.Padding = new BorderDouble (0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer notificationSettingsImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData (Path.Combine (ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "notify-24x24.png"), notificationSettingsImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness (notificationSettingsImage); } ImageWidget levelingIcon = new ImageWidget (notificationSettingsImage); levelingIcon.Margin = new BorderDouble (right: 6, bottom: 6); configureNotificationSettingsButton = textImageButtonFactory.Generate ("Configure".Localize ().ToUpper ()); configureNotificationSettingsButton.Margin = new BorderDouble (left: 6); configureNotificationSettingsButton.VAnchor = VAnchor.ParentCenter; configureNotificationSettingsButton.Click += new ButtonBase.ButtonEventHandler(configureNotificationSettingsButton_Click); notificationSettingsLabel = new TextWidget ("Notification Settings"); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; buttonRow.AddChild (levelingIcon); buttonRow.AddChild (notificationSettingsLabel); buttonRow.AddChild (new HorizontalSpacer ()); buttonRow.AddChild (configureNotificationSettingsButton); notificationSettingsContainer.AddChild (buttonRow); controlsTopToBottom.AddChild (notificationSettingsContainer); } }
private GuiWidget CreateSdCardManagerContainer() { GroupBox terminalControlsContainer; terminalControlsContainer = new GroupBox("SD Card Printing"); terminalControlsContainer.Margin = new BorderDouble(top: 10); terminalControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(3, 0, 3, 6); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Button showSDPrintingPannel = textImageButtonFactory.Generate("SD CARD MANAGER"); showSDPrintingPannel.Margin = new BorderDouble(left: 10); showSDPrintingPannel.Click += (sender, e) => { SDCardManager.Show(); }; buttonBar.AddChild(showSDPrintingPannel); terminalControlsContainer.AddChild(buttonBar); } return terminalControlsContainer; }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(groupBoxTitle); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentCenter; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble (right: 6); Button openEePromWindow = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch (PrinterConnectionAndCommunication.Instance.FirmwareType) { case PrinterConnectionAndCommunication.FirmwareTypes.Repetier: if (openEePromRepetierWidget != null) { openEePromRepetierWidget.BringToFront(); } else { openEePromRepetierWidget = new EePromRepetierWidget(); openEePromRepetierWidget.Closed += (RepetierWidget, RepetierEvent) => { openEePromRepetierWidget = null; }; } break; case PrinterConnectionAndCommunication.FirmwareTypes.Marlin: if (openEePromMarlinWidget != null) { openEePromMarlinWidget.BringToFront(); } else { openEePromMarlinWidget = new EePromMarlinWidget(); openEePromMarlinWidget.Closed += (marlinWidget, marlinEvent) => { openEePromMarlinWidget = null; }; } break; default: UiThread.RunOnIdle((state) => { StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }