Fixed theme serialization/deserialization and added them toolbar icons
This commit is contained in:
parent
a496ab9b42
commit
1b63f68eee
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Filtration.ObjectModel.Enums;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
namespace Filtration.ObjectModel.ThemeEditor
|
namespace Filtration.ObjectModel.ThemeEditor
|
||||||
|
@ -17,6 +18,8 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
public string FilePath { get; set; }
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
public ThemeComponentCollection Components
|
public ThemeComponentCollection Components
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Filtration.ObjectModel.Annotations;
|
using Filtration.ObjectModel.Annotations;
|
||||||
using Filtration.ObjectModel.Enums;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
@ -13,7 +14,12 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||||
private Color _color;
|
private Color _color;
|
||||||
private EventHandler _themeComponentUpdatedEventHandler;
|
private EventHandler _themeComponentUpdatedEventHandler;
|
||||||
private readonly object _eventLock = new object();
|
private readonly object _eventLock = new object();
|
||||||
|
|
||||||
|
public ThemeComponent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||||
{
|
{
|
||||||
if (componentName == null || componentColor == null)
|
if (componentName == null || componentColor == null)
|
||||||
|
@ -51,7 +57,7 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||||
public event EventHandler ThemeComponentDeleted;
|
public event EventHandler ThemeComponentDeleted;
|
||||||
|
|
||||||
public string ComponentName { get; set; }
|
public string ComponentName { get; set; }
|
||||||
public ThemeComponentType ComponentType{ get; private set; }
|
public ThemeComponentType ComponentType{ get; set; }
|
||||||
|
|
||||||
public Color Color
|
public Color Color
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,6 +169,7 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||||
FilePath = saveDialog.FileName;
|
FilePath = saveDialog.FileName;
|
||||||
_themeProvider.SaveTheme(this, FilePath);
|
_themeProvider.SaveTheme(this, FilePath);
|
||||||
_filenameIsFake = false;
|
_filenameIsFake = false;
|
||||||
|
Title = Filename;
|
||||||
//RemoveDirtyFlag();
|
//RemoveDirtyFlag();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="25" />
|
<RowDefinition Height="25" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.Resources>
|
<Grid.Resources>
|
||||||
<DataTemplate x:Key="EditableComponentNameTemplate">
|
<DataTemplate x:Key="EditableComponentNameTemplate">
|
||||||
<TextBox Text="{Binding ComponentName}" />
|
<TextBox Text="{Binding ComponentName}" />
|
||||||
|
@ -31,23 +27,25 @@
|
||||||
<TextBlock Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" />
|
<TextBlock Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Grid.Resources>
|
</Grid.Resources>
|
||||||
<TextBlock Grid.Row="0"
|
<DockPanel LastChildFill="True">
|
||||||
Grid.Column="1"
|
<TextBlock DockPanel.Dock="Left"
|
||||||
Text="{Binding UsageCount, StringFormat='Usages: {0}'}"
|
Text="{Binding UsageCount, StringFormat='Usages: {0}'}"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Visibility="{Binding Path=DataContext.EditEnabled, RelativeSource={RelativeSource AncestorType={x:Type views:ThemeEditorView}}, Converter={StaticResource BooleanVisibilityConverter}}">
|
HorizontalAlignment="Right"
|
||||||
<TextBlock.Style>
|
Visibility="{Binding Path=DataContext.EditEnabled, RelativeSource={RelativeSource AncestorType={x:Type views:ThemeEditorView}}, Converter={StaticResource BooleanVisibilityConverter}}">
|
||||||
<Style TargetType="TextBlock">
|
<TextBlock.Style>
|
||||||
<Style.Triggers>
|
<Style TargetType="TextBlock">
|
||||||
<DataTrigger Binding="{Binding UsageCount}" Value="0">
|
<Style.Triggers>
|
||||||
<Setter Property="Foreground" Value="Red" />
|
<DataTrigger Binding="{Binding UsageCount}" Value="0">
|
||||||
</DataTrigger>
|
<Setter Property="Foreground" Value="Red" />
|
||||||
</Style.Triggers>
|
</DataTrigger>
|
||||||
<Setter Property="Foreground" Value="SteelBlue"></Setter>
|
</Style.Triggers>
|
||||||
</Style>
|
<Setter Property="Foreground" Value="SteelBlue" />
|
||||||
</TextBlock.Style>
|
</Style>
|
||||||
</TextBlock>
|
</TextBlock.Style>
|
||||||
<ContentControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding}">
|
</TextBlock>
|
||||||
|
</DockPanel>
|
||||||
|
<ContentControl Grid.Row="1" Content="{Binding}">
|
||||||
<ContentControl.Style>
|
<ContentControl.Style>
|
||||||
<Style TargetType="ContentControl">
|
<Style TargetType="ContentControl">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
|
@ -62,6 +60,6 @@
|
||||||
</ContentControl.Style>
|
</ContentControl.Style>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
|
|
||||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" SelectedColor="{Binding Color}" />
|
<xctk:ColorPicker Grid.Row="2" SelectedColor="{Binding Color}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ListViewItem">
|
<ControlTemplate TargetType="ListViewItem">
|
||||||
<Border Name="Border" Padding="2" SnapsToDevicePixels="true">
|
<Border Name="Border" BorderBrush="Black" Background="White" BorderThickness="1" CornerRadius="3" Margin="2" SnapsToDevicePixels="true">
|
||||||
<ContentPresenter />
|
<ContentPresenter />
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
<GroupStyle>
|
<GroupStyle>
|
||||||
<GroupStyle.HeaderTemplate>
|
<GroupStyle.HeaderTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock FontWeight="Bold" FontSize="15" Text="{Binding Path=Name, Converter={StaticResource ThemeComponentTypeToStringConverter}}"/>
|
<TextBlock Margin="7,5,0,0" FontWeight="Bold" FontSize="15" Text="{Binding Path=Name, Converter={StaticResource ThemeComponentTypeToStringConverter}}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GroupStyle.HeaderTemplate>
|
</GroupStyle.HeaderTemplate>
|
||||||
</GroupStyle>
|
</GroupStyle>
|
||||||
|
|
|
@ -427,6 +427,8 @@
|
||||||
<Resource Include="Resources\Icons\ReplaceColors.ico" />
|
<Resource Include="Resources\Icons\ReplaceColors.ico" />
|
||||||
<Resource Include="Resources\Icons\Theme.ico" />
|
<Resource Include="Resources\Icons\Theme.ico" />
|
||||||
<Resource Include="Resources\Icons\filtration_icon.png" />
|
<Resource Include="Resources\Icons\filtration_icon.png" />
|
||||||
|
<Resource Include="Resources\Icons\Add.ico" />
|
||||||
|
<Resource Include="Resources\Icons\ThemeComponentDelete.ico" />
|
||||||
<Content Include="Resources\ItemBaseTypes.txt">
|
<Content Include="Resources\ItemBaseTypes.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
|
@ -29,4 +29,6 @@
|
||||||
<Image Source="/Filtration;component/Resources/Icons/Paste.ico" x:Key="PasteIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/Paste.ico" x:Key="PasteIcon" x:Shared="False" />
|
||||||
<Image Source="/Filtration;component/Resources/Icons/PasteStyle.ico" x:Key="PasteStyleIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/PasteStyle.ico" x:Key="PasteStyleIcon" x:Shared="False" />
|
||||||
<Image Source="/Filtration;component/Resources/Icons/filtration_icon.png" x:Key="FiltrationIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/filtration_icon.png" x:Key="FiltrationIcon" x:Shared="False" />
|
||||||
|
<Image Source="/Filtration;component/Resources/Icons/Add.ico" x:Key="AddIcon" x:Shared="False" />
|
||||||
|
<Image Source="/Filtration;component/Resources/Icons/ThemeComponentDelete.ico" x:Key="ThemeComponentDeleteIcon" x:Shared="False" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
|
@ -10,7 +10,7 @@
|
||||||
xmlns:views="clr-namespace:Filtration.Views"
|
xmlns:views="clr-namespace:Filtration.Views"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
||||||
Title="{Binding WindowTitle}" Height="768" Width="1100" BorderThickness="1" BorderBrush="Black" IsIconVisible="True" >
|
Title="{Binding WindowTitle}" Height="762" Width="1126" IsIconVisible="True" >
|
||||||
<fluent:RibbonWindow.InputBindings>
|
<fluent:RibbonWindow.InputBindings>
|
||||||
<KeyBinding Command="{Binding SaveCommand}" Modifiers="Control" Key="S" />
|
<KeyBinding Command="{Binding SaveCommand}" Modifiers="Control" Key="S" />
|
||||||
<KeyBinding Command="{Binding OpenScriptCommand}" Modifiers="Control" Key="O" />
|
<KeyBinding Command="{Binding OpenScriptCommand}" Modifiers="Control" Key="O" />
|
||||||
|
@ -64,9 +64,9 @@
|
||||||
</fluent:Ribbon.ContextualGroups>
|
</fluent:Ribbon.ContextualGroups>
|
||||||
<fluent:RibbonTabItem Header="View">
|
<fluent:RibbonTabItem Header="View">
|
||||||
<fluent:RibbonGroupBox Header="Tools">
|
<fluent:RibbonGroupBox Header="Tools">
|
||||||
<fluent:ToggleButton Header="Section Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource AddSectionIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.SectionBrowserViewModel.IsVisible}" />
|
<fluent:ToggleButton Header="Section Browser" Width="150" Size="Middle" Icon="{StaticResource AddSectionIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.SectionBrowserViewModel.IsVisible}"/>
|
||||||
<fluent:ToggleButton Header="Block Group Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockGroupBrowserIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockGroupBrowserViewModel.IsVisible}" />
|
<fluent:ToggleButton Header="Block Group Browser" SizeDefinition="Middle" Icon="{StaticResource BlockGroupBrowserIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockGroupBrowserViewModel.IsVisible}" />
|
||||||
<fluent:ToggleButton Header="Block Output Preview" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockOutputPreviewIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockOutputPreviewViewModel.IsVisible}" />
|
<fluent:ToggleButton Header="Block Output Preview" SizeDefinition="Middle" Icon="{StaticResource BlockOutputPreviewIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockOutputPreviewViewModel.IsVisible}" />
|
||||||
</fluent:RibbonGroupBox>
|
</fluent:RibbonGroupBox>
|
||||||
</fluent:RibbonTabItem>
|
</fluent:RibbonTabItem>
|
||||||
<fluent:RibbonTabItem x:Name="ScriptToolsTabItem" Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}" Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" >
|
<fluent:RibbonTabItem x:Name="ScriptToolsTabItem" Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}" Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" >
|
||||||
|
@ -103,12 +103,12 @@
|
||||||
</fluent:RibbonTabItem>
|
</fluent:RibbonTabItem>
|
||||||
<fluent:RibbonTabItem x:Name="ThemeToolsTabItem" Header="Theme Tools" Group="{Binding ElementName=ThemeToolsGroup}" Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}">
|
<fluent:RibbonTabItem x:Name="ThemeToolsTabItem" Header="Theme Tools" Group="{Binding ElementName=ThemeToolsGroup}" Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}">
|
||||||
<fluent:RibbonGroupBox Header="Add Components">
|
<fluent:RibbonGroupBox Header="Add Components">
|
||||||
<fluent:Button SizeDefinition="Middle" Header="Add Text Color" Command="{Binding AddTextColorThemeComponentCommand}" />
|
<fluent:Button SizeDefinition="Middle" Header="Add Text Color" Icon="{StaticResource AddIcon}" Command="{Binding AddTextColorThemeComponentCommand}" />
|
||||||
<fluent:Button SizeDefinition="Middle" Header="Add Background Color" Command="{Binding AddBackgroundColorThemeComponentCommand}" />
|
<fluent:Button SizeDefinition="Middle" Header="Add Background Color" Icon="{StaticResource AddIcon}" Command="{Binding AddBackgroundColorThemeComponentCommand}" />
|
||||||
<fluent:Button SizeDefinition="Middle" Header="Add Border Color" Command="{Binding AddBorderColorThemeComponentCommand}" />
|
<fluent:Button SizeDefinition="Middle" Header="Add Border Color" Icon="{StaticResource AddIcon}" Command="{Binding AddBorderColorThemeComponentCommand}" />
|
||||||
</fluent:RibbonGroupBox>
|
</fluent:RibbonGroupBox>
|
||||||
<fluent:RibbonGroupBox Header="Delete">
|
<fluent:RibbonGroupBox Header="Delete">
|
||||||
<fluent:Button Header="Delete Theme Component" Command="{Binding DeleteThemeComponentCommand}" />
|
<fluent:Button Header="Delete Theme Component" Icon="{StaticResource ThemeComponentDeleteIcon}" LargeIcon="{StaticResource ThemeComponentDeleteIcon}" Command="{Binding DeleteThemeComponentCommand}" />
|
||||||
</fluent:RibbonGroupBox>
|
</fluent:RibbonGroupBox>
|
||||||
</fluent:RibbonTabItem>
|
</fluent:RibbonTabItem>
|
||||||
</fluent:Ribbon>
|
</fluent:Ribbon>
|
||||||
|
|
Loading…
Reference in New Issue