mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 17:53:32 +00:00
Added NoneKeyboard to allow creating profiles without a keyboard for #141
This commit is contained in:
parent
60b89cc88d
commit
d777c61112
@ -321,6 +321,7 @@
|
|||||||
<Compile Include="Controls\Log\MemoryEventTarget.cs" />
|
<Compile Include="Controls\Log\MemoryEventTarget.cs" />
|
||||||
<Compile Include="DAL\ProfileProvider.cs" />
|
<Compile Include="DAL\ProfileProvider.cs" />
|
||||||
<Compile Include="DAL\SettingsProvider.cs" />
|
<Compile Include="DAL\SettingsProvider.cs" />
|
||||||
|
<Compile Include="DeviceProviders\Artemis\NoneKeyboard.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProL.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProL.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProS.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProS.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\Utilities\CmSdk.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\Utilities\CmSdk.cs" />
|
||||||
|
|||||||
42
Artemis/Artemis/DeviceProviders/Artemis/NoneKeyboard.cs
Normal file
42
Artemis/Artemis/DeviceProviders/Artemis/NoneKeyboard.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Artemis.Properties;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.Artemis
|
||||||
|
{
|
||||||
|
public class NoneKeyboard : KeyboardProvider
|
||||||
|
{
|
||||||
|
public NoneKeyboard()
|
||||||
|
{
|
||||||
|
Name = "None";
|
||||||
|
Slug = "none";
|
||||||
|
CantEnableText = "Waaaaah, this should not be happening!";
|
||||||
|
Height = 1;
|
||||||
|
Width = 1;
|
||||||
|
PreviewSettings = new PreviewSettings(984, 375, new Thickness(0, 0, 0, 0), Resources.none);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanEnable()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Enable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawBitmap(Bitmap bitmap)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.DeviceProviders;
|
using Artemis.DeviceProviders;
|
||||||
|
using Artemis.DeviceProviders.Artemis;
|
||||||
using Artemis.DeviceProviders.CoolerMaster;
|
using Artemis.DeviceProviders.CoolerMaster;
|
||||||
using Artemis.DeviceProviders.Corsair;
|
using Artemis.DeviceProviders.Corsair;
|
||||||
using Artemis.DeviceProviders.Logitech;
|
using Artemis.DeviceProviders.Logitech;
|
||||||
@ -12,6 +13,7 @@ namespace Artemis.InjectionModules
|
|||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
// Keyboards
|
// Keyboards
|
||||||
|
Bind<DeviceProvider>().To<NoneKeyboard>().InSingletonScope();
|
||||||
Bind<DeviceProvider>().To<CorsairKeyboard>().InSingletonScope();
|
Bind<DeviceProvider>().To<CorsairKeyboard>().InSingletonScope();
|
||||||
Bind<DeviceProvider>().To<G910>().InSingletonScope();
|
Bind<DeviceProvider>().To<G910>().InSingletonScope();
|
||||||
Bind<DeviceProvider>().To<G810>().InSingletonScope();
|
Bind<DeviceProvider>().To<G810>().InSingletonScope();
|
||||||
|
|||||||
@ -62,7 +62,7 @@ namespace Artemis.Modules.Effects.ProfilePreview
|
|||||||
var keyboardRect = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
var keyboardRect = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
{
|
{
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
||||||
DataModel, keyboardRect, true, true, "keyboard");
|
DataModel, keyboardRect, true, true, "keyboard");
|
||||||
}
|
}
|
||||||
// Render mice layer-by-layer
|
// Render mice layer-by-layer
|
||||||
|
|||||||
@ -23,7 +23,7 @@ namespace Artemis.Profiles.Layers.Types.Generic
|
|||||||
var thumbnailRect = new Rect(0, 0, 18, 18);
|
var thumbnailRect = new Rect(0, 0, 18, 18);
|
||||||
var visual = new DrawingVisual();
|
var visual = new DrawingVisual();
|
||||||
using (var c = visual.RenderOpen())
|
using (var c = visual.RenderOpen())
|
||||||
c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.headset), thumbnailRect);
|
c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.generic), thumbnailRect);
|
||||||
|
|
||||||
var image = new DrawingImage(visual.Drawing);
|
var image = new DrawingImage(visual.Drawing);
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
Binary file not shown.
@ -70,11 +70,7 @@ namespace Artemis.ViewModels.Flyouts
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var collection = new BindableCollection<string>
|
return new BindableCollection<string>(MainManager.DeviceManager.KeyboardProviders.Select(k => k.Name));
|
||||||
(MainManager.DeviceManager.KeyboardProviders.Select(k => k.Name));
|
|
||||||
|
|
||||||
collection.Insert(0, "None");
|
|
||||||
return collection;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Timers;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@ -45,6 +44,57 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
deviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
deviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProfileModel SelectedProfile { get; set; }
|
||||||
|
|
||||||
|
public LayerModel SelectedLayer
|
||||||
|
{
|
||||||
|
get { return _selectedLayer; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _selectedLayer)) return;
|
||||||
|
_selectedLayer = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawingImage KeyboardPreview
|
||||||
|
{
|
||||||
|
get { return _keyboardPreview; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _keyboardPreview)) return;
|
||||||
|
_keyboardPreview = value;
|
||||||
|
NotifyOfPropertyChange(() => KeyboardPreview);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double BlurRadius
|
||||||
|
{
|
||||||
|
get { return _blurRadius; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Equals(_blurRadius)) return;
|
||||||
|
_blurRadius = value;
|
||||||
|
NotifyOfPropertyChange(() => BlurRadius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShowAll
|
||||||
|
{
|
||||||
|
get { return _showAll; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _showAll) return;
|
||||||
|
_showAll = value;
|
||||||
|
NotifyOfPropertyChange(() => ShowAll);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageSource KeyboardImage => ImageUtilities
|
||||||
|
.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image ?? Resources.none);
|
||||||
|
|
||||||
|
public bool Activated { get; set; }
|
||||||
|
|
||||||
private void LoopManagerOnRenderCompleted(object sender, EventArgs eventArgs)
|
private void LoopManagerOnRenderCompleted(object sender, EventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!Activated)
|
if (!Activated)
|
||||||
@ -55,7 +105,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
_blurProgress = _blurProgress + 0.025;
|
_blurProgress = _blurProgress + 0.025;
|
||||||
BlurRadius = (Math.Sin(_blurProgress*Math.PI) + 1)*10 + 10;
|
BlurRadius = (Math.Sin(_blurProgress*Math.PI) + 1)*10 + 10;
|
||||||
|
|
||||||
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null)
|
// Besides the usual checks, also check if the ActiveKeyboard isn't the NoneKeyboard
|
||||||
|
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null || _deviceManager.ActiveKeyboard.Slug == "none")
|
||||||
{
|
{
|
||||||
var preview = new DrawingImage();
|
var preview = new DrawingImage();
|
||||||
preview.Freeze();
|
preview.Freeze();
|
||||||
@ -127,57 +178,6 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
KeyboardPreview = drawnPreview;
|
KeyboardPreview = drawnPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileModel SelectedProfile { get; set; }
|
|
||||||
|
|
||||||
public LayerModel SelectedLayer
|
|
||||||
{
|
|
||||||
get { return _selectedLayer; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, _selectedLayer)) return;
|
|
||||||
_selectedLayer = value;
|
|
||||||
NotifyOfPropertyChange(() => SelectedLayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingImage KeyboardPreview
|
|
||||||
{
|
|
||||||
get { return _keyboardPreview; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, _keyboardPreview)) return;
|
|
||||||
_keyboardPreview = value;
|
|
||||||
NotifyOfPropertyChange(() => KeyboardPreview);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double BlurRadius
|
|
||||||
{
|
|
||||||
get { return _blurRadius; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value.Equals(_blurRadius)) return;
|
|
||||||
_blurRadius = value;
|
|
||||||
NotifyOfPropertyChange(() => BlurRadius);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShowAll
|
|
||||||
{
|
|
||||||
get { return _showAll; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _showAll) return;
|
|
||||||
_showAll = value;
|
|
||||||
NotifyOfPropertyChange(() => ShowAll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImageSource KeyboardImage => ImageUtilities
|
|
||||||
.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image ?? Resources.none);
|
|
||||||
|
|
||||||
public bool Activated { get; set; }
|
|
||||||
|
|
||||||
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs e)
|
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => KeyboardImage);
|
NotifyOfPropertyChange(() => KeyboardImage);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user