From 86e632da523a369cea80bbee2007bdf4708d4176 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 7 May 2021 09:22:55 +0200 Subject: [PATCH 1/3] Device properties - Fixed color calibration not applying realtime Device properties - UI tweaks --- .../Controls/DeviceVisualizer.cs | 10 ++---- .../Settings/Device/DeviceDialogView.xaml | 3 +- .../Device/Tabs/DeviceLedsTabView.xaml | 34 +++++++++---------- .../Tabs/DevicePropertiesTabViewModel.cs | 3 ++ .../Device/Tabs/InputMappingsTabView.xaml | 4 +-- .../Tabs/Devices/DeviceSettingsView.xaml | 7 +++- 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index e3fd07f40..130cbe0c4 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -100,15 +100,11 @@ namespace Artemis.UI.Shared // Determine the scale required to fit the desired size of the control Size measureSize = MeasureDevice(); - double scale = Math.Min(DesiredSize.Width / measureSize.Width, DesiredSize.Height / measureSize.Height); - Rect scaledRect = new(0, 0, measureSize.Width * scale, measureSize.Height * scale); + double scale = Math.Min(RenderSize.Width / measureSize.Width, RenderSize.Height / measureSize.Height); - // Center and scale the visualization in the desired bounding box - if (DesiredSize.Width > 0 && DesiredSize.Height > 0) - { - drawingContext.PushTransform(new TranslateTransform(DesiredSize.Width / 2 - scaledRect.Width / 2, DesiredSize.Height / 2 - scaledRect.Height / 2)); + // Scale the visualization in the desired bounding box + if (RenderSize.Width > 0 && RenderSize.Height > 0) drawingContext.PushTransform(new ScaleTransform(scale, scale)); - } // Determine the offset required to rotate within bounds Rect rotationRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height); diff --git a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml index cecc74966..d9315be5d 100644 --- a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml +++ b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml @@ -114,7 +114,8 @@ HorizontalAlignment="Center" VerticalAlignment="Center" ShowColors="True" - LedClicked="{s:Action OnLedClicked}"/> + LedClicked="{s:Action OnLedClicked}" + Margin="20"/> + 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:tabs="clr-namespace:Artemis.UI.Screens.Settings.Device.Tabs" + xmlns:converters="clr-namespace:Artemis.UI.Converters" + x:Class="Artemis.UI.Screens.Settings.Device.Tabs.DeviceLedsTabView" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800" + d:DataContext="{d:DesignInstance {x:Type tabs:DeviceLedsTabViewModel}}"> - + @@ -32,10 +32,10 @@ - - + + - + diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs index a03ce103e..8b0f872dd 100644 --- a/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs @@ -7,6 +7,7 @@ using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared.Services; using Ookii.Dialogs.Wpf; +using RGB.NET.Core; using SkiaSharp; using Stylet; @@ -105,6 +106,8 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs Device.RedScale = RedScale / 100f; Device.GreenScale = GreenScale / 100f; Device.BlueScale = BlueScale / 100f; + + _rgbService.Surface.Update(true); } public void BrowseCustomLayout(object sender, MouseEventArgs e) diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/InputMappingsTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/InputMappingsTabView.xaml index d662eb770..267ccbd4b 100644 --- a/src/Artemis.UI/Screens/Settings/Device/Tabs/InputMappingsTabView.xaml +++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/InputMappingsTabView.xaml @@ -55,8 +55,8 @@ CanUserAddRows="False" AutoGenerateColumns="False" CanUserResizeRows="False" - materialDesign:DataGridAssist.CellPadding="8" - materialDesign:DataGridAssist.ColumnHeaderPadding="8" + materialDesign:DataGridAssist.CellPadding="16 5 5 5" + materialDesign:DataGridAssist.ColumnHeaderPadding="16 5 5 5" VirtualizingPanel.VirtualizationMode="Standard" Margin="10"> diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml index 34a5d27a0..e3f3676bf 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml @@ -30,7 +30,12 @@ - +