From a4d5e5e366930871534bcbbf06056fb7d10d511a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 11 Jun 2018 10:18:42 -0700 Subject: [PATCH] Change start page to have panels issue: MatterHackers/MCCentral#3516 Revise start page --- MatterControl.csproj | 13 +- PartPreviewWindow/PartPreviewContent.cs | 2 +- PartPreviewWindow/PlusTab/ExploreSection.cs | 216 ------------------ .../{PlusTab => StartPage}/ExploreItem.cs | 25 +- .../{PlusTab => StartPage}/ExplorePanel.cs | 60 ++--- PartPreviewWindow/StartPage/ExploreSection.cs | 127 ++++++++++ .../{PlusTab => StartPage}/ExplorerBar.cs | 0 PartPreviewWindow/StartPage/FeedData.cs | 39 ++++ PartPreviewWindow/StartPage/FeedItemData.cs | 46 ++++ .../StartPage/FeedSectionData.cs | 49 ++++ .../StartTabPage.cs} | 8 +- 11 files changed, 310 insertions(+), 275 deletions(-) delete mode 100644 PartPreviewWindow/PlusTab/ExploreSection.cs rename PartPreviewWindow/{PlusTab => StartPage}/ExploreItem.cs (80%) rename PartPreviewWindow/{PlusTab => StartPage}/ExplorePanel.cs (85%) create mode 100644 PartPreviewWindow/StartPage/ExploreSection.cs rename PartPreviewWindow/{PlusTab => StartPage}/ExplorerBar.cs (100%) create mode 100644 PartPreviewWindow/StartPage/FeedData.cs create mode 100644 PartPreviewWindow/StartPage/FeedItemData.cs create mode 100644 PartPreviewWindow/StartPage/FeedSectionData.cs rename PartPreviewWindow/{PlusTab/PlusTabPage.cs => StartPage/StartTabPage.cs} (92%) diff --git a/MatterControl.csproj b/MatterControl.csproj index fbad716bb..efe403504 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -112,6 +112,10 @@ + + + + @@ -179,7 +183,7 @@ - + @@ -220,9 +224,9 @@ - - - + + + @@ -319,7 +323,6 @@ - diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs index ee2fce97b..955a8a78b 100644 --- a/PartPreviewWindow/PartPreviewContent.cs +++ b/PartPreviewWindow/PartPreviewContent.cs @@ -70,7 +70,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow Border = new BorderDouble(left: 1), NewTabPage = () => { - return new PlusTabPage(this, theme); + return new StartTabPage(this, theme); } }; tabControl.ActiveTabChanged += (s, e) => diff --git a/PartPreviewWindow/PlusTab/ExploreSection.cs b/PartPreviewWindow/PlusTab/ExploreSection.cs deleted file mode 100644 index 9148739f3..000000000 --- a/PartPreviewWindow/PlusTab/ExploreSection.cs +++ /dev/null @@ -1,216 +0,0 @@ -/* -Copyright (c) 2017, Lars Brubaker, John Lewin -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using MatterHackers.Agg; -using MatterHackers.Agg.UI; -using MatterHackers.Localizations; -using MatterHackers.MatterControl.CustomWidgets; -using MatterHackers.VectorMath; - -namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab -{ - public class ExploreSection : FlowLayoutWidget - { - private List allIconViews = new List(); - private int cellIndex = 0; - private int columnCount = 1; - private ExploreFeedContent content; - private int lastReflowWidth = -1; - private int leftRightMargin; - private FlowLayoutWidget rowButtonContainer = null; - private TextWidget heading; - private ThemeConfig theme; - private TextButton moreButton; - int maxStuff = 10; - - public ExploreSection(ExploreFeedContent content, ThemeConfig theme) - : base(FlowDirection.TopToBottom) - { - this.content = content; - this.HAnchor = HAnchor.Stretch; - this.theme = theme; - - foreach (var item in content.group_items) - { - allIconViews.Add(new ExploreItem(item, theme) - { - BackgroundColor = theme.MinimalShade, - VAnchor = VAnchor.Top | VAnchor.Fit, - }); - } - } - - public override void OnBoundsChanged(EventArgs e) - { - int topBottomMargin = 5; - - int currentWidth = (int)this.Size.X; - if (lastReflowWidth != currentWidth) - { - lastReflowWidth = currentWidth; - - int newColumnCount = RecomputeFlowValues(); - if (newColumnCount != columnCount) - { - columnCount = newColumnCount; - - // Reflow Children - foreach (var iconView in allIconViews) - { - iconView.Parent?.RemoveChild(iconView); - } - this.CloseAllChildren(); - - if (content.group_title != null) - { - this.AddChild(heading = new TextWidget(content.group_title, pointSize: theme.H1PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor, bold: true) - { - HAnchor = HAnchor.Left, - Margin = new BorderDouble(leftRightMargin, 5) - }); - } - - int i = 0; - foreach (var iconView in allIconViews) - { - if (i < maxStuff) - { - iconView.ClearRemovedFlag(); - iconView.Margin = new BorderDouble(leftRightMargin, topBottomMargin); - AddColumnAndChild(iconView); - } - i++; - } - - if (content.group_items.Count > maxStuff) - { - moreButton = new TextButton("More".Localize() + "...", theme) - { - VAnchor = VAnchor.Absolute, - HAnchor = HAnchor.Right, - BackgroundColor = theme.MinimalShade, - Margin = new BorderDouble(right: leftRightMargin) - }; - moreButton.Click += (s, e1) => - { - maxStuff += 25; - lastReflowWidth = -1; - columnCount = 0; - - var scroll = this.Parents().FirstOrDefault(); - var position = scroll.ScrollPositionFromTop; - OnBoundsChanged(null); - scroll.ScrollPositionFromTop = position; - }; - this.AddChild(moreButton); - } - } - else - { - if (moreButton != null) - { - moreButton.Margin = new BorderDouble(right: leftRightMargin); - } - - if (heading != null) - { - heading.Margin = new BorderDouble(leftRightMargin, 5); - } - - foreach (var iconView in allIconViews) - { - iconView.Margin = new BorderDouble(leftRightMargin, topBottomMargin); - } - } - } - - base.OnBoundsChanged(e); - } - - private void AddColumnAndChild(ExploreItem iconView) - { - if (rowButtonContainer == null) - { - rowButtonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight) - { - HAnchor = HAnchor.Stretch, - Padding = 0 - }; - this.AddChild(rowButtonContainer); - } - - rowButtonContainer.AddChild(iconView); - - if (cellIndex++ >= columnCount - 1) - { - rowButtonContainer = null; - cellIndex = 0; - } - } - - private int RecomputeFlowValues() - { - int MinimumMargin = 8; - int itemWidth = (int)allIconViews[0].Width + MinimumMargin * 2; - - int newColumnCount = (int)Math.Round(this.LocalBounds.Width / itemWidth); - int remainingSpace = (int)this.LocalBounds.Width - newColumnCount * itemWidth; - - // Reset position before reflow - cellIndex = 0; - rowButtonContainer = null; - - // There should always be at least one visible column - if (newColumnCount < 1) - { - newColumnCount = 1; - remainingSpace = 0; - } - - // Only center items if extra space exists - - // we find the space we want between each column and the sides - double spacePerColumn = (remainingSpace > 0) ? remainingSpace / (newColumnCount + 1) : 0; - - // set the margin to be 1/2 the space (it will happen on each side of each icon) - // - // TODO: Replace short term hack with new solution - //leftRightMargin = (int)(remainingSpace > 0 ? spacePerColumn / 2 : 0); - leftRightMargin = Math.Max(MinimumMargin, (int)(remainingSpace > 0 ? spacePerColumn / 2 + 8 : 0)); - - // put in padding to get the "other" side of the outside icons - this.Padding = new BorderDouble(leftRightMargin - MinimumMargin, 0); - - return newColumnCount; - } - } -} \ No newline at end of file diff --git a/PartPreviewWindow/PlusTab/ExploreItem.cs b/PartPreviewWindow/StartPage/ExploreItem.cs similarity index 80% rename from PartPreviewWindow/PlusTab/ExploreItem.cs rename to PartPreviewWindow/StartPage/ExploreItem.cs index 3cb9bb74d..f61914515 100644 --- a/PartPreviewWindow/PlusTab/ExploreItem.cs +++ b/PartPreviewWindow/StartPage/ExploreItem.cs @@ -35,12 +35,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { public class ExploreItem : FlowLayoutWidget { - private ExplorerFeedItem item; + private FeedItemData item; public static int IconSize => (int)(40 * GuiWidget.DeviceScale); public static int ItemSpacing { get; } = 10; - public ExploreItem(ExplorerFeedItem item, ThemeConfig theme) + public ExploreItem(FeedItemData item, ThemeConfig theme) { this.HAnchor = HAnchor.Absolute; @@ -63,6 +63,27 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab imageWidget.Load += (s, e) => ApplicationController.Instance.DownloadToImageAsync(image, item.icon, true, new BlenderPreMultBGRA()); this.AddChild(imageWidget); } + else if(item.widget_url != null) + { + ImageBuffer image = new ImageBuffer(IconSize, IconSize); + + var whiteBackground = new GuiWidget(IconSize, IconSize) + { + // these images expect to be on white so change the background to white + BackgroundColor = Color.White, + }; + this.AddChild(whiteBackground); + + var imageWidget = new ImageWidget(image) + { + Selectable = false, + VAnchor = VAnchor.Center, + Margin = new BorderDouble(right: ItemSpacing) + }; + + imageWidget.Load += (s, e) => ApplicationController.Instance.DownloadToImageAsync(image, item.widget_url, true, new BlenderPreMultBGRA()); + whiteBackground.AddChild(imageWidget); + } var wrappedText = new WrappedTextWidget(item.title, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: theme.DefaultFontSize) { diff --git a/PartPreviewWindow/PlusTab/ExplorePanel.cs b/PartPreviewWindow/StartPage/ExplorePanel.cs similarity index 85% rename from PartPreviewWindow/PlusTab/ExplorePanel.cs rename to PartPreviewWindow/StartPage/ExplorePanel.cs index 6c7a98c25..e1dede438 100644 --- a/PartPreviewWindow/PlusTab/ExplorePanel.cs +++ b/PartPreviewWindow/StartPage/ExplorePanel.cs @@ -48,6 +48,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab string relativeUrl; string staticFile; private ThemeConfig theme; + FlowLeftRightWithWrapping currentContentContainer; public ExplorePanel(ThemeConfig theme, string relativeUrl, string staticFile) : base(FlowDirection.TopToBottom) @@ -67,13 +68,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab try { - ExplorerFeed explorerFeed = null; + FeedData explorerFeed = null; var json = ApplicationController.LoadCachedFile(staticFile, "MatterHackers"); if (json != null) { // Construct directly from cache - explorerFeed = JsonConvert.DeserializeObject(json); + explorerFeed = JsonConvert.DeserializeObject(json); // Add controls for content AddControlsForContent(explorerFeed); @@ -111,14 +112,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab } } - public async Task LoadExploreFeed(int loadedID, string cachePath) + public async Task LoadExploreFeed(int loadedID, string cachePath) { try { var client = new HttpClient(); string json = await client.GetStringAsync($"http://www.matterhackers.com/feeds/{relativeUrl}"); - var explorerFeed = JsonConvert.DeserializeObject(json); + var explorerFeed = JsonConvert.DeserializeObject(json); var sanitizedJsonID = JsonConvert.SerializeObject(explorerFeed, Formatting.Indented).GetHashCode(); if (loadedID == sanitizedJsonID) @@ -140,7 +141,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab return null; } - private void AddControlsForContent(ExplorerFeed contentList) + private void AddControlsForContent(FeedData contentList) { foreach (var content in contentList.Content) { @@ -148,12 +149,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab } } - private void AddContentItem(ExploreFeedContent content) + private void AddContentItem(FeedSectionData content) { switch (content.content_type) { case "headline": { + break; + // use the Golden Ratio to calculate an atractive size relative to the banner var image = new ImageBuffer(1520, (int)(170 / 1.618)); var imageWidget = new ResponsiveImageWidget(image) @@ -237,47 +240,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab case "article_group": case "product_group": - this.AddChild(new ExploreSection(content, theme)); + if(currentContentContainer == null) + { + currentContentContainer = new FlowLeftRightWithWrapping(); + this.AddChild(currentContentContainer); + } + currentContentContainer.AddChild(new ExploreSection(content, theme)); break; } } } - - #region json expand classes - - public class ExploreFeedContent - { - public string content_type; - public List group_items; - public List banner_list; - public string group_link; - public string group_subtitle; - public string group_title; - public string icon_url; - public string image_url; - public string link; - public string text; - public string theme_filter; - } - - public class ExplorerFeed - { - public List Content; - public string Status; - } - - public class ExplorerFeedItem - { - public string author; - public string category; - public string date_published; - public string description; - public string hero; - public string icon; - public string link; - public string title; - public string url; - } - - #endregion json expand classes } \ No newline at end of file diff --git a/PartPreviewWindow/StartPage/ExploreSection.cs b/PartPreviewWindow/StartPage/ExploreSection.cs new file mode 100644 index 000000000..daf253312 --- /dev/null +++ b/PartPreviewWindow/StartPage/ExploreSection.cs @@ -0,0 +1,127 @@ +/* +Copyright (c) 2017, Lars Brubaker, John Lewin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab +{ + public class ExploreSection : FlowLayoutWidget + { + private List allIconViews = new List(); + private FeedSectionData content; + private ThemeConfig theme; + private TextButton moreButton; + int maxStuff = 7; + + public ExploreSection(FeedSectionData content, ThemeConfig theme) + : base(FlowDirection.TopToBottom) + { + VAnchor = VAnchor.Fit | VAnchor.Top; + this.content = content; + this.theme = theme; + + foreach (var item in content.group_items) + { + allIconViews.Add(new ExploreItem(item, theme) + { + BackgroundColor = theme.MinimalShade, + VAnchor = VAnchor.Fit, + }); + } + + AddContent(); + } + + public void AddContent() + { + int leftRightMargin = 5; + int topBottomMargin = 5; + + // Reflow Children + foreach (var iconView in allIconViews) + { + if (this.Children.Contains(iconView)) + { + this.RemoveChild(iconView); + } + } + this.CloseAllChildren(); + + if (content.group_title != null) + { + this.AddChild(new TextWidget(content.group_title, pointSize: theme.H1PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor, bold: true) + { + HAnchor = HAnchor.Left, + Margin = new BorderDouble(leftRightMargin, 5) + }); + } + + int i = 0; + foreach (var iconView in allIconViews) + { + if (i < maxStuff) + { + iconView.ClearRemovedFlag(); + iconView.Margin = new BorderDouble(leftRightMargin, topBottomMargin); + this.AddChild(iconView); + } + i++; + } + + if (content.group_items.Count > maxStuff) + { + moreButton = new TextButton("More".Localize() + "...", theme) + { + VAnchor = VAnchor.Absolute, + HAnchor = HAnchor.Right, + BackgroundColor = theme.MinimalShade, + Margin = new BorderDouble(right: leftRightMargin) + }; + moreButton.Click += (s, e1) => + { + var scroll = this.Parents().FirstOrDefault(); + var position = scroll.ScrollPositionFromTop; + + maxStuff += 6; + AddContent(); + + scroll.ScrollPositionFromTop = position; + }; + this.AddChild(moreButton); + } + } + } +} \ No newline at end of file diff --git a/PartPreviewWindow/PlusTab/ExplorerBar.cs b/PartPreviewWindow/StartPage/ExplorerBar.cs similarity index 100% rename from PartPreviewWindow/PlusTab/ExplorerBar.cs rename to PartPreviewWindow/StartPage/ExplorerBar.cs diff --git a/PartPreviewWindow/StartPage/FeedData.cs b/PartPreviewWindow/StartPage/FeedData.cs new file mode 100644 index 000000000..9dee841a0 --- /dev/null +++ b/PartPreviewWindow/StartPage/FeedData.cs @@ -0,0 +1,39 @@ +/* +Copyright (c) 2018, Lars Brubaker, John Lewin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + +using System.Collections.Generic; + +namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab +{ + public class FeedData + { + public List Content; + public string Status; + } +} \ No newline at end of file diff --git a/PartPreviewWindow/StartPage/FeedItemData.cs b/PartPreviewWindow/StartPage/FeedItemData.cs new file mode 100644 index 000000000..2b54a512a --- /dev/null +++ b/PartPreviewWindow/StartPage/FeedItemData.cs @@ -0,0 +1,46 @@ +/* +Copyright (c) 2018, Lars Brubaker, John Lewin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + + +namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab +{ + public class FeedItemData + { + public string author; + public string category; + public string date_published; + public string description; + public string hero; + public string icon; + public string link; + public string title; + public string url; + public string widget_url; + } +} \ No newline at end of file diff --git a/PartPreviewWindow/StartPage/FeedSectionData.cs b/PartPreviewWindow/StartPage/FeedSectionData.cs new file mode 100644 index 000000000..7a2580b8f --- /dev/null +++ b/PartPreviewWindow/StartPage/FeedSectionData.cs @@ -0,0 +1,49 @@ +/* +Copyright (c) 2018, Lars Brubaker, John Lewin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + +using System.Collections.Generic; + +namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab +{ + public class FeedSectionData + { + public string content_type; + public List group_items; + public List banner_list; + public string group_link; + public string group_subtitle; + public string group_title; + public string icon_url; + public string image_url; + public string link; + public string text; + public string theme_filter; + public string banner_url; + } +} \ No newline at end of file diff --git a/PartPreviewWindow/PlusTab/PlusTabPage.cs b/PartPreviewWindow/StartPage/StartTabPage.cs similarity index 92% rename from PartPreviewWindow/PlusTab/PlusTabPage.cs rename to PartPreviewWindow/StartPage/StartTabPage.cs index 269cf0a68..6d2201311 100644 --- a/PartPreviewWindow/PlusTab/PlusTabPage.cs +++ b/PartPreviewWindow/StartPage/StartTabPage.cs @@ -27,21 +27,17 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using System.IO; using MatterHackers.Agg; -using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; -using MatterHackers.Localizations; -using MatterHackers.MatterControl.PrinterControls.PrinterConnections; using MatterHackers.MatterControl.SettingsManagement; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { - public class PlusTabPage : ScrollableWidget + public class StartTabPage : ScrollableWidget { - public PlusTabPage(PartPreviewContent partPreviewContent, ThemeConfig theme) + public StartTabPage(PartPreviewContent partPreviewContent, ThemeConfig theme) { this.AutoScroll = true; this.ScrollArea.Padding = new BorderDouble(3);