diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index ab1ffe400..6fd50646d 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl internal void ClearActivePrinter() { - this.ActivePrinter = emptyPrinter; + this.SetActivePrinter(emptyPrinter); } public void RefreshActiveInstance(PrinterSettings updatedPrinterSettings) @@ -658,10 +658,12 @@ namespace MatterHackers.MatterControl public void ReloadAll() { - var reloadingOverlay = new GuiWidget(); - reloadingOverlay.HAnchor = HAnchor.Stretch; - reloadingOverlay.VAnchor = VAnchor.Stretch; - reloadingOverlay.BackgroundColor = this.Theme.DarkShade; + var reloadingOverlay = new GuiWidget + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch, + BackgroundColor = this.Theme.DarkShade + }; reloadingOverlay.AddChild(new TextWidget("Reloading".Localize() + "...", textColor: Color.White, pointSize: this.Theme.DefaultFontSize * 1.5) { diff --git a/CustomWidgets/ValueDisplayInfo.cs b/CustomWidgets/InlineEditControl.cs similarity index 95% rename from CustomWidgets/ValueDisplayInfo.cs rename to CustomWidgets/InlineEditControl.cs index 40d109dd1..15d75b950 100644 --- a/CustomWidgets/ValueDisplayInfo.cs +++ b/CustomWidgets/InlineEditControl.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2014, Lars Brubaker +Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -31,16 +31,15 @@ using System; using System.Diagnostics; using MatterHackers.Agg; using MatterHackers.Agg.UI; -using MatterHackers.MeshVisualizer; namespace MatterHackers.MatterControl.CustomWidgets { - public class ValueDisplayInfo : GuiWidget + public class InlineEditControl : GuiWidget { private TextWidget numberDisplay; private NumberEdit numberEdit; - public ValueDisplayInfo(string defaultSizeString = "-0000.00", Agg.Font.Justification justification = Agg.Font.Justification.Left) + public InlineEditControl(string defaultSizeString = "-0000.00", Agg.Font.Justification justification = Agg.Font.Justification.Left) { double pointSize = 12; numberDisplay = new TextWidget(defaultSizeString, 0, 0, pointSize, justification: justification) diff --git a/Library/Interfaces/LibraryExtensionMethods.cs b/Library/Interfaces/LibraryExtensionMethods.cs index d4951713c..f02843777 100644 --- a/Library/Interfaces/LibraryExtensionMethods.cs +++ b/Library/Interfaces/LibraryExtensionMethods.cs @@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.Library { return item is ILibraryContentItem || item is SDCardFileItem + || item is PrintHistoryItem || (item is ILibraryContentStream contentStream && ApplicationController.Instance.Library.IsContentFileType(contentStream.FileName)); } diff --git a/Library/Widgets/ListView/IconListView.cs b/Library/Widgets/ListView/IconListView.cs index 5ef869aa6..f0d681e23 100644 --- a/Library/Widgets/ListView/IconListView.cs +++ b/Library/Widgets/ListView/IconListView.cs @@ -50,9 +50,14 @@ namespace MatterHackers.MatterControl.CustomWidgets private List allIconViews = new List(); - public IconListView() + public IconListView(int thumbnailSize = -1) : base(FlowDirection.TopToBottom) { + if (thumbnailSize != -1) + { + this.ThumbHeight = thumbnailSize; + this.ThumbWidth = thumbnailSize; + } } private int reflownWidth = -1; diff --git a/Library/Widgets/ListView/ListView.cs b/Library/Widgets/ListView/ListView.cs index a97f03e8d..e57075b96 100644 --- a/Library/Widgets/ListView/ListView.cs +++ b/Library/Widgets/ListView/ListView.cs @@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.CustomWidgets /// /// The original content view before it was replaced by a container default view /// - private GuiWidget stashedContentView = new IconListView(); + private GuiWidget stashedContentView; // Default constructor uses IconListView public ListView(ILibraryContext context) diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 4fae40aab..cd3f59bb0 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -623,12 +623,7 @@ namespace MatterHackers.MatterControl.PrintLibrary AlwaysEnabled = true, Action = (selectedLibraryItems, listView) => { - listView.ListContentView = new IconListView() - { - ThumbWidth = 256, - ThumbHeight = 256, - }; - + listView.ListContentView = new IconListView(256); listView.Reload().ConfigureAwait(false); }, }); diff --git a/MatterControl.csproj b/MatterControl.csproj index fd2782bb0..deacda461 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -93,6 +93,7 @@ + @@ -104,7 +105,6 @@ - diff --git a/PartPreviewWindow/PartTabPage.cs b/PartPreviewWindow/PartTabPage.cs index a6b76d6f7..7e4f2eb7c 100644 --- a/PartPreviewWindow/PartTabPage.cs +++ b/PartPreviewWindow/PartTabPage.cs @@ -70,11 +70,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.view3DWidget.ResetView(); } }; - viewControls3D.OverflowMenu.DynamicPopupContent = () => - { - return this.GetViewControls3DOverflowMenu(); - }; - + viewControls3D.OverflowMenu.DynamicPopupContent = this.GetViewControls3DOverflowMenu; + bool isPrinterType = this is PrinterTabPage; // The 3D model view @@ -87,21 +84,33 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this, editorType: (isPrinterType) ? MeshViewerWidget.EditorType.Printer : MeshViewerWidget.EditorType.Part); - topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); - topToBottom.AnchorAll(); - this.AddChild(topToBottom); + this.AddChild(topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch + }); - topToBottom.AddChild(viewControls3D); + topToBottom.AddChild(leftToRight = new FlowLayoutWidget() + { + Name = "View3DContainerParent", + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch + }); - leftToRight = new FlowLayoutWidget(); - leftToRight.Name = "View3DContainerParent"; - leftToRight.AnchorAll(); - topToBottom.AddChild(leftToRight); + view3DContainer = new GuiWidget() + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch + }; - view3DContainer = new GuiWidget(); - view3DContainer.AnchorAll(); - - view3DContainer.AddChild(view3DWidget); + var toolbarAndView3DWidget = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch + }; + toolbarAndView3DWidget.AddChild(viewControls3D); + toolbarAndView3DWidget.AddChild(view3DWidget); + view3DContainer.AddChild(toolbarAndView3DWidget); leftToRight.AddChild(view3DContainer); diff --git a/PartPreviewWindow/SaveAsPage.cs b/PartPreviewWindow/SaveAsPage.cs index 34c448391..3cdf5a8cd 100644 --- a/PartPreviewWindow/SaveAsPage.cs +++ b/PartPreviewWindow/SaveAsPage.cs @@ -37,10 +37,6 @@ using MatterHackers.MatterControl.Library; namespace MatterHackers.MatterControl { - public class SaveAsContext : LibraryConfig - { - } - public class SaveAsPage : DialogPage { private Func functionToCallOnSaveAs; @@ -61,24 +57,30 @@ namespace MatterHackers.MatterControl this.HeaderText = "Save New Design".Localize() + ":"; - libraryNavContext = new SaveAsContext() + contentRow.Padding = 0; + + FolderBreadCrumbWidget breadCrumbWidget = null; + + // Create a new library context for the SaveAs view + libraryNavContext = new LibraryConfig() { ActiveContainer = ApplicationController.Instance.Library.RootLibaryContainer }; libraryNavContext.ContainerChanged += (s, e) => { saveAsButton.Enabled = libraryNavContext.ActiveContainer is ILibraryWritableContainer; + breadCrumbWidget.SetBreadCrumbs(libraryNavContext.ActiveContainer); }; - librarySelectorWidget = new ListView(libraryNavContext) + librarySelectorWidget = new ListView(libraryNavContext, new IconListView(75)) { BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor, ShowItems = false, - ContainerFilter = (container) => !container.IsReadOnly + ContainerFilter = (container) => !container.IsReadOnly, }; // put in the bread crumb widget - var breadCrumbWidget = new FolderBreadCrumbWidget(librarySelectorWidget); + breadCrumbWidget = new FolderBreadCrumbWidget(librarySelectorWidget); contentRow.AddChild(breadCrumbWidget); // put in the area to pick the provider to save to @@ -87,9 +89,7 @@ namespace MatterHackers.MatterControl { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch, - Margin = new BorderDouble(5), BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor, - Padding = new BorderDouble(3), }; chooseWindow.AddChild(librarySelectorWidget); contentRow.AddChild(chooseWindow); diff --git a/PartPreviewWindow/SliceLayerSelector.cs b/PartPreviewWindow/SliceLayerSelector.cs index 0bce9eea3..c18e7ba72 100644 --- a/PartPreviewWindow/SliceLayerSelector.cs +++ b/PartPreviewWindow/SliceLayerSelector.cs @@ -39,7 +39,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { public static int SliderWidth { get; } = (UserSettings.Instance.IsTouchScreen) ? 20 : 10; - private ValueDisplayInfo currentLayerInfo; + private InlineEditControl currentLayerInfo; private LayerScrollbar layerScrollbar; private BedConfig sceneContext; @@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow layerSlider = layerScrollbar.layerSlider; - currentLayerInfo = new ValueDisplayInfo("1000") + currentLayerInfo = new InlineEditControl("1000") { GetDisplayString = (value) => $"{value + 1}", HAnchor = HAnchor.Absolute, diff --git a/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs b/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs index be5d4d457..fb1279b5f 100644 --- a/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs +++ b/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs @@ -57,14 +57,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private double lineLength = 55; private List lines = new List(); private double upArrowSize = 7 * GuiWidget.DeviceScale; - private ValueDisplayInfo zHeightDisplayInfo; + private InlineEditControl zHeightDisplayInfo; private bool HadClickOnControl; public MoveInZControl(IInteractionVolumeContext context) : base(context) { Name = "MoveInZControl"; - zHeightDisplayInfo = new ValueDisplayInfo() + zHeightDisplayInfo = new InlineEditControl() { ForceHide = () => { diff --git a/SlicerConfiguration/Settings/ActiveSliceSettings.cs b/SlicerConfiguration/Settings/ActiveSliceSettings.cs index dd035dfed..8b5000518 100644 --- a/SlicerConfiguration/Settings/ActiveSliceSettings.cs +++ b/SlicerConfiguration/Settings/ActiveSliceSettings.cs @@ -28,14 +28,8 @@ either expressed or implied, of the FreeBSD Project. */ using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; using MatterHackers.Agg; -using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; -using MatterHackers.MatterControl.SettingsManagement; -using Newtonsoft.Json; namespace MatterHackers.MatterControl.SlicerConfiguration {