Refactoring
This commit is contained in:
parent
32a192c2b8
commit
6f3fe2fddc
6 changed files with 472 additions and 726 deletions
|
|
@ -44,11 +44,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
{
|
||||
public class ThemeColorPanel : FlowLayoutWidget
|
||||
{
|
||||
private Color lastColor;
|
||||
private AccentColorsWidget colorSelector;
|
||||
private ThemeConfig theme;
|
||||
private readonly AccentColorsWidget colorSelector;
|
||||
private readonly ThemeConfig theme;
|
||||
private IColorTheme _themeProvider;
|
||||
private GuiWidget previewButtonPanel;
|
||||
private readonly GuiWidget previewButtonPanel;
|
||||
|
||||
public ThemeColorPanel(ThemeConfig theme, AccentColorsWidget colorSelector)
|
||||
: base (FlowDirection.TopToBottom)
|
||||
|
|
@ -67,8 +66,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
_themeProvider = AppContext.ThemeProviders.Values.First();
|
||||
}
|
||||
|
||||
accentPanelColor = theme.ResolveColor(theme.SectionBackgroundColor, theme.SlightShade);
|
||||
|
||||
this.SelectionColor = theme.MinimalShade;
|
||||
|
||||
this.AddChild(previewButtonPanel = new FlowLayoutWidget()
|
||||
|
|
@ -83,8 +80,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
public ImageBuffer CheckMark { get; } = StaticData.Instance.LoadIcon("fa-check_16.png", 16, 16, invertImage: true);
|
||||
|
||||
private Color accentPanelColor;
|
||||
|
||||
public Color SelectionColor { get; private set; }
|
||||
|
||||
public IColorTheme ThemeProvider
|
||||
|
|
@ -104,8 +99,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
{
|
||||
previewButtonPanel.CloseChildren();
|
||||
|
||||
var accentColor = theme.PrimaryAccentColor;
|
||||
|
||||
int providerIndex = 0;
|
||||
|
||||
foreach (var provider in AppContext.ThemeProviders.Values)
|
||||
|
|
@ -210,10 +203,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
}
|
||||
}
|
||||
|
||||
public void SetThemeColor(ThemeSet themeSet, Color accentColor, string mode = null)
|
||||
public void SetThemeColor(ThemeSet themeSet, Color accentColor)
|
||||
{
|
||||
lastColor = accentColor;
|
||||
|
||||
if (colorSelector != null)
|
||||
{
|
||||
foreach (var colorButton in colorSelector.ColorButtons)
|
||||
|
|
@ -232,10 +223,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
public class AccentColorsWidget : FlowLayoutWidget
|
||||
{
|
||||
private int containerHeight;
|
||||
private int buttonSpacing;
|
||||
private List<ColorButton> colorButtons = new List<ColorButton>();
|
||||
private ThemeSet themeSet;
|
||||
private readonly int containerHeight;
|
||||
private readonly int buttonSpacing;
|
||||
private readonly List<ColorButton> colorButtons = new();
|
||||
private readonly ThemeSet themeSet;
|
||||
|
||||
public AccentColorsWidget(ThemeSet themeSet, int buttonHeight = 18, int buttonSpacing = 3)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue