mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layouts - Round LEDs and device size
Tray - Use dark icon for for light Windows theme
This commit is contained in:
parent
96c55e5c03
commit
c7c78dfecc
@ -66,6 +66,44 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public LayoutCustomDeviceData LayoutCustomDeviceData { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Applies the layout to the provided device
|
||||
/// </summary>
|
||||
public void ApplyTo(IRGBDevice device, bool createMissingLeds = false, bool removeExcessiveLeds = false)
|
||||
{
|
||||
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
|
||||
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
|
||||
|
||||
HashSet<LedId> ledIds = new();
|
||||
foreach (ILedLayout layoutLed in RgbLayout.Leds)
|
||||
{
|
||||
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
|
||||
{
|
||||
ledIds.Add(ledId);
|
||||
|
||||
Led? led = device[ledId];
|
||||
if (led == null && createMissingLeds)
|
||||
led = device.AddLed(ledId, new Point(), new Size());
|
||||
|
||||
if (led != null)
|
||||
{
|
||||
led.Location = new Point(MathF.Round(layoutLed.X), MathF.Round(layoutLed.Y));
|
||||
led.Size = new Size(MathF.Round(layoutLed.Width), MathF.Round(layoutLed.Height));
|
||||
led.Shape = layoutLed.Shape;
|
||||
led.ShapeData = layoutLed.ShapeData;
|
||||
led.LayoutMetadata = layoutLed.CustomData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removeExcessiveLeds)
|
||||
{
|
||||
List<LedId> ledsToRemove = device.Select(led => led.Id).Where(id => !ledIds.Contains(id)).ToList();
|
||||
foreach (LedId led in ledsToRemove)
|
||||
device.RemoveLed(led);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ApplyDevice(ArtemisDevice artemisDevice)
|
||||
{
|
||||
Device = artemisDevice;
|
||||
@ -108,44 +146,6 @@ namespace Artemis.Core
|
||||
else
|
||||
Image = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the layout to the provided device
|
||||
/// </summary>
|
||||
public void ApplyTo(IRGBDevice device, bool createMissingLeds = false, bool removeExcessiveLeds = false)
|
||||
{
|
||||
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
|
||||
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
|
||||
|
||||
HashSet<LedId> ledIds = new();
|
||||
foreach (ILedLayout layoutLed in RgbLayout.Leds)
|
||||
{
|
||||
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
|
||||
{
|
||||
ledIds.Add(ledId);
|
||||
|
||||
Led? led = device[ledId];
|
||||
if ((led == null) && createMissingLeds)
|
||||
led = device.AddLed(ledId, new Point(), new Size());
|
||||
|
||||
if (led != null)
|
||||
{
|
||||
led.Location = new Point(MathF.Round(layoutLed.X), MathF.Round(layoutLed.Y));
|
||||
led.Size = new Size(MathF.Round(layoutLed.Width), MathF.Round(layoutLed.Height));
|
||||
led.Shape = layoutLed.Shape;
|
||||
led.ShapeData = layoutLed.ShapeData;
|
||||
led.LayoutMetadata = layoutLed.CustomData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removeExcessiveLeds)
|
||||
{
|
||||
List<LedId> ledsToRemove = device.Select(led => led.Id).Where(id => !ledIds.Contains(id)).ToList();
|
||||
foreach (LedId led in ledsToRemove)
|
||||
device.RemoveLed(led);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -85,6 +85,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Fonts\RobotoMono-Regular.ttf" />
|
||||
<Resource Include="Resources\Images\Logo\bow-black.ico" />
|
||||
<Resource Include="Resources\Images\Logo\bow-white.ico" />
|
||||
<Resource Include="Resources\Images\Logo\bow-white.svg" />
|
||||
<Resource Include="Resources\Images\Logo\bow.ico" />
|
||||
@ -313,6 +314,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\Fonts\RobotoMono-Regular.ttf" />
|
||||
<None Remove="Resources\Images\Logo\bow-black.ico" />
|
||||
<None Remove="Resources\Images\Logo\bow-white.ico" />
|
||||
<None Remove="Resources\Images\Logo\bow-white.svg" />
|
||||
<None Remove="Resources\Images\Logo\bow.ico" />
|
||||
|
||||
BIN
src/Artemis.UI/Resources/Images/Logo/bow-black.ico
Normal file
BIN
src/Artemis.UI/Resources/Images/Logo/bow-black.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@ -7,7 +7,7 @@
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d">
|
||||
<tb:TaskbarIcon IconSource="/Resources/Images/Logo/bow-white.ico"
|
||||
<tb:TaskbarIcon IconSource="{Binding Icon}"
|
||||
MenuActivation="LeftOrRightClick"
|
||||
PopupActivation="DoubleClick"
|
||||
DoubleClickCommand="{s:Action TrayBringToForeground}"
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Events;
|
||||
@ -27,6 +29,7 @@ namespace Artemis.UI.Screens
|
||||
private RootViewModel _rootViewModel;
|
||||
private SplashViewModel _splashViewModel;
|
||||
private TaskbarIcon _taskBarIcon;
|
||||
private ImageSource _icon;
|
||||
|
||||
public TrayViewModel(IKernel kernel,
|
||||
IWindowManager windowManager,
|
||||
@ -90,6 +93,12 @@ namespace Artemis.UI.Screens
|
||||
OnMainWindowOpened();
|
||||
}
|
||||
|
||||
public ImageSource Icon
|
||||
{
|
||||
get => _icon;
|
||||
set => SetAndNotify(ref _icon, value);
|
||||
}
|
||||
|
||||
public void TrayActivateSidebarItem(string sidebarItem)
|
||||
{
|
||||
TrayBringToForeground();
|
||||
@ -168,9 +177,15 @@ namespace Artemis.UI.Screens
|
||||
|
||||
private void ApplyWindowsTheme(ThemeWatcher.WindowsTheme windowsTheme)
|
||||
{
|
||||
Execute.PostToUIThread(() =>
|
||||
{
|
||||
Icon = windowsTheme == ThemeWatcher.WindowsTheme.Dark
|
||||
? new BitmapImage(new Uri("pack://application:,,,/Artemis.UI;component/Resources/Images/Logo/bow-white.ico"))
|
||||
: new BitmapImage(new Uri("pack://application:,,,/Artemis.UI;component/Resources/Images/Logo/bow-black.ico"));
|
||||
});
|
||||
|
||||
if (_colorScheme.Value != ApplicationColorScheme.Automatic)
|
||||
return;
|
||||
|
||||
if (windowsTheme == ThemeWatcher.WindowsTheme.Dark)
|
||||
ChangeMaterialColors(ApplicationColorScheme.Dark);
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user