* Moved VisualTreeHelper and PathOfExileColors to Filtration.Common

* Replaced bindings of PathOfExileColors with x:Static
* Fixed Advanced tab of ColorPicker control in theme editor not being clickable
This commit is contained in:
Ben Wallis
2018-12-05 17:40:59 +00:00
parent 0fe21336e6
commit 9f17d84a7f
16 changed files with 55 additions and 34 deletions

View File

@@ -247,7 +247,6 @@
<Compile Include="UserControls\ThemeComponentSelectionControl.xaml.cs">
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\VisualTreeUtility.cs" />
<Compile Include="ViewModels\DesignTime\DesignTimeItemFilterBlockViewModel.cs" />
<Compile Include="ViewModels\DesignTime\DesignTimeSettingsPageViewModel.cs" />
<Compile Include="Views\AttachedProperties\SelectedItemsAttachedProperty.cs" />
@@ -279,7 +278,6 @@
</Compile>
<Compile Include="Views\Behaviors\BindableSelectedItemBehavior.cs" />
<Compile Include="Views\BindingProxy.cs" />
<Compile Include="Views\PathOfExileColors.cs" />
<Compile Include="Views\SettingsPageView.xaml.cs">
<DependentUpon>SettingsPageView.xaml</DependentUpon>
</Compile>

View File

@@ -17,6 +17,7 @@
* New buttons for adding/removing DisableDropSound from selected blocks have been added (#110)
* The Enable/Disable Block toggle button is now visible on both the Regular Block Items and Appearance Block Items views
* When there are too many block items to fit horizontally in a block a horizontal scrollbar will now appear
* Fixed the Advanced tab in the Color Picker in the Theme Editor not being clickable (#115)
* Fixed the previously incorrect handling of DisableDropSound as a true/false value when in fact it is enabled/disabled purely by its presence or lack thereof in a block (#111)
* Fixed the application freezing for a long period of time when Ctrl+A (Select All) is performed
* Fixed the Switch to Appearance/Regular Block Items text overlapping block items

View File

@@ -11,6 +11,7 @@
xmlns:enums="clr-namespace:Filtration.ObjectModel.Enums;assembly=Filtration.ObjectModel"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:views="clr-namespace:Filtration.Views"
xmlns:utilities="clr-namespace:Filtration.Common.Utilities;assembly=Filtration.Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=userControls:BlockItemControl}"
d:DesignHeight="200" d:DesignWidth="190">
@@ -117,7 +118,7 @@
<!-- Color Template -->
<DataTemplate DataType="{x:Type blockItemBaseTypes:ColorBlockItem}">
<StackPanel>
<xctk:ColorPicker SelectedColor="{Binding Color}" AvailableColors="{Binding ElementName=BlockItemContentControl, Path=DataContext.AvailableColors }" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors"/>
<xctk:ColorPicker SelectedColor="{Binding Color}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors"/>
<userControls:ThemeComponentSelectionControl ThemeComponent="{Binding ThemeComponent}"
Margin="0,2,0,2">

View File

@@ -1,16 +1,13 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
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 Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.ThemeEditor;
using GalaSoft.MvvmLight.CommandWpf;
using Xceed.Wpf.Toolkit;
namespace Filtration.UserControls
{
@@ -81,9 +78,6 @@ namespace Filtration.UserControls
}
}
public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
public List<string> SoundsAvailable => new List<string> {
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
"ShGeneral", "ShBlessed", "ShChaos", "ShDivine", "ShExalted", "ShMirror", "ShAlchemy",

View File

@@ -1,26 +0,0 @@
using System.Windows;
using System.Windows.Media;
namespace Filtration.Utility
{
public class VisualTreeUtility
{
public static T FindParent<T>(DependencyObject child)
where T : DependencyObject
{
//get parent item
var parentObject = VisualTreeHelper.GetParent(child);
//we've reached the end of the tree
if (parentObject == null) return null;
//check if the parent matches the type we're looking for
if (parentObject is T parent)
{
return parent;
}
return FindParent<T>(parentObject);
}
}
}

View File

@@ -139,7 +139,6 @@ namespace Filtration.ViewModels.DesignTime
typeof (HasExplicitModBlockItem)
};
public List<Type> AudioVisualBlockItemTypesAvailable { get; }
public ObservableCollection<ColorItem> AvailableColors { get; }
public Color DisplayTextColor => Colors.Red;
public Color DisplayBackgroundColor => Colors.White;
public Color DisplayBorderColor => Colors.GreenYellow;

View File

@@ -54,7 +54,6 @@ namespace Filtration.ViewModels
IEnumerable<string> AutocompleteItemMods { get; }
List<Type> BlockItemTypesAvailable { get; }
List<Type> AudioVisualBlockItemTypesAvailable { get; }
ObservableCollection<ColorItem> AvailableColors { get; }
Color DisplayTextColor { get; }
Color DisplayBackgroundColor { get; }
Color DisplayBorderColor { get; }
@@ -276,8 +275,6 @@ namespace Filtration.ViewModels
}
}
public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
public Color DisplayTextColor => Block.DisplayTextColor;
public Color DisplayBackgroundColor => Block.DisplayBackgroundColor;
public Color DisplayBorderColor => Block.DisplayBorderColor;

View File

@@ -1,12 +1,9 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Linq;
using System.Windows.Media;
using Filtration.ObjectModel;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.Views;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using Xceed.Wpf.Toolkit;
namespace Filtration.ViewModels
{
@@ -62,8 +59,6 @@ namespace Filtration.ViewModels
_itemFilterScript = itemFilterScript;
}
public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
public Color NewTextColor
{
get => _replaceColorsParameterSet.NewTextColor;

View File

@@ -2,8 +2,8 @@
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Filtration.Common.Utilities;
using Filtration.UserControls;
using Filtration.Utility;
namespace Filtration.Views
{

View File

@@ -1,48 +0,0 @@
using System.Collections.ObjectModel;
using System.Windows.Media;
using Xceed.Wpf.Toolkit;
namespace Filtration.Views
{
internal static class PathOfExileColors
{
static PathOfExileColors()
{
DefaultColors = new ObservableCollection<ColorItem>
{
new ColorItem(new Color {A = 240, R=127, G = 127, B = 127}, "Default"),
new ColorItem(new Color {A = 240, R=255, G = 255, B = 255}, "Value Default"),
new ColorItem(new Color {A = 240, R=255, G = 192, B = 203}, "Pink"),
new ColorItem(new Color {A = 240, R=30, G = 144, B = 255}, "Dodger Blue"),
new ColorItem(new Color {A = 240, R=150, G = 0, B = 0}, "Fire"),
new ColorItem(new Color {A = 240, R=54, G = 100, B = 146}, "Cold"),
new ColorItem(new Color {A = 240, R=255, G = 215, B = 0}, "Lightning"),
new ColorItem(new Color {A = 240, R=208, G = 32, B = 144}, "Chaos"),
new ColorItem(new Color {A = 240, R=136, G = 136, B = 255}, "Augmented"),
new ColorItem(new Color {A = 240, R=184, G = 218, B = 242}, "Crafted"),
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Unmet"),
new ColorItem(new Color {A = 240, R=175, G = 96, B = 37}, "Unique Item"),
new ColorItem(new Color {A = 240, R=255, G = 255, B = 119}, "Rare Item"),
new ColorItem(new Color {A = 240, R=136, G = 136, B = 255}, "Magic Item"),
new ColorItem(new Color {A = 240, R=200, G = 200, B = 200}, "White Item"),
new ColorItem(new Color {A = 240, R=27, G = 162, B = 155}, "Gem Item"),
new ColorItem(new Color {A = 240, R=170, G = 158, B = 130}, "Currency Item"),
new ColorItem(new Color {A = 240, R=74, G = 230, B = 58}, "Quest Item"),
new ColorItem(new Color {A = 240, R=255, G = 200, B = 0}, "Nemesis Mod"),
new ColorItem(new Color {A = 220, R = 255, G = 40, B = 0}, "Nemesis Mod Outline"),
new ColorItem(new Color {A = 240, R=231, G = 180, B = 120}, "Title"),
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Corrupted"),
new ColorItem(new Color {A = 240, R=170, G = 158, B = 130}, "Favour"),
new ColorItem(new Color {A = 240, R=180, G = 96, B = 0}, "Supporter Pack New Item"),
new ColorItem(new Color {A = 240, R=163, G = 141, B = 109}, "Supporter Pack Item"),
new ColorItem(new Color {A = 240, R=210, G = 0, B = 220}, "Bloodline Mod"),
new ColorItem(new Color {A = 200, R = 74, G = 0, B = 160}, "Bloodline Mod Outline"),
new ColorItem(new Color {A = 240, R=50, G = 230, B = 100}, "Torment Mod"),
new ColorItem(new Color {A = 200, R = 0, G = 100, B = 150}, "Torment Mod Outline"),
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Can't Trade or Modify")
};
}
public static ObservableCollection<ColorItem> DefaultColors { get; private set; }
}
}

View File

@@ -6,6 +6,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
xmlns:userControls="clr-namespace:Filtration.UserControls"
xmlns:utilities="clr-namespace:Filtration.Common.Utilities;assembly=Filtration.Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}"
Title="Replace Script Colors" Height="280" Width="540"
@@ -31,22 +32,22 @@
</Grid.ColumnDefinitions>
<CheckBox Grid.Row="0" Grid.Column="0" Content="Replace Text Color" IsChecked="{Binding ReplaceTextColor}" />
<TextBlock Grid.Row="0" Grid.Column="2" VerticalAlignment="Center">Existing Text Color</TextBlock>
<xctk:ColorPicker Grid.Row="0" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldTextColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="0" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldTextColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">New Text Color</TextBlock>
<xctk:ColorPicker Grid.Row="1" Grid.Column="4" SelectedColor="{Binding NewTextColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="1" Grid.Column="4" SelectedColor="{Binding NewTextColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<CheckBox Grid.Row="2" Grid.Column="0" Content="Replace Background Color" IsChecked="{Binding ReplaceBackgroundColor}" />
<TextBlock Grid.Row="2" Grid.Column="2" VerticalAlignment="Center">Existing Background Color</TextBlock>
<xctk:ColorPicker Grid.Row="2" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBackgroundColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="2" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBackgroundColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<TextBlock Grid.Row="3" Grid.Column="2" VerticalAlignment="Center">New Background Color</TextBlock>
<xctk:ColorPicker Grid.Row="3" Grid.Column="4" SelectedColor="{Binding NewBackgroundColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="3" Grid.Column="4" SelectedColor="{Binding NewBackgroundColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<CheckBox Grid.Row="4" Grid.Column="0" Content="Replace Border Color" IsChecked="{Binding ReplaceBorderColor}" />
<TextBlock Grid.Row="4" Grid.Column="2" VerticalAlignment="Center">Existing Border Color</TextBlock>
<xctk:ColorPicker Grid.Row="4" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBorderColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="4" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBorderColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<TextBlock Grid.Row="5" Grid.Column="2" VerticalAlignment="Center">New Border Color</TextBlock>
<xctk:ColorPicker Grid.Row="5" Grid.Column="4" SelectedColor="{Binding NewBorderColor}" AvailableColors="{Binding AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<xctk:ColorPicker Grid.Row="5" Grid.Column="4" SelectedColor="{Binding NewBorderColor}" AvailableColors="{x:Static utilities:PathOfExileColors.DefaultColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors" />
<userControls:ItemPreviewControl Grid.Row="6" Grid.Column="4" TextColor="{Binding DisplayTextColor}" BackgroundColor="{Binding DisplayBackgroundColor}" BorderColor="{Binding DisplayBorderColor}" />
<TextBlock Grid.Row="6" Grid.Column="2" VerticalAlignment="Center">Preview</TextBlock>