mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Plugin settings window - Updated design
Brushes - Added option for brushes to have a settings window Effects - Added option for effects to have a settings window
This commit is contained in:
parent
2ad78411c8
commit
b80e59fa51
@ -0,0 +1,15 @@
|
|||||||
|
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Plugins.Abstract.ViewModels
|
||||||
|
{
|
||||||
|
public abstract class BrushConfigurationViewModel : Screen
|
||||||
|
{
|
||||||
|
protected BrushConfigurationViewModel(BaseLayerBrush layerBrush)
|
||||||
|
{
|
||||||
|
LayerBrush = layerBrush;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseLayerBrush LayerBrush { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Plugins.Abstract.ViewModels
|
||||||
|
{
|
||||||
|
public abstract class EffectConfigurationViewModel : Screen
|
||||||
|
{
|
||||||
|
protected EffectConfigurationViewModel(BaseLayerEffect layerEffect)
|
||||||
|
{
|
||||||
|
LayerEffect = layerEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseLayerEffect LayerEffect { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,6 @@ namespace Artemis.Core.Plugins.Abstract.ViewModels
|
|||||||
Plugin = plugin;
|
Plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin Plugin { get; set; }
|
public Plugin Plugin { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
@ -70,6 +71,12 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether this plugin has a configuration view model.
|
||||||
|
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasConfigurationViewModel { get; protected set; }
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
DisableLayerBrush();
|
DisableLayerBrush();
|
||||||
@ -94,6 +101,16 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
|||||||
/// <param name="deltaTime"></param>
|
/// <param name="deltaTime"></param>
|
||||||
public abstract void Update(double deltaTime);
|
public abstract void Update(double deltaTime);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the brush configuration window is opened from the UI. The UI will only attempt to open if
|
||||||
|
/// <see cref="HasConfigurationViewModel" /> is set to True.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual BrushConfigurationViewModel GetConfigurationViewModel()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Not only is this needed to initialize properties on the layer brushes, it also prevents implementing anything
|
// Not only is this needed to initialize properties on the layer brushes, it also prevents implementing anything
|
||||||
// but LayerBrush<T> and RgbNetLayerBrush<T> outside the core
|
// but LayerBrush<T> and RgbNetLayerBrush<T> outside the core
|
||||||
internal abstract void Initialize(ILayerService layerService);
|
internal abstract void Initialize(ILayerService layerService);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
@ -96,6 +97,12 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
|
|
||||||
internal string PropertyRootPath => $"LayerEffect.{EntityId}.{GetType().Name}.";
|
internal string PropertyRootPath => $"LayerEffect.{EntityId}.{GetType().Name}.";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether this plugin has a configuration view model.
|
||||||
|
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasConfigurationViewModel { get; protected set; }
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
DisableLayerEffect();
|
DisableLayerEffect();
|
||||||
@ -138,5 +145,16 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
|
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
|
||||||
// but LayerEffect<T> outside the core
|
// but LayerEffect<T> outside the core
|
||||||
internal abstract void Initialize(ILayerService layerService);
|
internal abstract void Initialize(ILayerService layerService);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the effect configuration window is opened from the UI. The UI will only attempt to open if
|
||||||
|
/// <see cref="HasConfigurationViewModel" /> is set to True.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual EffectConfigurationViewModel GetConfigurationViewModel()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<controls:MaterialWindow x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerBrushSettingsWindowView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor"
|
||||||
|
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Layer brush configuration"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
Width="800"
|
||||||
|
Height="800"
|
||||||
|
d:DesignHeight="800"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance local:LayerBrushSettingsWindowViewModel}"
|
||||||
|
Icon="/Resources/Images/Logo/logo-512.png">
|
||||||
|
<DockPanel>
|
||||||
|
<controls:AppBar Type="Dense" Title="{Binding ActiveItem.LayerBrush.Descriptor.DisplayName}" DockPanel.Dock="Top" Margin="-18 0 0 0" ShowShadow="False">
|
||||||
|
<controls:AppBar.AppIcon>
|
||||||
|
<materialDesign:PackIcon Kind="{Binding ActiveItem.LayerBrush.Descriptor.Icon}" Width="20" Height="28" />
|
||||||
|
</controls:AppBar.AppIcon>
|
||||||
|
</controls:AppBar>
|
||||||
|
|
||||||
|
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||||
|
</DockPanel>
|
||||||
|
</controls:MaterialWindow>
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
|
using MaterialDesignThemes.Wpf;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||||
|
{
|
||||||
|
public class LayerBrushSettingsWindowViewModel : Conductor<BrushConfigurationViewModel>
|
||||||
|
{
|
||||||
|
public LayerBrushSettingsWindowViewModel(BrushConfigurationViewModel configurationViewModel)
|
||||||
|
{
|
||||||
|
ActiveItem = configurationViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<controls:MaterialWindow x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerEffectSettingsWindowView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor"
|
||||||
|
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Layer effect configuration"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
Width="800"
|
||||||
|
Height="800"
|
||||||
|
d:DesignHeight="800"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance local:LayerEffectSettingsWindowViewModel}"
|
||||||
|
Icon="/Resources/Images/Logo/logo-512.png">
|
||||||
|
<DockPanel>
|
||||||
|
<controls:AppBar Type="Dense" Title="{Binding ActiveItem.LayerEffect.Descriptor.DisplayName}" DockPanel.Dock="Top" Margin="-18 0 0 0" ShowShadow="False">
|
||||||
|
<controls:AppBar.AppIcon>
|
||||||
|
<materialDesign:PackIcon Kind="{Binding ActiveItem.LayerEffect.Descriptor.Icon}" Width="20" Height="28" />
|
||||||
|
</controls:AppBar.AppIcon>
|
||||||
|
</controls:AppBar>
|
||||||
|
|
||||||
|
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||||
|
</DockPanel>
|
||||||
|
</controls:MaterialWindow>
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||||
|
{
|
||||||
|
public class LayerEffectSettingsWindowViewModel : Conductor<EffectConfigurationViewModel>
|
||||||
|
{
|
||||||
|
public LayerEffectSettingsWindowViewModel(EffectConfigurationViewModel configurationViewModel)
|
||||||
|
{
|
||||||
|
ActiveItem = configurationViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -67,9 +67,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Type: LayerBrushRoot -->
|
<!-- Type: LayerBrushRoot -->
|
||||||
<StackPanel Orientation="Horizontal" Margin="0 5" dd:DragDrop.DragSourceIgnore="True">
|
<Grid dd:DragDrop.DragSourceIgnore="True">
|
||||||
<StackPanel.Style>
|
<Grid.ColumnDefinitions>
|
||||||
<Style TargetType="{x:Type StackPanel}">
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.Style>
|
||||||
|
<Style TargetType="{x:Type Grid}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" />
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding LayerPropertyGroupViewModel.GroupType}" Value="LayerBrushRoot">
|
<DataTrigger Binding="{Binding LayerPropertyGroupViewModel.GroupType}" Value="LayerBrushRoot">
|
||||||
@ -77,12 +83,32 @@
|
|||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</StackPanel.Style>
|
</Grid.Style>
|
||||||
<materialDesign:PackIcon Grid.Column="0" Kind="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Icon}" Margin="0 -1 5 0" />
|
<materialDesign:PackIcon Grid.Column="0"
|
||||||
<TextBlock ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Description}">Brush - </TextBlock>
|
Kind="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Icon}"
|
||||||
<TextBlock Text="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.DisplayName}"
|
Margin="0 5 5 0" />
|
||||||
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Description}" />
|
<TextBlock Grid.Column="1"
|
||||||
</StackPanel>
|
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Description}"
|
||||||
|
Margin="0 5 0 0">
|
||||||
|
Brush - 
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Text="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.DisplayName}"
|
||||||
|
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.Descriptor.Description}"
|
||||||
|
Margin="0 5 0 0" />
|
||||||
|
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Style="{StaticResource MaterialDesignIconButton}"
|
||||||
|
ToolTip="Open brush settings"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Command="{s:Action OpenBrushSettings}"
|
||||||
|
Visibility="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.HasConfigurationViewModel, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||||
|
<materialDesign:PackIcon Kind="Settings" Height="16" Width="16" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- Type: LayerEffectRoot -->
|
<!-- Type: LayerEffectRoot -->
|
||||||
<Grid Height="24">
|
<Grid Height="24">
|
||||||
@ -151,6 +177,15 @@
|
|||||||
Command="{s:Action RenameEffect}">
|
Command="{s:Action RenameEffect}">
|
||||||
<materialDesign:PackIcon Kind="RenameBox" Height="16" Width="16" />
|
<materialDesign:PackIcon Kind="RenameBox" Height="16" Width="16" />
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button Style="{StaticResource MaterialDesignIconButton}"
|
||||||
|
ToolTip="Open effect settings"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{s:Action OpenEffectSettings}"
|
||||||
|
Visibility="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.HasConfigurationViewModel, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||||
|
<materialDesign:PackIcon Kind="Settings" Height="16" Width="16" />
|
||||||
|
</Button>
|
||||||
<Button Style="{StaticResource MaterialDesignIconButton}"
|
<Button Style="{StaticResource MaterialDesignIconButton}"
|
||||||
ToolTip="Remove"
|
ToolTip="Remove"
|
||||||
Width="24"
|
Width="24"
|
||||||
@ -160,8 +195,6 @@
|
|||||||
<materialDesign:PackIcon Kind="TrashCan" Height="16" Width="16" />
|
<materialDesign:PackIcon Kind="TrashCan" Height="16" Width="16" />
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.Dialogs;
|
using Artemis.UI.Screens.Module.ProfileEditor.Dialogs;
|
||||||
@ -11,20 +12,52 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
|||||||
public class TreePropertyGroupViewModel : PropertyChangedBase
|
public class TreePropertyGroupViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
|
private readonly IWindowManager _windowManager;
|
||||||
private readonly ILayerService _layerService;
|
private readonly ILayerService _layerService;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
|
||||||
public TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel,
|
public TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel,
|
||||||
IProfileEditorService profileEditorService, ILayerService layerService, IDialogService dialogService)
|
IProfileEditorService profileEditorService, ILayerService layerService, IDialogService dialogService, IWindowManager windowManager)
|
||||||
{
|
{
|
||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_layerService = layerService;
|
_layerService = layerService;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
_windowManager = windowManager;
|
||||||
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
|
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
||||||
|
|
||||||
|
public async void OpenBrushSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.GetConfigurationViewModel();
|
||||||
|
if (configurationViewModel != null)
|
||||||
|
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(configurationViewModel));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _dialogService.ShowExceptionDialog("An exception occured while trying to show the brush's settings window", e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void OpenEffectSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.GetConfigurationViewModel();
|
||||||
|
if (configurationViewModel != null)
|
||||||
|
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(configurationViewModel));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _dialogService.ShowExceptionDialog("An exception occured while trying to show the effect's settings window", e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async void RenameEffect()
|
public async void RenameEffect()
|
||||||
{
|
{
|
||||||
var result = await _dialogService.ShowDialogAt<RenameViewModel>(
|
var result = await _dialogService.ShowDialogAt<RenameViewModel>(
|
||||||
|
|||||||
@ -68,7 +68,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
{
|
{
|
||||||
var configurationViewModel = Plugin.GetConfigurationViewModel();
|
var configurationViewModel = Plugin.GetConfigurationViewModel();
|
||||||
if (configurationViewModel != null)
|
if (configurationViewModel != null)
|
||||||
_windowManager.ShowDialog(new PluginSettingsWindowViewModel(configurationViewModel));
|
_windowManager.ShowDialog(new PluginSettingsWindowViewModel(configurationViewModel, Icon));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,8 +6,9 @@
|
|||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.Plugins"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.Plugins"
|
||||||
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
|
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="{Binding Title}"
|
Title="Plugin configuration"
|
||||||
Background="{DynamicResource MaterialDesignPaper}"
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
||||||
UseLayoutRounding="True"
|
UseLayoutRounding="True"
|
||||||
@ -17,7 +18,13 @@
|
|||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:PluginSettingsWindowViewModel}"
|
d:DataContext="{d:DesignInstance local:PluginSettingsWindowViewModel}"
|
||||||
Icon="/Resources/Images/Logo/logo-512.png">
|
Icon="/Resources/Images/Logo/logo-512.png">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
<DockPanel>
|
||||||
|
<controls:AppBar Type="Dense" Title="{Binding ActiveItem.Plugin.PluginInfo.Name}" DockPanel.Dock="Top" Margin="-18 0 0 0" ShowShadow="False">
|
||||||
|
<controls:AppBar.AppIcon>
|
||||||
|
<materialDesign:PackIcon Kind="{Binding Icon}" Width="20" Height="28" />
|
||||||
|
</controls:AppBar.AppIcon>
|
||||||
|
</controls:AppBar>
|
||||||
|
|
||||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||||
</ScrollViewer>
|
</DockPanel>
|
||||||
</controls:MaterialWindow>
|
</controls:MaterialWindow>
|
||||||
@ -1,15 +1,17 @@
|
|||||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
|
using MaterialDesignThemes.Wpf;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||||
{
|
{
|
||||||
public class PluginSettingsWindowViewModel : Conductor<PluginConfigurationViewModel>
|
public class PluginSettingsWindowViewModel : Conductor<PluginConfigurationViewModel>
|
||||||
{
|
{
|
||||||
public PluginSettingsWindowViewModel(PluginConfigurationViewModel configurationViewModel)
|
public PackIconKind Icon { get; }
|
||||||
|
|
||||||
|
public PluginSettingsWindowViewModel(PluginConfigurationViewModel configurationViewModel, PackIconKind icon)
|
||||||
{
|
{
|
||||||
|
Icon = icon;
|
||||||
ActiveItem = configurationViewModel;
|
ActiveItem = configurationViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title => "Plugin configuration - " + ActiveItem?.Plugin?.PluginInfo?.Name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,9 +102,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (Properties.ColorType.BaseValue == ColorMappingType.Simple)
|
if (Properties.ColorType.BaseValue == ColorMappingType.Simple)
|
||||||
{
|
|
||||||
paint.Color = Properties.SecondaryColor.CurrentValue;
|
paint.Color = Properties.SecondaryColor.CurrentValue;
|
||||||
}
|
|
||||||
|
|
||||||
using var foregroundShader = SKShader.CreateBitmap(_bitmap, SKShaderTileMode.Clamp, SKShaderTileMode.Clamp, bitmapTransform);
|
using var foregroundShader = SKShader.CreateBitmap(_bitmap, SKShaderTileMode.Clamp, SKShaderTileMode.Clamp, bitmapTransform);
|
||||||
paint.Shader = foregroundShader;
|
paint.Shader = foregroundShader;
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
|
using Artemis.Plugins.LayerEffects.Filter.ViewModels;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
|
namespace Artemis.Plugins.LayerEffects.Filter
|
||||||
|
{
|
||||||
|
public class ColorMatrixEffect : LayerEffect<ColorMatrixEffectProperties>
|
||||||
|
{
|
||||||
|
public override void EnableLayerEffect()
|
||||||
|
{
|
||||||
|
HasConfigurationViewModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EffectConfigurationViewModel GetConfigurationViewModel()
|
||||||
|
{
|
||||||
|
return new ColorMatrixConfigurationViewModel(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DisableLayerEffect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(double deltaTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||||
|
{
|
||||||
|
paint.ImageFilter = SKImageFilter.CreateColorFilter(SKColorFilter.CreateColorMatrix(Properties.ColorMatrix.CurrentValue), paint.ImageFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
|
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||||
|
|
||||||
|
namespace Artemis.Plugins.LayerEffects.Filter
|
||||||
|
{
|
||||||
|
public class ColorMatrixEffectProperties : LayerPropertyGroup
|
||||||
|
{
|
||||||
|
[PropertyDescription]
|
||||||
|
public LayerProperty<float[]> ColorMatrix { get; set; }
|
||||||
|
|
||||||
|
protected override void PopulateDefaults()
|
||||||
|
{
|
||||||
|
// Set a gray scale value as default
|
||||||
|
ColorMatrix.DefaultValue = new[]
|
||||||
|
{
|
||||||
|
0.21f, 0.72f, 0.07f, 0, 0,
|
||||||
|
0.21f, 0.72f, 0.07f, 0, 0,
|
||||||
|
0.21f, 0.72f, 0.07f, 0, 0,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPropertiesInitialized()
|
||||||
|
{
|
||||||
|
ColorMatrix.IsHidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
|||||||
AddLayerEffectDescriptor<ErodeEffect>("Erode", "A layer effect providing an erode filter effect", "EyeMinus");
|
AddLayerEffectDescriptor<ErodeEffect>("Erode", "A layer effect providing an erode filter effect", "EyeMinus");
|
||||||
AddLayerEffectDescriptor<GlowEffect>("Glow", "A layer effect providing a glow filter effect", "BoxShadow");
|
AddLayerEffectDescriptor<GlowEffect>("Glow", "A layer effect providing a glow filter effect", "BoxShadow");
|
||||||
AddLayerEffectDescriptor<GrayScaleEffect>("Gray-scale", "A layer effect providing a gray-scale filter effect", "InvertColors");
|
AddLayerEffectDescriptor<GrayScaleEffect>("Gray-scale", "A layer effect providing a gray-scale filter effect", "InvertColors");
|
||||||
|
AddLayerEffectDescriptor<ColorMatrixEffect>("Color matrix", "A layer effect allowing you to apply a custom color matrix", "Matrix");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DisablePlugin()
|
public override void DisablePlugin()
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
|
|
||||||
|
namespace Artemis.Plugins.LayerEffects.Filter.ViewModels
|
||||||
|
{
|
||||||
|
public class ColorMatrixConfigurationViewModel : EffectConfigurationViewModel
|
||||||
|
{
|
||||||
|
public ColorMatrixConfigurationViewModel(ColorMatrixEffect layerEffect) : base(layerEffect)
|
||||||
|
{
|
||||||
|
Properties = layerEffect.Properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColorMatrixEffectProperties Properties { get; set; }
|
||||||
|
|
||||||
|
public void OpenGuide()
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo("cmd", "/c start https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters")
|
||||||
|
{
|
||||||
|
CreateNoWindow = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
<UserControl x:Class="Artemis.Plugins.LayerEffects.Filter.Views.ColorMatrixConfigurationView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
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:local="clr-namespace:Artemis.Plugins.LayerEffects.Filter.Views"
|
||||||
|
xmlns:viewModels="clr-namespace:Artemis.Plugins.LayerEffects.Filter.ViewModels"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:ColorMatrixConfigurationViewModel}">
|
||||||
|
<StackPanel Margin="15">
|
||||||
|
<TextBlock>
|
||||||
|
Below you can define the color matrix to be applied to the folder/layer. <LineBreak/>
|
||||||
|
Please note this is an advanced effect mainly included for the sake of completion.
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Margin="0 25">
|
||||||
|
If you are still not deterred,
|
||||||
|
<Hyperlink NavigateUri="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters"
|
||||||
|
RequestNavigate="{s:Action OpenGuide}">
|
||||||
|
click here
|
||||||
|
</Hyperlink>
|
||||||
|
for a full explanation of color transforms in SkiaSharp, the rendering library Artemis uses.
|
||||||
|
</TextBlock>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="50" />
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[0]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[1]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[2]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[3]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[4]}" Margin="2" />
|
||||||
|
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[5]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[6]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[7]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[8]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[9]}" Margin="2" />
|
||||||
|
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[10]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[11]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[12]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[13]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[14]}" Margin="2" />
|
||||||
|
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[15]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[16]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[17]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[18]}" Margin="2" />
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[19]}" Margin="2" />
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</UserControl>
|
||||||
Loading…
x
Reference in New Issue
Block a user