Add requested changes & minor bug fixes
This commit is contained in:
		
							parent
							
								
									c0e9c534de
								
							
						
					
					
						commit
						0974579684
					
				| @ -23,6 +23,6 @@ namespace Filtration.ObjectModel.BlockItemTypes | |||||||
|         public override Color SummaryTextColor => Colors.White; |         public override Color SummaryTextColor => Colors.White; | ||||||
|         public override int SortOrder => 15; |         public override int SortOrder => 15; | ||||||
|         public override int Minimum => 0; |         public override int Minimum => 0; | ||||||
|         public override int Maximum => 40; |         public override int Maximum => 21; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -299,7 +299,7 @@ namespace Filtration.Parser.Services | |||||||
|                     } |                     } | ||||||
|                     case "Icon": |                     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<IconBlockItem>(block); |                         RemoveExistingBlockItemsOfType<IconBlockItem>(block); | ||||||
| 
 | 
 | ||||||
|                         var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)"); |                         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 |             // Replace 'Maelström' to prevent encoding problems in other editors | ||||||
|             outputString.Replace("Maelström Staff", "Maelstr"); |             //outputString.Replace("Maelström Staff", "Maelstr"); | ||||||
|             outputString.Replace("Maelström of Chaos", "Maelstr"); |             //outputString.Replace("Maelström of Chaos", "Maelstr"); | ||||||
|             outputString.Replace("Maelström", "Maelstr"); |             //outputString.Replace("Maelström", "Maelstr"); | ||||||
| 
 | 
 | ||||||
|             return outputString; |             return outputString; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -245,6 +245,12 @@ namespace Filtration.Parser.Services | |||||||
|             // ReSharper disable once LoopCanBeConvertedToQuery |             // ReSharper disable once LoopCanBeConvertedToQuery | ||||||
|             foreach (var block in script.ItemFilterBlocks) |             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; |                 outputString += _blockTranslator.TranslateItemFilterBlockBaseToString(block) + Environment.NewLine; | ||||||
| 
 | 
 | ||||||
|                 if (Settings.Default.ExtraLineBetweenBlocks) |                 if (Settings.Default.ExtraLineBetweenBlocks) | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ namespace Filtration.Converters | |||||||
|                     return "/Filtration;component/Resources/DropIcons/Icon6.png"; |                     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) |         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||||||
|  | |||||||
| @ -552,6 +552,7 @@ | |||||||
|     <Resource Include="Resources\DropIcons\Icon4.png" /> |     <Resource Include="Resources\DropIcons\Icon4.png" /> | ||||||
|     <Resource Include="Resources\DropIcons\Icon5.png" /> |     <Resource Include="Resources\DropIcons\Icon5.png" /> | ||||||
|     <Resource Include="Resources\DropIcons\Icon6.png" /> |     <Resource Include="Resources\DropIcons\Icon6.png" /> | ||||||
|  |     <Resource Include="Resources\DropIcons\NoIcon.png" /> | ||||||
|     <Content Include="Resources\ItemBaseTypes.txt" /> |     <Content Include="Resources\ItemBaseTypes.txt" /> | ||||||
|     <Content Include="Resources\ItemClasses.txt" /> |     <Content Include="Resources\ItemClasses.txt" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								Filtration/Resources/DropIcons/NoIcon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Filtration/Resources/DropIcons/NoIcon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.7 KiB | 
| @ -9,11 +9,13 @@ namespace Filtration.ViewModels | |||||||
|         IItemFilterCommentBlock ItemFilterCommentBlock { get; } |         IItemFilterCommentBlock ItemFilterCommentBlock { get; } | ||||||
|         string Comment { get; } |         string Comment { get; } | ||||||
|         bool IsExpanded { get; set; } |         bool IsExpanded { get; set; } | ||||||
|  |         bool HasChild { get; set; } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel |     internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel | ||||||
|     { |     { | ||||||
|         private bool _isExpanded; |         private bool _isExpanded; | ||||||
|  |         private bool _hasChild; | ||||||
| 
 | 
 | ||||||
|         public ItemFilterCommentBlockViewModel() |         public ItemFilterCommentBlockViewModel() | ||||||
|         { |         { | ||||||
| @ -79,7 +81,6 @@ namespace Filtration.ViewModels | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         public bool IsExpanded |         public bool IsExpanded | ||||||
|         { |         { | ||||||
|             get => _isExpanded; |             get => _isExpanded; | ||||||
| @ -90,6 +91,16 @@ namespace Filtration.ViewModels | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public bool HasChild | ||||||
|  |         { | ||||||
|  |             get => _hasChild; | ||||||
|  |             set | ||||||
|  |             { | ||||||
|  |                 _hasChild = value; | ||||||
|  |                 RaisePropertyChanged(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         private void OnToggleSectionCommand() |         private void OnToggleSectionCommand() | ||||||
|         { |         { | ||||||
|             _parentScriptViewModel.ToggleSection(this); |             _parentScriptViewModel.ToggleSection(this); | ||||||
|  | |||||||
| @ -838,10 +838,11 @@ namespace Filtration.ViewModels | |||||||
| 
 | 
 | ||||||
|                 var blockIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) + 1; |                 var blockIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) + 1; | ||||||
|                 _scriptCommandManager.ExecuteCommand(new PasteSectionCommand(Script, blocksToPaste, targetBlockViewModelBase.BaseBlock)); |                 _scriptCommandManager.ExecuteCommand(new PasteSectionCommand(Script, blocksToPaste, targetBlockViewModelBase.BaseBlock)); | ||||||
|  |                 SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex]; | ||||||
|  |                 RaisePropertyChanged("SelectedBlockViewModel"); | ||||||
|                 var firstBlockAsComment = blocksToPaste[0] as IItemFilterCommentBlock; |                 var firstBlockAsComment = blocksToPaste[0] as IItemFilterCommentBlock; | ||||||
|                 if (firstBlockAsComment != null) |                 if (firstBlockAsComment != null) | ||||||
|                 { |                 { | ||||||
|                     SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex]; |  | ||||||
|                     OnCollapseSectionCommand(); |                     OnCollapseSectionCommand(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @ -954,6 +955,8 @@ namespace Filtration.ViewModels | |||||||
|             if (ItemFilterBlockViewModels[blockIndex - 1].IsVisible) |             if (ItemFilterBlockViewModels[blockIndex - 1].IsVisible) | ||||||
|             { |             { | ||||||
|                 _scriptCommandManager.ExecuteCommand(new MoveBlockUpCommand(Script, targetBlockViewModelBase?.BaseBlock)); |                 _scriptCommandManager.ExecuteCommand(new MoveBlockUpCommand(Script, targetBlockViewModelBase?.BaseBlock)); | ||||||
|  |                 SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex - 1]; | ||||||
|  |                 RaisePropertyChanged("SelectedBlockViewModel"); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
| @ -963,6 +966,8 @@ namespace Filtration.ViewModels | |||||||
|                     aboveSectionStart--; |                     aboveSectionStart--; | ||||||
|                 } |                 } | ||||||
|                 _scriptCommandManager.ExecuteCommand(new MoveSectionToIndexCommand(Script, blockIndex, 1, 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); |             ToggleSection(ItemFilterBlockViewModels[newLocation] as IItemFilterCommentBlockViewModel); | ||||||
|             SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; |             SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; | ||||||
|  |             RaisePropertyChanged("SelectedBlockViewModel"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void OnMoveBlockDownCommand() |         private void OnMoveBlockDownCommand() | ||||||
| @ -1013,6 +1019,8 @@ namespace Filtration.ViewModels | |||||||
|             if (beloveBlockAsComment == null || beloveBlockAsComment.IsExpanded) |             if (beloveBlockAsComment == null || beloveBlockAsComment.IsExpanded) | ||||||
|             { |             { | ||||||
|                 _scriptCommandManager.ExecuteCommand(new MoveBlockDownCommand(Script, targetBlockViewModelBase?.BaseBlock)); |                 _scriptCommandManager.ExecuteCommand(new MoveBlockDownCommand(Script, targetBlockViewModelBase?.BaseBlock)); | ||||||
|  |                 SelectedBlockViewModel = ItemFilterBlockViewModels[blockIndex + 1]; | ||||||
|  |                 RaisePropertyChanged("SelectedBlockViewModel"); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
| @ -1022,6 +1030,8 @@ namespace Filtration.ViewModels | |||||||
|                     beloveSectionEnd++; |                     beloveSectionEnd++; | ||||||
|                 } |                 } | ||||||
|                 _scriptCommandManager.ExecuteCommand(new MoveSectionToIndexCommand(Script, blockIndex, 1, beloveSectionEnd - 1)); |                 _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); |             ToggleSection(ItemFilterBlockViewModels[newLocation] as IItemFilterCommentBlockViewModel); | ||||||
|             SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; |             SelectedBlockViewModel = ItemFilterBlockViewModels[newLocation]; | ||||||
|  |             RaisePropertyChanged("SelectedBlockViewModel"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void OnMoveBlockToBottomCommand() |         private void OnMoveBlockToBottomCommand() | ||||||
| @ -1304,11 +1315,26 @@ namespace Filtration.ViewModels | |||||||
|         private void UpdateBlockModelsForView() |         private void UpdateBlockModelsForView() | ||||||
|         { |         { | ||||||
|             ObservableCollection<IItemFilterBlockViewModelBase> blocksForView = new ObservableCollection<IItemFilterBlockViewModelBase>(); |             ObservableCollection<IItemFilterBlockViewModelBase> blocksForView = new ObservableCollection<IItemFilterBlockViewModelBase>(); | ||||||
|             foreach (var block in ItemFilterBlockViewModels) |             for (var i = 0; i < ItemFilterBlockViewModels.Count; i++) | ||||||
|             { |             { | ||||||
|  |                 var block = ItemFilterBlockViewModels[i]; | ||||||
|                 if (block.IsVisible) |                 if (block.IsVisible) | ||||||
|                 { |                 { | ||||||
|                     blocksForView.Add(block); |                     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; | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -87,29 +87,30 @@ | |||||||
|                                 <ColumnDefinition Width="Auto" /> |                                 <ColumnDefinition Width="Auto" /> | ||||||
|                                 <ColumnDefinition Width="*" /> |                                 <ColumnDefinition Width="*" /> | ||||||
|                             </Grid.ColumnDefinitions> |                             </Grid.ColumnDefinitions> | ||||||
|                             <Label Grid.Column="0" VerticalAlignment="Center" MinWidth="150" Content="{Binding Header, Mode=OneWay}"></Label> | 
 | ||||||
|                         <Button Grid.Column="1" Command="{Binding ToggleSectionCommand}" |                             <Label Grid.Column="0" VerticalAlignment="Center" MinWidth="150" Content="{Binding Header, Mode=OneWay}" /> | ||||||
|  |                             <WrapPanel Grid.Column="1" HorizontalAlignment="Right" Visibility="{Binding HasChild, Converter={StaticResource BooleanVisibilityConverter}}"> | ||||||
|  |                                 <Button Command="{Binding ToggleSectionCommand}" | ||||||
|                                     Width="25" |                                     Width="25" | ||||||
|                                     Height="25" |                                     Height="25" | ||||||
|                                     VerticalAlignment="Center" |                                     VerticalAlignment="Center" | ||||||
|                                         HorizontalAlignment="Right" |  | ||||||
|                                     Margin="0,0,3,0" |                                     Margin="0,0,3,0" | ||||||
|                                     Background="Transparent" |                                     Background="Transparent" | ||||||
|                                     BorderBrush="Transparent" |                                     BorderBrush="Transparent" | ||||||
|                                     ToolTip="Expand Section" Visibility="{Binding IsExpanded, Converter={StaticResource InverseBooleanVisibilityConverter}}"> |                                     ToolTip="Expand Section" Visibility="{Binding IsExpanded, Converter={StaticResource InverseBooleanVisibilityConverter}}"> | ||||||
|                                     <Image Source="/Filtration;component/Resources/Icons/expand_icon.png"  VerticalAlignment="Center" HorizontalAlignment="Center" /> |                                     <Image Source="/Filtration;component/Resources/Icons/expand_icon.png"  VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||||||
|                                 </Button> |                                 </Button> | ||||||
|                         <Button Grid.Column="1" Command="{Binding ToggleSectionCommand}" |                                 <Button Command="{Binding ToggleSectionCommand}" | ||||||
|                                     Width="25" |                                     Width="25" | ||||||
|                                     Height="25" |                                     Height="25" | ||||||
|                                     VerticalAlignment="Center" |                                     VerticalAlignment="Center" | ||||||
|                                         HorizontalAlignment="Right" |  | ||||||
|                                     Margin="0,0,3,0" |                                     Margin="0,0,3,0" | ||||||
|                                     Background="Transparent" |                                     Background="Transparent" | ||||||
|                                     BorderBrush="Transparent" |                                     BorderBrush="Transparent" | ||||||
|                                     ToolTip="Collapse Section" Visibility="{Binding IsExpanded, Converter={StaticResource BooleanVisibilityConverter}}"> |                                     ToolTip="Collapse Section" Visibility="{Binding IsExpanded, Converter={StaticResource BooleanVisibilityConverter}}"> | ||||||
|                                     <Image Source="/Filtration;component/Resources/Icons/collapse_icon.png"  VerticalAlignment="Center" HorizontalAlignment="Center" /> |                                     <Image Source="/Filtration;component/Resources/Icons/collapse_icon.png"  VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||||||
|                                 </Button> |                                 </Button> | ||||||
|  |                             </WrapPanel> | ||||||
|                         </Grid> |                         </Grid> | ||||||
|                     </Expander.Header> |                     </Expander.Header> | ||||||
|                     <Grid> |                     <Grid> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user