Add font size theme support & improve theme system
This commit is contained in:
parent
8ba3433dcf
commit
bc5a005ee7
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Filtration.ObjectModel.Enums
|
|||
[Description("Background")]
|
||||
BackgroundColor,
|
||||
[Description("Border")]
|
||||
BorderColor
|
||||
BorderColor,
|
||||
[Description("Font Size")]
|
||||
FontSize
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<Compile Include="Factories\IItemFilterScriptFactory.cs" />
|
||||
<Compile Include="FilteredItem.cs" />
|
||||
<Compile Include="IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="IBlockItemWithTheme.cs" />
|
||||
<Compile Include="IItemFilterBlockItem.cs" />
|
||||
<Compile Include="Item.cs" />
|
||||
<Compile Include="ItemFilterBlock.cs" />
|
||||
|
@ -130,6 +131,7 @@
|
|||
<Compile Include="ReplaceColorsParameterSet.cs" />
|
||||
<Compile Include="Socket.cs" />
|
||||
<Compile Include="SocketGroup.cs" />
|
||||
<Compile Include="ThemeEditor\IntegerThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\Theme.cs" />
|
||||
<Compile Include="ThemeEditor\ColorThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\ThemeComponent.cs" />
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
public interface IBlockItemWithTheme : IItemFilterBlockItem
|
||||
{
|
||||
ThemeComponent ThemeComponent { get; }
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,15 +16,20 @@ namespace Filtration.ObjectModel.ThemeEditor
|
|||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
ThemeComponent component = null;
|
||||
switch(componentType)
|
||||
{
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
case ThemeComponentType.BorderColor:
|
||||
case ThemeComponentType.TextColor:
|
||||
component = new ColorThemeComponent(componentType, componentName, componentColor);
|
||||
break;
|
||||
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))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new IntegerThemeComponent(componentType, componentName, componentValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
|
|
|
@ -217,11 +217,15 @@ namespace Filtration.Parser.Services
|
|||
// Only ever use the last SetFontSize item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<FontSizeBlockItem>(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;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ namespace Filtration.ThemeEditor.Converters
|
|||
{
|
||||
return "Background Color Theme Components";
|
||||
}
|
||||
case "Font Size":
|
||||
{
|
||||
return "Font Size Theme Components";
|
||||
}
|
||||
}
|
||||
|
||||
return type.GetAttributeDescription();
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
<Compile Include="Services\ThemePersistenceService.cs" />
|
||||
<Compile Include="Services\ThemeService.cs" />
|
||||
<Compile Include="ViewModels\ColorThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\IntegerThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\IThemeViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\ThemeEditorViewModel.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;
|
||||
});
|
||||
|
|
|
@ -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<ItemFilterBlock> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public class IntegerThemeComponentViewModel : ThemeComponentViewModel
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,11 @@
|
|||
<DataTemplate DataType="{x:Type themeEditor:ColorThemeComponent}">
|
||||
<xctk:ColorPicker SelectedColor="{Binding Color}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Integer Theme Template -->
|
||||
<DataTemplate DataType="{x:Type themeEditor:IntegerThemeComponent}">
|
||||
<xctk:ShortUpDown Value="{Binding Value}" />
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace Filtration
|
|||
cfg.CreateMap<Theme, IThemeEditorViewModel>().ConstructUsingServiceLocator();
|
||||
cfg.CreateMap<ThemeComponent, ThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<ColorThemeComponent, ColorThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<IntegerThemeComponent, IntegerThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<IThemeEditorViewModel, Theme>();
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -116,9 +116,21 @@
|
|||
|
||||
<!-- Font Size Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:FontSizeBlockItem}">
|
||||
<WrapPanel HorizontalAlignment="Left">
|
||||
<xctk:ShortUpDown Value="{Binding Value}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Width="50" />
|
||||
</WrapPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<xctk:ShortUpDown Grid.Column="0" Value="{Binding Value}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Margin="0,0,10,0" />
|
||||
<userControls:ThemeComponentSelectionControl Grid.Column="1" ThemeComponent="{Binding ThemeComponent}">
|
||||
<userControls:ThemeComponentSelectionControl.AvailableThemeComponents>
|
||||
<MultiBinding Converter="{StaticResource AvailableThemeComponentsConverter}">
|
||||
<Binding Path="DataContext.Script.ThemeComponents" RelativeSource="{RelativeSource AncestorType={x:Type views:ItemFilterScriptView}}"/>
|
||||
<Binding Path="." />
|
||||
</MultiBinding>
|
||||
</userControls:ThemeComponentSelectionControl.AvailableThemeComponents>
|
||||
</userControls:ThemeComponentSelectionControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Sound Template -->
|
||||
|
|
|
@ -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()
|
||||
private void OnSetBlockValueCommmand()
|
||||
{
|
||||
var blockItem = BlockItem as ColorBlockItem;
|
||||
if (blockItem?.ThemeComponent == null) return;
|
||||
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;
|
||||
|
|
|
@ -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}"
|
||||
|
@ -32,7 +33,7 @@
|
|||
Visibility="{Binding ShowThemeComponentComboBox, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SetBlockColorCommand, RelativeSource={RelativeSource AncestorType=userControls:BlockItemControl}}" />
|
||||
<i:InvokeCommandAction Command="{Binding SetBlockValueCommand, RelativeSource={RelativeSource AncestorType=userControls:BlockItemControl}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ComboBox.ItemTemplate>
|
||||
|
@ -46,25 +47,23 @@
|
|||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="ComponentNameColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="ComponentColorColumn" Width="20" />
|
||||
<ColumnDefinition SharedSizeGroup="ComponentValueColumn" Width="20" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding ComponentName}" Margin="0,0,2,0" />
|
||||
<Border Grid.Column="1" Background="{Binding Color, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
|
||||
<ContentControl Content="{Binding Mode=OneWay}" Grid.Column="1">
|
||||
<ContentControl.Resources>
|
||||
<DataTemplate DataType="{x:Type themeEditor:ColorThemeComponent}">
|
||||
<Border Background="{Binding Color, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type themeEditor:IntegerThemeComponent}">
|
||||
<TextBlock Text="{Binding Value}" FontWeight="Bold" />
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ComboBoxItem}}" Value="{x:Null}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ComponentName}" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
|
|
@ -563,7 +563,7 @@ namespace Filtration.ViewModels
|
|||
Script.ThemeComponents.Where(
|
||||
t =>
|
||||
Script.ItemFilterBlocks.OfType<ItemFilterBlock>().Count(
|
||||
b => b.BlockItems.OfType<ColorBlockItem>().Count(i => i.ThemeComponent == t) > 0) == 0).ToList();
|
||||
b => b.BlockItems.OfType<IBlockItemWithTheme>().Count(i => i.ThemeComponent == t) > 0) == 0).ToList();
|
||||
|
||||
if (unusedThemeComponents.Count <= 0) return true;
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<fluent:Button SizeDefinition="Middle" Header="Add Text Color" Icon="{StaticResource AddIcon}" Command="{Binding AddTextColorThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Background Color" Icon="{StaticResource AddIcon}" Command="{Binding AddBackgroundColorThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Border Color" Icon="{StaticResource AddIcon}" Command="{Binding AddBorderColorThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Font Size" Icon="{StaticResource AddIcon}" Command="{Binding AddFontSizeThemeComponentCommand}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
<fluent:RibbonGroupBox Header="Delete">
|
||||
<fluent:Button Header="Delete Theme Component" Icon="{StaticResource ThemeComponentDeleteIcon}" LargeIcon="{StaticResource ThemeComponentDeleteIcon}" Command="{Binding DeleteThemeComponentCommand}" />
|
||||
|
|
Loading…
Reference in New Issue