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); } }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = LocalizedString.Get("Macro Presets"); string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); IEnumerable <DataStorage.CustomCommands> macroList = GetMacros(); foreach (DataStorage.CustomCommands currentCommand in macroList) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(currentCommand.Name); macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); Button editLink = linkButtonFactory.Generate(LocalizedString.Get("edit")); editLink.Margin = new BorderDouble(right: 5); // You can't pass a foreach variable into a link function or it wall always be the last item. // So we make a local variable copy of it and pass that. This will get the right one. DataStorage.CustomCommands currentCommandForLinkFunction = currentCommand; editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(currentCommandForLinkFunction); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(LocalizedString.Get("remove")); removeLink.Click += (sender, e) => { currentCommandForLinkFunction.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); addMacroButton.Click += new ButtonBase.ButtonEventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Close")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { this.windowController.Close(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
private void AddContent(HtmlParser htmlParser, string htmlContent) { ElementState elementState = htmlParser.CurrentElementState; string decodedHtml = HtmlParser.UrlDecode(htmlContent); switch (elementState.TypeName) { case "p": { elementsUnderConstruction.Push(new FlowLayoutWidget()); elementsUnderConstruction.Peek().Name = "p"; elementsUnderConstruction.Peek().HAnchor = HAnchor.ParentLeftRight; if (decodedHtml != null && decodedHtml != "") { WrappingTextWidget content = new WrappingTextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor); //content.VAnchor = VAnchor.ParentTop; elementsUnderConstruction.Peek().AddChild(content); } } break; case "div": { elementsUnderConstruction.Push(new FlowLayoutWidget()); elementsUnderConstruction.Peek().Name = "div"; if (decodedHtml != null && decodedHtml != "") { TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor); elementsUnderConstruction.Peek().AddChild(content); } } break; case "!DOCTYPE": break; case "body": break; case "img": { ImageBuffer image = new ImageBuffer(elementState.SizeFixed.x, elementState.SizeFixed.y, 32, new BlenderBGRA()); ImageWidget_AsyncLoadOnDraw imageWidget = new ImageWidget_AsyncLoadOnDraw(image, elementState.src); // put the image into the widget when it is done downloading. if (elementsUnderConstruction.Peek().Name == "a") { Button linkButton = new Button(0, 0, imageWidget); linkButton.Cursor = Cursors.Hand; linkButton.Click += (sender, mouseEvent) => { MatterControlApplication.Instance.LaunchBrowser(elementState.Href); }; elementsUnderConstruction.Peek().AddChild(linkButton); } else { elementsUnderConstruction.Peek().AddChild(imageWidget); } } break; case "a": { elementsUnderConstruction.Push(new FlowLayoutWidget()); elementsUnderConstruction.Peek().Name = "a"; if (decodedHtml != null && decodedHtml != "") { Button linkButton = linkButtonFactory.Generate(decodedHtml); StyledTypeFace styled = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize); double descentInPixels = styled.DescentInPixels; linkButton.OriginRelativeParent = new VectorMath.Vector2(linkButton.OriginRelativeParent.x, linkButton.OriginRelativeParent.y + descentInPixels); linkButton.Click += (sender, mouseEvent) => { MatterControlApplication.Instance.LaunchBrowser(elementState.Href); }; elementsUnderConstruction.Peek().AddChild(linkButton); } } break; case "table": break; case "td": case "span": GuiWidget widgetToAdd; if (elementState.Classes.Contains("translate")) { decodedHtml = decodedHtml.Localize(); } if (elementState.Classes.Contains("toUpper")) { decodedHtml = decodedHtml.ToUpper(); } if (elementState.Classes.Contains("versionNumber")) { decodedHtml = VersionInfo.Instance.ReleaseVersion; } if (elementState.Classes.Contains("buildNumber")) { decodedHtml = VersionInfo.Instance.BuildVersion; } Button createdButton = null; if (elementState.Classes.Contains("centeredButton")) { createdButton = textImageButtonFactory.Generate(decodedHtml); widgetToAdd = createdButton; } else if (elementState.Classes.Contains("linkButton")) { double oldFontSize = linkButtonFactory.fontSize; linkButtonFactory.fontSize = elementState.PointSize; createdButton = linkButtonFactory.Generate(decodedHtml); StyledTypeFace styled = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize); double descentInPixels = styled.DescentInPixels; createdButton.OriginRelativeParent = new VectorMath.Vector2(createdButton.OriginRelativeParent.x, createdButton.OriginRelativeParent.y + descentInPixels); widgetToAdd = createdButton; linkButtonFactory.fontSize = oldFontSize; } else { TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor); widgetToAdd = content; } if (createdButton != null) { if (elementState.Id == "sendFeedback") { createdButton.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); }; } else if (elementState.Id == "clearCache") { createdButton.Click += (sender, mouseEvent) => { AboutWidget.DeleteCacheData(); }; } } if (elementState.VerticalAlignment == ElementState.VerticalAlignType.top) { widgetToAdd.VAnchor = VAnchor.ParentTop; } elementsUnderConstruction.Peek().AddChild(widgetToAdd); break; case "tr": elementsUnderConstruction.Push(new FlowLayoutWidget()); elementsUnderConstruction.Peek().Name = "tr"; if (elementState.SizePercent.y == 100) { elementsUnderConstruction.Peek().VAnchor = VAnchor.ParentBottomTop; } if (elementState.Alignment == ElementState.AlignType.center) { elementsUnderConstruction.Peek().HAnchor |= HAnchor.ParentCenter; } break; default: throw new NotImplementedException("Don't know what to do with '{0}'".FormatWith(elementState.TypeName)); } }
private void AddMatterHackersInfo(FlowLayoutWidget topToBottom) { FlowLayoutWidget headerContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); headerContainer.Margin = new BorderDouble(0, 0, 0, 10); headerContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { TextWidget headerText = new TextWidget(string.Format(new LocalizedString("MatterControl").Translated), textColor: RGBA_Bytes.White, pointSize: 20); headerText.MinimumSize = new VectorMath.Vector2(headerText.Width, headerText.Height); headerText.HAnchor = Agg.UI.HAnchor.ParentCenter; headerContainer.AddChild(headerText); TextWidget versionText = new TextWidget(string.Format(new LocalizedString("Version {0}").Translated, VersionInfo.Instance.ReleaseVersion), textColor: RGBA_Bytes.White, pointSize: 10); versionText.MinimumSize = new VectorMath.Vector2(versionText.Width, versionText.Height); versionText.HAnchor = Agg.UI.HAnchor.ParentCenter; headerContainer.AddChild(versionText); TextWidget developedByText = new TextWidget(new LocalizedString("Developed by MatterHackers").Translated, textColor: RGBA_Bytes.White); developedByText.Margin = new BorderDouble(top: 5); developedByText.HAnchor = Agg.UI.HAnchor.ParentCenter; developedByText.MinimumSize = new VectorMath.Vector2(developedByText.Width, developedByText.Height); headerContainer.AddChild(developedByText); } topToBottom.AddChild(headerContainer); GuiWidget topSpacer = new GuiWidget(); topSpacer.VAnchor = VAnchor.ParentBottomTop; topToBottom.AddChild(topSpacer); // Slicer and agg thanks { // donate to mc { FlowLayoutWidget donateTextContanier = new FlowLayoutWidget(); TextWidget donateStartText = new TextWidget(new LocalizedString("Please consider ").Translated, textColor: RGBA_Bytes.White); donateTextContanier.AddChild(donateStartText); Button matterControlDonateLink = linkButtonFactory.Generate(new LocalizedString("donating").Translated); matterControlDonateLink.OriginRelativeParent = new VectorMath.Vector2(matterControlDonateLink.OriginRelativeParent.x, matterControlDonateLink.OriginRelativeParent.y + donateStartText.Printer.TypeFaceStyle.DescentInPixels); matterControlDonateLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("http://www.matterhackers.com/store/printer-accessories/mattercontrol-donation"); }; donateTextContanier.AddChild(matterControlDonateLink); donateTextContanier.AddChild(new TextWidget(new LocalizedString(" to help support and improve MatterControl.").Translated, textColor: RGBA_Bytes.White)); donateTextContanier.HAnchor = Agg.UI.HAnchor.ParentCenter; topToBottom.AddChild(donateTextContanier); } // spacer topToBottom.AddChild(new GuiWidget(10, 15)); InsertAttributionText(topToBottom, linkButtonFactory); } GuiWidget bottomSpacer = new GuiWidget(); bottomSpacer.VAnchor = VAnchor.ParentBottomTop; topToBottom.AddChild(bottomSpacer); FlowLayoutWidget feedbackButtons = new FlowLayoutWidget(); feedbackButtons.Margin = new BorderDouble(bottom: 10); { feedbackButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter; Button feedbackLink = textImageButtonFactory.Generate(new LocalizedString("Send Feedback").Translated); feedbackLink.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); }; feedbackButtons.AddChild(feedbackLink); GuiWidget buttonSpacer = new GuiWidget(10, 10); feedbackButtons.AddChild(buttonSpacer); } topToBottom.AddChild(feedbackButtons); Button learnMoreLink = linkButtonFactory.Generate(new LocalizedString("www.matterhackers.com").Translated); learnMoreLink.Margin = new BorderDouble(right: 12); learnMoreLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("http://www.matterhackers.com?clk=mc"); }; learnMoreLink.HAnchor = HAnchor.ParentCenter; learnMoreLink.Margin = new BorderDouble(0, 5); topToBottom.AddChild(learnMoreLink); TextWidget copyrightText = new TextWidget(string.Format(new LocalizedString("Copyright © 2013 MatterHackers, Inc.").Translated), textColor: offWhite); copyrightText.HAnchor = Agg.UI.HAnchor.ParentCenter; topToBottom.AddChild(copyrightText); { FlowLayoutWidget leftToRightBuildInfo = new FlowLayoutWidget(); leftToRightBuildInfo.HAnchor |= HAnchor.ParentCenter; TextWidget buildText = new TextWidget(string.Format(new LocalizedString("Build: {0} | ").Translated, VersionInfo.Instance.BuildVersion), textColor: offWhite, pointSize: 10); leftToRightBuildInfo.AddChild(buildText); double oldFontSize = linkButtonFactory.fontSize; linkButtonFactory.fontSize = 10; Button deleteCacheLink = linkButtonFactory.Generate(new LocalizedString("Clear Cache").Translated); linkButtonFactory.fontSize = oldFontSize; deleteCacheLink.OriginRelativeParent = new VectorMath.Vector2(deleteCacheLink.OriginRelativeParent.x, deleteCacheLink.OriginRelativeParent.y + buildText.Printer.TypeFaceStyle.DescentInPixels); deleteCacheLink.Click += (sender, mouseEvent) => { DeleteCacheData(); }; leftToRightBuildInfo.AddChild(deleteCacheLink); topToBottom.AddChild(leftToRightBuildInfo); } }
private void AddContent(HtmlParser htmlParser, string htmlContent) { ElementState elementState = htmlParser.CurrentElementState; string decodedHtml = HtmlParser.UrlDecode(htmlContent); switch (elementState.TypeName) { case "a": { Button linkButton = linkButtonFactory.Generate(decodedHtml); StyledTypeFace styled = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize); double descentInPixels = styled.DescentInPixels; linkButton.OriginRelativeParent = new VectorMath.Vector2(linkButton.OriginRelativeParent.x, linkButton.OriginRelativeParent.y + descentInPixels); linkButton.Click += (sender, mouseEvent) => { MatterControlApplication.Instance.LaunchBrowser(elementState.Href); }; currentRow.AddChild(linkButton); } break; case "table": break; case "td": case "span": GuiWidget widgetToAdd; if (elementState.Classes.Contains("translate")) { decodedHtml = decodedHtml.Localize(); } if (elementState.Classes.Contains("toUpper")) { decodedHtml = decodedHtml.ToUpper(); } if (elementState.Classes.Contains("versionNumber")) { decodedHtml = VersionInfo.Instance.ReleaseVersion; } if (elementState.Classes.Contains("buildNumber")) { decodedHtml = VersionInfo.Instance.BuildVersion; } Button createdButton = null; if (elementState.Classes.Contains("centeredButton")) { createdButton = textImageButtonFactory.Generate(decodedHtml); widgetToAdd = createdButton; } else if (elementState.Classes.Contains("linkButton")) { double oldFontSize = linkButtonFactory.fontSize; linkButtonFactory.fontSize = elementState.PointSize; createdButton = linkButtonFactory.Generate(decodedHtml); StyledTypeFace styled = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize); double descentInPixels = styled.DescentInPixels; createdButton.OriginRelativeParent = new VectorMath.Vector2(createdButton.OriginRelativeParent.x, createdButton.OriginRelativeParent.y + descentInPixels); widgetToAdd = createdButton; linkButtonFactory.fontSize = oldFontSize; } else { TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor); widgetToAdd = content; } if (createdButton != null) { if (elementState.Id == "sendFeedback") { createdButton.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); }; } else if (elementState.Id == "clearCache") { createdButton.Click += (sender, mouseEvent) => { DeleteCacheData(); }; } } if (elementState.VerticalAlignment == ElementState.VerticalAlignType.top) { widgetToAdd.VAnchor = VAnchor.ParentTop; } currentRow.AddChild(widgetToAdd); break; case "tr": currentRow = new FlowLayoutWidget(); if (elementState.HeightPercent == 100) { currentRow.VAnchor = VAnchor.ParentBottomTop; } if (elementState.Alignment == ElementState.AlignType.center) { currentRow.HAnchor |= HAnchor.ParentCenter; } break; default: throw new NotImplementedException("Don't know what to do with {0}".FormatWith(elementState.TypeName)); } }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = new LocalizedString("Macro Presets").Translated; string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); IEnumerable <DataStorage.CustomCommands> macroList = GetMacros(); int buttonCount = 0; foreach (DataStorage.CustomCommands m in macroList) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(m.Name); macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); Button editLink = linkButtonFactory.Generate(new LocalizedString("edit").Translated); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(m); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(new LocalizedString("remove").Translated); removeLink.Click += (sender, e) => { m.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png"); addMacroButton.Click += new ButtonBase.ButtonEventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated); cancelPresetsButton.Click += (sender, e) => { this.windowController.Close(); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public ApplicationMenuRow() : base(FlowDirection.LeftToRight) { linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; this.HAnchor = HAnchor.ParentLeftRight; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; // put in the file menu this.AddChild(new MenuOptionFile()); this.AddChild(new MenuOptionSettings()); // put in the action menu if (ActiveSliceSettings.Instance?.ActionMacros().Any() == true) { this.AddChild(new MenuOptionAction()); } // put in the help menu this.AddChild(new MenuOptionHelp()); //linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor; linkButtonFactory.fontSize = 10; Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize()); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); popUpAboutPage = new FlowLayoutWidget(); popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0); popUpAboutPage.HAnchor = HAnchor.FitToChildren; popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); updateStatusMessage.Click += (sender, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; this.AddChild(popUpAboutPage); SetUpdateNotification(this, null); // 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.VAnchor = VAnchor.FitToChildren; this.AddChild(rightElement); this.Padding = new BorderDouble(0); AddRightElement?.Invoke(rightElement); // When the application is first started, plugins are loaded after the MainView control has been initialized, // and as such they not around when this constructor executes. In that case, we run the AddRightElement // delegate after the plugins have been initialized via the PluginsLoaded event ApplicationController.Instance.PluginsLoaded.RegisterEvent((s, e) => { AddRightElement?.Invoke(rightElement); }, ref unregisterEvents); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = LocalizedString.Get("Macro Presets"); string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); if (ActiveSliceSettings.Instance?.Macros != null) { foreach (GCodeMacro macro in ActiveSliceSettings.Instance.Macros) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(MacroControls.FixMacroName(macro.Name)); macroRow.AddChild(buttonLabel); macroRow.AddChild(new HorizontalSpacer()); // You can't pass a foreach variable into a link function or it wall always be the last item. // So we make a local variable copy of it and pass that. This will get the right one. var localMacroReference = macro; Button editLink = linkButtonFactory.Generate("edit".Localize()); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(localMacroReference); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate("remove".Localize()); removeLink.Click += (sender, e) => { ActiveSliceSettings.Instance.Macros.Remove(localMacroReference); windowController.FunctionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } } Button addMacroButton = textImageButtonFactory.Generate("Add".Localize(), "icon_circle_plus.png"); addMacroButton.ToolTipText = "Add a new Macro".Localize(); addMacroButton.Click += (s, e) => { windowController.ChangeToMacroDetail(new GCodeMacro() { Name = "Home All", GCode = "G28 ; Home All Axes" }); }; Button cancelPresetsButton = textImageButtonFactory.Generate("Close".Localize()); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle(() => this.windowController.Close()); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
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); } }
public ApplicationMenuRow() : base(FlowDirection.LeftToRight) { 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); MenuOptionSettings menuOptionSettings = new MenuOptionSettings(); this.AddChild(menuOptionSettings); // put in the help menu MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); this.AddChild(menuOptionHelp); //linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor; linkButtonFactory.fontSize = 10; Button updateStatusMessage = linkButtonFactory.Generate("Update Available"); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); popUpAboutPage = new FlowLayoutWidget(); popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0); popUpAboutPage.HAnchor = HAnchor.FitToChildren; popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); updateStatusMessage.Click += (sender, e) => { UiThread.RunOnIdle(AboutWindow.Show); }; this.AddChild(popUpAboutPage); SetUpdateNotification(this, null); // 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.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; Button signOutLink = linkButtonFactory.Generate("(Sign Out)"); signOutLink.Name = "Authentication Sign Out"; signOutLink.ToolTipText = "Sign out of your MatterControl account".Localize(); signOutLink.VAnchor = Agg.UI.VAnchor.ParentCenter; signOutLink.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); MenuOptionSettings menuOptionSettings = new MenuOptionSettings(); this.AddChild(menuOptionSettings); // put in the help menu MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); this.AddChild(menuOptionHelp); //linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor; linkButtonFactory.fontSize = 10; Button updateStatusMessage = linkButtonFactory.Generate("Update Available"); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); popUpAboutPage = new FlowLayoutWidget(); popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0); popUpAboutPage.HAnchor = HAnchor.FitToChildren; popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); updateStatusMessage.Click += (sender, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; this.AddChild(popUpAboutPage); SetUpdateNotification(this, null); // 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 (AddRightElement != null) { AddRightElement(rightElement); } // When the application is first started, plugins are loaded after the MainView control has been initialize, // and such they not around when this constructor executes. In that case, we run the AddRightElement // delegate after the plugins get initialized via the PluginsLoaded event ApplicationController.Instance.PluginsLoaded.RegisterEvent(PluginsLoaded, ref unregisterEvents); }
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); }
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); }