diff --git a/AboutPage/HTMLParser/ImageWidget_AsyncLoadOnDraw.cs b/AboutPage/HTMLParser/ImageWidget_AsyncLoadOnDraw.cs
index c142af3e6..c7c9ca0c0 100644
--- a/AboutPage/HTMLParser/ImageWidget_AsyncLoadOnDraw.cs
+++ b/AboutPage/HTMLParser/ImageWidget_AsyncLoadOnDraw.cs
@@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl
void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
- try // if we get a bad result we can get a target ivocation exception. In that case just don't show anything
+ try // if we get a bad result we can get a target invocation exception. In that case just don't show anything
{
byte[] raw = e.Result;
Stream stream = new MemoryStream(raw);
@@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl
{
// The image sampler we use is a 2x2 filter so we need to scale by a max of 1/2 if we want to get good results.
// So we scale as many times as we need to to get the Image to be the right size.
- // If this were going to be a non-uniform scale we could do the x and y separatly to get better results.
+ // If this were going to be a non-uniform scale we could do the x and y separately to get better results.
ImageBuffer halfImage = new ImageBuffer(unScaledImage.Width / 2, unScaledImage.Height / 2, 32, scalingBlender);
halfImage.NewGraphics2D().Render(unScaledImage, 0, 0, 0, halfImage.Width / (double)unScaledImage.Width, halfImage.Height / (double)unScaledImage.Height);
unScaledImage = halfImage;
diff --git a/ControlElements/ImageButtonFactory.cs b/ControlElements/ImageButtonFactory.cs
index 7661ce65b..bef906ba2 100644
--- a/ControlElements/ImageButtonFactory.cs
+++ b/ControlElements/ImageButtonFactory.cs
@@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
+using MatterHackers.Agg.Image;
using MatterHackers.Agg.ImageProcessing;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
@@ -72,10 +73,51 @@ namespace MatterHackers.MatterControl
disabledImageName = normalImageName;
}
- Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName);
- Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName);
- Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName);
- Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName);
+ ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName);
+ ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName);
+ ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName);
+ ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName);
+
+ if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor)
+ {
+ InvertLightness.DoInvertLightness(normalImage);
+ InvertLightness.DoInvertLightness(pressedImage);
+ InvertLightness.DoInvertLightness(hoverImage);
+ InvertLightness.DoInvertLightness(disabledImage);
+ }
+
+ if (ActiveTheme.Instance.IsTouchScreen)
+ {
+ //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);
+ RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0);
+ pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor);
+ }
+
+ ButtonViewStates buttonViewWidget = new ButtonViewStates(
+ new ImageWidget(normalImage),
+ new ImageWidget(hoverImage),
+ new ImageWidget(pressedImage),
+ new ImageWidget(disabledImage)
+ );
+
+ //Create button based on view container widget
+ Button imageButton = new Button(0, 0, buttonViewWidget);
+ imageButton.Margin = new BorderDouble(0);
+ imageButton.Padding = new BorderDouble(0);
+ return imageButton;
+ }
+
+ public Button Generate(ImageBuffer normalImage, ImageBuffer hoverImage, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)
+ {
+ if (pressedImage == null)
+ {
+ pressedImage = hoverImage;
+ }
+
+ if (disabledImage == null)
+ {
+ disabledImage = normalImage;
+ }
if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor)
{
diff --git a/ControlElements/TextImageButtonFactory.cs b/ControlElements/TextImageButtonFactory.cs
index bd4daea42..ae1f8e727 100644
--- a/ControlElements/TextImageButtonFactory.cs
+++ b/ControlElements/TextImageButtonFactory.cs
@@ -33,6 +33,7 @@ using MatterHackers.Agg.ImageProcessing;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
+using MatterHackers.ImageProcessing;
using MatterHackers.VectorMath;
using System;
@@ -201,7 +202,13 @@ namespace MatterHackers.MatterControl
public Button GenerateEditButton()
{
- Button editButton = new Button(0, 0, new ButtonViewThreeImage(LoadUpButtonImage("icon_edit_white.png"), LoadUpButtonImage("icon_edit_gray.png"), LoadUpButtonImage("icon_edit_black.png")));
+ ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png");
+ int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio);
+ normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize);
+
+ Button editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage,
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray),
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black)));
editButton.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentTop;
return editButton;
@@ -211,7 +218,13 @@ namespace MatterHackers.MatterControl
{
FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget();
- editButton = new Button(0, 0, new ButtonViewThreeImage(LoadUpButtonImage("icon_edit_white.png"), LoadUpButtonImage("icon_edit_gray.png"), LoadUpButtonImage("icon_edit_black.png")));
+ ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png");
+ int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio);
+ normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize);
+
+ editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage,
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray),
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black)));
editButton.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentBottom;
textWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
@@ -225,7 +238,13 @@ namespace MatterHackers.MatterControl
{
FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget();
- editButton = new Button(0, 0, new ButtonViewThreeImage(LoadUpButtonImage("icon_edit_white.png"), LoadUpButtonImage("icon_edit_gray.png"), LoadUpButtonImage("icon_edit_black.png")));
+ ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png");
+ int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio);
+ normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize);
+
+ editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage,
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray),
+ WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black)));
editButton.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentBottom;
TextWidget textLabel = new TextWidget(label, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 12);
diff --git a/SlicerConfiguration/SettingsControlSelectors.cs b/SlicerConfiguration/SettingsControlSelectors.cs
index 4b80980e8..1c9c8d426 100644
--- a/SlicerConfiguration/SettingsControlSelectors.cs
+++ b/SlicerConfiguration/SettingsControlSelectors.cs
@@ -29,7 +29,10 @@ either expressed or implied, of the FreeBSD Project.
//#define DO_IN_PLACE_EDIT
using MatterHackers.Agg;
+using MatterHackers.Agg.Image;
+using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
+using MatterHackers.ImageProcessing;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.VectorMath;
@@ -93,7 +96,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
container.HAnchor = HAnchor.ParentLeftRight;
container.Padding = new BorderDouble(6, 0);
- editButton = imageButtonFactory.Generate("icon_edit_white.png", "icon_edit_gray.png");
+ ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png");
+ int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio);
+ normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize);
+
+ editButton = imageButtonFactory.Generate(normalImage, WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray));
editButton.VAnchor = VAnchor.ParentCenter;
editButton.Margin = new BorderDouble(right: 6);
@@ -252,7 +259,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
dropDownList.SelectedValue = ActivePrinterProfile.Instance.GetMaterialSetting(presetIndex).ToString();
}
- catch(Exception e)
+ catch (Exception e)
{
Debug.Print(e.Message);
GuiWidget.BreakInDebugger();
@@ -265,7 +272,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
dropDownList.SelectedValue = ActivePrinterProfile.Instance.ActiveQualitySettingsID.ToString();
}
- catch(Exception e)
+ catch (Exception e)
{
Debug.Print(e.Message);
GuiWidget.BreakInDebugger();
@@ -323,7 +330,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
SelectedLabel = MatterSliceInfo.DisplayName;
}
- catch(Exception e)
+ catch (Exception e)
{
Debug.Print(e.Message);
GuiWidget.BreakInDebugger();
diff --git a/StaticData/Icons/296.png b/StaticData/Icons/296.png
deleted file mode 100644
index a657ac3bb..000000000
Binary files a/StaticData/Icons/296.png and /dev/null differ
diff --git a/StaticData/Icons/icon_edit_black.png b/StaticData/Icons/icon_edit_black.png
deleted file mode 100644
index 236b3f864..000000000
Binary files a/StaticData/Icons/icon_edit_black.png and /dev/null differ
diff --git a/StaticData/Icons/icon_edit_gray.png b/StaticData/Icons/icon_edit_gray.png
deleted file mode 100644
index 33cd953cc..000000000
Binary files a/StaticData/Icons/icon_edit_gray.png and /dev/null differ
diff --git a/StaticData/Icons/icon_edit_white_32x32.png b/StaticData/Icons/icon_edit_white_32x32.png
new file mode 100644
index 000000000..e705bcbec
Binary files /dev/null and b/StaticData/Icons/icon_edit_white_32x32.png differ