From 62b7ecd82f6805bbceb732d287ba581eb82953de Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 17:15:04 -0800 Subject: [PATCH] Pass in and use theme --- ApplicationView/WidescreenPanel.cs | 2 +- .../ApplicationSettings/ApplicationSettingsView.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 8f65a3dce..90f73facb 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -116,7 +116,7 @@ namespace MatterHackers.MatterControl this.VAnchor = VAnchor.Fit; this.HAnchor = HAnchor.Stretch; this.Margin = 0; - this.PopupContent = new ApplicationSettingsWidget(theme.MenuButtonFactory) + this.PopupContent = new ApplicationSettingsWidget(theme.MenuButtonFactory, theme) { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Fit, diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 07b9f9d3a..cbf094f3a 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage private Color menuTextColor = Color.Black; - public ApplicationSettingsWidget(TextImageButtonFactory buttonFactory) + public ApplicationSettingsWidget(TextImageButtonFactory buttonFactory, ThemeConfig theme) : base(FlowDirection.TopToBottom) { this.buttonFactory = buttonFactory; @@ -161,7 +161,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage #if !__ANDROID__ { // ThumbnailRendering - var thumbnailsModeDropList = new DropDownList("", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200, pointSize: ApplicationController.Instance.Theme.DefaultFontSize) + var thumbnailsModeDropList = new DropDownList("", theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize) { TextColor = menuTextColor, }; @@ -304,7 +304,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage this.AddSettingsRow(updateMatterControl); this.AddChild(new SettingsItem("Theme".Localize(), new GuiWidget())); - this.AddChild(this.GetThemeControl()); + this.AddChild(this.GetThemeControl(theme)); this.AddChild(new HorizontalLine(70) { Margin = new BorderDouble(left: 30), @@ -322,10 +322,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage Margin = new BorderDouble(10, 0), Padding = new BorderDouble(2), Border = new BorderDouble(1), - BorderColor = ActiveTheme.Instance.PrimaryAccentColor, + BorderColor = theme.Colors.PrimaryAccentColor, VAnchor = VAnchor.Center | VAnchor.Fit }; - blueBox.AddChild(new TextWidget("64", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryAccentColor)); + blueBox.AddChild(new TextWidget("64", pointSize: 8, textColor: theme.Colors.PrimaryAccentColor)); aboutMatterControl.AddChild(blueBox); } @@ -359,7 +359,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage }); } - private FlowLayoutWidget GetThemeControl() + private FlowLayoutWidget GetThemeControl(ThemeConfig theme) { var container = new FlowLayoutWidget(FlowDirection.TopToBottom) { @@ -367,7 +367,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage }; // Determine if we should set the dark or light version of the theme - var activeThemeIndex = ActiveTheme.AvailableThemes.IndexOf(ActiveTheme.Instance); + var activeThemeIndex = ActiveTheme.AvailableThemes.IndexOf(theme.Colors); var midPoint = ActiveTheme.AvailableThemes.Count / 2;