From 1ba0f37d26476afcf819759273f2019c23909ac2 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 30 May 2018 15:55:07 -0700 Subject: [PATCH 1/4] Add heading for page - Issue MatterHackers/MCCentral#3444 Vague title --- ConfigurationPage/PrintLeveling/PrintLevelingWizard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConfigurationPage/PrintLeveling/PrintLevelingWizard.cs b/ConfigurationPage/PrintLeveling/PrintLevelingWizard.cs index b0ff0efff..ba5fb17a7 100644 --- a/ConfigurationPage/PrintLeveling/PrintLevelingWizard.cs +++ b/ConfigurationPage/PrintLeveling/PrintLevelingWizard.cs @@ -224,7 +224,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling yield return new LastPageInstructions( this, - "Done".Localize(), + "Print Leveling Wizard".Localize(), string.Format( "{0} {1}\n\n{2}\n{3}\n\n{4}", "Congratulations!".Localize(), From 3ceae5461bbc750ac4480ab5435bd0ddacba2493 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 30 May 2018 16:08:46 -0700 Subject: [PATCH 2/4] Inline RebuildTitleBar method - Issue MatterHackers/MCCentral#3418 RebuildTitleBar fires when text changes --- CustomWidgets/TreeView/TreeNode.cs | 109 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/CustomWidgets/TreeView/TreeNode.cs b/CustomWidgets/TreeView/TreeNode.cs index 044508840..d0acfd609 100644 --- a/CustomWidgets/TreeView/TreeNode.cs +++ b/CustomWidgets/TreeView/TreeNode.cs @@ -47,11 +47,13 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView public TreeNode() : base(FlowDirection.TopToBottom) { - HAnchor = HAnchor.Fit | HAnchor.Left; - VAnchor = VAnchor.Fit; + var theme = ApplicationController.Instance.Theme; - TitleBar = new FlowLayoutWidget(); - TitleBar.Click += (s, e) => + this.HAnchor = HAnchor.Fit | HAnchor.Left; + this.VAnchor = VAnchor.Fit; + + this.TitleBar = new FlowLayoutWidget(); + this.TitleBar.Click += (s, e) => { if (TreeView != null) { @@ -59,7 +61,52 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView } }; AddChild(TitleBar); - RebuildTitleBar(); + + // add a check box + expandWidget = new TreeExpandWidget(theme) + { + Expandable = GetNodeCount(false) != 0, + VAnchor = VAnchor.Fit, + Height = 16, + Width = 16 + }; + + var expandCheckBox = new CheckBox(expandWidget) + { + Checked = this.Expanded, + VAnchor = VAnchor.Center, + }; + + this.ExpandedChanged += (s2, e2) => + { + expandWidget.Expanded = this.Expanded; + expandCheckBox.Checked = this.Expanded; + }; + + expandCheckBox.CheckedStateChanged += (s3, e3) => + { + Expanded = expandCheckBox.Checked; + }; + + this.TitleBar.AddChild(expandCheckBox); + + // add a check box + if (Image != null) + { + this.TitleBar.AddChild(imageWidget = new ImageWidget(this.Image) + { + VAnchor = VAnchor.Center, + BackgroundColor = new Color(theme.Colors.PrimaryTextColor, 12), + Margin = 2, + Selectable = false + }); + }; + this.TitleBar.AddChild(textWidget = new TextWidget(this.Text, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor) + { + Selectable = false, + AutoExpandBoundsToText = true, + VAnchor = VAnchor.Center + }); content = new FlowLayoutWidget(FlowDirection.TopToBottom) { @@ -162,58 +209,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView expandWidget.Expandable = GetNodeCount(false) != 0; } - private void RebuildTitleBar() - { - TitleBar.RemoveAllChildren(); - - var theme = ApplicationController.Instance.Theme; - // add a check box - expandWidget = new TreeExpandWidget(theme) - { - Expandable = GetNodeCount(false) != 0, - VAnchor = VAnchor.Fit, - Height = 16, - Width = 16 - }; - - var expandCheckBox = new CheckBox(expandWidget) - { - Checked = this.Expanded, - VAnchor = VAnchor.Center, - }; - - this.ExpandedChanged += (s, e) => - { - expandWidget.Expanded = this.Expanded; - expandCheckBox.Checked = this.Expanded; - }; - - expandCheckBox.CheckedStateChanged += (s, e) => - { - Expanded = expandCheckBox.Checked; - }; - - this.TitleBar.AddChild(expandCheckBox); - - // add a check box - if (Image != null) - { - this.TitleBar.AddChild(imageWidget = new ImageWidget(this.Image) - { - VAnchor = VAnchor.Center, - BackgroundColor = new Color(theme.Colors.PrimaryTextColor, 12), - Margin = 2, - Selectable = false - }); - }; - TitleBar.AddChild(textWidget = new TextWidget(this.Text, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor) - { - Selectable = false, - AutoExpandBoundsToText = true, - VAnchor = VAnchor.Center - }); - } - #region Properties private ImageBuffer _image = new ImageBuffer(16, 16); From d4a7b47a959838c44bf3f2e80b79428bd5ecd535 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 30 May 2018 16:21:33 -0700 Subject: [PATCH 3/4] Restore parameterless constructor required for custom/dynamic view - Issue MatterHackers/MCCentral#3475 PrintHistoryContainer throws exception when opened --- History/PrintHistoryListItem.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/History/PrintHistoryListItem.cs b/History/PrintHistoryListItem.cs index b3d55a35e..48fa5d92c 100644 --- a/History/PrintHistoryListItem.cs +++ b/History/PrintHistoryListItem.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2014, Kevin Pope +Copyright (c) 2018, Kevin Pope, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -40,7 +40,6 @@ using MatterHackers.MatterControl.PrintQueue; namespace MatterHackers.MatterControl.PrintHistory { - public class HistoryListView : FlowLayoutWidget, IListContentView { private ThemeConfig theme; @@ -48,6 +47,11 @@ namespace MatterHackers.MatterControl.PrintHistory public int ThumbWidth { get; } = 50; public int ThumbHeight { get; } = 50; + public HistoryListView() + : base(FlowDirection.TopToBottom) + { + } + public HistoryListView(ThemeConfig theme) : base(FlowDirection.TopToBottom) { From f2a36f28d9dccc401ea0b932d3b5e76796260211 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 30 May 2018 16:28:54 -0700 Subject: [PATCH 4/4] Update PrintHistoryListItem for recent changes - Issue MatterHackers/MCCentral#3472 Print History folder multiplies --- History/PrintHistoryListItem.cs | 1 + Library/Widgets/ListView/ListViewItemBase.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/History/PrintHistoryListItem.cs b/History/PrintHistoryListItem.cs index 48fa5d92c..2c01c1fc8 100644 --- a/History/PrintHistoryListItem.cs +++ b/History/PrintHistoryListItem.cs @@ -50,6 +50,7 @@ namespace MatterHackers.MatterControl.PrintHistory public HistoryListView() : base(FlowDirection.TopToBottom) { + this.theme = ApplicationController.Instance.Theme; } public HistoryListView(ThemeConfig theme) diff --git a/Library/Widgets/ListView/ListViewItemBase.cs b/Library/Widgets/ListView/ListViewItemBase.cs index 98e19fdf2..d201e48a3 100644 --- a/Library/Widgets/ListView/ListViewItemBase.cs +++ b/Library/Widgets/ListView/ListViewItemBase.cs @@ -224,8 +224,10 @@ namespace MatterHackers.MatterControl.CustomWidgets // TODO: Resolve and implement // Allow the container to draw an overlay - use signal interface or add method to interface? //var iconWithOverlay = ActiveContainer.DrawOverlay() - - this.imageWidget.Image = thumbnail; + if (this.imageWidget != null) + { + this.imageWidget.Image = thumbnail; + } this.ImageSet?.Invoke(this, null);