From bc5a005ee7ddbedb4a40ebe46fc55ae0319bda23 Mon Sep 17 00:00:00 2001 From: azakhi Date: Sat, 25 Aug 2018 15:52:16 +0300 Subject: [PATCH] Add font size theme support & improve theme system --- .../BlockItemBaseTypes/ColorBlockItem.cs | 2 +- .../BlockItemBaseTypes/IntegerBlockItem.cs | 42 ++++++++++- .../Enums/ThemeComponentType.cs | 4 +- .../Filtration.ObjectModel.csproj | 2 + Filtration.ObjectModel/IBlockItemWithTheme.cs | 9 +++ .../ThemeEditor/ColorThemeComponent.cs | 4 - .../ThemeEditor/IntegerThemeComponent.cs | 35 +++++++++ Filtration.ObjectModel/ThemeEditor/Theme.cs | 5 ++ .../ThemeEditor/ThemeComponentCollection.cs | 19 +++-- .../Services/ItemFilterBlockTranslator.cs | 12 ++- .../ThemeComponentTypeToStringConverter.cs | 4 + .../Filtration.ThemeEditor.csproj | 1 + .../Providers/ThemeProvider.cs | 3 + .../Services/ThemeService.cs | 23 ++++++ .../ColorThemeComponentViewModel.cs | 1 - .../IntegerThemeComponentViewModel.cs | 7 ++ .../ViewModels/ThemeEditorViewModel.cs | 3 + .../Views/ThemeComponentControl.xaml | 5 ++ Filtration/App.xaml.cs | 1 + .../AvailableThemeComponentsConverter.cs | 6 +- Filtration/UserControls/BlockItemControl.xaml | 18 ++++- .../UserControls/BlockItemControl.xaml.cs | 28 +++++-- .../ThemeComponentSelectionControl.xaml | 73 +++++++++---------- .../ViewModels/ItemFilterScriptViewModel.cs | 2 +- Filtration/ViewModels/MainWindowViewModel.cs | 7 ++ Filtration/Views/MainWindow.xaml | 1 + 26 files changed, 247 insertions(+), 70 deletions(-) create mode 100644 Filtration.ObjectModel/IBlockItemWithTheme.cs create mode 100644 Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs create mode 100644 Filtration.ThemeEditor/ViewModels/IntegerThemeComponentViewModel.cs diff --git a/Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs b/Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs index 7f6efc9..7592642 100644 --- a/Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs +++ b/Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs @@ -4,7 +4,7 @@ using Filtration.ObjectModel.ThemeEditor; namespace Filtration.ObjectModel.BlockItemBaseTypes { - public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem + public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme { private Color _color; private ThemeComponent _themeComponent; diff --git a/Filtration.ObjectModel/BlockItemBaseTypes/IntegerBlockItem.cs b/Filtration.ObjectModel/BlockItemBaseTypes/IntegerBlockItem.cs index 6beb767..2299140 100644 --- a/Filtration.ObjectModel/BlockItemBaseTypes/IntegerBlockItem.cs +++ b/Filtration.ObjectModel/BlockItemBaseTypes/IntegerBlockItem.cs @@ -1,10 +1,13 @@ -using System.Windows.Media; +using System; +using System.Windows.Media; +using Filtration.ObjectModel.ThemeEditor; namespace Filtration.ObjectModel.BlockItemBaseTypes { - public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem + public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme { private int _value; + private ThemeComponent _themeComponent; protected IntegerBlockItem() { @@ -15,7 +18,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes Value = value; } - public override string OutputText => PrefixText + " " + Value; + public override string OutputText => PrefixText + " " + Value + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty); public override string SummaryText => string.Empty; public override Color SummaryBackgroundColor => Colors.Transparent; @@ -24,6 +27,29 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes public abstract int Minimum { get; } public abstract int Maximum { get; } + public ThemeComponent ThemeComponent + { + get { return _themeComponent; } + set + { + if (_themeComponent == value) { return; } + + if (_themeComponent != null) + { + _themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated; + _themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted; + } + if (value != null) + { + value.ThemeComponentUpdated += OnThemeComponentUpdated; + value.ThemeComponentDeleted += OnThemeComponentDeleted; + } + + _themeComponent = value; + OnPropertyChanged(); + } + } + public int Value { get { return _value; } @@ -34,5 +60,15 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes OnPropertyChanged(); } } + + private void OnThemeComponentUpdated(object sender, EventArgs e) + { + Value = ((IntegerBlockItem)sender).Value; + } + + private void OnThemeComponentDeleted(object sender, EventArgs e) + { + ThemeComponent = null; + } } } diff --git a/Filtration.ObjectModel/Enums/ThemeComponentType.cs b/Filtration.ObjectModel/Enums/ThemeComponentType.cs index 4f17dc5..48c20a0 100644 --- a/Filtration.ObjectModel/Enums/ThemeComponentType.cs +++ b/Filtration.ObjectModel/Enums/ThemeComponentType.cs @@ -9,6 +9,8 @@ namespace Filtration.ObjectModel.Enums [Description("Background")] BackgroundColor, [Description("Border")] - BorderColor + BorderColor, + [Description("Font Size")] + FontSize } } diff --git a/Filtration.ObjectModel/Filtration.ObjectModel.csproj b/Filtration.ObjectModel/Filtration.ObjectModel.csproj index 89582ac..bcc1cef 100644 --- a/Filtration.ObjectModel/Filtration.ObjectModel.csproj +++ b/Filtration.ObjectModel/Filtration.ObjectModel.csproj @@ -115,6 +115,7 @@ + @@ -130,6 +131,7 @@ + diff --git a/Filtration.ObjectModel/IBlockItemWithTheme.cs b/Filtration.ObjectModel/IBlockItemWithTheme.cs new file mode 100644 index 0000000..5971eb0 --- /dev/null +++ b/Filtration.ObjectModel/IBlockItemWithTheme.cs @@ -0,0 +1,9 @@ +using Filtration.ObjectModel.ThemeEditor; + +namespace Filtration.ObjectModel +{ + public interface IBlockItemWithTheme : IItemFilterBlockItem + { + ThemeComponent ThemeComponent { get; } + } +} diff --git a/Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs b/Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs index de1ae3d..044f468 100644 --- a/Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs +++ b/Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs @@ -1,8 +1,5 @@ using System; -using System.ComponentModel; -using System.Runtime.CompilerServices; using System.Windows.Media; -using Filtration.ObjectModel.Annotations; using Filtration.ObjectModel.Enums; namespace Filtration.ObjectModel.ThemeEditor @@ -11,7 +8,6 @@ namespace Filtration.ObjectModel.ThemeEditor public class ColorThemeComponent : ThemeComponent { private Color _color; - private readonly object _eventLock = new object(); public ColorThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor) { diff --git a/Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs b/Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs new file mode 100644 index 0000000..a72d822 --- /dev/null +++ b/Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs @@ -0,0 +1,35 @@ +using System; +using System.Windows.Media; +using Filtration.ObjectModel.Enums; + +namespace Filtration.ObjectModel.ThemeEditor +{ + [Serializable] + public class IntegerThemeComponent : ThemeComponent + { + private int _value; + + public IntegerThemeComponent(ThemeComponentType componentType, string componentName, int componentValue) + { + if (componentName == null) + { + throw new ArgumentException("Null parameters not allowed in IntegerThemeComponent constructor"); + } + + ComponentType = componentType; + Value = componentValue; + ComponentName = componentName; + } + + public int Value + { + get { return _value; } + set + { + _value = value; + OnPropertyChanged(); + _themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty); + } + } + } +} diff --git a/Filtration.ObjectModel/ThemeEditor/Theme.cs b/Filtration.ObjectModel/ThemeEditor/Theme.cs index 34b8cbc..a765e30 100644 --- a/Filtration.ObjectModel/ThemeEditor/Theme.cs +++ b/Filtration.ObjectModel/ThemeEditor/Theme.cs @@ -34,5 +34,10 @@ namespace Filtration.ObjectModel.ThemeEditor { _components.Add(new ColorThemeComponent(componentType, componentName, componentColor)); } + + public void AddComponent(ThemeComponentType componentType, string componentName, int componentValue) + { + _components.Add(new IntegerThemeComponent(componentType, componentName, componentValue)); + } } } diff --git a/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs b/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs index d2d88fe..605a62c 100644 --- a/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs +++ b/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs @@ -16,15 +16,20 @@ namespace Filtration.ObjectModel.ThemeEditor return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType); } - ThemeComponent component = null; - switch(componentType) + var component = new ColorThemeComponent(componentType, componentName, componentColor); + Items.Add(component); + + return component; + } + + public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, int componentValue) + { + if (ComponentExists(componentType, componentName)) { - case ThemeComponentType.BackgroundColor: - case ThemeComponentType.BorderColor: - case ThemeComponentType.TextColor: - component = new ColorThemeComponent(componentType, componentName, componentColor); - break; + return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType); } + + var component = new IntegerThemeComponent(componentType, componentName, componentValue); Items.Add(component); return component; diff --git a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs index 3545227..fb1d755 100644 --- a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs +++ b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs @@ -217,11 +217,15 @@ namespace Filtration.Parser.Services // Only ever use the last SetFontSize item encountered as multiples aren't valid. RemoveExistingBlockItemsOfType(block); - var match = Regex.Match(trimmedLine, @"\s+(\d+)"); - if (match.Success) + var match = Regex.Matches(trimmedLine, @"(\s+(\d+)\s*)([#]?)(.*)"); + if (match.Count > 0) { - var blockItemValue = new FontSizeBlockItem(Convert.ToInt16(match.Value)); - block.BlockItems.Add(blockItemValue); + var blockItem = new FontSizeBlockItem(Convert.ToInt16(match[0].Groups[2].Value)); + if(match[0].Groups[3].Value == "#" && !string.IsNullOrWhiteSpace(match[0].Groups[4].Value)) + { + blockItem.ThemeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize, match[0].Groups[4].Value.Trim(), blockItem.Value); + } + block.BlockItems.Add(blockItem); } break; } diff --git a/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs b/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs index 37c9829..2ae7c2d 100644 --- a/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs +++ b/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs @@ -31,6 +31,10 @@ namespace Filtration.ThemeEditor.Converters { return "Background Color Theme Components"; } + case "Font Size": + { + return "Font Size Theme Components"; + } } return type.GetAttributeDescription(); diff --git a/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj b/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj index 4a5d93d..d64952d 100644 --- a/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj +++ b/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj @@ -109,6 +109,7 @@ + diff --git a/Filtration.ThemeEditor/Providers/ThemeProvider.cs b/Filtration.ThemeEditor/Providers/ThemeProvider.cs index 18fb0ed..2c9bec3 100644 --- a/Filtration.ThemeEditor/Providers/ThemeProvider.cs +++ b/Filtration.ThemeEditor/Providers/ThemeProvider.cs @@ -42,6 +42,9 @@ namespace Filtration.ThemeEditor.Providers case ThemeComponentType.TextColor: c.Add(new ColorThemeComponent(component.ComponentType, component.ComponentName, ((ColorThemeComponent)component).Color)); break; + case ThemeComponentType.FontSize: + c.Add(new IntegerThemeComponent(component.ComponentType, component.ComponentName, ((IntegerThemeComponent)component).Value)); + break; } return c; }); diff --git a/Filtration.ThemeEditor/Services/ThemeService.cs b/Filtration.ThemeEditor/Services/ThemeService.cs index 4e3e23d..2885dd0 100644 --- a/Filtration.ThemeEditor/Services/ThemeService.cs +++ b/Filtration.ThemeEditor/Services/ThemeService.cs @@ -42,6 +42,9 @@ namespace Filtration.ThemeEditor.Services case ThemeComponentType.BorderColor: mismatchedComponents = ApplyColorTheme(blocks, typeof(BorderColorBlockItem), component); break; + case ThemeComponentType.FontSize: + mismatchedComponents = ApplyIntegerTheme(blocks, typeof(FontSizeBlockItem), component); + break; } } @@ -72,5 +75,25 @@ namespace Filtration.ThemeEditor.Services return !componentMatched; } + + private bool ApplyIntegerTheme(IEnumerable blocks, Type type, ThemeComponent component) + { + var componentMatched = false; + foreach (var block in blocks) + { + foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type)) + { + var colorBlockItem = (IntegerBlockItem)blockItem; + if (colorBlockItem.ThemeComponent != null && + colorBlockItem.ThemeComponent.ComponentName == component.ComponentName) + { + colorBlockItem.Value = ((IntegerThemeComponent)component).Value; + componentMatched = true; + } + } + } + + return !componentMatched; + } } } diff --git a/Filtration.ThemeEditor/ViewModels/ColorThemeComponentViewModel.cs b/Filtration.ThemeEditor/ViewModels/ColorThemeComponentViewModel.cs index 81c196b..849d61d 100644 --- a/Filtration.ThemeEditor/ViewModels/ColorThemeComponentViewModel.cs +++ b/Filtration.ThemeEditor/ViewModels/ColorThemeComponentViewModel.cs @@ -1,5 +1,4 @@ using System.Windows.Media; -using Filtration.ObjectModel.Enums; namespace Filtration.ThemeEditor.ViewModels { diff --git a/Filtration.ThemeEditor/ViewModels/IntegerThemeComponentViewModel.cs b/Filtration.ThemeEditor/ViewModels/IntegerThemeComponentViewModel.cs new file mode 100644 index 0000000..64d71e4 --- /dev/null +++ b/Filtration.ThemeEditor/ViewModels/IntegerThemeComponentViewModel.cs @@ -0,0 +1,7 @@ +namespace Filtration.ThemeEditor.ViewModels +{ + public class IntegerThemeComponentViewModel : ThemeComponentViewModel + { + public int Value { get; set; } + } +} diff --git a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs index 9552e32..b342082 100644 --- a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs +++ b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs @@ -202,6 +202,9 @@ namespace Filtration.ThemeEditor.ViewModels Components.Add(new ColorThemeComponent(themeComponentType, "Untitled Component", new Color { A = 255, R = 255, G = 255, B = 255 })); break; + case ThemeComponentType.FontSize: + Components.Add(new IntegerThemeComponent(themeComponentType, "Untitled Component", 35)); + break; } } diff --git a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml index bcd5453..231561b 100644 --- a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml +++ b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml @@ -64,6 +64,11 @@ + + + + + diff --git a/Filtration/App.xaml.cs b/Filtration/App.xaml.cs index 61ab85d..192f000 100644 --- a/Filtration/App.xaml.cs +++ b/Filtration/App.xaml.cs @@ -47,6 +47,7 @@ namespace Filtration cfg.CreateMap().ConstructUsingServiceLocator(); cfg.CreateMap().ReverseMap(); cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); cfg.CreateMap(); }); diff --git a/Filtration/Converters/AvailableThemeComponentsConverter.cs b/Filtration/Converters/AvailableThemeComponentsConverter.cs index 0d4b3f3..33a1a2b 100644 --- a/Filtration/Converters/AvailableThemeComponentsConverter.cs +++ b/Filtration/Converters/AvailableThemeComponentsConverter.cs @@ -16,7 +16,7 @@ namespace Filtration.Converters var themeComponentsList = values[0] as ThemeComponentCollection; if (themeComponentsList == null || themeComponentsList.Count == 0) return null; - var blockItem = values[1] as ColorBlockItem; + var blockItem = values[1] as BlockItemBase; if (blockItem == null) return null; ThemeComponentType themeComponentType; @@ -33,6 +33,10 @@ namespace Filtration.Converters { themeComponentType = ThemeComponentType.BorderColor; } + else if (blockItem.GetType() == typeof(FontSizeBlockItem)) + { + themeComponentType = ThemeComponentType.FontSize; + } else { return null; diff --git a/Filtration/UserControls/BlockItemControl.xaml b/Filtration/UserControls/BlockItemControl.xaml index 18ae6ac..abf7363 100644 --- a/Filtration/UserControls/BlockItemControl.xaml +++ b/Filtration/UserControls/BlockItemControl.xaml @@ -116,9 +116,21 @@ - - - + + + + + + + + + + + + + + + diff --git a/Filtration/UserControls/BlockItemControl.xaml.cs b/Filtration/UserControls/BlockItemControl.xaml.cs index 43a9ca7..e312c3d 100644 --- a/Filtration/UserControls/BlockItemControl.xaml.cs +++ b/Filtration/UserControls/BlockItemControl.xaml.cs @@ -6,6 +6,7 @@ using System.Windows; using Filtration.Annotations; using Filtration.ObjectModel; using Filtration.ObjectModel.BlockItemBaseTypes; +using Filtration.ObjectModel.Enums; using Filtration.ObjectModel.ThemeEditor; using Filtration.Views; using GalaSoft.MvvmLight.CommandWpf; @@ -21,10 +22,10 @@ namespace Filtration.UserControls // ReSharper disable once PossibleNullReferenceException (Content as FrameworkElement).DataContext = this; - SetBlockColorCommand = new RelayCommand(OnSetBlockColorCommmand); + SetBlockValueCommand = new RelayCommand(OnSetBlockValueCommmand); } - public RelayCommand SetBlockColorCommand { get; private set; } + public RelayCommand SetBlockValueCommand { get; private set; } public static readonly DependencyProperty BlockItemProperty = DependencyProperty.Register( "BlockItem", @@ -93,12 +94,25 @@ namespace Filtration.UserControls "Icon1", "Icon2", "Icon3", "Icon4", "Icon5", "Icon6" }; - private void OnSetBlockColorCommmand() - { - var blockItem = BlockItem as ColorBlockItem; - if (blockItem?.ThemeComponent == null) return; + private void OnSetBlockValueCommmand() + { + var blockItemWithTheme = BlockItem as IBlockItemWithTheme; + if (blockItemWithTheme?.ThemeComponent == null) return; - blockItem.Color = ((ColorThemeComponent)blockItem.ThemeComponent).Color; + var componentType = ((IBlockItemWithTheme)BlockItem).ThemeComponent.ComponentType; + switch(componentType) + { + case ThemeComponentType.BackgroundColor: + case ThemeComponentType.BorderColor: + case ThemeComponentType.TextColor: + var colorBlockItem = BlockItem as ColorBlockItem; + colorBlockItem.Color = ((ColorThemeComponent)colorBlockItem.ThemeComponent).Color; + break; + case ThemeComponentType.FontSize: + var integerBlockItem = BlockItem as IntegerBlockItem; + integerBlockItem.Value = ((IntegerThemeComponent)integerBlockItem.ThemeComponent).Value; + break; + } } public event PropertyChangedEventHandler PropertyChanged; diff --git a/Filtration/UserControls/ThemeComponentSelectionControl.xaml b/Filtration/UserControls/ThemeComponentSelectionControl.xaml index 19d17ab..97ac25b 100644 --- a/Filtration/UserControls/ThemeComponentSelectionControl.xaml +++ b/Filtration/UserControls/ThemeComponentSelectionControl.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:userControls="clr-namespace:Filtration.UserControls" + xmlns:themeEditor="clr-namespace:Filtration.ObjectModel.ThemeEditor;assembly=Filtration.ObjectModel" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=userControls:ThemeComponentSelectionControl}" @@ -21,7 +22,7 @@ - + @@ -32,44 +33,42 @@ Visibility="{Binding ShowThemeComponentComboBox, Converter={StaticResource BooleanToVisibilityConverter}}"> - + - - - - - - - - - + + + + + + + + + diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index b6cc5d2..01564a4 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -563,7 +563,7 @@ namespace Filtration.ViewModels Script.ThemeComponents.Where( t => Script.ItemFilterBlocks.OfType().Count( - b => b.BlockItems.OfType().Count(i => i.ThemeComponent == t) > 0) == 0).ToList(); + b => b.BlockItems.OfType().Count(i => i.ThemeComponent == t) > 0) == 0).ToList(); if (unusedThemeComponents.Count <= 0) return true; diff --git a/Filtration/ViewModels/MainWindowViewModel.cs b/Filtration/ViewModels/MainWindowViewModel.cs index 358e797..168f006 100644 --- a/Filtration/ViewModels/MainWindowViewModel.cs +++ b/Filtration/ViewModels/MainWindowViewModel.cs @@ -114,6 +114,7 @@ namespace Filtration.ViewModels AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); + AddFontSizeThemeComponentCommand = new RelayCommand(OnAddFontSizeThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null); ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); @@ -213,6 +214,7 @@ namespace Filtration.ViewModels public RelayCommand AddTextColorThemeComponentCommand { get; } public RelayCommand AddBackgroundColorThemeComponentCommand { get; } public RelayCommand AddBorderColorThemeComponentCommand { get; } + public RelayCommand AddFontSizeThemeComponentCommand { get; } public RelayCommand DeleteThemeComponentCommand { get; } public RelayCommand AddBlockCommand { get; } @@ -677,6 +679,11 @@ namespace Filtration.ViewModels _avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.BorderColor); } + private void OnAddFontSizeThemeComponentCommand() + { + _avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.FontSize); + } + private void OnDeleteThemeComponentCommand() { _avalonDockWorkspaceViewModel.ActiveThemeViewModel.DeleteThemeComponentCommand.Execute( diff --git a/Filtration/Views/MainWindow.xaml b/Filtration/Views/MainWindow.xaml index 6120def..2fd013b 100644 --- a/Filtration/Views/MainWindow.xaml +++ b/Filtration/Views/MainWindow.xaml @@ -129,6 +129,7 @@ +