From 30e76e333c6dfc51d806fce055373160b6ec71e7 Mon Sep 17 00:00:00 2001 From: Ben Wallis Date: Sun, 2 Dec 2018 21:36:01 +0000 Subject: [PATCH] * Bumped version to 1.1.0-beta3 * Fixed Switch to Appearance/Regular Block Items text overlapping block item controls * Added Enable/Disable toggle button to Appearance block items control * Added horizontal scrollbar to block items view * Moved Enable/Disable toggle button to separate user control(previously it was only visible when viewing Regular block items) * Added DesignTimeItemFilterBlockViewModel --- Filtration/Filtration.csproj | 8 + Filtration/Filtration.nuspec | 4 + Filtration/Properties/AssemblyInfo.cs | 2 +- .../EnableDisableToggleButton.xaml | 30 ++ .../EnableDisableToggleButton.xaml.cs | 28 ++ .../DesignTimeItemFilterBlockViewModel.cs | 158 ++++++++++ .../ViewModels/ItemFilterBlockViewModel.cs | 41 +++ Filtration/Views/ItemFilterBlockView.xaml | 270 +++++++++--------- 8 files changed, 400 insertions(+), 141 deletions(-) create mode 100644 Filtration/UserControls/EnableDisableToggleButton.xaml create mode 100644 Filtration/UserControls/EnableDisableToggleButton.xaml.cs create mode 100644 Filtration/ViewModels/DesignTime/DesignTimeItemFilterBlockViewModel.cs diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index 24ba2cd..16b01e4 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -238,12 +238,16 @@ EditableListBoxControl.xaml + + EnableDisableToggleButton.xaml + ItemPreviewControl.xaml ThemeComponentSelectionControl.xaml + @@ -282,6 +286,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Filtration/Filtration.nuspec b/Filtration/Filtration.nuspec index 62492eb..aeef0ab 100644 --- a/Filtration/Filtration.nuspec +++ b/Filtration/Filtration.nuspec @@ -12,6 +12,10 @@ * All open filter scripts are now remembered on exit and reopened when the application is started rather than just the last opened one (#95) * Filter sections are once again now expanded by default when scripts are opened, unless the new "Auto-expand all sections when opening scripts" setting is disabled * A new Clear Styles button has been added which removes all styles from the selected block (#96) +* 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 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 * Fixed theme saving (blank theme files were being saved) (#83) * Fixed checkboxes in Block Group Browser (#97) * Fixed the Select Path of Exile data directory dialog appearing after every upgrade (#94) diff --git a/Filtration/Properties/AssemblyInfo.cs b/Filtration/Properties/AssemblyInfo.cs index 3a0da64..d688e82 100644 --- a/Filtration/Properties/AssemblyInfo.cs +++ b/Filtration/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyInformationalVersion("1.1.0-beta2")] +[assembly: AssemblyInformationalVersion("1.1.0-beta3")] [assembly: InternalsVisibleTo("Filtration.Tests")] [assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")] diff --git a/Filtration/UserControls/EnableDisableToggleButton.xaml b/Filtration/UserControls/EnableDisableToggleButton.xaml new file mode 100644 index 0000000..316fb38 --- /dev/null +++ b/Filtration/UserControls/EnableDisableToggleButton.xaml @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/Filtration/UserControls/EnableDisableToggleButton.xaml.cs b/Filtration/UserControls/EnableDisableToggleButton.xaml.cs new file mode 100644 index 0000000..6e6cc08 --- /dev/null +++ b/Filtration/UserControls/EnableDisableToggleButton.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Filtration.UserControls +{ + /// + /// Interaction logic for EnableDisableToggleButton.xaml + /// + public partial class EnableDisableToggleButton : UserControl + { + public EnableDisableToggleButton() + { + InitializeComponent(); + } + } +} diff --git a/Filtration/ViewModels/DesignTime/DesignTimeItemFilterBlockViewModel.cs b/Filtration/ViewModels/DesignTime/DesignTimeItemFilterBlockViewModel.cs new file mode 100644 index 0000000..d9989c0 --- /dev/null +++ b/Filtration/ViewModels/DesignTime/DesignTimeItemFilterBlockViewModel.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows.Media; +using Filtration.ObjectModel; +using Filtration.ObjectModel.BlockItemTypes; +using Filtration.ObjectModel.Commands; +using Filtration.ObjectModel.Enums; +using GalaSoft.MvvmLight.CommandWpf; +using Xceed.Wpf.Toolkit; + +namespace Filtration.ViewModels.DesignTime +{ + internal class FakeCommandManager : ICommandManagerInternal { + public void ExecuteCommand(ICommand command) + { + throw new NotImplementedException(); + } + + public void Undo(int undoLevels = 1) + { + throw new NotImplementedException(); + } + + public void Redo(int redoLevels = 1) + { + throw new NotImplementedException(); + } + + public void SetScript(IItemFilterScriptInternal layout) + { + } + } + + internal class DesignTimeItemFilterBlockViewModel : IItemFilterBlockViewModel + { + private ItemFilterBlock itemFilterBlock; + + public DesignTimeItemFilterBlockViewModel() + { + itemFilterBlock = new ItemFilterBlock(new ItemFilterScript(new FakeCommandManager())) + { + Action = BlockAction.Show, + Enabled = true + }; + + itemFilterBlock.BlockItems.Add(new RarityBlockItem(FilterPredicateOperator.Equal, ItemRarity.Rare)); + itemFilterBlock.BlockItems.Add(new DropLevelBlockItem(FilterPredicateOperator.GreaterThan, 23)); + itemFilterBlock.BlockItems.Add(new BaseTypeBlockItem()); + itemFilterBlock.BlockItems.Add(new BaseTypeBlockItem()); + itemFilterBlock.BlockItems.Add(new BaseTypeBlockItem()); + } + + public void Initialise(IItemFilterBlockBase itemFilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel) + { + //throw new NotImplementedException(); + } + + public IItemFilterBlockBase BaseBlock { get; } + public bool IsDirty { get; set; } + public bool IsVisible { get; set; } + public event EventHandler BlockBecameDirty; + + public bool IsExpanded + { + get => true; + set { } + } + + public IItemFilterBlock Block => itemFilterBlock; + + public bool BlockEnabled + { + get => true; + set { } + } + + public string BlockDescription { get; set; } + public RelayCommand CopyBlockStyleCommand { get; } + public RelayCommand PasteBlockStyleCommand { get; } + public RelayCommand ToggleBlockActionCommand { get; } + public RelayCommand ReplaceColorsCommand { get; } + public RelayCommand AddFilterBlockItemCommand { get; } + public RelayCommand RemoveFilterBlockItemCommand { get; } + public RelayCommand PlaySoundCommand { get; } + public RelayCommand PlayPositionalSoundCommand { get; } + public RelayCommand SwitchBlockItemsViewCommand { get; } + public RelayCommand CustomSoundFileDialogCommand { get; } + public RelayCommand PlayCustomSoundCommand { get; } + public RelayCommand AddBlockGroupCommand { get; } + public RelayCommand DeleteBlockGroupCommand { get; } + public ObservableCollection BlockGroups { get; } + public ObservableCollection BlockGroupSuggestions { get; } + public string BlockGroupSearch { get; set; } + public ObservableCollection BlockItems => Block.BlockItems; + + public IEnumerable SummaryBlockItems + { + get { return Block.BlockItems.Where(b => !(b is IAudioVisualBlockItem)); } + } + + public IEnumerable RegularBlockItems + { + get { return Block.BlockItems.Where(b => !(b is IAudioVisualBlockItem)); } + } + + public IEnumerable AudioVisualBlockItems { get; } + public bool AdvancedBlockGroup { get; } + public bool AudioVisualBlockItemsGridVisible { get; set; } + public bool DisplaySettingsPopupOpen { get; set; } + public IEnumerable AutoCompleteItemClasses { get; } + public IEnumerable AutoCompleteItemBaseTypes { get; } + public IEnumerable AutocompleteItemMods { get; } + public List BlockItemTypesAvailable => new List + { + typeof (ItemLevelBlockItem), + typeof (DropLevelBlockItem), + typeof (QualityBlockItem), + typeof (RarityBlockItem), + typeof (SocketsBlockItem), + typeof (LinkedSocketsBlockItem), + typeof (WidthBlockItem), + typeof (HeightBlockItem), + typeof (SocketGroupBlockItem), + typeof (ClassBlockItem), + typeof (BaseTypeBlockItem), + typeof (IdentifiedBlockItem), + typeof (CorruptedBlockItem), + typeof (ElderItemBlockItem), + typeof (ShaperItemBlockItem), + typeof (MapTierBlockItem), + typeof (ShapedMapBlockItem), + typeof (ElderMapBlockItem), + typeof (GemLevelBlockItem), + typeof (StackSizeBlockItem), + typeof (HasExplicitModBlockItem) + }; + public List AudioVisualBlockItemTypesAvailable { get; } + public ObservableCollection AvailableColors { get; } + public Color DisplayTextColor => Colors.Red; + public Color DisplayBackgroundColor => Colors.White; + public Color DisplayBorderColor => Colors.GreenYellow; + public double DisplayFontSize => 20; + public int DisplayIconSize { get; } + public int DisplayIconColor { get; } + public int DisplayIconShape { get; } + public Color DisplayEffectColor { get; } + public bool HasSound { get; } + public bool HasPositionalSound { get; } + public bool HasCustomSound { get; } + public bool HasAudioVisualBlockItems { get; } + public void RefreshBlockPreview() + { + throw new NotImplementedException(); + } + } +} diff --git a/Filtration/ViewModels/ItemFilterBlockViewModel.cs b/Filtration/ViewModels/ItemFilterBlockViewModel.cs index 586983b..a45fcd1 100644 --- a/Filtration/ViewModels/ItemFilterBlockViewModel.cs +++ b/Filtration/ViewModels/ItemFilterBlockViewModel.cs @@ -25,6 +25,47 @@ namespace Filtration.ViewModels IItemFilterBlock Block { get; } bool BlockEnabled { get; set; } string BlockDescription { get; set; } + RelayCommand CopyBlockStyleCommand { get; } + RelayCommand PasteBlockStyleCommand { get; } + RelayCommand ToggleBlockActionCommand { get; } + RelayCommand ReplaceColorsCommand { get; } + RelayCommand AddFilterBlockItemCommand { get; } + RelayCommand RemoveFilterBlockItemCommand { get; } + RelayCommand PlaySoundCommand { get; } + RelayCommand PlayPositionalSoundCommand { get; } + RelayCommand SwitchBlockItemsViewCommand { get; } + RelayCommand CustomSoundFileDialogCommand { get; } + RelayCommand PlayCustomSoundCommand { get; } + RelayCommand AddBlockGroupCommand { get; } + RelayCommand DeleteBlockGroupCommand { get; } + ObservableCollection BlockGroups { get; } + ObservableCollection BlockGroupSuggestions { get; } + string BlockGroupSearch { get; set; } + ObservableCollection BlockItems { get; } + IEnumerable SummaryBlockItems { get; } + IEnumerable RegularBlockItems { get; } + IEnumerable AudioVisualBlockItems { get; } + bool AdvancedBlockGroup { get; } + bool AudioVisualBlockItemsGridVisible { get; set; } + bool DisplaySettingsPopupOpen { get; set; } + IEnumerable AutoCompleteItemClasses { get; } + IEnumerable AutoCompleteItemBaseTypes { get; } + IEnumerable AutocompleteItemMods { get; } + List BlockItemTypesAvailable { get; } + List AudioVisualBlockItemTypesAvailable { get; } + ObservableCollection AvailableColors { get; } + Color DisplayTextColor { get; } + Color DisplayBackgroundColor { get; } + Color DisplayBorderColor { get; } + double DisplayFontSize { get; } + int DisplayIconSize { get; } + int DisplayIconColor { get; } + int DisplayIconShape { get; } + Color DisplayEffectColor { get; } + bool HasSound { get; } + bool HasPositionalSound { get; } + bool HasCustomSound { get; } + bool HasAudioVisualBlockItems { get; } void RefreshBlockPreview(); } diff --git a/Filtration/Views/ItemFilterBlockView.xaml b/Filtration/Views/ItemFilterBlockView.xaml index e7d1929..f771ccc 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml +++ b/Filtration/Views/ItemFilterBlockView.xaml @@ -3,43 +3,39 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:viewModels="clr-namespace:Filtration.ViewModels" xmlns:userControls="clr-namespace:Filtration.UserControls" xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" xmlns:views="clr-namespace:Filtration.Views" xmlns:converters="clr-namespace:Filtration.Converters" xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel" xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase" + xmlns:designTime="clr-namespace:Filtration.ViewModels.DesignTime" mc:Ignorable="d" - d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterBlockViewModel}" - d:DesignHeight="200" d:DesignWidth="800"> + d:DataContext="{d:DesignInstance Type=designTime:DesignTimeItemFilterBlockViewModel, IsDesignTimeCreatable=True}" + d:DesignHeight="400" d:DesignWidth="817"> - - - - - - - - + + + + @@ -99,7 +95,7 @@ - + @@ -121,9 +117,9 @@ @@ -199,9 +195,9 @@ - - - + + + @@ -240,24 +236,78 @@