diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index 560d620a6..e90ba5dc8 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -723,34 +723,10 @@ namespace MatterHackers.MatterControl ActiveTheme.ThemeChanged.RegisterEvent((s, e) => { - var themeColors = ActiveTheme.Instance; - this.Theme.RebuildTheme(themeColors); - - var json = JsonConvert.SerializeObject(ActiveTheme.Instance); - - var clonedColors = JsonConvert.DeserializeObject(json); - clonedColors.IsDarkTheme = false; - clonedColors.Name = "MenuColors"; - clonedColors.PrimaryTextColor = new Color("#222"); - clonedColors.SecondaryTextColor = new Color("#666"); - clonedColors.PrimaryBackgroundColor = new Color("#fff"); - clonedColors.SecondaryBackgroundColor = new Color("#ddd"); - clonedColors.TertiaryBackgroundColor = new Color("#ccc"); - - this.MenuTheme.RebuildTheme(clonedColors); - - this.RebuildSceneOperations(this.Theme); - -#if DEBUG && !__ANDROID__ - if (AggContext.StaticData is FileSystemStaticData staticData) - { - staticData.PurgeCache(); - } -#endif - + ChangeToTheme(ActiveTheme.Instance); }, ref unregisterEvents); - this.Theme.RebuildTheme(ActiveTheme.Instance); + this.ChangeToTheme(ActiveTheme.Instance); Object3D.AssetsPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, "Assets"); @@ -949,6 +925,33 @@ namespace MatterHackers.MatterControl } } + private void ChangeToTheme(IThemeColors themeColors) + { + this.Theme.RebuildTheme(themeColors); + + var json = JsonConvert.SerializeObject(ActiveTheme.Instance); + + var clonedColors = JsonConvert.DeserializeObject(json); + clonedColors.IsDarkTheme = false; + clonedColors.Name = "MenuColors"; + clonedColors.PrimaryTextColor = new Color("#222"); + clonedColors.SecondaryTextColor = new Color("#666"); + clonedColors.PrimaryBackgroundColor = new Color("#fff"); + clonedColors.SecondaryBackgroundColor = new Color("#ddd"); + clonedColors.TertiaryBackgroundColor = new Color("#ccc"); + + this.MenuTheme.RebuildTheme(clonedColors); + + this.RebuildSceneOperations(this.Theme); + +#if DEBUG && !__ANDROID__ + if (AggContext.StaticData is FileSystemStaticData staticData) + { + staticData.PurgeCache(); + } +#endif + } + public bool RunAnyRequiredPrinterSetup(PrinterConfig printer, ThemeConfig theme) { if (PrintLevelingData.NeedsToBeRun(printer)) @@ -2145,9 +2148,11 @@ namespace MatterHackers.MatterControl var systemWindow = new RootSystemWindow(width, height); + var theme = ApplicationController.Instance.Theme; + var overlay = new GuiWidget() { - BackgroundColor = Color.DarkGray + BackgroundColor = theme.TabBodyBackground }; overlay.AnchorAll(); @@ -2165,7 +2170,7 @@ namespace MatterHackers.MatterControl }; overlay.AddChild(progressPanel); - progressPanel.AddChild(statusText = new TextWidget("", textColor: new Color("#9ad5dd")) + progressPanel.AddChild(statusText = new TextWidget("", textColor: theme.Colors.PrimaryTextColor) { MinimumSize = new Vector2(200, 30), HAnchor = HAnchor.Center, @@ -2174,8 +2179,8 @@ namespace MatterHackers.MatterControl progressPanel.AddChild(progressBar = new ProgressBar() { - FillColor = new Color("#049eb6"), - BorderColor = new Color("#006f83"), + FillColor = theme.Colors.PrimaryAccentColor, + BorderColor = theme.GetBorderColor(75), Height = 11, Width = 230, HAnchor = HAnchor.Center, @@ -2375,6 +2380,9 @@ namespace MatterHackers.MatterControl } }; + // Load theme + ApplicationController.LoadTheme(); + // Hook SystemWindow load and spin up MatterControl once we've hit first draw systemWindow.Load += (s, e) => { @@ -2404,8 +2412,6 @@ namespace MatterHackers.MatterControl { UiThread.RunOnIdle(() => { - var theme = ApplicationController.Instance.Theme; - statusText.Visible = false; var errorTextColor = Color.White; @@ -2478,10 +2484,6 @@ namespace MatterHackers.MatterControl reporter?.Invoke(0.05, "ApplicationController"); var na = ApplicationController.Instance; - // Set the default theme colors - reporter?.Invoke(0.1, "LoadOemOrDefaultTheme"); - ApplicationController.LoadTheme(); - // Accessing any property on ProfileManager will run the static constructor and spin up the ProfileManager instance reporter?.Invoke(0.2, "ProfileManager"); bool na2 = ProfileManager.Instance.IsGuestProfile; diff --git a/RootSystemWindow.cs b/RootSystemWindow.cs index 28d36b0ba..99983b5dd 100644 --- a/RootSystemWindow.cs +++ b/RootSystemWindow.cs @@ -70,6 +70,7 @@ namespace MatterHackers.MatterControl // TODO: Needs review - doesn't seem like we want to scale on Touchscreen, rather we want device specific, configuration based scaling. Suggest remove if (UserSettings.Instance.IsTouchScreen) { + // TODO: This steps on user scaling GuiWidget.DeviceScale = 1.3; SystemWindow.ShareSingleOsWindow = true; }