public static void InsertAttributionText(GuiWidget topToBottom, LinkButtonFactory linkButtonFactory) { // slicer credit { FlowLayoutWidget donateTextContainer = new FlowLayoutWidget(); TextWidget thanksText = new TextWidget(new LocalizedString("Special thanks to Alessandro Ranellucci for his incredible work on ").Translated, textColor: RGBA_Bytes.White); donateTextContainer.AddChild(thanksText); Button slic3rOrgLink = linkButtonFactory.Generate(new LocalizedString("Slic3r").Translated); //slic3rOrgLink.VAnchor = Agg.UI.VAnchor.Bottom; slic3rOrgLink.OriginRelativeParent = new VectorMath.Vector2(slic3rOrgLink.OriginRelativeParent.x, slic3rOrgLink.OriginRelativeParent.y + thanksText.Printer.TypeFaceStyle.DescentInPixels); slic3rOrgLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("https://github.com/alexrj/Slic3r"); }; donateTextContainer.AddChild(slic3rOrgLink); donateTextContainer.HAnchor = Agg.UI.HAnchor.ParentCenter; topToBottom.AddChild(donateTextContainer); } // cura engine credit { FlowLayoutWidget curaEngineTextContanier = new FlowLayoutWidget(); TextWidget donateStartText = new TextWidget(new LocalizedString("and to David Braam and Ultimaker BV, for the amazing ").Translated, textColor: RGBA_Bytes.White); curaEngineTextContanier.AddChild(donateStartText); Button curaEngineSourceLink = linkButtonFactory.Generate(new LocalizedString("CuraEngine").Translated); curaEngineSourceLink.OriginRelativeParent = new VectorMath.Vector2(curaEngineSourceLink.OriginRelativeParent.x, curaEngineSourceLink.OriginRelativeParent.y + donateStartText.Printer.TypeFaceStyle.DescentInPixels); curaEngineSourceLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("https://github.com/Ultimaker/CuraEngine"); }; curaEngineTextContanier.AddChild(curaEngineSourceLink); curaEngineTextContanier.AddChild(new TextWidget(".", textColor: RGBA_Bytes.White)); curaEngineTextContanier.HAnchor = Agg.UI.HAnchor.ParentCenter; topToBottom.AddChild(curaEngineTextContanier); } }
private void RebuildList(PrinterSettings printerSettings, LinkButtonFactory linkButtonFactory) { this.contentRow.CloseAllChildren(); if (printerSettings?.Macros != null) { foreach (GCodeMacro macro in printerSettings.Macros) { var macroRow = new FlowLayoutWidget { Margin = new BorderDouble(3, 0, 3, 3), HAnchor = HAnchor.Stretch, Padding = new BorderDouble(3), BackgroundColor = Color.White }; macroRow.AddChild(new TextWidget(GCodeMacro.FixMacroName(macro.Name))); macroRow.AddChild(new HorizontalSpacer()); // You can't use the foreach variable inside the lambda functions directly or it will always be the last item. // We make a local variable to create a closure around it to ensure we get the correct instance var localMacroReference = macro; var oldColor = linkButtonFactory.textColor; linkButtonFactory.textColor = Color.Black; Button editLink = linkButtonFactory.Generate("edit".Localize()); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (s, e) => { this.DialogWindow.ChangeToPage( new MacroDetailPage(localMacroReference, printerSettings)); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate("remove".Localize()); removeLink.Click += (sender, e) => { printerSettings.Macros.Remove(localMacroReference); printerSettings.Save(); this.RebuildList(printerSettings, linkButtonFactory); }; macroRow.AddChild(removeLink); linkButtonFactory.textColor = oldColor; contentRow.AddChild(macroRow); } } }
public ApplicationMenuRow() : base(FlowDirection.LeftToRight) { LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; Button signInLink = linkButtonFactory.Generate("(Sign Out)"); signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; signInLink.Margin = new BorderDouble(top: 0); this.HAnchor = HAnchor.ParentLeftRight; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; // put in the file menu MenuOptionFile menuOptionFile = new MenuOptionFile(); this.AddChild(menuOptionFile); #if false // put in the view menu MenuOptionView menuOptionView = new MenuOptionView(); this.AddChild(menuOptionView); #endif // put in the help menu MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); this.AddChild(menuOptionHelp); // put in a spacer this.AddChild(new HorizontalSpacer()); // make an object that can hold custom content on the right (like the sign in) rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); rightElement.Height = 24; rightElement.Margin = new BorderDouble(bottom: 4); this.AddChild(rightElement); this.Padding = new BorderDouble(0, 0, 6, 0); if (privateAddRightElement != null) { privateAddRightElement(rightElement); } }
public ApplicationMenuRow() : base(FlowDirection.LeftToRight) { LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; Button signInLink = linkButtonFactory.Generate("(Sign Out)"); signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; signInLink.Margin = new BorderDouble(top: 0); this.HAnchor = HAnchor.ParentLeftRight; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; MenuOptionFile menuOptionFile = new MenuOptionFile(); //TextWidget menuOptionFile = new TextWidget("FILE", pointSize: 10); //menuOptionFile.TextColor = ActiveTheme.Instance.PrimaryTextColor; MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); rightElement.Height = 24; rightElement.Margin = new BorderDouble(bottom: 4); //rightElement.VAnchor = Agg.UI.VAnchor.ParentCenter; this.AddChild(menuOptionFile); this.AddChild(menuOptionHelp); this.AddChild(new HorizontalSpacer()); this.AddChild(rightElement); this.Padding = new BorderDouble(0, 0, 6, 0); if (privateAddRightElement != null) { privateAddRightElement(rightElement); } }
public ApplicationMenuRow() :base(FlowDirection.LeftToRight) { LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; Button signInLink = linkButtonFactory.Generate("(Sign Out)"); signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; signInLink.Margin = new BorderDouble(top: 0); this.HAnchor = HAnchor.ParentLeftRight; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; MenuOptionFile menuOptionFile = new MenuOptionFile(); //TextWidget menuOptionFile = new TextWidget("FILE", pointSize: 10); //menuOptionFile.TextColor = ActiveTheme.Instance.PrimaryTextColor; MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); rightElement.Height = 24; rightElement.Margin = new BorderDouble(bottom: 4); //rightElement.VAnchor = Agg.UI.VAnchor.ParentCenter; this.AddChild(menuOptionFile); this.AddChild(menuOptionHelp); this.AddChild(new HorizontalSpacer()); this.AddChild(rightElement); this.Padding = new BorderDouble(0, 0, 6, 0); if (privateAddRightElement != null) { privateAddRightElement(rightElement); } }
protected void AddChildElements() { Button editButton; AltGroupBox groupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(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: 2) * TextWidget.GlobalPointSizeScaleRatio; 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: 0) * TextWidget.GlobalPointSizeScaleRatio; temperatureIndicator.Padding = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; // put in the actual temperature controls { FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); extruderActualIndicator.Margin = new BorderDouble(3, 0) * TextWidget.GlobalPointSizeScaleRatio; string extruderActualLabelTxt = LocalizedString.Get("Actual"); 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 = LocalizedString.Get("Target"); string extruderAboutLabelTxtFull = string.Format("{0}: ", extruderAboutLabelTxt); TextWidget extruderTargetLabel = new TextWidget(extruderAboutLabelTxtFull, pointSize: 10); extruderTargetLabel.Margin = new BorderDouble(left: 10) * TextWidget.GlobalPointSizeScaleRatio; 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(); temperatureIndicator.AddChild(new HorizontalSpacer()); temperatureIndicator.AddChild(presetButtonsContainer); controlRow.AddChild(temperatureIndicator); //controlRow.AddChild(helperTextWidget); //controlRow.AddChild(this.presetButtonsContainer); //controlRow.AddChild(tempSliderContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
public DialogPage(string cancelButtonText = null, bool useOverflowBar = false) : base(FlowDirection.TopToBottom) { theme = ApplicationController.Instance.Theme; this.HAnchor = HAnchor.Stretch; this.VAnchor = VAnchor.Stretch; this.BackgroundColor = theme.Colors.PrimaryBackgroundColor; linkButtonFactory = theme.LinkButtonFactory; if (cancelButtonText == null) { cancelButtonText = "Cancel".Localize(); } cancelButton = theme.CreateDialogButton(cancelButtonText); cancelButton.Margin = 0; cancelButton.Name = "Cancel Wizard Button"; // Create the header row for the widget if (useOverflowBar) { headerRow = new OverflowBar(theme) { Name = "HeaderRow", Margin = new BorderDouble(0, 3, 0, 0), Padding = new BorderDouble(0, 12), HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit }; } else { headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { Name = "HeaderRow", Margin = new BorderDouble(0, 3, 0, 0), Padding = new BorderDouble(0, 12), HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit }; } this.AddChild(headerRow); headerLabel = new TextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: theme.Colors.PrimaryAccentColor) { HAnchor = HAnchor.Stretch }; headerRow.AddChild(headerLabel); // Create the main control container contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(10), BackgroundColor = theme.MinimalShade, HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch }; this.AddChild(contentRow); // Create the footer (button) container footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, Margin = new BorderDouble(0, 6), Padding = new BorderDouble(top: 4, bottom: 2) }; this.AddChild(footerRow); #if !__ANDROID__ headerRow.Padding = new BorderDouble(0, 3, 0, 3); headerLabel.PointSize = 14; headerLabel.TextColor = theme.Colors.PrimaryTextColor; contentRow.Padding = new BorderDouble(5); footerRow.Padding = 0; footerRow.Margin = new BorderDouble(top: theme.DefaultContainerPadding); #endif }