Implemented layer elements

Added a brush layer element
Corsair - Added ST100 RGB layout
This commit is contained in:
SpoinkyNL committed 2019-12-01 18:55:49 +01:00
1 parent c70c162ef0
commit f8037feb81
81 files changed
+1610 -365

No files matched your search

@@ -7,8 +7,8 @@
<ProjectGuid>{0F288A66-6EB0-4589-8595-E33A3A3EAEA2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Artemis.Plugins.LayerTypes.Brush</RootNamespace>
<AssemblyName>Artemis.Plugins.LayerTypes.Brush</AssemblyName>
<RootNamespace>Artemis.Plugins.LayerElements.Brush</RootNamespace>
<AssemblyName>Artemis.Plugins.LayerElements.Brush</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
@@ -33,14 +33,20 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MaterialDesignColors, Version=1.2.0.325, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.1.2.0\lib\net45\MaterialDesignColors.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MaterialDesignThemes.Wpf">
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.2.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.2.5\lib\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Core, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\RGB.NET\bin\net45\RGB.NET.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Stylet, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Stylet.1.2.0\lib\net45\Stylet.dll</HintPath>
@@ -52,6 +58,7 @@
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -59,14 +66,13 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.2.5\lib\net40\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="BrushConfiguration.cs" />
<Compile Include="BrushLayerType.cs" />
<Compile Include="BrushLayerElementSettings.cs" />
<Compile Include="BrushLayerElementViewModel.cs" />
<Compile Include="BrushLayerElement.cs" />
<Compile Include="BrushLayerElementProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -83,6 +89,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Include="BrushLayerElementView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>echo Copying plugin to Artemis.UI output directory
@@ -1,9 +0,0 @@
using Artemis.Core.Plugins.Interfaces;
namespace Artemis.Plugins.LayerTypes.Brush
{
public class BrushConfiguration : ILayerTypeConfiguration
{
public System.Windows.Media.Brush Brush { get; set; }
}
}
@@ -0,0 +1,40 @@
using System.Drawing;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.LayerElement;
namespace Artemis.Plugins.LayerElements.Brush
{
public class BrushLayerElement : LayerElement
{
public BrushLayerElement(Layer layer, BrushLayerElementSettings settings, LayerElementDescriptor descriptor) : base(layer, settings, descriptor)
{
Settings = settings ?? new BrushLayerElementSettings {Brush = new SolidBrush(Color.Red)};
}
public new BrushLayerElementSettings Settings { get; }
public override LayerElementViewModel GetViewModel()
{
return new BrushLayerElementViewModel(this);
}
public override void Update(double deltaTime)
{
}
public override void RenderPreProcess(ArtemisSurface surface, Graphics graphics)
{
}
public override void Render(ArtemisSurface surface, Graphics graphics)
{
if (Settings?.Brush != null)
graphics.FillRectangle(Settings.Brush, Layer.RenderRectangle);
}
public override void RenderPostProcess(ArtemisSurface surface, Graphics graphics)
{
}
}
}
@@ -0,0 +1,25 @@
using Artemis.Core.Plugins.LayerElement;
using Artemis.Core.Plugins.Models;
namespace Artemis.Plugins.LayerElements.Brush
{
public class BrushLayerElementProvider : LayerElementProvider
{
public BrushLayerElementProvider(PluginInfo pluginInfo) : base(pluginInfo)
{
AddLayerElementDescriptor<BrushLayerElement>("Brush", "A brush of a specific type and colors", "Brush");
}
public override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override void Dispose()
{
}
}
}
@@ -0,0 +1,9 @@
using Artemis.Core.Plugins.LayerElement;
namespace Artemis.Plugins.LayerElements.Brush
{
public class BrushLayerElementSettings : LayerElementSettings
{
public System.Drawing.Brush Brush { get; set; }
}
}
@@ -0,0 +1,54 @@
<UserControl x:Class="Artemis.Plugins.LayerElements.Brush.BrushLayerElementView"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:brushLayer="clr-namespace:Artemis.Plugins.LayerElements.Brush"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance {x:Type brushLayer:BrushLayerElementViewModel}}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Teal.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Setting 1 -->
<StackPanel Grid.Row="0" Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
</StackPanel>
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
<!-- Setting 2 -->
<StackPanel Grid.Row="2" Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" VerticalAlignment="Center">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
</StackPanel>
<Separator Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignLightSeparator}" />
</Grid>
</UserControl>
@@ -0,0 +1,14 @@
using Artemis.Core.Plugins.LayerElement;
namespace Artemis.Plugins.LayerElements.Brush
{
public class BrushLayerElementViewModel : LayerElementViewModel
{
public BrushLayerElementViewModel(BrushLayerElement layerElement) : base(layerElement)
{
LayerElement = layerElement;
}
public new BrushLayerElement LayerElement { get; }
}
}
@@ -1,42 +0,0 @@
using System.Drawing;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models;
using QRCoder;
namespace Artemis.Plugins.LayerTypes.Brush
{
public class BrushLayerType : LayerType
{
public BrushLayerType(PluginInfo pluginInfo) : base(pluginInfo)
{
}
public override void EnablePlugin()
{
var qrGenerator = new QRCodeGenerator();
}
public override void DisablePlugin()
{
}
public override void Update(Layer layer)
{
var config = layer.LayerTypeConfiguration as BrushConfiguration;
if (config == null)
return;
// Update the brush
}
public override void Render(Layer device, ArtemisSurface surface, Graphics graphics)
{
}
public override void Dispose()
{
}
}
}
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Artemis.Plugins.LayerTypes.Brush")]
[assembly: AssemblyTitle("Artemis.Plugins.LayerElements.Brush")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="QRCoder" version="1.2.5" targetFramework="net461" />
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
<package id="Stylet" version="1.2.0" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
@@ -1,10 +1,10 @@
{
"Guid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
"Name": "Brush layer",
"Name": "Brush layer elements",
"Version": {
"Major": 1,
"Minor": 0,
"Build": 0
},
"Main": "Artemis.Plugins.LayerTypes.Brush.dll"
"Main": "Artemis.Plugins.LayerElements.Brush.dll"
}