diff --git a/AboutPage/CheckForUpdatesPage.cs b/AboutPage/CheckForUpdatesPage.cs index 852903ab6..7722cade2 100644 --- a/AboutPage/CheckForUpdatesPage.cs +++ b/AboutPage/CheckForUpdatesPage.cs @@ -10,12 +10,11 @@ namespace MatterHackers.MatterControl.AboutPage public class CheckForUpdatesPage : DialogPage { public CheckForUpdatesPage() - : base("Close") + : base("Close".Localize()) { AnchorAll(); - this.WindowTitle = "Check for Update".Localize(); - this.HeaderText = "Check for Update".Localize(); + this.WindowTitle = this.HeaderText = "Check for Update".Localize(); var theme = ApplicationController.Instance.Theme; diff --git a/ActionBar/TemperatureWidgetBase.cs b/ActionBar/TemperatureWidgetBase.cs index 48b52bfc2..eecf335ea 100644 --- a/ActionBar/TemperatureWidgetBase.cs +++ b/ActionBar/TemperatureWidgetBase.cs @@ -37,7 +37,7 @@ using MatterHackers.MatterControl.PartPreviewWindow; namespace MatterHackers.MatterControl.ActionBar { - internal abstract class TemperatureWidgetBase : PopupButton + internal abstract class TemperatureWidgetBase : PopupMenuButton { protected CheckBox heatToggle; protected TextWidget CurrentTempIndicator; @@ -60,6 +60,8 @@ namespace MatterHackers.MatterControl.ActionBar public TemperatureWidgetBase(PrinterConfig printer, string textValue) { + this.AlignToRightEdge = true; + this.DrawArrow = true; this.printer = printer; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit | VAnchor.Center; @@ -71,7 +73,7 @@ namespace MatterHackers.MatterControl.ActionBar { HAnchor = HAnchor.Fit, VAnchor = VAnchor.Fit, - Padding = new BorderDouble(5) + Padding = new BorderDouble(10, 5, 0, 5) }; this.AddChild(container); diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index 142c043a8..3e4470416 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -854,8 +854,6 @@ namespace MatterHackers.MatterControl } //HtmlWindowTest(); - - AppContext.IsLoading = false; } private static void RunSetupIfRequired() @@ -1572,8 +1570,7 @@ namespace MatterHackers.MatterControl systemWindow.BackgroundColor = Color.Transparent; overlay.Close(); - // TODO: Still can't figure out the delay between concluding this block and the first actual render with MainView content. Current - // best guess is delays between widget construction and OpenGL texture creation + AppContext.IsLoading = false; }); }; diff --git a/CustomWidgets/ConfigurePrinterWidget.cs b/CustomWidgets/ConfigurePrinterWidget.cs new file mode 100644 index 000000000..704a02bd4 --- /dev/null +++ b/CustomWidgets/ConfigurePrinterWidget.cs @@ -0,0 +1,94 @@ +/* +Copyright (c) 2017, 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.Linq; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.PartPreviewWindow; +using MatterHackers.MatterControl.SlicerConfiguration; + +namespace MatterHackers.MatterControl +{ + public class ConfigurePrinterWidget : FlowLayoutWidget + { + public ConfigurePrinterWidget(PartTabPage partTabPage, ThemeConfig theme) + : base(FlowDirection.TopToBottom) + { + var sliceSettingsWidget = partTabPage.ChildrenRecursive().FirstOrDefault(); + + int tabIndex = 0; + var rowItem = sliceSettingsWidget.CreateItemRow(SliceSettingsOrganizer.SettingsData["printer_name"], ref tabIndex); + + var firstChild = rowItem.Children.FirstOrDefault(); + firstChild.HAnchor = HAnchor.Absolute; + firstChild.Width = 100; + firstChild.Margin = firstChild.Margin.Clone(right: 0); + + var nextChild = rowItem.Children.Skip(1).FirstOrDefault(); + nextChild.HAnchor = HAnchor.Stretch; + nextChild.Children.FirstOrDefault().HAnchor = HAnchor.Stretch; + + this.AddChild(rowItem); + + var primaryTabControl = new TabControl(); + primaryTabControl.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor; + primaryTabControl.AnchorAll(); + this.AddChild(primaryTabControl); + + foreach (var section in SliceSettingsOrganizer.Instance.UserLevels["Printer"].CategoriesList) + { + var tabPage = new TabPage(section.Name.Localize()) + { + Padding = new BorderDouble(10, 4) + }; + + primaryTabControl.AddTab(new TextTab( + tabPage, + section.Name + " Tab", + theme.DefaultFontSize, + ActiveTheme.Instance.TabLabelSelected, + new Color(), + ActiveTheme.Instance.TabLabelUnselected, + new Color(), + useUnderlineStyling: true)); + + var scrollable = new ScrollableWidget(true) + { + VAnchor = VAnchor.Stretch, + HAnchor = HAnchor.Stretch, + }; + scrollable.ScrollArea.HAnchor = HAnchor.Stretch; + scrollable.AddChild( + sliceSettingsWidget.CreateGroupContent(section.GroupsList.FirstOrDefault() , sliceSettingsWidget.settingsContext, sliceSettingsWidget.ShowHelpControls)); + tabPage.AddChild(scrollable); + } + } + } +} diff --git a/MatterControl.OpenGL/GCodeRenderer/RenderFeatures/RenderFeatureBase.cs b/MatterControl.OpenGL/GCodeRenderer/RenderFeatures/RenderFeatureBase.cs index af1ecbb8d..b49b2b478 100644 --- a/MatterControl.OpenGL/GCodeRenderer/RenderFeatures/RenderFeatureBase.cs +++ b/MatterControl.OpenGL/GCodeRenderer/RenderFeatures/RenderFeatureBase.cs @@ -62,6 +62,10 @@ namespace MatterHackers.GCodeVisualizer double zScale = halfHeight / radius; double xScale = halfWidth / radius; + // Adjust start/end positions to be centered on Z for the given layer height + startPos.Z -= halfHeight; + endPos.Z -= halfHeight; + Vector3 scale = new Vector3(xScale, xScale, zScale); for (int i = 0; i < steps; i++) diff --git a/MatterControl.csproj b/MatterControl.csproj index 9edcfc620..88357eb99 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -73,6 +73,7 @@ + @@ -305,7 +306,6 @@ - diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs index a4dc7a3ae..01944369e 100644 --- a/PartPreviewWindow/PartPreviewContent.cs +++ b/PartPreviewWindow/PartPreviewContent.cs @@ -161,6 +161,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow ApplicationController.Instance.NotifyPrintersTabRightElement(extensionArea); + // Show start page during initial application startup + if (AppContext.IsLoading) + { + tabControl.AddTab( + new MainTab("New Tab".Localize(), tabControl, tabControl.NewTabPage(), theme) + { + MinimumSize = new Vector2(0, theme.shortButtonHeight) + }); + } + // When the application is first started, plugins are loaded after the MainView control has been initialized, // and as such they not around when this constructor executes. In that case, we run the AddRightElement // delegate after the plugins have been initialized via the PluginsLoaded event diff --git a/PartPreviewWindow/PopupButton.cs b/PartPreviewWindow/PopupButton.cs index a94220078..c8f89f353 100644 --- a/PartPreviewWindow/PopupButton.cs +++ b/PartPreviewWindow/PopupButton.cs @@ -76,6 +76,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow base.OnMouseDown(mouseEvent); } + private Color stashedColor; + public override void OnMouseUp(MouseEventArgs mouseEvent) { // HACK: Child controls seem to be interfering with this.MouseCaptured - this short term workaround ensure we get clicks but likely mean mouse down outside of the control will fire the popup @@ -88,6 +90,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow ShowPopup(); // Set a background color while the menu is active + stashedColor = this.BackgroundColor; this.BackgroundColor = slightShade; } @@ -125,7 +128,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow popupWidget.Closed += (s, e) => { // Clear the temp background color - this.BackgroundColor = Color.Transparent; + this.BackgroundColor = stashedColor; menuVisible = false; popupWidget = null; diff --git a/PartPreviewWindow/PopupMenuButton.cs b/PartPreviewWindow/PopupMenuButton.cs index 4d1bceaa0..a592a3b2e 100644 --- a/PartPreviewWindow/PopupMenuButton.cs +++ b/PartPreviewWindow/PopupMenuButton.cs @@ -30,14 +30,33 @@ either expressed or implied, of the FreeBSD Project. using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; +using MatterHackers.MatterControl.CustomWidgets; namespace MatterHackers.MatterControl.PartPreviewWindow { public class PopupMenuButton : PopupButton { + public PopupMenuButton() + { + } + public PopupMenuButton(GuiWidget viewWidget) : base(viewWidget) { + viewWidget.Selectable = false; + viewWidget.BackgroundColor = Color.Transparent; + this.BackgroundColor = ApplicationController.Instance.Theme.SlightShade; + } + + public PopupMenuButton(string text, ThemeConfig theme) + : this (new TextButton(text, theme) + { + Selectable = false, + Padding = theme.ButtonFactory.Options.Margin.Clone(right: 5) + }) + { + this.DrawArrow = true; + this.BackgroundColor = theme.SlightShade; } private bool _drawArrow = false; diff --git a/PartPreviewWindow/PrinterTabPage.cs b/PartPreviewWindow/PrinterTabPage.cs index d522b1e16..ab2fd19c1 100644 --- a/PartPreviewWindow/PrinterTabPage.cs +++ b/PartPreviewWindow/PrinterTabPage.cs @@ -461,6 +461,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { var sideBar = new DockingTabControl(widgetTodockTo, DockSide.Right, ApplicationController.Instance.ActivePrinter) { + Name = "DockingTabControl", ControlIsPinned = ApplicationController.Instance.ActivePrinter.ViewState.SliceSettingsTabPinned }; sideBar.PinStatusChanged += (s, e) => diff --git a/PartPreviewWindow/View3D/Actions/IntersectionEditor.cs b/PartPreviewWindow/View3D/Actions/IntersectionEditor.cs index 1e0464980..9c9870764 100644 --- a/PartPreviewWindow/View3D/Actions/IntersectionEditor.cs +++ b/PartPreviewWindow/View3D/Actions/IntersectionEditor.cs @@ -46,6 +46,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D public bool Unlocked { get; } = true; + public IEnumerable SupportedTypes() => new Type[] { typeof(MeshWrapperOperation) }; + public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme) { this.view3DWidget = view3DWidget; @@ -54,7 +56,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); if (group is MeshWrapperOperation operationNode - && operationNode.Mesh == null) + && operationNode.Children.All(c => c.OutputType != PrintOutputTypes.Hole)) { bool first = true; // set all but one mesh to look like holes @@ -70,42 +72,36 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D return mainContainer; } - public IEnumerable SupportedTypes() => new Type[] - { - typeof(MeshWrapperOperation), - }; - private async void ProcessBooleans(IObject3D group) { - // spin up a task to remove holes from the objects in the group - await Task.Run(() => + await Task.Run(() => + { + var participants = group.Descendants().Where((obj) => obj.OwnerID == group.ID); + + if (participants.Count() > 1) { - var participants = group.Descendants().Where((obj) => obj.OwnerID == group.ID); + var first = participants.First(); - if (participants.Count() > 1) + foreach (var remove in participants) { - var first = participants.First(); - - foreach (var remove in participants) + if (remove != first) { - if(remove != first) - { - var transformedRemove = Mesh.Copy(remove.Mesh, CancellationToken.None); - transformedRemove.Transform(remove.WorldMatrix()); + var transformedRemove = Mesh.Copy(remove.Mesh, CancellationToken.None); + transformedRemove.Transform(remove.WorldMatrix()); - var transformedKeep = Mesh.Copy(first.Mesh, CancellationToken.None); - transformedKeep.Transform(first.WorldMatrix()); + var transformedKeep = Mesh.Copy(first.Mesh, CancellationToken.None); + transformedKeep.Transform(first.WorldMatrix()); - transformedKeep = PolygonMesh.Csg.CsgOperations.Intersect(transformedKeep, transformedRemove); - var inverse = first.WorldMatrix(); - inverse.Invert(); - transformedKeep.Transform(inverse); - first.Mesh = transformedKeep; - remove.Visible = false; - } + transformedKeep = PolygonMesh.Csg.CsgOperations.Intersect(transformedKeep, transformedRemove); + var inverse = first.WorldMatrix(); + inverse.Invert(); + transformedKeep.Transform(inverse); + first.Mesh = transformedKeep; + remove.Visible = false; } } - }); + } + }); } } } diff --git a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs index 9b914cfa3..d0dcb5e18 100644 --- a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs +++ b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs @@ -37,7 +37,7 @@ using MatterHackers.MatterControl.SlicerConfiguration; namespace MatterHackers.MatterControl.PartPreviewWindow { - public class PrintPopupMenu : PopupButton + public class PrintPopupMenu : PopupMenuButton { private TextImageButtonFactory buttonFactory = ApplicationController.Instance.Theme.ButtonFactory; private PrinterConfig printer; @@ -47,6 +47,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { this.printerTabPage = printerTabPage; this.printer = printer; + this.DrawArrow = true; + this.BackgroundColor = theme.ButtonFactory.Options.NormalFillColor; + //this.HoverColor = theme.ButtonFactory.Options.HoverFillColor; this.Name = "PrintPopupMenu"; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; @@ -92,7 +95,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow HAnchor = HAnchor.Right, VAnchor = VAnchor.Absolute, Margin = new BorderDouble(top: 10), - BackgroundColor = theme.MinimalShade }; button.Click += (s, e) => { @@ -119,8 +121,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.AddChild(new TextButton("Print".Localize(), theme) { - BackgroundColor = theme.ButtonFactory.Options.NormalFillColor, - HoverColor = theme.ButtonFactory.Options.HoverFillColor, + Selectable = false, + Padding = theme.ButtonFactory.Options.Margin.Clone(right: 5) }); } diff --git a/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs b/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs index fc98c1631..d4c5edf40 100644 --- a/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs +++ b/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs @@ -34,6 +34,7 @@ using MatterHackers.Agg; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; using MatterHackers.Localizations; +using MatterHackers.MatterControl.AboutPage; using MatterHackers.MatterControl.ActionBar; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.EeProm; @@ -123,11 +124,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (printer.Settings.GetValue(SettingsKey.has_heated_bed)) { - this.AddChild(new TemperatureWidgetBed(printer)); + this.AddChild(new TemperatureWidgetBed(printer) + { + Margin = new BorderDouble(right: 35) + }); } this.OverflowMenu.Name = "Printer Overflow Menu"; - this.OverflowMenu.DynamicPopupContent = GeneratePrinterOverflowMenu; + this.OverflowMenu.DynamicPopupContent = () => GeneratePrinterOverflowMenu(theme); ApplicationController.Instance.ActivePrinter.Connection.ConnectionSucceeded.RegisterEvent((s, e) => { @@ -147,7 +151,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow base.OnClosed(e); } - private GuiWidget GeneratePrinterOverflowMenu() + private GuiWidget GeneratePrinterOverflowMenu(ThemeConfig theme) { var menuActions = new NamedAction[] { @@ -178,6 +182,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow })); } }, + new NamedAction() + { + Title = "Configure Printer".Localize(), + Action = () => + { + var partTabPage = this.Parents().FirstOrDefault(); + var dockingTabControl = partTabPage.FindNamedChildRecursive("DockingTabControl") as DockingTabControl; + printer.ViewState.SliceSettingsTabIndex = 3; + + dockingTabControl.AddPage( + "Printer", + new ConfigurePrinterWidget(partTabPage, theme) + { + BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor, + Padding = new BorderDouble(top: 10), + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch, + }); + } + }, new NamedAction() { Title = "----" }, new NamedAction() { diff --git a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs index 11c1d4c73..6a28bff5a 100644 --- a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs +++ b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs @@ -37,22 +37,15 @@ using static MatterHackers.MatterControl.PrinterCommunication.PrinterConnection; namespace MatterHackers.MatterControl.PartPreviewWindow { - public class PopupActionPanel : FlowLayoutWidget, IIgnoredPopupChild - { - public PopupActionPanel() : base(FlowDirection.TopToBottom) - { - this.Padding = 15; - BackgroundColor = Color.White; - } - } - public class MirrorControls : PopupActionPanel + public class MirrorControls : FlowLayoutWidget, IIgnoredPopupChild { private InteractiveScene scene; public MirrorControls(InteractiveScene scene) { this.scene = scene; + this.Padding = 15; FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonContainer.HAnchor = HAnchor.Fit; diff --git a/PartPreviewWindow/View3D/SideBar/ScaleControl.cs b/PartPreviewWindow/View3D/SideBar/ScaleControl.cs index 9efbdc321..00a5e85c1 100644 --- a/PartPreviewWindow/View3D/SideBar/ScaleControl.cs +++ b/PartPreviewWindow/View3D/SideBar/ScaleControl.cs @@ -35,7 +35,7 @@ using MatterHackers.DataConverters3D; namespace MatterHackers.MatterControl.PartPreviewWindow { - public partial class ScaleControls : PopupActionPanel + public partial class ScaleControls : FlowLayoutWidget, IIgnoredPopupChild { private EditableNumberDisplay[] sizeDisplay = new EditableNumberDisplay[3]; internal CheckBox uniformScale; @@ -44,11 +44,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private InteractiveScene scene; public ScaleControls(InteractiveScene scene) + : base (FlowDirection.TopToBottom) { this.scene = scene; var theme = ApplicationController.Instance.Theme; + this.Padding = 15; + List scaleControls = new List(); // Put in the scale ratio edit field diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 53cb2a01c..6cf23cbc3 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -236,7 +236,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } // put in the material options - var alignButton = new PopupButton(smallMarginButtonFactory.Generate("Align".Localize())) + var alignButton = new PopupMenuButton("Align".Localize(), theme) { PopDirection = Direction.Up, PopupContent = this.AddAlignControls(), @@ -294,10 +294,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }; selectionActionBar.AddChild(deleteButton); - // put in the mirror button - var mirrorView = smallMarginButtonFactory.Generate("Mirror".Localize()); - - var mirrorButton = new PopupButton(mirrorView) + var mirrorButton = new PopupMenuButton("Mirror".Localize(), theme) { Name = "Mirror Button", PopDirection = Direction.Up, @@ -311,10 +308,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }; selectionActionBar.AddChild(mirrorButton); - // put in the scale button - var scaleView = smallMarginButtonFactory.Generate("Scale".Localize()); - - var scaleButton = new PopupButton(scaleView) + var scaleButton = new PopupMenuButton("Scale".Localize(), theme) { Name = "Scale Button", PopDirection = Direction.Up, @@ -329,7 +323,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow selectionActionBar.AddChild(scaleButton); // put in the material options - var materialsButton = new PopupButton(smallMarginButtonFactory.Generate("Materials".Localize())) + var materialsButton = new PopupMenuButton("Materials".Localize(), theme) { PopDirection = Direction.Up, PopupContent = this.AddMaterialControls(), @@ -412,13 +406,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow bool isPrinterMode = meshViewerWidget.EditorMode == MeshViewerWidget.EditorType.Printer; - var buttonView = smallMarginButtonFactory.Generate( - label: (isPrinterMode) ? "Bed".Localize() : "Part".Localize(), - normalImage: AggContext.StaticData.LoadIcon((isPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme)); + var buttonView = new FlowLayoutWidget(); + buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((isPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme)) + { + Margin = new BorderDouble(left: 10), + VAnchor = VAnchor.Center + }); + + var buttonText = (isPrinterMode) ? "Bed".Localize() : "Part".Localize(); + buttonView.AddChild(new TextButton(buttonText, theme) + { + Padding = new BorderDouble(8, 4, 0, 4) + }); selectionActionBar.AddChild( - new PopupButton(buttonView) + new PopupMenuButton(buttonView) { + DrawArrow = true, PopDirection = Direction.Up, DynamicPopupContent = () => theme.CreatePopupMenu(bedMenuActions), AlignToRightEdge = true, diff --git a/SetupWizard/DialogPage.cs b/SetupWizard/DialogPage.cs index 0c97916cc..c2549a678 100644 --- a/SetupWizard/DialogPage.cs +++ b/SetupWizard/DialogPage.cs @@ -84,6 +84,7 @@ namespace MatterHackers.MatterControl // Create the header row for the widget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { + Name = "HeaderRow", Margin = new BorderDouble(0, 3, 0, 0), Padding = new BorderDouble(0, 12), HAnchor = HAnchor.Stretch diff --git a/SlicerConfiguration/SliceSettingListControl.cs b/SlicerConfiguration/SliceSettingListControl.cs deleted file mode 100644 index 2b6d688e5..000000000 --- a/SlicerConfiguration/SliceSettingListControl.cs +++ /dev/null @@ -1,58 +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 MatterHackers.Agg; -using MatterHackers.Agg.UI; - -namespace MatterHackers.MatterControl.SlicerConfiguration -{ - internal class SliceSettingListControl : ScrollableWidget - { - private FlowLayoutWidget topToBottomItemList; - - public SliceSettingListControl() - { - this.AnchorAll(); - this.AutoScroll = true; - this.ScrollArea.HAnchor = HAnchor.Stretch; - this.Padding = new BorderDouble(left: 8); - - topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom) - { - HAnchor = HAnchor.Stretch, - }; - base.AddChild(topToBottomItemList); - } - - public override void AddChild(GuiWidget child, int indexInChildrenList = -1) - { - topToBottomItemList.AddChild(child, indexInChildrenList); - } - } -} diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 92827afe9..aecaffb1e 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration private TabControl primaryTabControl; internal PresetsToolbar settingsControlBar; - private SettingsContext settingsContext; + internal SettingsContext settingsContext; private PrinterConfig printer; private Dictionary allUiFields = new Dictionary(); @@ -266,87 +266,26 @@ namespace MatterHackers.MatterControl.SlicerConfiguration child.Padding = new BorderDouble(10); } - var subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); - subGroupLayoutTopToBottom.AnchorAll(); - - bool needToAddSubGroup = false; - foreach (OrganizerSubGroup subGroup in group.SubGroupsList) + FlowLayoutWidget subgroupPanel = CreateGroupContent(group, oemAndUserContext, showHelpControls); + if (subgroupPanel.Children.Count > 0) { - string subGroupTitle = subGroup.Name; - - bool addedSettingToSubGroup = false; - - var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom) + var scrollableWidget = new ScrollableWidget() { - HAnchor = HAnchor.Stretch + AutoScroll = true, + }; - GuiWidget hline = new HorizontalLine(20) - { - Margin = new BorderDouble(top: 5) - }; - topToBottomSettings.AddChild(hline); + scrollableWidget.ScrollArea.HAnchor = HAnchor.Stretch; + scrollableWidget.AnchorAll(); + scrollableWidget.AddChild(subgroupPanel); - foreach (SliceSettingData settingData in subGroup.SettingDataList) - { - // Note: tab sections may disappear if / when they are empty, as controlled by: - // settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup - bool settingShouldBeShown = CheckIfShouldBeShown(settingData, oemAndUserContext); - - if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName) - && settingShouldBeShown) - { - addedSettingToSubGroup = true; - - topToBottomSettings.AddChild( - CreateItemRow(settingData, ref tabIndexForItem)); - - hline = new HorizontalLine(20) - { - Margin = 0 - }; - topToBottomSettings.AddChild(hline); - - if (showHelpControls) - { - topToBottomSettings.AddChild(AddInHelpText(topToBottomSettings, settingData)); - } - } - } - - if (addedSettingToSubGroup) - { - needToAddSubGroup = true; - - var groupBox = new AltGroupBox(subGroupTitle.Localize()) - { - TextColor = ActiveTheme.Instance.PrimaryTextColor, - BorderColor = ActiveTheme.Instance.PrimaryTextColor, - HAnchor = HAnchor.Stretch, - Margin = new BorderDouble(bottom: 8, top: 8), - Padding = new BorderDouble(left: 4), - }; - groupBox.AddChild(topToBottomSettings); - - subGroupLayoutTopToBottom.AddChild(groupBox); - } - } - - if (needToAddSubGroup) - { - SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl(); - - subGroupLayoutTopToBottom.VAnchor = VAnchor.Fit; - subGroupLayoutTopToBottom.HAnchor = HAnchor.Stretch; - - scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom); - groupTabPage.AddChild(scrollOnGroupTab); + groupTabPage.AddChild(scrollableWidget); secondaryTabControl.AddTab(groupTabWidget); } if (group.Name == "Connection") { - subGroupLayoutTopToBottom.AddChild(SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true)); + subgroupPanel.AddChild(SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true)); } } @@ -368,6 +307,74 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return secondaryTabControl; } + public FlowLayoutWidget CreateGroupContent(OrganizerGroup group, SettingsContext oemAndUserContext, bool showHelpControls) + { + var groupPanel = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + VAnchor = VAnchor.Fit, + HAnchor = HAnchor.Stretch + }; + foreach (OrganizerSubGroup subGroup in group.SubGroupsList) + { + var section = AddSettingRowsForSubgroup(subGroup, oemAndUserContext, showHelpControls); + if (section != null) + { + var groupBox = new AltGroupBox(subGroup.Name.Localize()) + { + TextColor = ActiveTheme.Instance.PrimaryTextColor, + BorderColor = ActiveTheme.Instance.PrimaryTextColor, + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(bottom: 8, top: 8), + Padding = new BorderDouble(left: 4), + }; + groupBox.AddChild(section); + + groupPanel.AddChild(groupBox); + } + } + + return groupPanel; + } + + private GuiWidget AddSettingRowsForSubgroup(OrganizerSubGroup subGroup, SettingsContext oemAndUserContext, bool showHelpControls) + { + var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + HAnchor = HAnchor.Stretch, + }; + + topToBottomSettings.AddChild(new HorizontalLine(20) + { + Margin = new BorderDouble(top: 5), + }); + + foreach (SliceSettingData settingData in subGroup.SettingDataList) + { + // Note: tab sections may disappear if / when they are empty, as controlled by: + // settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup + bool settingShouldBeShown = CheckIfShouldBeShown(settingData, oemAndUserContext); + + if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName) + && settingShouldBeShown) + { + topToBottomSettings.AddChild( + CreateItemRow(settingData, ref tabIndexForItem)); + + topToBottomSettings.AddChild(new HorizontalLine(20) + { + Margin = 0 + }); + + if (showHelpControls) + { + topToBottomSettings.AddChild(AddInHelpText(topToBottomSettings, settingData)); + } + } + } + + return (topToBottomSettings.Children.Count == 1) ? null : topToBottomSettings; + } + private bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext) { bool settingShouldBeShown = settingsContext.ParseShowString(settingData.ShowIfSet); @@ -469,7 +476,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } - private GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem) + internal GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem) { return CreateItemRow(settingData, settingsContext, printer, ref tabIndexForItem, allUiFields); } diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 440574a8d..8b77e44a2 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -260,29 +260,49 @@ Advanced min_print_speed Enable cool_extruder_lift - Printer - Connection - Description - printer_name - Details +Printer + General + Common + Settings auto_connect baud_rate com_port selector_ip_address ip_address ip_port - Print Area Size and Coordinates bed_size print_center build_height z_offset bed_shape + Extruders + extruder_count + nozzle_diameter + extruders_share_temperature + extruder_offset + Features Features Interface sla_printer show_reset_connection include_firmware_updater + Print Recovery + recover_is_enabled + recover_first_layer_speed + recover_position_before_z_home + Print Leveling + print_leveling_solution + leveling_manual_positions + print_leveling_required_to_print + Leveling Probe + print_leveling_probe_start + use_z_probe + z_probe_samples + z_probe_xy_offset + z_probe_z_offset + z_servo_depolyed_angle + z_servo_retracted_angle Hardware has_fan has_hardware_leveling @@ -307,24 +327,7 @@ Advanced Advanced use_firmware_retraction vibration_limit - Print Leveling - Machine Settings - print_leveling_solution - leveling_manual_positions - print_leveling_required_to_print - Probe Settings - print_leveling_probe_start - use_z_probe - z_probe_samples - z_probe_xy_offset - z_probe_z_offset - z_servo_depolyed_angle - z_servo_retracted_angle - Print Recovery - Recover Settings - recover_is_enabled - recover_first_layer_speed - recover_position_before_z_home + G-Code Custom G-Code Custom G-Code start_gcode @@ -339,9 +342,3 @@ Advanced Filters write_regex read_regex - Extruder - Extruders - extruder_count - nozzle_diameter - extruders_share_temperature - extruder_offset diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index b474fb5f3..854852100 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit b474fb5f3a2a1c072345bc5960af087a7e9c2564 +Subproject commit 8548521009d049dddc9d16719209ff5e830c36b7