Add requested changes & minor bug fixes

This commit is contained in:
azakhi 2018-08-22 11:41:02 +03:00
parent c0e9c534de
commit 0974579684
9 changed files with 92 additions and 46 deletions

View File

@ -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;
}
}

View File

@ -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<IconBlockItem>(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;
}

View File

@ -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)

View File

@ -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)

View File

@ -552,6 +552,7 @@
<Resource Include="Resources\DropIcons\Icon4.png" />
<Resource Include="Resources\DropIcons\Icon5.png" />
<Resource Include="Resources\DropIcons\Icon6.png" />
<Resource Include="Resources\DropIcons\NoIcon.png" />
<Content Include="Resources\ItemBaseTypes.txt" />
<Content Include="Resources\ItemClasses.txt" />
</ItemGroup>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -9,11 +9,13 @@ namespace Filtration.ViewModels
IItemFilterCommentBlock ItemFilterCommentBlock { get; }
string Comment { get; }
bool IsExpanded { get; set; }
bool HasChild { get; set; }
}
internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel
{
private bool _isExpanded;
private bool _hasChild;
public ItemFilterCommentBlockViewModel()
{
@ -79,7 +81,6 @@ namespace Filtration.ViewModels
}
}
public bool IsExpanded
{
get => _isExpanded;
@ -90,6 +91,16 @@ namespace Filtration.ViewModels
}
}
public bool HasChild
{
get => _hasChild;
set
{
_hasChild = value;
RaisePropertyChanged();
}
}
private void OnToggleSectionCommand()
{
_parentScriptViewModel.ToggleSection(this);

View File

@ -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<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)
{
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;
}
}
}
}

View File

@ -87,29 +87,30 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</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"
Height="25"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Margin="0,0,3,0"
Background="Transparent"
BorderBrush="Transparent"
ToolTip="Expand Section" Visibility="{Binding IsExpanded, Converter={StaticResource InverseBooleanVisibilityConverter}}">
<Image Source="/Filtration;component/Resources/Icons/expand_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="1" Command="{Binding ToggleSectionCommand}"
<Button Command="{Binding ToggleSectionCommand}"
Width="25"
Height="25"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Margin="0,0,3,0"
Background="Transparent"
BorderBrush="Transparent"
ToolTip="Collapse Section" Visibility="{Binding IsExpanded, Converter={StaticResource BooleanVisibilityConverter}}">
<Image Source="/Filtration;component/Resources/Icons/collapse_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</WrapPanel>
</Grid>
</Expander.Header>
<Grid>