From 832405a5fd617d3b8a60d6a31b7589d61622d82c Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Mon, 4 Oct 2021 17:30:24 +0900 Subject: [PATCH] - Adjust base.xaml to match original(1.8) size for classic themes - Adjust Querybox Width - Add Width and height value for new themes - Merge #722 --- Flow.Launcher.Core/Resource/Theme.cs | 39 ++++++++++++-------------- Flow.Launcher/Themes/Base.xaml | 10 +++---- Flow.Launcher/Themes/Discord Dark.xaml | 6 +++- Flow.Launcher/Themes/League.xaml | 5 ++++ Flow.Launcher/Themes/Pink.xaml | 1 - Flow.Launcher/Themes/Sublime.xaml | 6 +++- Flow.Launcher/Themes/Win10Light.xaml | 8 ++++-- Flow.Launcher/Themes/Win11Dark.xaml | 4 +++ Flow.Launcher/Themes/Win11Light.xaml | 6 +++- 9 files changed, 53 insertions(+), 32 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 5eb5772b6..b12ddb13a 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -145,11 +145,9 @@ namespace Flow.Launcher.Core.Resource public ResourceDictionary GetResourceDictionary() { var dict = CurrentThemeResourceDictionary(); - - Style queryBoxStyle = dict["QueryBoxStyle"] as Style; - Style querySuggestionBoxStyle = dict["QuerySuggestionBoxStyle"] as Style; - - if (queryBoxStyle != null && querySuggestionBoxStyle != null) + + if (dict["QueryBoxStyle"] is Style queryBoxStyle && + dict["QuerySuggestionBoxStyle"] is Style querySuggestionBoxStyle) { var fontFamily = new FontFamily(Settings.QueryBoxFont); var fontStyle = FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.QueryBoxFontStyle); @@ -174,14 +172,11 @@ namespace Flow.Launcher.Core.Resource querySuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontStretchProperty, fontStretch)); } - Style resultItemStyle = dict["ItemTitleStyle"] as Style; - Style resultSubItemStyle = dict["ItemSubTitleStyle"] as Style; - Style resultHotkeyItemStyle = dict["ItemHotkeyStyle"] as Style; - Style resultItemSelectedStyle = dict["ItemTitleSelectedStyle"] as Style; - Style resultSubItemSelectedStyle = dict["ItemSubTitleSelectedStyle"] as Style; - Style resultHotkeyItemSelectedStyle = dict["ItemHotkeySelectedStyle"] as Style; - - if (resultItemStyle != null && resultSubItemStyle != null && resultSubItemSelectedStyle != null && resultItemSelectedStyle != null) + if (dict["ItemTitleStyle"] is Style resultItemStyle && + dict["ItemSubTitleStyle"] is Style resultSubItemStyle && + dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle && + dict["ItemTitleSelectedStyle"] is Style resultItemSelectedStyle && + dict["ItemHotkeySelectedStyle"] is Style resultHotkeyItemSelectedStyle) { Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultFont)); Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.ResultFontStyle)); @@ -189,7 +184,7 @@ namespace Flow.Launcher.Core.Resource Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultFontStretch)); Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; - Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); + Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } var windowStyle = dict["WindowStyle"] as Style; @@ -239,17 +234,19 @@ namespace Flow.Launcher.Core.Resource public void AddDropShadowEffectToCurrentTheme() { - var dict = CurrentThemeResourceDictionary(); + var dict = GetResourceDictionary(); var windowBorderStyle = dict["WindowBorderStyle"] as Style; - var effectSetter = new Setter(); - effectSetter.Property = Border.EffectProperty; - effectSetter.Value = new DropShadowEffect + var effectSetter = new Setter { - Opacity = 0.4, - ShadowDepth = 2, - BlurRadius = 15 + Property = Border.EffectProperty, + Value = new DropShadowEffect + { + Opacity = 0.9, + ShadowDepth = 2, + BlurRadius = 15 + } }; var marginSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.MarginProperty) as Setter; diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 3bfe79386..871e24abc 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -7,11 +7,11 @@ - - + + @@ -40,9 +40,9 @@ diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index 17af0c413..0b2ac4d43 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -10,11 +10,15 @@ + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index 04ab02907..374fddb71 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -6,11 +6,15 @@ + + diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 89c1035e4..259af947e 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -11,12 +11,16 @@ + + - + + + +