From 5ff04ba2f17fdaa021a0ff78a77dd75ef827b23d Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 15 Mar 2022 11:21:04 -0700 Subject: [PATCH] Making bold markdown wrap --- .../Library/Widgets/AddPrinterWidget.cs | 2 +- .../Widgets/HardwarePage/PrinterDetails.cs | 41 ++----------------- .../UIFields/ColorField.cs | 14 +++---- .../MarkdigAgg/AggParagraphRenderer.cs | 2 +- .../Inlines/AggEmphasisInlineRenderer.cs | 2 +- Submodules/agg-sharp | 2 +- 6 files changed, 14 insertions(+), 49 deletions(-) diff --git a/MatterControlLib/Library/Widgets/AddPrinterWidget.cs b/MatterControlLib/Library/Widgets/AddPrinterWidget.cs index 8fa5ffb23..c2de3df55 100644 --- a/MatterControlLib/Library/Widgets/AddPrinterWidget.cs +++ b/MatterControlLib/Library/Widgets/AddPrinterWidget.cs @@ -183,7 +183,7 @@ namespace MatterHackers.MatterControl.PrintLibrary public bool ValidateControls() { - bool selectionValid = this.SelectedPrinter is AddPrinterWidget.MakeModelInfo selectedPrinter; + bool selectionValid = this.SelectedPrinter is MakeModelInfo selectedPrinter; if (!selectionValid) { diff --git a/MatterControlLib/Library/Widgets/HardwarePage/PrinterDetails.cs b/MatterControlLib/Library/Widgets/HardwarePage/PrinterDetails.cs index de767bd8e..bf6a48801 100644 --- a/MatterControlLib/Library/Widgets/HardwarePage/PrinterDetails.cs +++ b/MatterControlLib/Library/Widgets/HardwarePage/PrinterDetails.cs @@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage public bool ShowProducts { get; set; } = true; - public override async void OnLoad(EventArgs args) + public override void OnLoad(EventArgs args) { if (string.IsNullOrEmpty(this.StoreID) && File.Exists(printerInfo.ProfilePath)) @@ -166,7 +166,6 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage base.OnLoad(args); } - //private void CreateProductDataWidgets(PrinterSettings printerSettings, ProductSkuData product) private void CreateProductDataWidgets(ProductSkuData product) { var row = new FlowLayoutWidget() @@ -194,12 +193,13 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage var description = new MarkdownWidget(theme) { - MinimumSize = new VectorMath.Vector2(50, 0), + MinimumSize = new Vector2(50, 0), HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, AutoScroll = false, Markdown = product.ProductDescription.Trim() }; + descriptionBackground.AddChild(description); descriptionBackground.BeforeDraw += (s, e) => { @@ -245,40 +245,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage addonsColumn.AddChild(addOnRow); } } - - //if (false) - //{ - // var settingsPanel = new GuiWidget() - // { - // HAnchor = HAnchor.Stretch, - // VAnchor = VAnchor.Stretch, - // MinimumSize = new VectorMath.Vector2(20, 20), - // DebugShowBounds = true - // }; - - // settingsPanel.Load += (s, e) => - // { - // var printer = new PrinterConfig(printerSettings); - - // var settingsContext = new SettingsContext( - // printer, - // null, - // NamedSettingsLayers.All); - - // settingsPanel.AddChild( - // new ConfigurePrinterWidget(settingsContext, printer, theme) - // { - // HAnchor = HAnchor.Stretch, - // VAnchor = VAnchor.Stretch, - // }); - // }; - - // this.AddChild(new SectionWidget("Settings", settingsPanel, theme, expanded: false, setContentVAnchor: false) - // { - // VAnchor = VAnchor.Stretch - // }); - //} - } + } private GuiWidget AddHeading(ImageBuffer icon, string text) { diff --git a/MatterControlLib/SlicerConfiguration/UIFields/ColorField.cs b/MatterControlLib/SlicerConfiguration/UIFields/ColorField.cs index 185c2ded5..ecaf71bcb 100644 --- a/MatterControlLib/SlicerConfiguration/UIFields/ColorField.cs +++ b/MatterControlLib/SlicerConfiguration/UIFields/ColorField.cs @@ -30,23 +30,21 @@ either expressed or implied, of the FreeBSD Project. using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.MatterControl.PartPreviewWindow; +using System; namespace MatterHackers.MatterControl.SlicerConfiguration { public class ColorField : UIField { private ItemColorButton colorWidget; - private ThemeConfig theme; + private Action> getPickedColor; + private ThemeConfig theme; private Color initialColor; - public ColorField(ThemeConfig theme) + public ColorField(ThemeConfig theme, Color initialColor, Action> getPickedColor) { + this.getPickedColor = getPickedColor; this.theme = theme; - } - - public ColorField(ThemeConfig theme, Color initialColor) - : this(theme) - { this.initialColor = initialColor; } @@ -60,7 +58,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { var container = new FlowLayoutWidget(); - colorWidget = new ItemColorButton(theme, initialColor); + colorWidget = new ItemColorButton(theme, initialColor, getPickedColor); colorWidget.ColorChanged += (s, e) => { this.SetValue(Color.Html, true); diff --git a/MatterControlLib/Utilities/MarkdigAgg/AggParagraphRenderer.cs b/MatterControlLib/Utilities/MarkdigAgg/AggParagraphRenderer.cs index a47e908fd..625d3505d 100644 --- a/MatterControlLib/Utilities/MarkdigAgg/AggParagraphRenderer.cs +++ b/MatterControlLib/Utilities/MarkdigAgg/AggParagraphRenderer.cs @@ -17,7 +17,7 @@ namespace Markdig.Renderers.Agg } } - public class ParagraphX : FlowLeftRightWithWrapping + public class ParagraphX : FlowLeftRightWithWrapping, IHardBreak { } diff --git a/MatterControlLib/Utilities/MarkdigAgg/Inlines/AggEmphasisInlineRenderer.cs b/MatterControlLib/Utilities/MarkdigAgg/Inlines/AggEmphasisInlineRenderer.cs index 33eacdf5d..123fdb9cd 100644 --- a/MatterControlLib/Utilities/MarkdigAgg/Inlines/AggEmphasisInlineRenderer.cs +++ b/MatterControlLib/Utilities/MarkdigAgg/Inlines/AggEmphasisInlineRenderer.cs @@ -7,7 +7,7 @@ using MatterHackers.Agg.UI; namespace Markdig.Renderers.Agg.Inlines { - public class EmphasisInlineX : FlowLayoutWidget + public class EmphasisInlineX : FlowLayoutWidget, IWrapChildrenSeparatly { private char delimiter; diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 0ea5548c2..e53350017 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 0ea5548c2bdd91e3daa3769609ead4554e193ea2 +Subproject commit e53350017c3b8ebb2c8c028a07f5fe958aecb74a