From 09b2db02b91a3a00bdea4b782ce6b503dc40b8ef Mon Sep 17 00:00:00 2001 From: John Lewin Date: Mon, 22 Jan 2018 10:32:32 -0800 Subject: [PATCH] Group print popup optional items into SectionWidget --- PartPreviewWindow/SectionWidget.cs | 2 +- .../View3D/PrinterBar/PrintPopupMenu.cs | 40 ++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/PartPreviewWindow/SectionWidget.cs b/PartPreviewWindow/SectionWidget.cs index 0778e01da..e2d89bc72 100644 --- a/PartPreviewWindow/SectionWidget.cs +++ b/PartPreviewWindow/SectionWidget.cs @@ -7,7 +7,7 @@ namespace MatterHackers.MatterControl.CustomWidgets /// /// A container control having a header and a content panel, with optional collapse behavior and right aligned widget /// - public class SectionWidget : FlowLayoutWidget + public class SectionWidget : FlowLayoutWidget, IIgnoredPopupChild { private ExpandCheckboxButton checkbox; diff --git a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs index 203256389..ffdb568b6 100644 --- a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs +++ b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs @@ -81,12 +81,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var settingsContext = new SettingsContext(printer, null, NamedSettingsLayers.All); - foreach (var key in new[] { "layer_height", "fill_density", "support_material", "create_raft", "spiral_vase", "layer_to_pause" }) + var lightGray = new Color("#aaa"); + + foreach (var key in new[] { "layer_height", "fill_density", "support_material", "create_raft"}) { var settingsData = SettingsOrganizer.Instance.GetSettingsData(key); var row = SliceSettingsTabView.CreateItemRow(settingsData, settingsContext, printer, Color.Black, theme, ref tabIndex); - var lightGray = new Color("#aaa"); foreach (var widget in row.Descendants()) { @@ -103,6 +104,41 @@ namespace MatterHackers.MatterControl.PartPreviewWindow optionsPanel.AddChild(row); } + var subPanel = new FlowLayoutWidget(FlowDirection.TopToBottom); + + // TODO: lookup settings values + bool anySettingOverridden = false; + + var sectionWidget = new SectionWidget("Advanced", subPanel, theme, expanded: anySettingOverridden) + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Fit, + Margin = 0 + }; + column.AddChild(sectionWidget); + + foreach (var key in new[] { "spiral_vase", "layer_to_pause" }) + { + var settingsData = SettingsOrganizer.Instance.GetSettingsData(key); + var row = SliceSettingsTabView.CreateItemRow(settingsData, settingsContext, printer, Color.Black, theme, ref tabIndex); + + foreach (var widget in row.Descendants()) + { + widget.Border = 1; + widget.BorderColor = lightGray; + } + + foreach (var widget in row.Descendants()) + { + widget.Border = 1; + widget.BorderColor = lightGray; + } + + subPanel.AddChild(row); + } + + sectionWidget.ApplyBoxStyle(); + var button = new TextButton("Start Print".Localize(), theme, Color.Black) { Name = "Start Print Button",