Convert static icons to instance, use theme colors
This commit is contained in:
parent
8e205cce57
commit
f8a15c3b96
6 changed files with 22 additions and 21 deletions
|
|
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
GuiWidget content;
|
||||
|
||||
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize)
|
||||
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
|
||||
{
|
||||
Padding = MenuPadding,
|
||||
};
|
||||
|
|
@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
VAnchor = VAnchor.Fit
|
||||
};
|
||||
|
||||
content.AddChild(new TextWidget(shortCut, pointSize: theme.DefaultFontSize)
|
||||
content.AddChild(new TextWidget(shortCut, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
|
||||
{
|
||||
HAnchor = HAnchor.Right
|
||||
});
|
||||
|
|
@ -114,19 +114,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return menuItem;
|
||||
}
|
||||
|
||||
private static ImageBuffer faChecked = AggContext.StaticData.LoadIcon("fa-check_16.png");
|
||||
|
||||
private static ImageBuffer radioIconChecked;
|
||||
|
||||
private static ImageBuffer radioIconUnchecked;
|
||||
|
||||
public class CheckboxMenuItem : MenuItem, IIgnoredPopupChild, ICheckbox
|
||||
{
|
||||
private bool _checked;
|
||||
|
||||
private ImageBuffer faChecked;
|
||||
|
||||
public CheckboxMenuItem(GuiWidget widget, ThemeConfig theme)
|
||||
: base(widget, theme)
|
||||
{
|
||||
faChecked = AggContext.StaticData.LoadIcon("fa-check_16.png", 16, 16, theme.InvertIcons);
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
|
|
@ -158,6 +155,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
private bool _checked;
|
||||
|
||||
private ImageBuffer radioIconChecked;
|
||||
|
||||
private ImageBuffer radioIconUnchecked;
|
||||
|
||||
public RadioMenuItem(GuiWidget widget, ThemeConfig theme)
|
||||
: base (widget, theme)
|
||||
{
|
||||
|
|
@ -176,14 +177,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
RadioImage.DrawCircle(
|
||||
radioIconChecked.NewGraphics2D(),
|
||||
rect.Center,
|
||||
Color.Black,
|
||||
theme.Colors.IsDarkTheme ? Color.White : Color.Black,
|
||||
isChecked: true,
|
||||
isActive: false);
|
||||
|
||||
RadioImage.DrawCircle(
|
||||
radioIconUnchecked.NewGraphics2D(),
|
||||
rect.Center,
|
||||
Color.Gray,
|
||||
theme.Colors.IsDarkTheme ? Color.White : Color.Black,
|
||||
isChecked: false,
|
||||
isActive: false);
|
||||
}
|
||||
|
|
@ -230,7 +231,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public MenuItem CreateBoolMenuItem(string name, Func<bool> getter, Action<bool> setter, bool useRadioStyle = false, IList<GuiWidget> SiblingRadioButtonList = null)
|
||||
{
|
||||
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize)
|
||||
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
|
||||
{
|
||||
Padding = MenuPadding,
|
||||
};
|
||||
|
|
@ -303,7 +304,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
: base (theme)
|
||||
{
|
||||
this.Padding = new BorderDouble(left: PopupMenu.GutterWidth, right: 15);
|
||||
this.BackgroundColor = Color.White;
|
||||
this.BackgroundColor = theme.Colors.PrimaryBackgroundColor;
|
||||
this.HAnchor = HAnchor.MaxFitOrStretch;
|
||||
this.VAnchor = VAnchor.Fit;
|
||||
this.MinimumSize = new Vector2(150, 32);
|
||||
|
|
@ -340,7 +341,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (content is TextWidget textWidget)
|
||||
{
|
||||
textWidget.TextColor = (value) ? Color.Black : PopupMenu.DisabledTextColor;
|
||||
textWidget.TextColor = (value) ? theme.Colors.PrimaryTextColor : PopupMenu.DisabledTextColor;
|
||||
}
|
||||
|
||||
base.Enabled = value;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
},
|
||||
new NamedAction()
|
||||
{
|
||||
Icon = AggContext.StaticData.LoadIcon("memory_16x16.png", 16, 16),
|
||||
Icon = AggContext.StaticData.LoadIcon("memory_16x16.png", 16, 16, theme.InvertIcons),
|
||||
Title = "Configure EEProm".Localize(),
|
||||
Action = configureEePromButton_Click
|
||||
},
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Name = "Bed Options Menu",
|
||||
DynamicPopupContent = () =>
|
||||
{
|
||||
var menuContent = theme.CreateMenuItems(popupMenu, this.BedMenuActions(sceneContext));
|
||||
var menuContent = theme.CreateMenuItems(popupMenu, this.BedMenuActions(sceneContext, theme));
|
||||
menuContent.MinimumSize = new Vector2(200, 0);
|
||||
|
||||
return menuContent;
|
||||
|
|
@ -475,14 +475,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private NamedAction[] BedMenuActions(BedConfig sceneContext)
|
||||
private NamedAction[] BedMenuActions(BedConfig sceneContext, ThemeConfig theme)
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new NamedAction()
|
||||
{
|
||||
Title = "Insert".Localize(),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube.png", 16, 16),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube.png", 16, 16, theme.InvertIcons),
|
||||
Action = () =>
|
||||
{
|
||||
var extensionsWithoutPeriod = new HashSet<string>(ApplicationSettings.OpenDesignFileParams.Split('|').First().Split(',').Select(s => s.Trim().Trim('.')));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue