diff --git a/src/Artemis.Core/Models/Profile/Folder.cs b/src/Artemis.Core/Models/Profile/Folder.cs index 3389ff82e..daf70f7ff 100644 --- a/src/Artemis.Core/Models/Profile/Folder.cs +++ b/src/Artemis.Core/Models/Profile/Folder.cs @@ -40,26 +40,29 @@ namespace Artemis.Core.Models.Profile // Ensure order integrity, should be unnecessary but no one is perfect specially me _children = _children.OrderBy(c => c.Order).ToList(); for (var index = 0; index < _children.Count; index++) - { - var profileElement = _children[index]; - profileElement.Order = index + 1; - } + _children[index].Order = index + 1; } internal FolderEntity FolderEntity { get; set; } public override void Update(double deltaTime) { - // Folders don't update but their children do - foreach (var profileElement in Children) + // Iterate the children in reverse because that's how they must be rendered too + for (var index = Children.Count - 1; index > -1; index--) + { + var profileElement = Children[index]; profileElement.Update(deltaTime); + } } public override void Render(double deltaTime, SKCanvas canvas, SKImageInfo canvasInfo) { - // Folders don't render but their children do - foreach (var profileElement in Children) + // Iterate the children in reverse because the first layer must be rendered last to end up on top + for (var index = Children.Count - 1; index > -1; index--) + { + var profileElement = Children[index]; profileElement.Render(deltaTime, canvas, canvasInfo); + } } public Folder AddFolder(string name) diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 1d1123483..fa30d4764 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; using Artemis.Core.Models.Surface; using RGB.NET.Core; +using Stylet; namespace Artemis.UI.Shared.Controls { @@ -18,6 +20,9 @@ namespace Artemis.UI.Shared.Controls public static readonly DependencyProperty ShowColorsProperty = DependencyProperty.Register(nameof(ShowColors), typeof(bool), typeof(DeviceVisualizer), new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.AffectsRender, ShowColorsPropertyChangedCallback)); + public static readonly DependencyProperty HighlightedLedsProperty = DependencyProperty.Register(nameof(HighlightedLeds), typeof(IEnumerable), typeof(DeviceVisualizer), + new FrameworkPropertyMetadata(default(IEnumerable))); + private readonly DrawingGroup _backingStore; private readonly List _deviceVisualizerLeds; private BitmapImage _deviceImage; @@ -57,6 +62,12 @@ namespace Artemis.UI.Shared.Controls set => SetValue(ShowColorsProperty, value); } + public IEnumerable HighlightedLeds + { + get => (IEnumerable) GetValue(HighlightedLedsProperty); + set => SetValue(HighlightedLedsProperty, value); + } + public void Dispose() { RGBSurface.Instance.Updated -= RgbSurfaceOnUpdated; @@ -159,8 +170,17 @@ namespace Artemis.UI.Shared.Controls { var drawingContext = _backingStore.Open(); - foreach (var deviceVisualizerLed in _deviceVisualizerLeds) - deviceVisualizerLed.RenderColor(drawingContext); + if (HighlightedLeds.Any()) + { + foreach (var deviceVisualizerLed in _deviceVisualizerLeds) + deviceVisualizerLed.RenderColor(drawingContext, !HighlightedLeds.Contains(deviceVisualizerLed.Led)); + } + else + { + foreach (var deviceVisualizerLed in _deviceVisualizerLeds) + deviceVisualizerLed.RenderColor(drawingContext, false); + } + drawingContext.Close(); } diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs index 215e97366..80535ae27 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs @@ -23,11 +23,11 @@ namespace Artemis.UI.Shared.Controls if (Led.RgbLed.Image != null && File.Exists(Led.RgbLed.Image.AbsolutePath)) LedImage = new BitmapImage(Led.RgbLed.Image); - + CreateLedGeometry(); } - + public ArtemisLed Led { get; } public Rect LedRect { get; set; } public BitmapImage LedImage { get; set; } @@ -60,7 +60,6 @@ namespace Artemis.UI.Shared.Controls // Stroke geometry is the display geometry excluding the inner geometry DisplayGeometry.Transform = new TranslateTransform(Led.RgbLed.LedRectangle.Location.X, Led.RgbLed.LedRectangle.Location.Y); // Try to gain some performance - DisplayGeometry = DisplayGeometry.GetFlattenedPathGeometry(); DisplayGeometry.Freeze(); } @@ -103,7 +102,7 @@ namespace Artemis.UI.Shared.Controls } } - public void RenderColor(DrawingContext drawingContext) + public void RenderColor(DrawingContext drawingContext, bool isDimmed) { if (DisplayGeometry == null) return; @@ -111,8 +110,10 @@ namespace Artemis.UI.Shared.Controls var r = Led.RgbLed.Color.GetR(); var g = Led.RgbLed.Color.GetG(); var b = Led.RgbLed.Color.GetB(); - - drawingContext.DrawRectangle(new SolidColorBrush(Color.FromRgb(r, g, b)), null, LedRect); + + drawingContext.DrawRectangle(isDimmed + ? new SolidColorBrush(Color.FromArgb(100, r, g, b)) + : new SolidColorBrush(Color.FromRgb(r, g, b)), null, LedRect); } public void RenderImage(DrawingContext drawingContext) diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker.xaml b/src/Artemis.UI.Shared/Controls/GradientPicker.xaml index 32ed02fcf..544726848 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker.xaml +++ b/src/Artemis.UI.Shared/Controls/GradientPicker.xaml @@ -41,7 +41,9 @@ Background="{StaticResource Checkerboard}"> - + diff --git a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml index e08eb0abd..780b13421 100644 --- a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml +++ b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml @@ -53,7 +53,9 @@ utilities:SizeObserver.ObservedWidth="{Binding PreviewWidth, Mode=OneWayToSource}"> + GradientStops="{Binding ColorGradient.Stops, Converter={StaticResource ColorGradientToGradientStopsConverter}}" + EndPoint="1,0" + StartPoint="0,0"/> diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml index b85412407..cff17995b 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml @@ -121,7 +121,7 @@ - + - + - - - - - - - - + + + - + - - - - - + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerView.xaml.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerView.xaml.cs deleted file mode 100644 index 79b26cf6e..000000000 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerView.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization -{ - /// - /// Interaction logic for ProfileLayerView.xaml - /// - public partial class ProfileLayerView : UserControl - { - public ProfileLayerView() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs index 80402ff5e..d8673d3a3 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs @@ -1,11 +1,17 @@ using System; using System.Linq; using System.Windows; +using System.Windows.Controls; using System.Windows.Media; +using System.Windows.Media.Imaging; using Artemis.Core.Models.Profile; using Artemis.Core.Models.Profile.LayerShapes; +using Artemis.Core.Models.Surface; +using Artemis.UI.Extensions; using Artemis.UI.Services.Interfaces; +using RGB.NET.Core; using Stylet; +using Rectangle = Artemis.Core.Models.Profile.LayerShapes.Rectangle; namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization { @@ -28,10 +34,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization } public Layer Layer { get; } - public Rect LayerRect { get; set; } - public Thickness LayerRectMargin => LayerRect == Rect.Empty ? new Thickness() : new Thickness(LayerRect.Left, LayerRect.Top, 0, 0); - public bool IsSelected { get; set; } + + public Geometry LayerGeometry { get; set; } + public Geometry OpacityGeometry { get; set; } public Geometry ShapeGeometry { get; set; } + public RenderTargetBitmap LayerGeometryBitmap { get; set; } + public Rect ViewportRectangle { get; set; } + public Thickness LayerPosition => new Thickness(ViewportRectangle.Left, ViewportRectangle.Top, 0, 0); + public bool IsSelected { get; set; } public void Dispose() { @@ -44,12 +54,68 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization private void Update() { IsSelected = _profileEditorService.SelectedProfileElement == Layer; - if (!Layer.Leds.Any() || Layer.LayerShape == null) - LayerRect = Rect.Empty; - else - LayerRect = _layerEditorService.GetLayerBounds(Layer); - + CreateLayerGeometry(); CreateShapeGeometry(); + CreateViewportRectangle(); + } + + private void CreateLayerGeometry() + { + if (!Layer.Leds.Any()) + { + LayerGeometry = Geometry.Empty; + OpacityGeometry = Geometry.Empty; + ViewportRectangle = Rect.Empty; + return; + } + + var group = new GeometryGroup(); + group.FillRule = FillRule.Nonzero; + + foreach (var led in Layer.Leds) + { + Geometry geometry; + switch (led.RgbLed.Shape) + { + case Shape.Custom: + if (led.RgbLed.Device.DeviceInfo.DeviceType == RGBDeviceType.Keyboard || led.RgbLed.Device.DeviceInfo.DeviceType == RGBDeviceType.Keypad) + geometry = CreateCustomGeometry(led, 2); + else + geometry = CreateCustomGeometry(led, 1); + break; + case Shape.Rectangle: + geometry = CreateRectangleGeometry(led); + break; + case Shape.Circle: + geometry = CreateCircleGeometry(led); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + group.Children.Add(geometry); + } + + var layerGeometry = group.GetOutlinedPathGeometry(); + var opacityGeometry = Geometry.Combine(Geometry.Empty, layerGeometry, GeometryCombineMode.Exclude, new TranslateTransform()); + + LayerGeometry = layerGeometry; + OpacityGeometry = opacityGeometry; + + // Render the store as a bitmap + var drawingImage = new DrawingImage(new GeometryDrawing(new SolidColorBrush(Colors.Black), null, LayerGeometry)); + var image = new Image {Source = drawingImage}; + var bitmap = new RenderTargetBitmap( + (int) (LayerGeometry.Bounds.Width * 2.5), + (int) (LayerGeometry.Bounds.Height * 2.5), + 96, + 96, + PixelFormats.Pbgra32 + ); + image.Arrange(new Rect(0, 0, bitmap.Width, bitmap.Height)); + bitmap.Render(image); + bitmap.Freeze(); + LayerGeometryBitmap = bitmap; } private void CreateShapeGeometry() @@ -79,6 +145,59 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization }); } + private void CreateViewportRectangle() + { + if (!Layer.Leds.Any() || Layer.LayerShape == null) + { + ViewportRectangle = Rect.Empty; + return; + } + + ViewportRectangle = _layerEditorService.GetLayerBounds(Layer); + } + + private Geometry CreateRectangleGeometry(ArtemisLed led) + { + var rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); + rect.Inflate(1, 1); + return new RectangleGeometry(rect); + } + + private Geometry CreateCircleGeometry(ArtemisLed led) + { + var rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); + rect.Inflate(1, 1); + return new EllipseGeometry(rect); + } + + private Geometry CreateCustomGeometry(ArtemisLed led, double deflateAmount) + { + var rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); + rect.Inflate(1, 1); + try + { + var geometry = Geometry.Combine( + Geometry.Empty, + Geometry.Parse(led.RgbLed.ShapeData), + GeometryCombineMode.Union, + new TransformGroup + { + Children = new TransformCollection + { + new ScaleTransform(rect.Width, rect.Height), + new TranslateTransform(rect.X, rect.Y) + } + } + ); + + return geometry; + } + catch (Exception) + { + return CreateRectangleGeometry(led); + } + } + #region Event handlers private void LayerOnRenderPropertiesUpdated(object sender, EventArgs e) @@ -98,7 +217,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization private void ProfileEditorServiceOnProfilePreviewUpdated(object sender, EventArgs e) { - Update(); + CreateShapeGeometry(); + CreateViewportRectangle(); } #endregion diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml index 2e4c4a4a7..0c40e351b 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml @@ -57,7 +57,7 @@ - + @@ -122,7 +122,9 @@ - + @@ -158,11 +160,11 @@ - - Dim LEDs outside selected layer + + Only show shape of selected layer (NYI) - - Pause visualization on focus loss + + Highlight LEDs of selected layer diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs index c0b0a4002..f61881edb 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs @@ -51,7 +51,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization CanvasViewModels = new BindableCollection(); Devices = new BindableCollection(); - DimmedLeds = new BindableCollection(); + HighlightedLeds = new BindableCollection(); SelectedLeds = new BindableCollection(); }); @@ -64,21 +64,22 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization public bool IsInitializing { get; private set; } + public bool CanSelectEditTool { get; set; } public PanZoomViewModel PanZoomViewModel { get; set; } public BindableCollection CanvasViewModels { get; set; } public BindableCollection Devices { get; set; } - public BindableCollection DimmedLeds { get; set; } + public BindableCollection HighlightedLeds { get; set; } public BindableCollection SelectedLeds { get; set; } + public PluginSetting OnlyShowSelectedShape { get; set; } public PluginSetting HighlightSelectedLayer { get; set; } - public PluginSetting PauseRenderingOnFocusLoss { get; set; } public VisualizationToolViewModel ActiveToolViewModel { get => _activeToolViewModel; - set + private set { // Remove the tool from the canvas if (_activeToolViewModel != null) @@ -120,8 +121,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization protected override void OnInitialActivate() { + OnlyShowSelectedShape = _settingsService.GetSetting("ProfileEditor.OnlyShowSelectedShape", true); HighlightSelectedLayer = _settingsService.GetSetting("ProfileEditor.HighlightSelectedLayer", true); - PauseRenderingOnFocusLoss = _settingsService.GetSetting("ProfileEditor.PauseRenderingOnFocusLoss", true); HighlightSelectedLayer.SettingChanged += HighlightSelectedLayerOnSettingChanged; _surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected; @@ -131,7 +132,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization base.OnInitialActivate(); } - + protected override void OnClose() { HighlightSelectedLayer.SettingChanged -= HighlightSelectedLayerOnSettingChanged; @@ -140,8 +141,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization _profileEditorService.ProfileElementSelected -= OnProfileElementSelected; _profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated; + OnlyShowSelectedShape.Save(); HighlightSelectedLayer.Save(); - PauseRenderingOnFocusLoss.Save(); base.OnClose(); } @@ -183,9 +184,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization private void UpdateLedsDimStatus() { - DimmedLeds.Clear(); + HighlightedLeds.Clear(); if (HighlightSelectedLayer.Value && _profileEditorService.SelectedProfileElement is Layer layer) - DimmedLeds.AddRange(layer.Leds); + HighlightedLeds.AddRange(layer.Leds); } #region Buttons @@ -300,14 +301,38 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization private void OnProfileElementSelected(object sender, EventArgs e) { UpdateLedsDimStatus(); - CanApplyToLayer = _profileEditorService.SelectedProfileElement is Layer; + if (_profileEditorService.SelectedProfileElement is Layer layer) + { + CanApplyToLayer = true; + CanSelectEditTool = layer.Leds.Any(); + } + else + { + CanApplyToLayer = false; + CanSelectEditTool = false; + } + if (CanSelectEditTool == false && ActiveToolIndex == 1) + ActivateToolByIndex(2); } + + private void OnSelectedProfileElementUpdated(object sender, EventArgs e) { ApplyActiveProfile(); UpdateLedsDimStatus(); - CanApplyToLayer = _profileEditorService.SelectedProfileElement is Layer; + if (_profileEditorService.SelectedProfileElement is Layer layer) + { + CanApplyToLayer = true; + CanSelectEditTool = layer.Leds.Any(); + } + else + { + CanApplyToLayer = false; + CanSelectEditTool = false; + } + if (CanSelectEditTool == false && ActiveToolIndex == 1) + ActivateToolByIndex(2); } public void Handle(MainWindowFocusChangedEvent message) diff --git a/src/Artemis.UI/Screens/RootView.xaml b/src/Artemis.UI/Screens/RootView.xaml index 42f60a4c8..a188a4773 100644 --- a/src/Artemis.UI/Screens/RootView.xaml +++ b/src/Artemis.UI/Screens/RootView.xaml @@ -50,7 +50,7 @@ - + diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs index da6f4a4f7..1e7c5e03b 100644 --- a/src/Artemis.UI/Screens/RootViewModel.cs +++ b/src/Artemis.UI/Screens/RootViewModel.cs @@ -1,8 +1,12 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using Artemis.Core.Plugins.Models; +using Artemis.Core.Services; using Artemis.UI.Events; +using Artemis.UI.Screens.Settings; using Artemis.UI.Screens.Sidebar; using Artemis.UI.Utilities; using MaterialDesignThemes.Wpf; @@ -14,15 +18,19 @@ namespace Artemis.UI.Screens { private readonly IEventAggregator _eventAggregator; private bool _lostFocus; + private PluginSetting _colorScheme; + private ThemeWatcher _themeWatcher; - public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel) + public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel, ISettingsService settingsService) { SidebarViewModel = sidebarViewModel; _eventAggregator = eventAggregator; - var themeWatcher = new ThemeWatcher(); - themeWatcher.ThemeChanged += (sender, args) => ApplyWindowsTheme(args.Theme); - ApplyWindowsTheme(themeWatcher.GetWindowsTheme()); + _colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic); + _colorScheme.SettingChanged += (sender, args) => ApplyColorSchemeSetting(); + _themeWatcher = new ThemeWatcher(); + _themeWatcher.ThemeChanged += (sender, args) => ApplyWindowsTheme(args.Theme); + ApplyColorSchemeSetting(); ActiveItem = SidebarViewModel.SelectedItem; ActiveItemReady = true; @@ -79,18 +87,34 @@ namespace Artemis.UI.Screens } } + private void ApplyColorSchemeSetting() + { + if (_colorScheme.Value == ApplicationColorScheme.Automatic) + ApplyWindowsTheme(_themeWatcher.GetWindowsTheme()); + else + ChangeMaterialColors(_colorScheme.Value); + } + private void ApplyWindowsTheme(ThemeWatcher.WindowsTheme windowsTheme) + { + if (_colorScheme.Value != ApplicationColorScheme.Automatic) + return; + + if (windowsTheme == ThemeWatcher.WindowsTheme.Dark) + ChangeMaterialColors(ApplicationColorScheme.Dark); + else + ChangeMaterialColors(ApplicationColorScheme.Light); + } + + private void ChangeMaterialColors(ApplicationColorScheme colorScheme) { var paletteHelper = new PaletteHelper(); var theme = paletteHelper.GetTheme(); - theme.SetBaseTheme(windowsTheme == ThemeWatcher.WindowsTheme.Dark ? Theme.Dark : Theme.Light); + theme.SetBaseTheme(colorScheme == ApplicationColorScheme.Dark ? Theme.Dark : Theme.Light); paletteHelper.SetTheme(theme); var extensionsPaletteHelper = new MaterialDesignExtensions.Themes.PaletteHelper(); - // That's nice, then don't use it in your own examples and provide a working alternative -#pragma warning disable 612 - extensionsPaletteHelper.SetLightDark(windowsTheme == ThemeWatcher.WindowsTheme.Dark); -#pragma warning restore 612 + extensionsPaletteHelper.SetLightDark(colorScheme == ApplicationColorScheme.Dark); } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.xaml b/src/Artemis.UI/Screens/Settings/SettingsView.xaml index 2eb391a49..37ea52121 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.xaml +++ b/src/Artemis.UI/Screens/Settings/SettingsView.xaml @@ -62,6 +62,27 @@ + + + + + + + + + + + Color scheme + + Pick between a light and dark color scheme, the automatic option copies your Windows settings. + + + + + + + + @@ -143,7 +164,7 @@ Log level - Sets the logging level, a verbose logging level will result in more log files. + Sets the logging level, a higher logging level will result in more log files. diff --git a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs index 2fe0f4f3d..332c94092 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs @@ -57,6 +57,7 @@ namespace Artemis.UI.Screens.Settings Plugins = new BindableCollection(); LogLevels = EnumUtilities.GetAllValuesAndDescriptions(typeof(LogEventLevel)); + ColorSchemes = EnumUtilities.GetAllValuesAndDescriptions(typeof(ApplicationColorScheme)); RenderScales = new List> {new Tuple("10%", 0.1)}; for (var i = 25; i <= 100; i += 25) RenderScales.Add(new Tuple(i + "%", i / 100.0)); @@ -72,6 +73,7 @@ namespace Artemis.UI.Screens.Settings public List> TargetFrameRates { get; set; } public List> RenderScales { get; set; } public IEnumerable LogLevels { get; } + public IEnumerable ColorSchemes { get; } public List SampleSizes { get; set; } public BindableCollection DeviceSettingsViewModels { get; set; } @@ -118,6 +120,16 @@ namespace Artemis.UI.Screens.Settings _settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information).Value = value; _settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information).Save(); } + } + + public ApplicationColorScheme SelectedColorScheme + { + get => _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value; + set + { + _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value = value; + _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Save(); + } } public double RenderScale @@ -218,4 +230,11 @@ namespace Artemis.UI.Screens.Settings } } } + + public enum ApplicationColorScheme + { + Light, + Dark, + Automatic + } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml index 9a998e566..2e472b794 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml @@ -190,7 +190,7 @@ - + diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs index 605320449..dcfe1ee33 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs @@ -78,7 +78,7 @@ namespace Artemis.Plugins.LayerBrushes.Color GradientType.Solid => SKShader.CreateColor(_color), GradientType.LinearGradient => SKShader.CreateLinearGradient( new SKPoint(_shaderBounds.Left, _shaderBounds.Top), - new SKPoint(_shaderBounds.Right, _shaderBounds.Bottom), + new SKPoint(_shaderBounds.Right, _shaderBounds.Top), GradientProperty.Value.GetColorsArray(), GradientProperty.Value.GetPositionsArray(), SKShaderTileMode.Repeat),