mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Core - Add HidSharp to force plugins to share the HidSharp types
Core - For now, set default log level to debug ColorGradient- Improved GetColor performance ColorGradient - GetColor now handles colors not between two stops properly Home - Fix links Plugins - Only allow layer property registration through Brushes Color brush - Default to solid color
This commit is contained in:
1 parent
6c3bc9869c
commit
8c0d62a00b
21 files changed
+279
-172
No files matched your search
@@ -25,6 +25,7 @@
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" />
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressWarnings" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -10,6 +10,7 @@
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:controls1="clr-namespace:Artemis.UI.Shared.Controls"
|
||||
xmlns:utilities="clr-namespace:Artemis.UI.Shared.Utilities"
|
||||
mc:Ignorable="d"
|
||||
Background="{DynamicResource MaterialDesignPaper}"
|
||||
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
||||
@@ -22,13 +23,13 @@
|
||||
<converters:ColorGradientToGradientStopsConverter x:Key="ColorGradientToGradientStopsConverter" />
|
||||
<converters:SKColorToColorConverter x:Key="SKColorToColorConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid Margin="16">
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card Grid.Row="0" Margin="15 15 15 7" >
|
||||
<materialDesign:Card Grid.Row="0" Margin="15 15 15 7">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
|
||||
<materialDesign:PackIcon Kind="Crane" Width="80" Height="80" HorizontalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap"
|
||||
@@ -47,7 +48,9 @@
|
||||
<TextBlock Margin="15 15 0 0">Gradient</TextBlock>
|
||||
<Separator Margin="15 5" />
|
||||
|
||||
<Rectangle x:Name="Preview" Width="440" Height="40" Margin="15 0">
|
||||
<Rectangle x:Name="Preview" Height="40" Margin="15 0"
|
||||
utilities:SizeObserver.Observe="True"
|
||||
utilities:SizeObserver.ObservedWidth="{Binding PreviewWidth, Mode=OneWayToSource}">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush
|
||||
GradientStops="{Binding ColorGradient.Stops, Converter={StaticResource ColorGradientToGradientStopsConverter}}" />
|
||||
|
||||
@@ -7,15 +7,14 @@ using System.Windows.Input;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.UI.Shared.Services.Dialog;
|
||||
using Artemis.UI.Shared.Utilities;
|
||||
using SkiaSharp;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Shared.Screens.GradientEditor
|
||||
{
|
||||
public class GradientEditorViewModel : DialogViewModelBase
|
||||
{
|
||||
private ColorStopViewModel _selectedColorStopViewModel;
|
||||
private readonly List<ColorGradientStop> _originalStops;
|
||||
private ColorStopViewModel _selectedColorStopViewModel;
|
||||
|
||||
public GradientEditorViewModel(ColorGradient colorGradient)
|
||||
{
|
||||
@@ -24,8 +23,7 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
|
||||
|
||||
_originalStops = ColorGradient.Stops.Select(s => new ColorGradientStop(s.Color, s.Position)).ToList();
|
||||
|
||||
foreach (var colorStop in ColorGradient.Stops.OrderBy(s => s.Position))
|
||||
ColorStopViewModels.Add(new ColorStopViewModel(this, colorStop));
|
||||
PropertyChanged += UpdateColorStopViewModels;
|
||||
}
|
||||
|
||||
public BindableCollection<ColorStopViewModel> ColorStopViewModels { get; set; }
|
||||
@@ -43,8 +41,7 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
|
||||
public bool HasSelectedColorStopViewModel => SelectedColorStopViewModel != null;
|
||||
|
||||
public ColorGradient ColorGradient { get; }
|
||||
// TODO: Find the width out from view
|
||||
public double PreviewWidth => 408;
|
||||
public double PreviewWidth { get; set; }
|
||||
|
||||
public void AddColorStop(object sender, MouseEventArgs e)
|
||||
{
|
||||
@@ -99,5 +96,12 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
|
||||
if (!Session.IsEnded)
|
||||
Session.Close(false);
|
||||
}
|
||||
|
||||
private void UpdateColorStopViewModels(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != nameof(PreviewWidth)) return;
|
||||
foreach (var colorStop in ColorGradient.Stops.OrderBy(s => s.Position))
|
||||
ColorStopViewModels.Add(new ColorStopViewModel(this, colorStop));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.UI.Shared.Ninject.Factories;
|
||||
using Artemis.UI.Shared.Screens.GradientEditor;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
using LiteDB.Engine;
|
||||
using Ninject;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Shared.Services
|
||||
{
|
||||
public class GradientPickerService : IGradientPickerService
|
||||
{
|
||||
private readonly IGradientEditorVmFactory _gradientEditorVmFactory;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IWindowManager _windowManager;
|
||||
|
||||
public GradientPickerService(IGradientEditorVmFactory gradientEditorVmFactory, IDialogService dialogService)
|
||||
public GradientPickerService(IDialogService dialogService)
|
||||
{
|
||||
_gradientEditorVmFactory = gradientEditorVmFactory;
|
||||
_dialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user