diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index 983c5db9a..8a000c221 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl public event EventHandler AnyPrintComplete; - public static string[] ShellFileExtensions => new string[] { ".stl", ".amf", ".3mf", ".obj", ".mcx", ".png", ".jpg", ".jpeg" }; + public static string[] ShellFileExtensions => new string[] { ".stl", ".amf", ".3mf", ".obj", ".mcx", ".png", ".jpg", ".jpeg", ".ttf", ".otf" }; public bool IsMatterControlPro() { @@ -1380,10 +1380,9 @@ namespace MatterHackers.MatterControl { addedWindowsFonts = true; - // add all the windows fonts - // get all the files with the extension .ttf in the windows/fonts directory - var ttfs = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "*.ttf"); - var otf = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "*.otf"); + // add all the fonts from user data "Fonts" folder + var ttfs = Directory.GetFiles(ApplicationDataStorage.Instance.ApplicationFontsDataPath, "*.ttf"); + var otf = Directory.GetFiles(ApplicationDataStorage.Instance.ApplicationFontsDataPath, "*.otf"); var fonts = ttfs.Concat(otf); // add all the fonts to the cache foreach (var font in fonts) diff --git a/MatterControlLib/DataStorage/ApplicationDataStorage.cs b/MatterControlLib/DataStorage/ApplicationDataStorage.cs index 88199594d..41200e62f 100644 --- a/MatterControlLib/DataStorage/ApplicationDataStorage.cs +++ b/MatterControlLib/DataStorage/ApplicationDataStorage.cs @@ -76,7 +76,9 @@ namespace MatterHackers.MatterControl.DataStorage private static string _applicationUserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationDataFolderName); - private static string _applicationLibraryDataPath => Path.Combine(_applicationUserDataPath, "Library"); + private static string _applicationLibraryDataPath => Path.Combine(_applicationUserDataPath, "Library"); + + private static string _applicationFontsDataPath => Path.Combine(_applicationUserDataPath, "Fonts"); private static string _libraryAssetPath => Path.Combine(_applicationLibraryDataPath, "Assets"); @@ -96,6 +98,8 @@ namespace MatterHackers.MatterControl.DataStorage public string ApplicationLibraryDataPath => EnsurePath(_applicationLibraryDataPath); + public string ApplicationFontsDataPath => EnsurePath(_applicationFontsDataPath); + public string CloudLibraryPath => EnsurePath(_cloudLibraryPath); public string LibraryAssetsPath => EnsurePath(_libraryAssetPath); diff --git a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs index 6e8a49433..47b38f430 100644 --- a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs @@ -34,6 +34,7 @@ using System.Threading; using System.Threading.Tasks; using MatterControlLib.DesignTools.Operations.Path; using MatterHackers.Agg.UI; +using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters3D; using MatterHackers.DataConverters3D.UndoCommands; using MatterHackers.Localizations; @@ -44,7 +45,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class LinearExtrudeObject3D : PathObject3DAbstract, IPrimaryOperationsSpecifier, IPropertyGridModifier + public class LinearExtrudeObject3D : Object3D, IPrimaryOperationsSpecifier, IPropertyGridModifier, IPathProvider { [Description("The height of the extrusion")] [Slider(.1, 50, Easing.EaseType.Quadratic, useSnappingGrid: true)] @@ -65,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override bool CanApply => true; - public override bool MeshIsSolidObject => true; + public bool MeshIsSolidObject => true; public override void Apply(UndoBuffer undoBuffer) { @@ -195,5 +196,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations { yield return SceneOperations.ById("AddBase"); } + + public IVertexSource GetRawPath() + { + return this.CombinedVisibleChildrenPaths(); + } } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs index 4ca34c295..971495fa7 100644 --- a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs @@ -231,10 +231,10 @@ namespace MatterHackers.MatterControl.DesignTools }); // and create the base - var vertexSource = GetRawPath(); + var vertexSource = this.CombinedVisibleChildrenPaths(); - // Convert VertexSource into expected Polygons - Polygons polygonShape = (vertexSource == null) ? null : vertexSource.CreatePolygons(); + // Convert VertexSource into expected Polygons + Polygons polygonShape = (vertexSource == null) ? null : vertexSource.CreatePolygons(); GenerateBase(polygonShape, firstChild.GetAxisAlignedBoundingBox().MinXYZ.Z); } diff --git a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs index c6f802b33..23b31b4cf 100644 --- a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs +++ b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs @@ -42,6 +42,7 @@ using MatterHackers.DataConverters3D; using MatterHackers.ImageProcessing; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.Library; using MatterHackers.MatterControl.Library.Widgets; using MatterHackers.MatterControl.PartPreviewWindow.PlusTab; @@ -510,7 +511,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } break; - default: + case ".ttf": + case ".otf": + { + // check if the file is already in the fonts directory + if (!File.Exists(Path.Combine(ApplicationDataStorage.Instance.ApplicationFontsDataPath, Path.GetFileName(filePath)))) + { + // make sure the directory exists + Directory.CreateDirectory(ApplicationDataStorage.Instance.ApplicationFontsDataPath); + + // copy the file to the fonts directory + var newFilePath = Path.Combine(ApplicationDataStorage.Instance.ApplicationFontsDataPath, Path.GetFileName(filePath)); + File.Copy(filePath, newFilePath, true); + } + } + break; + + default: { var workspace = await CreateNewDesignTab(false); workspace.SceneContext.AddToPlate(new string[] { filePath }, false); diff --git a/MatterControlLib/SettingsManagement/ApplicationSettings.cs b/MatterControlLib/SettingsManagement/ApplicationSettings.cs index 9191d1217..9b42d3292 100644 --- a/MatterControlLib/SettingsManagement/ApplicationSettings.cs +++ b/MatterControlLib/SettingsManagement/ApplicationSettings.cs @@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl public static string LibraryFilterFileExtensions { get; } = ValidFileExtensions + ",.gcode"; - public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, 3MF, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx"; + public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, 3MF, MCX, TTF, OTF|*.stl;*.amf;*.obj;*.mcx;*.ttf;*.otf"; private static ApplicationSettings globalInstance = null; diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 32264001e..a107c21f6 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -2434,6 +2434,9 @@ Translated:Image Converter English:Image Missing Translated:Image Missing +English:Image Search +Translated:Image Search + English:Image to Path Translated:Image to Path diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 4a3185d8d..2f0d72553 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 4a3185d8d49855cf6ade9d2bf2ada19e101d731f +Subproject commit 2f0d725538c880d740ed516d6eb9d3d261f68c58