Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device layout editor #1930

Open
wants to merge 52 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
871c295
Dynamical layout json files scanning
xQwexx Feb 6, 2020
0368726
Minor code cleaning in the LayoutManager
xQwexx Feb 8, 2020
5774fa4
Refactor to enable multiple device layouts
xQwexx Feb 18, 2020
3d9c281
Enable to move deviceKeys and some fixes
xQwexx Feb 29, 2020
0db80c5
Merge branch 'dev' of https://github.com/antonpup/Aurora into feature…
xQwexx May 2, 2020
e5ff467
enable loading old profiles, Keycap control refactor
xQwexx May 4, 2020
026602c
Add control to edit DeviceKeycapConf
xQwexx May 6, 2020
89f32ed
Merge branch 'dev' of https://github.com/antonpup/Aurora into feature…
xQwexx May 6, 2020
133e30b
Merge branch 'dev' into feature/multiple-device-layout
xQwexx May 11, 2020
dd66332
Copy json if it newer, delete unnecessary ones
xQwexx May 12, 2020
0e81fa2
Not found directory fix
xQwexx May 14, 2020
92169cb
Merge branch 'dev' of https://github.com/antonpup/Aurora into feature…
xQwexx May 16, 2020
c9ef9dc
Enable separate japan layout editing, convert physical layout Types t…
xQwexx May 18, 2020
fa19307
Merge branch 'dev' of https://github.com/antonpup/Aurora into feature…
xQwexx May 18, 2020
338c626
All current bug fix + Merge branch 'dev' 'Asus Change'
xQwexx May 18, 2020
c650efa
Merge branch 'dev' of https://github.com/antonpup/Aurora into feature…
xQwexx May 18, 2020
dfeb64e
small fix
xQwexx May 19, 2020
1a3825f
Fix exception when device layout offset was negative
xQwexx May 19, 2020
d918127
Fix device selection, update visualname change, refactor deviceLayout
xQwexx May 20, 2020
8baa6de
Update no device selected box
xQwexx May 20, 2020
79fcb62
Fix layout not applying the colors
xQwexx May 20, 2020
5398227
Bug fixes, add keyboard physical layout detection, Fix bitmap lock ex…
xQwexx May 21, 2020
ed93d28
Fix keyselection selection
xQwexx May 21, 2020
35dcb6b
Optimizing the DevicePresenter, fix other bugs
xQwexx May 21, 2020
e35314b
Resize freeform thumbs
xQwexx May 21, 2020
0ef421d
Merge branch 'dev' of https://github.com/xQwexx/Aurora into feature/m…
xQwexx Nov 29, 2020
fa95f4b
Add OpenRGB multi device support
xQwexx Jun 12, 2021
1575f43
Add Cointainer Wrapper, Fix 0 index for Keyboard, and other bug fixes
xQwexx Jun 12, 2021
cf5b478
Fix async not working proberly, One openRGB device just one layout
xQwexx Jun 12, 2021
052c007
Add invisible background json flag and some performance optimalization
xQwexx Jun 18, 2021
9bc3135
Fix selection Key Layout, finalizing the Control_Keys
xQwexx Jun 19, 2021
bd4b410
Small editor improvement
xQwexx Jun 20, 2021
d0b496d
Add Steelseries rival 650 layout and disable keycap dragging
xQwexx Jun 20, 2021
6549283
The custom layout stores in the appdata
xQwexx Jun 20, 2021
8ad7e6c
Enable Keycap dragging
xQwexx Jun 20, 2021
b282273
Replace corsair sdk support
xQwexx Jun 21, 2021
4a080f4
Add not existing keyboard keys
xQwexx Jun 22, 2021
e2919c6
Fix Razer Sdk init fail, missed index
xQwexx Jun 22, 2021
60da8ba
Fix custom device layouts are not displayed in the drop down
xQwexx Jun 23, 2021
538e161
Fix old way of serrializate keyboard
xQwexx Jun 23, 2021
c36b6e9
Add +/- and auto devicename discovery
xQwexx Jun 23, 2021
4f461bc
Set active layoutname after you save it
xQwexx Jun 25, 2021
02c3cf7
Fix for #2320
xQwexx Jun 13, 2021
9c7dae3
Add corsair sdk suppport
xQwexx Jun 25, 2021
bcee7fd
Remove CorairRGB.NET dependency
xQwexx Jun 25, 2021
35fe7b1
Fix update flash not happening
xQwexx Jun 25, 2021
3c66632
Fix corsair detection
xQwexx Jun 26, 2021
fae2c2d
Fix ghosting device layout bug
xQwexx Jun 26, 2021
faae773
Fix Corsair key mapping
xQwexx Jun 26, 2021
d03a8a7
Fix some device layout bugs
xQwexx Jun 28, 2021
ee7c448
Update Colore version
xQwexx Jun 28, 2021
b9d868e
Fix helping text
xQwexx Aug 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions Project-Aurora/Project-Aurora/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static void LogLine(this NLog.Logger logger, string text, Logging_Level l
public static NetworkListener net_listener;
public static Configuration Configuration;
public static DeviceManager dev_manager;
public static KeyboardLayoutManager kbLayout;
public static DeviceLayoutManager devicesLayout;
public static Effects effengine;
public static KeyRecorder key_recorder;
public static RzSdkManager razerSdkManager;
Expand Down Expand Up @@ -313,9 +313,9 @@ protected override void OnStartup(StartupEventArgs e)
Global.logger.Info("Loading Plugins");
(Global.PluginManager = new PluginManager()).Initialize();

Global.logger.Info("Loading KB Layouts");
Global.kbLayout = new KeyboardLayoutManager();
Global.kbLayout.LoadBrandDefault();

Global.devicesLayout = new DeviceLayoutManager();


Global.logger.Info("Loading Input Hooking");
Global.InputEvents = new InputEvents();
Expand Down Expand Up @@ -407,6 +407,8 @@ protected override void OnStartup(StartupEventArgs e)
MainWindow = new ConfigUI();
((ConfigUI)MainWindow).Display();

Global.logger.Info("Loading Device Layouts");

//Debug Windows on Startup
if (Global.Configuration.BitmapWindowOnStartUp)
Window_BitmapView.Open();
Expand Down
15 changes: 2 additions & 13 deletions Project-Aurora/Project-Aurora/ConfigUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:Aurora"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:Controls="clr-namespace:Aurora.Controls" xmlns:Settings="clr-namespace:Aurora.Settings" x:Class="Aurora.ConfigUI"
xmlns:Controls="clr-namespace:Aurora.Controls" xmlns:Settings="clr-namespace:Aurora.Settings" xmlns:DeviceLayout="clr-namespace:Aurora.Settings.DeviceLayoutViewer" x:Class="Aurora.ConfigUI"
mc:Ignorable="d" Height="656" Width="1000" Title="Aurora" Loaded="Window_Loaded" Initialized="Window_Initialized" Closing="Window_Closing" Activated="Window_Activated" Deactivated="Window_Deactivated" HorizontalContentAlignment="Stretch" MinWidth="926" MinHeight="575"
DataContext="{Binding RelativeSource={RelativeSource Self}}" SizeChanged="Window_SizeChanged">
<DockPanel x:Name="bg_grid" Background="#FF660000">
Expand Down Expand Up @@ -87,18 +87,7 @@
</Grid.RowDefinitions>

<ContentPresenter Margin="6,4,7,6" Grid.Row="1" Content="{Binding SelectedControl}" />
<Viewbox x:Name="keyboard_viewbox" StretchDirection="Both" Margin="0,0,7,0">
<Border Margin="5,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="#A51E1E1E" CornerRadius="8" MinWidth="650" MinHeight="216">
<Grid>
<Grid x:Name="keyboard_grid" Margin="10,10,10,10" Height="192" VerticalAlignment="Top" HorizontalAlignment="Left" Width="803">
<Grid.CacheMode>
<BitmapCache EnableClearType="True"/>
</Grid.CacheMode>
</Grid>
<Label x:Name="keyboard_record_message" Content="Please select key(s) you want to assign" HorizontalAlignment="Right" Foreground="Red" Height="26" VerticalAlignment="Top" Margin="0,0,10,0" Grid.Column="1" Padding="0" IsHitTestVisible="False" />
</Grid>
</Border>
</Viewbox>
<DeviceLayout:Control_DeviceLayoutPresenter x:Name="deviceLayerPresenter" Margin="0,0,7,0" MaxHeight="500" MinHeight="200"/>
</Grid>
</DockPanel>
</Window>
75 changes: 4 additions & 71 deletions Project-Aurora/Project-Aurora/ConfigUI.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Aurora.Controls;
using Aurora.Profiles.Generic_Application;
using System.IO;
using Aurora.Settings.Keycaps;
using Aurora.Profiles;
using Aurora.Settings.Layers;
using Aurora.Profiles.Aurora_Wrapper;
Expand Down Expand Up @@ -50,13 +49,7 @@ partial class ConfigUI : Window, INotifyPropertyChanged

private Timer virtual_keyboard_timer;
private Stopwatch recording_stopwatch = new Stopwatch();
private Grid virtial_kb = new Grid();

private readonly double virtual_keyboard_width;
private readonly double virtual_keyboard_height;

private readonly double width;
private readonly double height;

public static readonly DependencyProperty FocusedApplicationProperty = DependencyProperty.Register("FocusedApplication", typeof(Profiles.Application), typeof(ConfigUI), new PropertyMetadata(null, new PropertyChangedCallback(FocusedProfileChanged)));

Expand All @@ -70,8 +63,6 @@ public Profiles.Application FocusedApplication
}
}

LayerEditor layer_editor = new LayerEditor();

private bool _ShowHidden = false;

public bool ShowHidden
Expand All @@ -88,19 +79,10 @@ public ConfigUI()
{
InitializeComponent();

virtual_keyboard_height = this.keyboard_grid.Height;
virtual_keyboard_width = this.keyboard_grid.Width;

width = Width;
height = Height;

Global.kbLayout.KeyboardLayoutUpdated += KbLayout_KeyboardLayoutUpdated;

ctrlProfileManager.ProfileSelected += CtrlProfileManager_ProfileSelected;

GenerateProfileStack();
settingsControl.DataContext = this;


}

Expand Down Expand Up @@ -141,28 +123,7 @@ private void Layer_manager_NewLayer(Layer layer)
SelectedControl = layerPresenter;
}

private void KbLayout_KeyboardLayoutUpdated(object sender)
{
virtial_kb = Global.kbLayout.Virtual_keyboard;

keyboard_grid.Children.Clear();
keyboard_grid.Children.Add(virtial_kb);
keyboard_grid.Children.Add(new LayerEditor());

keyboard_grid.Width = virtial_kb.Width;
this.Width = width + (virtial_kb.Width - virtual_keyboard_width);

keyboard_grid.Height = virtial_kb.Height;
this.Height = height + (virtial_kb.Height - virtual_keyboard_height);

keyboard_grid.UpdateLayout();

keyboard_viewbox.MaxWidth = virtial_kb.Width + 50;
keyboard_viewbox.MaxHeight = virtial_kb.Height + 50;
keyboard_viewbox.UpdateLayout();

this.UpdateLayout();
}


private void Window_Loaded(object sender, RoutedEventArgs e)
{
Expand All @@ -171,34 +132,15 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
if (!settingsloaded)
{
virtual_keyboard_timer = new Timer(33);
virtual_keyboard_timer.Elapsed += new ElapsedEventHandler(virtual_keyboard_timer_Tick);
virtual_keyboard_timer.Elapsed += new ElapsedEventHandler(LayoutRenderTimerTick);
virtual_keyboard_timer.Start();

settingsloaded = true;
}

this.keyboard_record_message.Visibility = Visibility.Hidden;

current_color = desktop_color_scheme;
bg_grid.Background = new SolidColorBrush(Color.FromRgb(desktop_color_scheme.Red, desktop_color_scheme.Green, desktop_color_scheme.Blue));

virtial_kb = Global.kbLayout.Virtual_keyboard;

keyboard_grid.Children.Clear();
keyboard_grid.Children.Add(virtial_kb);
keyboard_grid.Children.Add(new LayerEditor());

keyboard_grid.Width = virtial_kb.Width;
this.Width = width + (virtial_kb.Width - virtual_keyboard_width);

keyboard_grid.Height = virtial_kb.Height;
this.Height = height + (virtial_kb.Height - virtual_keyboard_height);

keyboard_grid.UpdateLayout();

keyboard_viewbox.MaxWidth = virtial_kb.Width + 50;
keyboard_viewbox.MaxHeight = virtial_kb.Height + 50;
keyboard_viewbox.UpdateLayout();

UpdateManagerStackFocus(ctrlLayerManager);

Expand Down Expand Up @@ -233,7 +175,7 @@ public static bool ApplicationIsActivated()
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
private static extern int GetWindowThreadProcessId(IntPtr handle, out int processId);

private void virtual_keyboard_timer_Tick(object sender, EventArgs e)
private void LayoutRenderTimerTick(object sender, EventArgs e)
{
if (!ApplicationIsActivated())
return;
Expand All @@ -249,20 +191,11 @@ private void virtual_keyboard_timer_Tick(object sender, EventArgs e)
bg_grid.UpdateLayout();
}


Dictionary<Devices.DeviceKeys, System.Drawing.Color> keylights = new Dictionary<Devices.DeviceKeys, System.Drawing.Color>();

if (IsActive)
{
keylights = Global.effengine.GetKeyboardLights();
Global.kbLayout.SetKeyboardColors(keylights);
deviceLayerPresenter.Refresh();
}

if (Global.key_recorder.IsRecording())
this.keyboard_record_message.Visibility = Visibility.Visible;
else
this.keyboard_record_message.Visibility = Visibility.Hidden;

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Aurora.Controls"
xmlns:DeviceLayout="clr-namespace:Aurora.Settings.DeviceLayoutViewer"
mc:Ignorable="d"
d:DesignHeight="414" d:DesignWidth="535" Loaded="UserControl_Loaded" PreviewKeyDown="UserControl_PreviewKeyDown">
<Grid>
<DockPanel LastChildFill="True">
<Grid DockPanel.Dock="Top">
<DockPanel>
<GroupBox x:Name="grpbxProperties" Header="Properties" BorderThickness="1" Margin="0,0,2,0" Width="200" MinWidth="200" DockPanel.Dock="Right"/>
<Viewbox x:Name="viewbxAnimationView" StretchDirection="Both" Margin="0,0,7,0" >
<Border Margin="5,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="#A51E1E1E" CornerRadius="8" MinWidth="650" MinHeight="216">
<Grid>
<Rectangle Margin="0" Width="15" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="White"/>
<local:Control_Ruler x:Name="rulerHorizontalPixels" Height="15" Margin="15,0,0,0" Background="White" VerticalAlignment="Top" Foreground="Black" />
<local:Control_Ruler x:Name="rulerVerticalPixels" Width="15" Margin="0,15,0,0" Background="White" IsVertical="True" HorizontalAlignment="Left" Foreground="Black" />
<Image x:Name="keyboard_overlayPreview" RenderOptions.BitmapScalingMode="HighQuality" SizeChanged="keyboard_overlayPreview_SizeChanged" Margin="15,15,0,0" Stretch="Fill" />
<Grid x:Name="keyboard_grid" Margin="15,15,0,0" Opacity="0.8">
<Grid.CacheMode>
<BitmapCache EnableClearType="True"/>
</Grid.CacheMode>
</Grid>
</Grid>
</Border>
<Viewbox x:Name="viewbxAnimationView" MaxHeight="500" MaxWidth="1200" StretchDirection="Both" Margin="0,0,7,0" >
<Grid>
<Image x:Name="keyboard_overlayPreview" RenderOptions.BitmapScalingMode="HighQuality" SizeChanged="keyboard_overlayPreview_SizeChanged" Margin="15,15,0,0" Stretch="Fill" />
<DeviceLayout:Control_DeviceLayoutPresenter x:Name="deviceLayerPresenter" IsLayoutMoveEnabled="False" Margin="0,0,7,0" Opacity="0.8"/>
<Rectangle Margin="0" Width="15" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="White"/>
<local:Control_Ruler x:Name="rulerHorizontalPixels" Height="15" Margin="15,0,0,0" Background="White" VerticalAlignment="Top" Foreground="Black" />
<local:Control_Ruler x:Name="rulerVerticalPixels" Width="15" Margin="0,15,0,0" Background="White" IsVertical="True" HorizontalAlignment="Left" Foreground="Black" />
</Grid>
</Viewbox>
</DockPanel>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Aurora.Devices;
using Aurora.EffectsEngine.Animations;
using Aurora.Settings;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down Expand Up @@ -57,71 +58,41 @@ public Control_AnimationEditor()
{
InitializeComponent();

UpdateVirtualKeyboard();

Global.kbLayout.KeyboardLayoutUpdated += KbLayout_KeyboardLayoutUpdated;
}

private void KbLayout_KeyboardLayoutUpdated(object sender)
{
UpdateVirtualKeyboard();
}

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
}

private void UpdateVirtualKeyboard()
{
Grid virtial_kb = Global.kbLayout.AbstractVirtualKeyboard;

keyboard_grid.Children.Clear();
keyboard_grid.Children.Add(virtial_kb);
keyboard_grid.Children.Add(new LayerEditor());

keyboard_grid.Width = virtial_kb.Width;
keyboard_grid.Height = virtial_kb.Height;

keyboard_grid.UpdateLayout();

viewbxAnimationView.MaxWidth = virtial_kb.Width + 50;
viewbxAnimationView.MaxHeight = virtial_kb.Height + 50;
viewbxAnimationView.UpdateLayout();

this.UpdateLayout();

//Generate a new mapping
foreach (FrameworkElement Child in virtial_kb.Children)
foreach (Settings.DeviceLayoutViewer.Control_Keycap key in deviceLayerPresenter.Keycaps)
{
if (Child is Settings.Keycaps.IKeycap && (Child as Settings.Keycaps.IKeycap).GetKey() != DeviceKeys.NONE)
if (key.GetKey() != DeviceKeys.NONE)
{
Child.PreviewMouseLeftButtonDown += KeyboardKey_PreviewMouseLeftButtonDown;
Child.PreviewMouseRightButtonDown += KeyboardKey_PreviewMouseRightButtonDown;
key.PreviewMouseLeftButtonDown += KeyboardKey_PreviewMouseLeftButtonDown;
key.PreviewMouseRightButtonDown += KeyboardKey_PreviewMouseRightButtonDown;
}
}
}

private void KeyboardKey_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.Keycaps.IKeycap)
if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.DeviceLayoutViewer.Keycaps.KeycapViewer keycapViewer)
{
SetKeyColor((sender as Settings.Keycaps.IKeycap).GetKey(), _PrimaryManualColor);
SetKeyColor(keycapViewer.GetKey(), _PrimaryManualColor);

this.animMixer.UpdatePlaybackTime();
}
}

private void KeyboardKey_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.Keycaps.IKeycap)
if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.DeviceLayoutViewer.Keycaps.KeycapViewer keycapViewer)
{
SetKeyColor((sender as Settings.Keycaps.IKeycap).GetKey(), _SecondaryManualColor);
SetKeyColor(keycapViewer.GetKey(), _SecondaryManualColor);

this.animMixer.UpdatePlaybackTime();
}
}

private void SetKeyColor(DeviceKeys key, System.Drawing.Color color)
private void SetKeyColor(DeviceKey key, System.Drawing.Color color)
{
if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame)
{
Expand Down Expand Up @@ -443,7 +414,7 @@ private void BtnClearColors_Click(object sender, RoutedEventArgs e)
{
AnimationManualColorFrame frame = ((_selectedFrameItem as Control_AnimationFrameItem).ContextFrame as AnimationManualColorFrame);

frame.SetBitmapColors(new Dictionary<DeviceKeys, System.Drawing.Color>());
frame.SetBitmapColors(new Dictionary<DeviceKey, System.Drawing.Color>());

this.animMixer.UpdatePlaybackTime();
}
Expand Down
Loading