diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs
index 4903fdf84..8c167e51f 100644
--- a/ApplicationView/ApplicationController.cs
+++ b/ApplicationView/ApplicationController.cs
@@ -1732,7 +1732,7 @@ namespace MatterHackers.MatterControl
// loading animation stuff
LightingData lighting = new LightingData();
- var logoPath = AggContext.StaticData.MapPath(Path.Combine("OEMSettings", "SampleParts", "MH Logo.stl"));
+ var logoPath = AggContext.StaticData.MapPath(Path.Combine("Stls", "MH Logo.stl"));
var logoMesh = MeshFileIo.Load(logoPath, CancellationToken.None).Mesh;
// Position
diff --git a/DesignTools/Attributes/IconsAttribute.cs b/DesignTools/Attributes/IconsAttribute.cs
new file mode 100644
index 000000000..1968d53c0
--- /dev/null
+++ b/DesignTools/Attributes/IconsAttribute.cs
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2018, 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 System;
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ public class IconsAttribute : Attribute
+ {
+ public bool Item0IsNone { get; private set; }
+ public string[] IconPaths { get; private set; }
+ public int Width { get; set; }
+ public int Height { get; set; }
+ public IconsAttribute(string[] iconPaths, int width = 16, int height = 16, bool item0IsNone = true)
+ {
+ Width = width;
+ Height = height;
+ this.IconPaths = iconPaths;
+ Item0IsNone = item0IsNone;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/Attributes/SortableAttribute.cs b/DesignTools/Attributes/SortableAttribute.cs
new file mode 100644
index 000000000..e441f7b32
--- /dev/null
+++ b/DesignTools/Attributes/SortableAttribute.cs
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2018, 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 System;
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ public class SortableAttribute : Attribute
+ {
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/Attributes/UnlockLinkAttribute.cs b/DesignTools/Attributes/UnlockLinkAttribute.cs
new file mode 100644
index 000000000..8897ea4dc
--- /dev/null
+++ b/DesignTools/Attributes/UnlockLinkAttribute.cs
@@ -0,0 +1,45 @@
+/*
+Copyright (c) 2018, 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 System;
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public class UnlockLinkAttribute : Attribute
+ {
+ public static string DetailPageBaseUrl => "https://www.matterhackers.com/store/l/";
+
+ public string DetailsPageLink { get; private set; }
+ public UnlockLinkAttribute(string detailsPageLink)
+ {
+ DetailsPageLink = detailsPageLink;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/ImageAsset.cs b/DesignTools/ImageAsset.cs
new file mode 100644
index 000000000..94d7d994b
--- /dev/null
+++ b/DesignTools/ImageAsset.cs
@@ -0,0 +1,95 @@
+/*
+Copyright (c) 2018, 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 System.IO;
+using MatterHackers.Agg.Image;
+using MatterHackers.Agg.ImageProcessing;
+using MatterHackers.Agg.Platform;
+using Newtonsoft.Json;
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ public class ImageAsset
+ {
+ private string _assetPath;
+ private ImageBuffer _image;
+ private bool _invert;
+
+ public string AssetPath
+ {
+ get { return _assetPath; }
+ set
+ {
+ if (_assetPath != value)
+ {
+ _assetPath = value;
+ _image = null;
+ }
+ }
+ }
+
+ [JsonIgnore]
+ public ImageBuffer Image
+ {
+ get
+ {
+ if (_image == null)
+ {
+ if (File.Exists(AssetPath))
+ {
+ _image = AggContext.ImageIO.LoadImage(AssetPath);
+ if (Invert)
+ {
+ _image = InvertLightness.DoInvertLightness(_image);
+ }
+ }
+ }
+
+ return _image;
+ }
+
+ private set
+ {
+ }
+ }
+
+ public bool Invert
+ {
+ get { return _invert; }
+ set
+ {
+ if (_invert != value)
+ {
+ _invert = value;
+ _image = null;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/Interfaces/IPropertyGridModifier.cs b/DesignTools/Interfaces/IPropertyGridModifier.cs
new file mode 100644
index 000000000..6501218e2
--- /dev/null
+++ b/DesignTools/Interfaces/IPropertyGridModifier.cs
@@ -0,0 +1,37 @@
+/*
+Copyright (c) 2018, 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.
+*/
+
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ public interface IPropertyGridModifier
+ {
+ void UpdateControls(PublicPropertyEditor editor);
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/Interfaces/IRebuildable.cs b/DesignTools/Interfaces/IRebuildable.cs
new file mode 100644
index 000000000..a07079834
--- /dev/null
+++ b/DesignTools/Interfaces/IRebuildable.cs
@@ -0,0 +1,37 @@
+/*
+Copyright (c) 2018, 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.
+*/
+
+
+namespace MatterHackers.MatterControl.DesignTools
+{
+ public interface IRebuildable
+ {
+ void Rebuild();
+ }
+}
\ No newline at end of file
diff --git a/DesignTools/PublicPropertyEditor.cs b/DesignTools/PublicPropertyEditor.cs
index 51a903112..155dcc9d6 100644
--- a/DesignTools/PublicPropertyEditor.cs
+++ b/DesignTools/PublicPropertyEditor.cs
@@ -30,57 +30,24 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.IO;
using System.Linq;
using System.Reflection;
using MatterHackers.Agg;
+using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.DesignTools.Operations;
+using MatterHackers.MatterControl.Library;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.DesignTools
{
- public interface IRebuildable
- {
- void Rebuild();
- }
-
- public interface IPropertyGridModifier
- {
- void UpdateControls(PublicPropertyEditor editor);
- }
-
- [AttributeUsage(AttributeTargets.Property)]
- public class SortableAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Property)]
- public class IconsAttribute : Attribute
- {
- public string[] IconPaths { get; private set; }
- public IconsAttribute(string[] iconPaths)
- {
- this.IconPaths = iconPaths;
- }
- }
-
- [AttributeUsage(AttributeTargets.Class)]
- public class UnlockLinkAttribute : Attribute
- {
- public static string DetailPageBaseUrl => "https://www.matterhackers.com/store/l/";
-
- public string DetailsPageLink { get; private set; }
- public UnlockLinkAttribute(string detailsPageLink)
- {
- DetailsPageLink = detailsPageLink;
- }
- }
public class PublicPropertyEditor : IObject3DEditor
{
@@ -90,11 +57,12 @@ namespace MatterHackers.MatterControl.DesignTools
public bool Unlocked { get; } = true;
- private static Type[] allowedTypes =
+ private static Type[] allowedTypes =
{
typeof(double), typeof(int), typeof(string), typeof(bool),
typeof(Vector2), typeof(Vector3),
- typeof(DirectionVector), typeof(DirectionAxis)
+ typeof(DirectionVector), typeof(DirectionAxis),
+ typeof(ImageAsset)
};
public const BindingFlags OwnedPropertiesOnly = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
@@ -187,9 +155,10 @@ namespace MatterHackers.MatterControl.DesignTools
AddUnlockLinkIfRequired(editControlsContainer, theme);
- GuiWidget rowContainer = null;
foreach (var property in editableProperties)
{
+ GuiWidget rowContainer = null;
+
// create a double editor
if (property.Value is double doubleValue)
{
@@ -451,6 +420,14 @@ namespace MatterHackers.MatterControl.DesignTools
theme);
editControlsContainer.AddChild(rowContainer);
}
+ // create an image asset editor
+ else if(property.Value is ImageAsset imageAsset)
+ {
+ rowContainer = CreateImageEditor(rebuildable,
+ imageAsset,
+ theme);
+ editControlsContainer.AddChild(rowContainer);
+ }
// remember the row name and widget
editRows.Add(property.PropertyInfo.Name, rowContainer);
@@ -488,10 +465,141 @@ namespace MatterHackers.MatterControl.DesignTools
}
}
+ private GuiWidget CreateImageEditor(IRebuildable item,
+ ImageAsset imageAsset,
+ ThemeConfig theme)
+ {
+ var column = new FlowLayoutWidget(FlowDirection.TopToBottom)
+ {
+ HAnchor = HAnchor.Stretch
+ };
+
+ var imageSection = new SectionWidget(
+ "Image".Localize(),
+ new FlowLayoutWidget(FlowDirection.TopToBottom),
+ theme).ApplyBoxStyle(margin: 0);
+
+ column.AddChild(imageSection);
+
+ ImageBuffer thumbnailImage = SetImage(theme, imageAsset);
+
+ ImageWidget thumbnailWidget;
+ imageSection.ContentPanel.AddChild(thumbnailWidget = new ImageWidget(thumbnailImage)
+ {
+ Margin = new BorderDouble(bottom: 5),
+ HAnchor = HAnchor.Center
+ });
+
+ var changeImageButton = new TextButton("Change".Localize(), theme)
+ {
+ BackgroundColor = theme.MinimalShade
+ };
+ changeImageButton.Click += (sender, e) =>
+ {
+ UiThread.RunOnIdle(() =>
+ {
+ // we do this using to make sure that the stream is closed before we try and insert the Picture
+ AggContext.FileDialogs.OpenFileDialog(
+ new OpenFileDialogParams(
+ "Select an image file|*.jpg;*.png;*.bmp;*.gif;*.pdf",
+ multiSelect: false,
+ title: "Add Image".Localize()),
+ (openParams) =>
+ {
+ if (!File.Exists(openParams.FileName))
+ {
+ return;
+ }
+
+ imageAsset.AssetPath = openParams.FileName;
+ thumbnailWidget.Image = SetImage(theme, imageAsset);
+
+ item?.Rebuild();
+
+ column.Invalidate();
+ });
+ });
+ };
+
+ var row = new FlowLayoutWidget()
+ {
+ HAnchor = HAnchor.Stretch,
+ VAnchor = VAnchor.Fit,
+ };
+ imageSection.ContentPanel.AddChild(row);
+
+ // Invert checkbox
+ var invertCheckbox = new CheckBox(new CheckBoxViewText("Invert".Localize(), textColor: theme.Colors.PrimaryTextColor))
+ {
+ Checked = imageAsset.Invert,
+ Margin = new BorderDouble(0),
+ };
+ invertCheckbox.CheckedStateChanged += (s, e) =>
+ {
+ imageAsset.Invert = invertCheckbox.Checked;
+ thumbnailWidget.Image = SetImage(theme, imageAsset);
+ item?.Rebuild();
+ };
+ row.AddChild(invertCheckbox);
+
+ row.AddChild(new HorizontalSpacer());
+
+ row.AddChild(changeImageButton);
+
+ return column;
+ }
+
+ private ImageBuffer SetImage(ThemeConfig theme, ImageAsset imageAsset)
+ {
+ var image = imageAsset.Image;
+ // Show image load error if needed
+ if (image == null)
+ {
+ image = new ImageBuffer(185, 185).SetPreMultiply();
+ var graphics2D = image.NewGraphics2D();
+
+ graphics2D.FillRectangle(0, 0, 185, 185, theme.MinimalShade);
+ graphics2D.Rectangle(0, 0, 185, 185, theme.SlightShade);
+ graphics2D.DrawString("Error Loading Image".Localize() + "...", 10, 185 / 2, baseline: Agg.Font.Baseline.BoundsCenter, color: Color.Red, pointSize: theme.DefaultFontSize, drawFromHintedCach: true);
+ }
+
+ return (image.Height <= 185) ? image : ScaleThumbnailImage(185, image);
+ }
+
+ private ImageBuffer ScaleThumbnailImage(int height, ImageBuffer imageBuffer)
+ {
+ if (imageBuffer.Height != height)
+ {
+ var factor = (double)height / imageBuffer.Height;
+
+ int width = (int)(imageBuffer.Width * factor);
+
+ var scaledImageBuffer = new ImageBuffer(width, height);
+ scaledImageBuffer.NewGraphics2D().Render(imageBuffer, 0, 0, width, height);
+ return scaledImageBuffer;
+ }
+
+ return imageBuffer;
+ }
+
+ private ImageBuffer ScaleThumbnailImage(int width, int height, ImageBuffer imageBuffer)
+ {
+ if (imageBuffer.Width != width)
+ {
+ var scaledImageBuffer = new ImageBuffer(width, height);
+ scaledImageBuffer.NewGraphics2D().Render(imageBuffer, 0, 0, scaledImageBuffer.Width, scaledImageBuffer.Height);
+ imageBuffer = scaledImageBuffer;
+ }
+
+ return imageBuffer;
+ }
+
private GuiWidget CreateEnumEditor(IRebuildable item,
PropertyInfo propertyInfo, Type propertyType, object value, string displayName,
ThemeConfig theme)
{
+ var propertyGridModifier = item as IPropertyGridModifier;
+
// Enum keyed on name to friendly name
var enumItems = Enum.GetNames(propertyType).Select(enumName =>
{
@@ -511,12 +619,25 @@ namespace MatterHackers.MatterControl.DesignTools
foreach (var enumItem in enumItems)
{
var localIndex = index;
- var iconImage = AggContext.StaticData.LoadIcon(iconsAttribute.IconPaths[localIndex], 16, 16);
+ ImageBuffer iconImage = null;
+ if (iconsAttribute.Width > 0)
+ {
+ iconImage = AggContext.StaticData.LoadIcon(iconsAttribute.IconPaths[localIndex], iconsAttribute.Width, iconsAttribute.Height);
+ }
+ else
+ {
+ iconImage = AggContext.StaticData.LoadIcon(iconsAttribute.IconPaths[localIndex]);
+ }
var radioButton = new RadioButton(new ImageWidget(iconImage));
// set it if checked
if(enumItem.Value == value.ToString())
{
radioButton.Checked = true;
+ if (localIndex != 0
+ || !iconsAttribute.Item0IsNone)
+ {
+ radioButton.BackgroundColor = new Color(Color.Black, 100);
+ }
}
rowContainer.AddChild(radioButton);
@@ -530,7 +651,9 @@ namespace MatterHackers.MatterControl.DesignTools
this.item,
new Object[] { Enum.Parse(propertyType, localItem.Key) });
item?.Rebuild();
- if (localIndex != 0)
+ propertyGridModifier?.UpdateControls(this);
+ if (localIndex != 0
+ || !iconsAttribute.Item0IsNone)
{
radioButton.BackgroundColor = new Color(Color.Black, 100);
}
@@ -561,6 +684,7 @@ namespace MatterHackers.MatterControl.DesignTools
this.item,
new Object[] { Enum.Parse(propertyType, localOredrItem.Key) });
item?.Rebuild();
+ propertyGridModifier?.UpdateControls(this);
};
}
diff --git a/MatterControl.csproj b/MatterControl.csproj
index 2261f113e..e1c50eb46 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -86,6 +86,10 @@
+
+
+
+
@@ -115,6 +119,8 @@
+
+
diff --git a/StaticData/Icons/ch_image.png b/StaticData/Icons/ch_image.png
new file mode 100644
index 000000000..96c5976ec
Binary files /dev/null and b/StaticData/Icons/ch_image.png differ
diff --git a/StaticData/Icons/ch_image_text.png b/StaticData/Icons/ch_image_text.png
new file mode 100644
index 000000000..c7cf17397
Binary files /dev/null and b/StaticData/Icons/ch_image_text.png differ
diff --git a/StaticData/Icons/ch_text.png b/StaticData/Icons/ch_text.png
new file mode 100644
index 000000000..8b48e0b82
Binary files /dev/null and b/StaticData/Icons/ch_text.png differ
diff --git a/StaticData/Images/mh-logo.png b/StaticData/Images/mh-logo.png
index 6b9229e51..47153fcf4 100644
Binary files a/StaticData/Images/mh-logo.png and b/StaticData/Images/mh-logo.png differ
diff --git a/StaticData/Images/splash.png b/StaticData/Images/splash.png
deleted file mode 100644
index 0a5d1c633..000000000
Binary files a/StaticData/Images/splash.png and /dev/null differ
diff --git a/StaticData/CardHolder.stl b/StaticData/Stls/CardHolder.stl
similarity index 100%
rename from StaticData/CardHolder.stl
rename to StaticData/Stls/CardHolder.stl
diff --git a/StaticData/Stls/MH Logo.stl b/StaticData/Stls/MH Logo.stl
new file mode 100644
index 000000000..d12d717ef
Binary files /dev/null and b/StaticData/Stls/MH Logo.stl differ
diff --git a/StaticData/openscad_logo.stl b/StaticData/Stls/openscad_logo.stl
similarity index 100%
rename from StaticData/openscad_logo.stl
rename to StaticData/Stls/openscad_logo.stl
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index c966cd82c..aa02e60a6 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit c966cd82c471da08a7ac3b5cfd201c95381a1a14
+Subproject commit aa02e60a6c33efb0c35606a794e2f9acc1514b1b