From 330aba83f797345cb1cdd7389ff1c9d1195ae612 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sat, 2 Feb 2019 13:51:02 -0800 Subject: [PATCH] Add item Drawables to menu --- .../PartPreviewWindow/View3D/InteractionLayer.cs | 2 ++ .../View3D/PrinterBar/PrintPopupMenu.cs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs b/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs index bf5bd8b6f..53b30f135 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs @@ -96,6 +96,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public IEnumerable Drawables => drawables; + public IEnumerable ItemDrawables => itemDrawables; + internal void SetRenderTarget(GuiWidget renderSource) { this.renderSource = renderSource; diff --git a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs index ff519d144..6c8c2881e 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs @@ -160,6 +160,22 @@ namespace MatterHackers.MatterControl.PartPreviewWindow row.AddChild(toggleSwitch); } + foreach (var drawable in ApplicationController.Instance.DragDropData.View3DWidget.InteractionLayer.ItemDrawables) + { + var row = new SettingsRow(drawable.Title, drawable.Description, theme); + subPanel.AddChild(row); + + var toggleSwitch = new RoundedToggleSwitch(theme) + { + Checked = drawable.Enabled + }; + toggleSwitch.CheckedStateChanged += (s, e) => + { + drawable.Enabled = toggleSwitch.Checked; + }; + row.AddChild(toggleSwitch); + } + menuTheme.ApplyBoxStyle(sectionWidget); sectionWidget.Margin = new BorderDouble(0, 10);