diff --git a/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs b/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs index e6954108c..fe3e91468 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs @@ -34,22 +34,28 @@ using System.Linq; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Localizations; -using MatterHackers.MatterControl.CustomWidgets; namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { - public class ArticleSection : FlowLeftRightWithWrapping + public class ArticleSection : FlowLayoutWidget { private List allIconViews = new List(); private FeedSectionData content; private ThemeConfig theme; int maxStuff = 20; + private FlowLeftRightWithWrapping wrappingContent; - public ArticleSection(FeedSectionData content, ThemeConfig theme) - { - Proportional = true; - VAnchor = VAnchor.Fit | VAnchor.Top; - this.content = content; + public ArticleSection(FeedSectionData content, ThemeConfig theme) + : base(FlowDirection.TopToBottom) + { + this.HAnchor = HAnchor.Stretch; + this.VAnchor = VAnchor.Fit; + wrappingContent = new FlowLeftRightWithWrapping(); + wrappingContent.Proportional = true; + wrappingContent.VAnchor = VAnchor.Fit; + wrappingContent.HAnchor = HAnchor.Stretch; + this.AddChild(wrappingContent); + this.content = content; this.theme = theme; var cultureInfo = new CultureInfo("en-US"); @@ -74,12 +80,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab // Remove items and Children (this happens if the feed is different than the inital cach after being retrieved) foreach (var iconView in allIconViews) { - if (this.Children.Contains(iconView)) + if (wrappingContent.Children.Contains(iconView)) { - this.RemoveChild(iconView); + wrappingContent.RemoveChild(iconView); } } - this.CloseChildren(); + + wrappingContent.CloseChildren(); int i = 0; foreach (var iconView in allIconViews) @@ -88,7 +95,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { iconView.ClearRemovedFlag(); iconView.Margin = new BorderDouble(leftRightMargin, topBottomMargin); - this.AddChild(iconView); + wrappingContent.AddChild(iconView); } i++; } @@ -99,6 +106,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { BackgroundColor = theme.MinimalShade, Margin = new BorderDouble(right: leftRightMargin), + HAnchor = HAnchor.Left }; moreButton.Click += (s, e1) => { @@ -119,7 +127,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab } }; - this.AddChild(moreButton); + this.AddChild(moreButton); } } } diff --git a/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs b/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs index 2c11c9f4f..ff87f2acc 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs @@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using MatterControl.Printing; using MatterHackers.Agg; @@ -50,8 +51,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab private GuiWidget sectionSelectButtons; private GuiWidget contentSection; private bool loaded; + private int buttonPressedAlpha => 40; + private int buttonBackgroundAlpha => 5; - public ExplorePanel(ThemeConfig theme, string relativeUrl) + public ExplorePanel(ThemeConfig theme, string relativeUrl, bool addUnderline = false) : base(FlowDirection.TopToBottom) { this.relativeUrl = relativeUrl; @@ -70,6 +73,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab Proportional = true, Name = "Select Buttons" }); + + if (addUnderline) + { + this.AddChild(new HorizontalLine()); + } + contentSection = this.AddChild(new GuiWidget() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit }); } @@ -121,8 +130,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab }); } + private void ButtonSelected(object s, EventArgs e) + { + foreach (var button in sectionSelectButtons.Descendants()) + { + if (button == s) + { + button.BackgroundColor = button.HoverColor.WithAlpha(buttonPressedAlpha); + } + else + { + button.BackgroundColor = button.HoverColor.WithAlpha(buttonBackgroundAlpha); + } + } + } - private void AddContentItem(ThemeConfig theme, FeedSectionData content) + + private void AddContentItem(ThemeConfig theme, FeedSectionData content) { switch (content.content_type) { @@ -223,7 +247,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab // add the article group button to the button group // add a content section connected to the button var sectionButton = new ThemedTextButton(content.group_title, theme); - sectionSelectButtons.AddChild(sectionButton); + sectionButton.BackgroundColor = sectionButton.HoverColor.WithAlpha(buttonBackgroundAlpha); + sectionButton.Click += ButtonSelected; + sectionSelectButtons.AddChild(sectionButton); var articleSection = new ArticleSection(content, theme) { Visible = false, @@ -244,7 +270,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { var sectionButton = new ThemedTextButton(content.group_title, theme); sectionSelectButtons.AddChild(sectionButton); - var exploreSection = new ProductSection(content, theme) + sectionButton.BackgroundColor = sectionButton.HoverColor.WithAlpha(buttonPressedAlpha); + sectionButton.Click += ButtonSelected; + var exploreSection = new ProductSection(content, theme) { Name = content.group_title }; diff --git a/MatterControlLib/Library/Widgets/StorePage/StoreTabPage.cs b/MatterControlLib/Library/Widgets/StorePage/StoreTabPage.cs index bac7c290f..fd3ecbac0 100644 --- a/MatterControlLib/Library/Widgets/StorePage/StoreTabPage.cs +++ b/MatterControlLib/Library/Widgets/StorePage/StoreTabPage.cs @@ -57,10 +57,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab if (OemSettings.Instance.ShowShopButton) { topToBottom.AddChild(new ExplorePanel(theme, "banners?sk=ii2gffs6e89c2cdd9er21v")); - // actual feed - topToBottom.AddChild(new ExplorePanel(theme, "explore?sk=2lhddgi3q67xoqa53pchpeddl6w1uf")); - } - } + // actual feed + topToBottom.AddChild(new ExplorePanel(theme, "explore?sk=2lhddgi3q67xoqa53pchpeddl6w1uf", true)); + } + } public override void OnMouseWheel(MouseEventArgs mouseEvent) { diff --git a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs index 67ecc1e6b..5ecc71f00 100644 --- a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs +++ b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs @@ -288,7 +288,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // Store tab tabControl.AddTab( - tab = new ChromeTab("Store", "Resources".Localize(), tabControl, new StoreTabPage(theme), theme, hasClose: false) + tab = new ChromeTab("Store", "Store".Localize(), tabControl, new StoreTabPage(theme), theme, hasClose: false) { MinimumSize = new Vector2(0, theme.TabButtonHeight), Name = "Store Tab", diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 23124256d..0cd659555 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -4939,6 +4939,9 @@ Translated:Stop English:Stop trying to connect to the printer. Translated:Stop trying to connect to the printer. +English:Store +Translated:Store + English:Stretch X Translated:Stretch X diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 7faf670df..84b74049e 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 7faf670dff04708f45a94d5e3288de3b71cc4dc4 +Subproject commit 84b74049ebe5836f8570d498cb386299cb43ded8