Fixed the colors on the pencil icon

This commit is contained in:
Lars Brubaker 2016-05-02 14:20:51 -07:00
parent 906ee5f4f8
commit 1ba768f9ef
2 changed files with 25 additions and 21 deletions

View file

@ -202,13 +202,8 @@ namespace MatterHackers.MatterControl
public Button GenerateEditButton() public Button GenerateEditButton()
{ {
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); Button editButton = GetThemedEditButton();
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.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentTop; editButton.VAnchor = Agg.UI.VAnchor.ParentTop;
return editButton; return editButton;
@ -218,13 +213,8 @@ namespace MatterHackers.MatterControl
{ {
FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget(); FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget();
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); editButton = GetThemedEditButton();
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.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentBottom; editButton.VAnchor = Agg.UI.VAnchor.ParentBottom;
textWidget.VAnchor = Agg.UI.VAnchor.ParentBottom; textWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
@ -234,17 +224,35 @@ namespace MatterHackers.MatterControl
return groupLableAndEditControl; return groupLableAndEditControl;
} }
public GuiWidget GenerateGroupBoxLabelWithEdit(string label, out Button editButton) public static Button GetThemedEditButton()
{ {
FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget();
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png");
int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio);
normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize);
editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage, Button editButton;
if (!ActiveTheme.Instance.IsDarkTheme)
{
editButton = new Button(0, 0, new ButtonViewThreeImage(WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black),
WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray),
normalImage));
}
else
{
editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage,
WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray), WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray),
WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black))); WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black)));
}
return editButton;
}
public GuiWidget GenerateGroupBoxLabelWithEdit(string label, out Button editButton)
{
FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget();
editButton = GetThemedEditButton();
editButton.Margin = new BorderDouble(2, 2, 2, 0); editButton.Margin = new BorderDouble(2, 2, 2, 0);
editButton.VAnchor = Agg.UI.VAnchor.ParentBottom; editButton.VAnchor = Agg.UI.VAnchor.ParentBottom;
TextWidget textLabel = new TextWidget(label, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 12); TextWidget textLabel = new TextWidget(label, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 12);

View file

@ -95,11 +95,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
container.HAnchor = HAnchor.ParentLeftRight; container.HAnchor = HAnchor.ParentLeftRight;
container.Padding = new BorderDouble(6, 0); container.Padding = new BorderDouble(6, 0);
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); editButton = TextImageButtonFactory.GetThemedEditButton();
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.VAnchor = VAnchor.ParentCenter;
editButton.Margin = new BorderDouble(right: 6); editButton.Margin = new BorderDouble(right: 6);