Fixed contextual tabs
This commit is contained in:
parent
bfa2341ab8
commit
d6bd1678b4
|
@ -3,9 +3,9 @@ using System.Globalization;
|
|||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
namespace Filtration.Common.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverterCopy : IValueConverter
|
||||
public class BooleanVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
|
@ -64,6 +64,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\MessageBoxService.cs" />
|
||||
|
|
|
@ -11,12 +11,9 @@ namespace Filtration.ObjectModel.ThemeEditor
|
|||
public class ThemeComponent : INotifyPropertyChanged
|
||||
{
|
||||
private Color _color;
|
||||
|
||||
public ThemeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private EventHandler _themeComponentUpdatedEventHandler;
|
||||
private readonly object _eventLock = new object();
|
||||
|
||||
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (componentName == null || componentColor == null)
|
||||
|
@ -29,7 +26,28 @@ namespace Filtration.ObjectModel.ThemeEditor
|
|||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public event EventHandler ThemeComponentUpdated;
|
||||
// By implementing a custom event accessor here we can keep the UsageCount up to date.
|
||||
public event EventHandler ThemeComponentUpdated
|
||||
{
|
||||
add
|
||||
{
|
||||
lock (_eventLock)
|
||||
{
|
||||
_themeComponentUpdatedEventHandler += value;
|
||||
OnPropertyChanged("UsageCount");
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
lock (_eventLock)
|
||||
{
|
||||
// ReSharper disable once DelegateSubtraction
|
||||
_themeComponentUpdatedEventHandler -= value;
|
||||
OnPropertyChanged("UsageCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ThemeComponentDeleted;
|
||||
|
||||
public string ComponentName { get; set; }
|
||||
|
@ -42,13 +60,26 @@ namespace Filtration.ObjectModel.ThemeEditor
|
|||
{
|
||||
_color = value;
|
||||
OnPropertyChanged();
|
||||
if (ThemeComponentUpdated != null)
|
||||
if (_themeComponentUpdatedEventHandler != null)
|
||||
{
|
||||
ThemeComponentUpdated.Invoke(this, EventArgs.Empty);
|
||||
_themeComponentUpdatedEventHandler.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int UsageCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_themeComponentUpdatedEventHandler == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _themeComponentUpdatedEventHandler.GetInvocationList().Length;
|
||||
}
|
||||
}
|
||||
|
||||
public void TerminateComponent()
|
||||
{
|
||||
if (ThemeComponentDeleted != null)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
|
||||
|
@ -18,6 +17,22 @@ namespace Filtration.ThemeEditor.Converters
|
|||
}
|
||||
var type = (ThemeComponentType) value;
|
||||
|
||||
switch (type.GetAttributeDescription())
|
||||
{
|
||||
case "TextColor":
|
||||
{
|
||||
return "Text";
|
||||
}
|
||||
case "BorderColor":
|
||||
{
|
||||
return "Border";
|
||||
}
|
||||
case "BackgroundColor":
|
||||
{
|
||||
return "Background";
|
||||
}
|
||||
}
|
||||
|
||||
return type.GetAttributeDescription();
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:converters="clr-namespace:Filtration.ThemeEditor.Converters"
|
||||
xmlns:commonConverters="clr-namespace:Filtration.Common.Converters;assembly=Filtration.Common"
|
||||
xmlns:themeEditor="clr-namespace:Filtration.ObjectModel.ThemeEditor;assembly=Filtration.ObjectModel"
|
||||
xmlns:views="clr-namespace:Filtration.ThemeEditor.Views"
|
||||
mc:Ignorable="d"
|
||||
|
@ -12,6 +13,7 @@
|
|||
d:DesignHeight="40" d:DesignWidth="200">
|
||||
<UserControl.Resources>
|
||||
<converters:ThemeComponentTypeToStringConverter x:Key="ThemeComponentTypeToStringConverter" />
|
||||
<commonConverters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid Width="200">
|
||||
<Grid.RowDefinitions>
|
||||
|
@ -19,6 +21,10 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="25" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.Resources>
|
||||
<DataTemplate x:Key="EditableComponentNameTemplate">
|
||||
<TextBox Text="{Binding ComponentName}" />
|
||||
|
@ -27,8 +33,23 @@
|
|||
<TextBlock Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" />
|
||||
</DataTemplate>
|
||||
</Grid.Resources>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding ComponentType, Converter={StaticResource ThemeComponentTypeToStringConverter}}" Foreground="Red" FontSize="10" />
|
||||
<ContentControl Grid.Row="1" Grid.Column="0" Content="{Binding}">
|
||||
<TextBlock Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Text="{Binding UsageCount, StringFormat='Usages: {0}'}"
|
||||
FontSize="10"
|
||||
Visibility="{Binding Path=DataContext.EditEnabled, RelativeSource={RelativeSource AncestorType={x:Type views:ThemeEditorView}}, Converter={StaticResource BooleanVisibilityConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding UsageCount}" Value="0">
|
||||
<Setter Property="Foreground" Value="Red" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Foreground" Value="SteelBlue"></Setter>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<ContentControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding}">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Style.Triggers>
|
||||
|
@ -43,6 +64,6 @@
|
|||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="0" SelectedColor="{Binding Color}" />
|
||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" SelectedColor="{Binding Color}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool && targetType == typeof (Visibility))
|
||||
{
|
||||
var val = (bool) value;
|
||||
if (val)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
if (parameter is Visibility)
|
||||
{
|
||||
return parameter;
|
||||
}
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
if (parameter is Visibility)
|
||||
{
|
||||
return parameter;
|
||||
}
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -137,8 +137,6 @@
|
|||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverterCopy.cs" />
|
||||
<Compile Include="Converters\BlockItemToRemoveEnabledVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\HashSignRemovalConverter.cs" />
|
||||
|
|
|
@ -13,6 +13,8 @@ using Filtration.Common.Services;
|
|||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
@ -326,6 +328,7 @@ namespace Filtration.ViewModels
|
|||
public void Save()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
if (!CheckForUnusedThemeComponents()) return;
|
||||
|
||||
if (_filenameIsFake)
|
||||
{
|
||||
|
@ -353,6 +356,7 @@ namespace Filtration.ViewModels
|
|||
public void SaveAs()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
if (!CheckForUnusedThemeComponents()) return;
|
||||
|
||||
var saveDialog = new SaveFileDialog
|
||||
{
|
||||
|
@ -387,6 +391,27 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private bool CheckForUnusedThemeComponents()
|
||||
{
|
||||
var unusedThemeComponents =
|
||||
Script.ThemeComponents.Where(
|
||||
t =>
|
||||
Script.ItemFilterBlocks.Count(
|
||||
b => b.BlockItems.OfType<ColorBlockItem>().Count(i => i.ThemeComponent == t) > 0) == 0).ToList();
|
||||
|
||||
if (unusedThemeComponents.Count <= 0) return true;
|
||||
|
||||
var themeComponents = unusedThemeComponents.Aggregate(string.Empty,
|
||||
(current, themeComponent) => current + (themeComponent.ComponentName + Environment.NewLine));
|
||||
|
||||
var ignoreUnusedThemeComponents = _messageBoxService.Show("Unused Theme Components",
|
||||
"The following theme components are unused, they will be lost when this script is reopened. Save anyway?" +
|
||||
Environment.NewLine + Environment.NewLine + themeComponents, MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Exclamation);
|
||||
|
||||
return ignoreUnusedThemeComponents != MessageBoxResult.No;
|
||||
}
|
||||
|
||||
private void OnActiveDocumentChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_avalonDockWorkspaceViewModel.ActiveScriptViewModel != this)
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace Filtration.ViewModels
|
|||
private readonly IUpdateCheckService _updateCheckService;
|
||||
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
private bool _activeDocumentIsScript;
|
||||
private bool _activeDocumentIsTheme;
|
||||
|
||||
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||
|
@ -72,7 +74,7 @@ namespace Filtration.ViewModels
|
|||
_messageBoxService = messageBoxService;
|
||||
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => _activeDocumentIsScript);
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
OpenThemeCommand = new RelayCommand(OnOpenThemeCommand);
|
||||
|
||||
|
@ -80,40 +82,40 @@ namespace Filtration.ViewModels
|
|||
SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable);
|
||||
CloseCommand = new RelayCommand(OnCloseDocumentCommand, () => AvalonDockWorkspaceViewModel.ActiveDocument != null);
|
||||
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
|
||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
|
||||
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
|
||||
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
|
||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => _activeDocumentIsScript);
|
||||
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => _activeDocumentIsScript);
|
||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||
|
||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);
|
||||
|
||||
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript);
|
||||
ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => ActiveDocumentIsScript);
|
||||
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => _activeDocumentIsScript);
|
||||
|
||||
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => _activeDocumentIsScript);
|
||||
ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => _activeDocumentIsScript);
|
||||
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => _activeDocumentIsScript);
|
||||
|
||||
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
||||
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand,
|
||||
() =>
|
||||
ActiveDocumentIsTheme && ActiveDocumentIsTheme &&
|
||||
ActiveDocumentIsTheme && _activeDocumentIsTheme &&
|
||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
|
||||
|
||||
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
|
||||
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);
|
||||
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => _activeDocumentIsScript);
|
||||
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => _activeDocumentIsScript);
|
||||
|
||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript);
|
||||
ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript);
|
||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => _activeDocumentIsScript);
|
||||
ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => _activeDocumentIsScript);
|
||||
|
||||
if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
|
||||
{
|
||||
|
@ -142,6 +144,7 @@ namespace Filtration.ViewModels
|
|||
ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
|
||||
EditMasterThemeCommand.RaiseCanExecuteChanged();
|
||||
CreateThemeCommand.RaiseCanExecuteChanged();
|
||||
SetActiveDocumentStatusProperties();
|
||||
RaisePropertyChanged("ShowAdvancedStatus");
|
||||
break;
|
||||
}
|
||||
|
@ -158,6 +161,8 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
});
|
||||
CheckForUpdates();
|
||||
ActiveDocumentIsScript = false;
|
||||
ActiveDocumentIsTheme = false;
|
||||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get; private set; }
|
||||
|
@ -263,26 +268,46 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private void SetActiveDocumentStatusProperties()
|
||||
{
|
||||
ActiveDocumentIsScript = AvalonDockWorkspaceViewModel.ActiveDocument is ItemFilterScriptViewModel;
|
||||
ActiveDocumentIsTheme = AvalonDockWorkspaceViewModel.ActiveDocument is ThemeEditorViewModel;
|
||||
}
|
||||
|
||||
public bool ActiveDocumentIsScript
|
||||
{
|
||||
get
|
||||
get { return _activeDocumentIsScript; }
|
||||
private set
|
||||
{
|
||||
{
|
||||
var isScript = AvalonDockWorkspaceViewModel.ActiveDocument is ItemFilterScriptViewModel;
|
||||
return isScript;
|
||||
}
|
||||
_activeDocumentIsScript = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ActiveDocumentIsTheme
|
||||
{
|
||||
get { return _activeDocumentIsTheme; }
|
||||
private set
|
||||
{
|
||||
_activeDocumentIsTheme = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//public bool ActiveDocumentIsScript
|
||||
//{
|
||||
// get { return AvalonDockWorkspaceViewModel.ActiveDocument is ItemFilterScriptViewModel; }
|
||||
//}
|
||||
|
||||
public bool ActiveScriptHasSelectedBlock
|
||||
{
|
||||
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null; }
|
||||
}
|
||||
|
||||
public bool ActiveDocumentIsTheme
|
||||
{
|
||||
get { return AvalonDockWorkspaceViewModel.ActiveDocument is ThemeEditorViewModel; }
|
||||
}
|
||||
//public bool ActiveDocumentIsTheme
|
||||
//{
|
||||
// get { return AvalonDockWorkspaceViewModel.ActiveDocument is ThemeEditorViewModel; }
|
||||
//}
|
||||
|
||||
public bool ActiveThemeIsEditable
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:viewsAvalonDock="clr-namespace:Filtration.Views.AvalonDock"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:commonConverters="clr-namespace:Filtration.Common.Converters;assembly=Filtration.Common"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
||||
Title="{Binding WindowTitle}" Height="768" Width="1100" BorderThickness="1" BorderBrush="Black" IsIconVisible="True" >
|
||||
|
@ -17,10 +17,10 @@
|
|||
<KeyBinding Command="{Binding OpenScriptCommand}" Modifiers="Control" Key="O" />
|
||||
</fluent:RibbonWindow.InputBindings>
|
||||
<fluent:RibbonWindow.Resources>
|
||||
<converters:BooleanVisibilityConverterCopy x:Key="BooleanVisibilityConverterCopy" />
|
||||
<commonConverters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
</fluent:RibbonWindow.Resources>
|
||||
<DockPanel x:Name="RootDockPanel">
|
||||
<fluent:Ribbon DockPanel.Dock="Top">
|
||||
<fluent:Ribbon DockPanel.Dock="Top" x:Name="RibbonRoot">
|
||||
<fluent:Ribbon.Menu>
|
||||
<fluent:Backstage>
|
||||
<fluent:BackstageTabControl>
|
||||
|
@ -53,21 +53,29 @@
|
|||
</fluent:Backstage>
|
||||
</fluent:Ribbon.Menu>
|
||||
<fluent:Ribbon.ContextualGroups>
|
||||
<fluent:RibbonContextualTabGroup Header="Script Tools"
|
||||
<fluent:RibbonContextualTabGroup Header="Script"
|
||||
Background="ForestGreen"
|
||||
BorderBrush="ForestGreen"
|
||||
x:Name="ScriptToolsGroup"
|
||||
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverterCopy}, Mode=OneWay}" />
|
||||
<fluent:RibbonContextualTabGroup Header="Theme Tools"
|
||||
x:Name="ScriptToolsGroup"
|
||||
IsVisibleChanged="ScriptToolsGroup_OnIsVisibleChanged"
|
||||
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" />
|
||||
<fluent:RibbonContextualTabGroup Header="Theme"
|
||||
Background="DodgerBlue"
|
||||
BorderBrush="DodgerBlue"
|
||||
x:Name="ThemeToolsGroup"
|
||||
Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverterCopy}, Mode=OneWay}" />
|
||||
IsVisibleChanged="ThemeToolsGroup_OnIsVisibleChanged"
|
||||
Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" />
|
||||
</fluent:Ribbon.ContextualGroups>
|
||||
<fluent:RibbonTabItem Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}">
|
||||
<fluent:RibbonTabItem Header="View">
|
||||
<fluent:RibbonGroupBox Header="Tools">
|
||||
<fluent:ToggleButton Header="Section Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource AddSectionIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.SectionBrowserViewModel.IsVisible}" />
|
||||
<fluent:ToggleButton Header="Block Group Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockGroupBrowserIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockGroupBrowserViewModel.IsVisible}" />
|
||||
<fluent:ToggleButton Header="Block Output Preview" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockOutputPreviewIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockOutputPreviewViewModel.IsVisible}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
<fluent:RibbonTabItem x:Name="ScriptToolsTabItem" Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}" Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" >
|
||||
<fluent:RibbonGroupBox Header="Clipboard">
|
||||
<fluent:Button Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" LargeIcon="{StaticResource CopyIcon}">
|
||||
</fluent:Button>
|
||||
<fluent:Button Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" LargeIcon="{StaticResource CopyIcon}"/>
|
||||
<fluent:Button Header="Paste Block" Command="{Binding PasteCommand}" Icon="{StaticResource PasteIcon}" LargeIcon="{StaticResource PasteIcon}" />
|
||||
<fluent:Button Header="Copy Style" Command="{Binding CopyBlockStyleCommand}" Icon="{StaticResource CopyIcon}" LargeIcon="{StaticResource CopyIcon}" SizeDefinition="Middle" />
|
||||
<fluent:Button Header="Paste Style" Command="{Binding PasteBlockStyleCommand}" Icon="{StaticResource PasteStyleIcon}" LargeIcon="{StaticResource PasteIcon}" SizeDefinition="Middle" />
|
||||
|
@ -97,7 +105,7 @@
|
|||
<fluent:Button Header="Replace Colours" Command="{Binding ReplaceColorsCommand}" Icon="{StaticResource ReplaceColorsIcon}" LargeIcon="{StaticResource ReplaceColorsIcon}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
<fluent:RibbonTabItem Header="Theme Tools" Group="{Binding ElementName=ThemeToolsGroup}">
|
||||
<fluent:RibbonTabItem x:Name="ThemeToolsTabItem" Header="Theme Tools" Group="{Binding ElementName=ThemeToolsGroup}" Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}">
|
||||
<fluent:RibbonGroupBox Header="Add Components">
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Text Color" Command="{Binding AddTextColorThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Background Color" Command="{Binding AddBackgroundColorThemeComponentCommand}" />
|
||||
|
@ -107,13 +115,6 @@
|
|||
<fluent:Button Header="Delete Theme Component" Command="{Binding DeleteThemeComponentCommand}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
<fluent:RibbonTabItem Header="View">
|
||||
<fluent:RibbonGroupBox Header="Tools">
|
||||
<fluent:ToggleButton Header="Section Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource AddSectionIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.SectionBrowserViewModel.IsVisible}" />
|
||||
<fluent:ToggleButton Header="Block Group Browser" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockGroupBrowserIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockGroupBrowserViewModel.IsVisible}" />
|
||||
<fluent:ToggleButton Header="Block Output Preview" Width="150" SizeDefinition="Middle" Icon="{StaticResource BlockOutputPreviewIcon}" IsChecked="{Binding AvalonDockWorkspaceViewModel.BlockOutputPreviewViewModel.IsVisible}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
</fluent:Ribbon>
|
||||
<Grid>
|
||||
<viewsAvalonDock:AvalonDockWorkspaceView DataContext="{Binding AvalonDockWorkspaceViewModel}" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Filtration.ViewModels;
|
||||
using System.Windows;
|
||||
using Filtration.ViewModels;
|
||||
|
||||
namespace Filtration.Views
|
||||
{
|
||||
|
@ -14,5 +15,21 @@ namespace Filtration.Views
|
|||
InitializeComponent();
|
||||
DataContext = mainWindowViewModel;
|
||||
}
|
||||
|
||||
private void ScriptToolsGroup_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (ScriptToolsGroup.IsVisible)
|
||||
{
|
||||
RibbonRoot.SelectedTabItem = ScriptToolsTabItem;
|
||||
}
|
||||
}
|
||||
|
||||
private void ThemeToolsGroup_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (ThemeToolsGroup.IsVisible)
|
||||
{
|
||||
RibbonRoot.SelectedTabItem = ThemeToolsTabItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:commonConverters="clr-namespace:Filtration.Common.Converters;assembly=Filtration.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" >
|
||||
|
@ -38,7 +39,7 @@
|
|||
<converters:BooleanToBlockActionConverter x:Key="BooleanToBlockActionConverter" />
|
||||
<converters:BooleanToBlockActionInverseConverter x:Key="BooleanToBlockActionInverseConverter" />
|
||||
<converters:BlockItemTypeToStringConverter x:Key="BlockItemTypeToStringConverter" />
|
||||
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
<commonConverters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
<converters:InverseBooleanVisibilityConverter x:Key="InverseBooleanVisibilityConverter" />
|
||||
<converters:BlockItemToRemoveEnabledVisibilityConverter x:Key="BlockItemToRemoveEnabledVisibilityConverter" />
|
||||
<converters:AvailableThemeComponentsConverter x:Key="AvailableThemeComponentsConverter" />
|
||||
|
|
Loading…
Reference in New Issue