From 09745796849015d419d10fa06ac74fd1fdd4ff99 Mon Sep 17 00:00:00 2001 From: azakhi Date: Wed, 22 Aug 2018 11:41:02 +0300 Subject: [PATCH] Add requested changes & minor bug fixes --- .../BlockItemTypes/GemLevelBlockItem.cs | 2 +- .../Services/ItemFilterBlockTranslator.cs | 9 ++- .../Services/ItemFilterScriptTranslator.cs | 6 ++ Filtration/Converters/DropIconConverter.cs | 2 +- Filtration/Filtration.csproj | 1 + Filtration/Resources/DropIcons/NoIcon.png | Bin 0 -> 2797 bytes .../ItemFilterCommentBlockViewModel.cs | 15 +++- .../ViewModels/ItemFilterScriptViewModel.cs | 30 ++++++- .../Views/ItemFilterCommentBlockView.xaml | 73 +++++++++--------- 9 files changed, 92 insertions(+), 46 deletions(-) create mode 100644 Filtration/Resources/DropIcons/NoIcon.png diff --git a/Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs b/Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs index 35bc632..f12136d 100644 --- a/Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs +++ b/Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs @@ -23,6 +23,6 @@ namespace Filtration.ObjectModel.BlockItemTypes public override Color SummaryTextColor => Colors.White; public override int SortOrder => 15; public override int Minimum => 0; - public override int Maximum => 40; + public override int Maximum => 21; } } diff --git a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs index 9f306fb..3e23653 100644 --- a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs +++ b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs @@ -299,7 +299,7 @@ namespace Filtration.Parser.Services } case "Icon": { - // Only ever use the last PlayAlertSound item encountered as multiples aren't valid. + // Only ever use the last Icon item encountered as multiples aren't valid. RemoveExistingBlockItemsOfType(block); var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)"); @@ -593,10 +593,11 @@ namespace Filtration.Parser.Services } } + //TODO: Disabled for the time being. A better solution is needed. // Replace 'Maelström' to prevent encoding problems in other editors - outputString.Replace("Maelström Staff", "Maelstr"); - outputString.Replace("Maelström of Chaos", "Maelstr"); - outputString.Replace("Maelström", "Maelstr"); + //outputString.Replace("Maelström Staff", "Maelstr"); + //outputString.Replace("Maelström of Chaos", "Maelstr"); + //outputString.Replace("Maelström", "Maelstr"); return outputString; } diff --git a/Filtration.Parser/Services/ItemFilterScriptTranslator.cs b/Filtration.Parser/Services/ItemFilterScriptTranslator.cs index 6407226..dc2d967 100644 --- a/Filtration.Parser/Services/ItemFilterScriptTranslator.cs +++ b/Filtration.Parser/Services/ItemFilterScriptTranslator.cs @@ -245,6 +245,12 @@ namespace Filtration.Parser.Services // ReSharper disable once LoopCanBeConvertedToQuery foreach (var block in script.ItemFilterBlocks) { + // Do not save temporary block until the new feature is fully implemented + if(block is ObjectModel.BlockItemTypes.IconBlockItem) + { + continue; + } + outputString += _blockTranslator.TranslateItemFilterBlockBaseToString(block) + Environment.NewLine; if (Settings.Default.ExtraLineBetweenBlocks) diff --git a/Filtration/Converters/DropIconConverter.cs b/Filtration/Converters/DropIconConverter.cs index 1f4b21a..4caeffa 100644 --- a/Filtration/Converters/DropIconConverter.cs +++ b/Filtration/Converters/DropIconConverter.cs @@ -25,7 +25,7 @@ namespace Filtration.Converters return "/Filtration;component/Resources/DropIcons/Icon6.png"; } - return ""; + return "/Filtration;component/Resources/DropIcons/NoIcon.png"; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index c6a582b..9b35e47 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -552,6 +552,7 @@ + diff --git a/Filtration/Resources/DropIcons/NoIcon.png b/Filtration/Resources/DropIcons/NoIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..fb56f36b047c44bfd9b7de6c5927b0fdcd01b4d6 GIT binary patch literal 2797 zcmVKLZ*U+IBfRsybQWXdw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000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000ONkl _isExpanded; @@ -90,6 +91,16 @@ namespace Filtration.ViewModels } } + public bool HasChild + { + get => _hasChild; + set + { + _hasChild = value; + RaisePropertyChanged(); + } + } + private void OnToggleSectionCommand() { _parentScriptViewModel.ToggleSection(this); diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index 3ecb278..2d173b6 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -838,10 +838,11 @@ namespace Filtration.ViewModels var blockIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) + 1; _scriptCommandManager.ExecuteCommand(new PasteSectionCommand(Script, blocksToPaste, targetBlockViewModelBase.BaseBlock)); + SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex]; + RaisePropertyChanged("SelectedBlockViewModel"); var firstBlockAsComment = blocksToPaste[0] as IItemFilterCommentBlock; if (firstBlockAsComment != null) { - SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex]; OnCollapseSectionCommand(); } } @@ -954,6 +955,8 @@ namespace Filtration.ViewModels if (ItemFilterBlockViewModels[blockIndex - 1].IsVisible) { _scriptCommandManager.ExecuteCommand(new MoveBlockUpCommand(Script, targetBlockViewModelBase?.BaseBlock)); + SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex - 1]; + RaisePropertyChanged("SelectedBlockViewModel"); } else { @@ -963,6 +966,8 @@ namespace Filtration.ViewModels aboveSectionStart--; } _scriptCommandManager.ExecuteCommand(new MoveSectionToIndexCommand(Script, blockIndex, 1, aboveSectionStart)); + SelectedBlockViewModel = ItemFilterBlockViewModels[aboveSectionStart]; + RaisePropertyChanged("SelectedBlockViewModel"); } } @@ -991,6 +996,7 @@ namespace Filtration.ViewModels ToggleSection(ItemFilterBlockViewModels[newLocation] as IItemFilterCommentBlockViewModel); SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; + RaisePropertyChanged("SelectedBlockViewModel"); } private void OnMoveBlockDownCommand() @@ -1013,6 +1019,8 @@ namespace Filtration.ViewModels if (beloveBlockAsComment == null || beloveBlockAsComment.IsExpanded) { _scriptCommandManager.ExecuteCommand(new MoveBlockDownCommand(Script, targetBlockViewModelBase?.BaseBlock)); + SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex + 1]; + RaisePropertyChanged("SelectedBlockViewModel"); } else { @@ -1022,6 +1030,8 @@ namespace Filtration.ViewModels beloveSectionEnd++; } _scriptCommandManager.ExecuteCommand(new MoveSectionToIndexCommand(Script, blockIndex, 1, beloveSectionEnd - 1)); + SelectedBlockViewModel = ItemFilterBlockViewModels[beloveSectionEnd - 1]; + RaisePropertyChanged("SelectedBlockViewModel"); } } @@ -1056,6 +1066,7 @@ namespace Filtration.ViewModels ToggleSection(ItemFilterBlockViewModels[newLocation] as IItemFilterCommentBlockViewModel); SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; + RaisePropertyChanged("SelectedBlockViewModel"); } private void OnMoveBlockToBottomCommand() @@ -1304,11 +1315,26 @@ namespace Filtration.ViewModels private void UpdateBlockModelsForView() { ObservableCollection blocksForView = new ObservableCollection(); - foreach (var block in ItemFilterBlockViewModels) + for (var i = 0; i < ItemFilterBlockViewModels.Count; i++) { + var block = ItemFilterBlockViewModels[i]; if (block.IsVisible) { blocksForView.Add(block); + + var blockAsComment = block as IItemFilterCommentBlockViewModel; + if(blockAsComment != null && i < (ItemFilterBlockViewModels.Count - 1)) + { + var followingBlock = ItemFilterBlockViewModels[i + 1] as IItemFilterBlockViewModel; + if(followingBlock != null) + { + blockAsComment.HasChild = true; + } + else + { + blockAsComment.HasChild = false; + } + } } } diff --git a/Filtration/Views/ItemFilterCommentBlockView.xaml b/Filtration/Views/ItemFilterCommentBlockView.xaml index 2989243..e8a521e 100644 --- a/Filtration/Views/ItemFilterCommentBlockView.xaml +++ b/Filtration/Views/ItemFilterCommentBlockView.xaml @@ -44,7 +44,7 @@ - + @@ -81,45 +81,46 @@ Style="{StaticResource ExpanderRightAlignStyle}" x:Name="BlockExpander"> - + + + + + + + + + - - - - - + + + - - - - - - - - - +