mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 18:23:32 +00:00
1.2.0 (#127)
* Changed Rocket League to no longer rely on float but int for boost reading * Small fixes Fixed layer sometimes losing it's parent after edit Reoganized layer type view(models) Added animations to headsets (broken for Corsair atm) * Working toward 1.2.0 Fixed sliding animations sometimes leaving a blank pixel Added a 'new folder' button (resolves #123) Added official G810 support (needs testing, shares profiles with the G910, resolves #114) Added support for generic Logitech RGB devices (needs testing, pretends to be a headset for now, resolves #45) * Implemented a generic fix for transparency issues * Rendering cleanup Added a RenderFrame class to encapsulate all bitmaps that must be rendered LayerTypes now define a target device LayerTypes can set wheter to be drawn in the editor or not Added Generic device type * Resharper cleanup * Fixed startup issues, together with the refactor this resolves #111 it seems. * Fixed profile editor crash Fixed boolean condition not showing last value in editor * Added missing generic device type usage check * Generic device fixes * Fixed folder cloning Fixed unsaved changes false-positive * Profile editor no longer takes over keyboard if a game is running Updated Rocket League for 1.21 * Added JsonIgnore to ILayerType properties Renamed Generic device to Generic (Logitech) * Reduced profile editor CPU usage * Non-keyboard types clean up keyboard properties when selected Fixed a crash while saving * Added layer resize on import Null reference fixes Cleaned up JSON some more Added default animation to layer (NoneAnimation) Removed unnecessary layer properties casts * Updated default profiles for all keyboards * Bumped version number to 1.2.0
This commit is contained in:
parent
86e4f83b1d
commit
11035f7920
@ -2,24 +2,59 @@
|
|||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<sectionGroup name="userSettings"
|
||||||
<section name="Artemis.Modules.Effects.Bubbles.Bubbles" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<section name="Artemis.Modules.Effects.WindowsProfile.WindowsProfile" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Effects.Bubbles.Bubbles"
|
||||||
<section name="Artemis.Modules.Games.Overwatch.Overwatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Effects.WindowsProfile.WindowsProfile"
|
||||||
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Settings.Offsets" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Games.Overwatch.Overwatch"
|
||||||
<section name="Artemis.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Games.TheDivision.TheDivision"
|
||||||
<section name="Artemis.Settings.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
<section name="Artemis.Settings.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Settings.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Games.Dota2.Dota2"
|
||||||
<section name="Artemis.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
<section name="Artemis.Settings.TypeWave" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Settings.General" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.Offsets"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Modules.Games.Witcher3.Witcher3"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.CounterStrike"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.AudioVisualization"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.RocketLeague"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Properties.Settings"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.TypeWave"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="Artemis.Settings.General"
|
||||||
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<connectionStrings />
|
<connectionStrings />
|
||||||
|
|||||||
@ -38,8 +38,8 @@
|
|||||||
<SupportUrl>https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-%28FAQ%29</SupportUrl>
|
<SupportUrl>https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-%28FAQ%29</SupportUrl>
|
||||||
<ProductName>Artemis</ProductName>
|
<ProductName>Artemis</ProductName>
|
||||||
<PublisherName>Artemis</PublisherName>
|
<PublisherName>Artemis</PublisherName>
|
||||||
<ApplicationRevision>3</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.1.3.3</ApplicationVersion>
|
<ApplicationVersion>1.2.0.0</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -275,6 +275,9 @@
|
|||||||
<Compile Include="DeviceProviders\Corsair\CorsairMice.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairMice.cs" />
|
||||||
<Compile Include="DeviceProviders\Corsair\CorsairHeadsets.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairHeadsets.cs" />
|
||||||
<Compile Include="DeviceProviders\DeviceProvider.cs" />
|
<Compile Include="DeviceProviders\DeviceProvider.cs" />
|
||||||
|
<Compile Include="DeviceProviders\Logitech\G810.cs" />
|
||||||
|
<Compile Include="DeviceProviders\Logitech\LogitechGeneric.cs" />
|
||||||
|
<Compile Include="DeviceProviders\Logitech\LogitechKeyboard.cs" />
|
||||||
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
||||||
<Compile Include="Events\RazerColorArrayChanged.cs" />
|
<Compile Include="Events\RazerColorArrayChanged.cs" />
|
||||||
<Compile Include="Events\ToggleEnabled.cs" />
|
<Compile Include="Events\ToggleEnabled.cs" />
|
||||||
@ -282,9 +285,9 @@
|
|||||||
<Compile Include="InjectionFactories\ILayerEditorVmFactory.cs" />
|
<Compile Include="InjectionFactories\ILayerEditorVmFactory.cs" />
|
||||||
<Compile Include="InjectionFactories\IProfileEditorVmFactory.cs" />
|
<Compile Include="InjectionFactories\IProfileEditorVmFactory.cs" />
|
||||||
<Compile Include="ItemBehaviours\BindableSelectedItemBehavior.cs" />
|
<Compile Include="ItemBehaviours\BindableSelectedItemBehavior.cs" />
|
||||||
<Compile Include="DeviceProviders\Corsair\CorsairRGB.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairKeyboards.cs" />
|
||||||
<Compile Include="DeviceProviders\KeyboardProvider.cs" />
|
<Compile Include="DeviceProviders\KeyboardProvider.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Orion.cs" />
|
<Compile Include="DeviceProviders\Logitech\G910.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\KeyboardNames.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\KeyboardNames.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\KeyMap.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\KeyMap.cs" />
|
||||||
<Compile Include="DeviceProviders\Logitech\Utilities\LogitechGSDK.cs" />
|
<Compile Include="DeviceProviders\Logitech\Utilities\LogitechGSDK.cs" />
|
||||||
@ -306,6 +309,11 @@
|
|||||||
<Compile Include="Profiles\Layers\Animations\NoneAnimation.cs" />
|
<Compile Include="Profiles\Layers\Animations\NoneAnimation.cs" />
|
||||||
<Compile Include="Profiles\Layers\Models\EventPropertiesModel.cs" />
|
<Compile Include="Profiles\Layers\Models\EventPropertiesModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Models\KeyboardEventPropertiesModel.cs" />
|
<Compile Include="Profiles\Layers\Models\KeyboardEventPropertiesModel.cs" />
|
||||||
|
<Compile Include="Profiles\Layers\Types\Generic\GenericPropertiesView.xaml.cs">
|
||||||
|
<DependentUpon>GenericPropertiesView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Profiles\Layers\Types\Generic\GenericPropertiesViewModel.cs" />
|
||||||
|
<Compile Include="Profiles\Layers\Types\Generic\GenericType.cs" />
|
||||||
<Compile Include="Profiles\ProfileModel.cs" />
|
<Compile Include="Profiles\ProfileModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Models\SimplePropertiesModel.cs" />
|
<Compile Include="Profiles\Layers\Models\SimplePropertiesModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesModel.cs" />
|
||||||
@ -503,14 +511,14 @@
|
|||||||
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\ProfileViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\ProfileViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Layers\KeyboardPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerConditionViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerConditionViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerDynamicPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerDynamicPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerEditorViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Layers\LayerPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Abstract\LayerPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Layers\HeadsetPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Headset\HeadsetPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Layers\FolderPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Folder\FolderPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Layers\MousePropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\ProfileEditorViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\ProfileEditorViewModel.cs" />
|
||||||
@ -550,13 +558,13 @@
|
|||||||
<Compile Include="Views\Profiles\Events\EventPropertiesView.xaml.cs">
|
<Compile Include="Views\Profiles\Events\EventPropertiesView.xaml.cs">
|
||||||
<DependentUpon>EventPropertiesView.xaml</DependentUpon>
|
<DependentUpon>EventPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\Layers\FolderPropertiesView.xaml.cs">
|
<Compile Include="Profiles\Layers\Types\Folder\FolderPropertiesView.xaml.cs">
|
||||||
<DependentUpon>FolderPropertiesView.xaml</DependentUpon>
|
<DependentUpon>FolderPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\Layers\HeadsetPropertiesView.xaml.cs">
|
<Compile Include="Profiles\Layers\Types\Headset\HeadsetPropertiesView.xaml.cs">
|
||||||
<DependentUpon>HeadsetPropertiesView.xaml</DependentUpon>
|
<DependentUpon>HeadsetPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\Layers\KeyboardPropertiesView.xaml.cs">
|
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesView.xaml.cs">
|
||||||
<DependentUpon>KeyboardPropertiesView.xaml</DependentUpon>
|
<DependentUpon>KeyboardPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\LayerConditionView.xaml.cs">
|
<Compile Include="Views\Profiles\LayerConditionView.xaml.cs">
|
||||||
@ -568,7 +576,7 @@
|
|||||||
<Compile Include="Views\Profiles\LayerEditorView.xaml.cs">
|
<Compile Include="Views\Profiles\LayerEditorView.xaml.cs">
|
||||||
<DependentUpon>LayerEditorView.xaml</DependentUpon>
|
<DependentUpon>LayerEditorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\Layers\MousePropertiesView.xaml.cs">
|
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesView.xaml.cs">
|
||||||
<DependentUpon>MousePropertiesView.xaml</DependentUpon>
|
<DependentUpon>MousePropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\OverlaysView.xaml.cs">
|
<Compile Include="Views\OverlaysView.xaml.cs">
|
||||||
@ -594,6 +602,8 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<None Include="Resources\generic.png" />
|
||||||
|
<None Include="Resources\Keyboards\g810.png" />
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -707,6 +717,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Profiles\Layers\Types\Generic\GenericPropertiesView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Resources\Icons.xaml">
|
<Page Include="Resources\Icons.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -767,15 +781,15 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\Layers\FolderPropertiesView.xaml">
|
<Page Include="Profiles\Layers\Types\Folder\FolderPropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\Layers\HeadsetPropertiesView.xaml">
|
<Page Include="Profiles\Layers\Types\Headset\HeadsetPropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\Layers\KeyboardPropertiesView.xaml">
|
<Page Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@ -791,7 +805,7 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\Layers\MousePropertiesView.xaml">
|
<Page Include="Profiles\Layers\Types\Mouse\MousePropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@ -117,7 +117,7 @@ namespace Artemis
|
|||||||
private void CheckDuplicateInstances()
|
private void CheckDuplicateInstances()
|
||||||
{
|
{
|
||||||
bool aIsNewInstance;
|
bool aIsNewInstance;
|
||||||
Mutex = new Mutex(true, "ArtemisMutex2", out aIsNewInstance);
|
Mutex = new Mutex(true, "ArtemisMutex", out aIsNewInstance);
|
||||||
if (aIsNewInstance)
|
if (aIsNewInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -58,15 +58,32 @@ namespace Artemis.DAL
|
|||||||
{
|
{
|
||||||
if (prof == null)
|
if (prof == null)
|
||||||
throw new ArgumentNullException(nameof(prof));
|
throw new ArgumentNullException(nameof(prof));
|
||||||
if (!(prof.GameName?.Length > 1) || !(prof.KeyboardSlug?.Length > 1) || !(prof.Name?.Length > 1))
|
|
||||||
throw new ArgumentException("Profile is invalid. Name, GameName and KeyboardSlug are required");
|
|
||||||
|
|
||||||
var path = ProfileFolder + $@"\{prof.KeyboardSlug}\{prof.GameName}";
|
lock (prof)
|
||||||
if (!Directory.Exists(path))
|
{
|
||||||
Directory.CreateDirectory(path);
|
if (!(prof.GameName?.Length > 1) || !(prof.KeyboardSlug?.Length > 1) || !(prof.Name?.Length > 1))
|
||||||
|
throw new ArgumentException("Profile is invalid. Name, GameName and KeyboardSlug are required");
|
||||||
|
|
||||||
var json = JsonConvert.SerializeObject(prof, Formatting.Indented);
|
var path = ProfileFolder + $@"\{prof.KeyboardSlug}\{prof.GameName}";
|
||||||
File.WriteAllText(path + $@"\{prof.Name}.json", json);
|
if (!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
string json;
|
||||||
|
|
||||||
|
// Should saving fail for whatever reason, catch the exception and log it
|
||||||
|
// But DON'T touch the profile file.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
json = JsonConvert.SerializeObject(prof, Formatting.Indented);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, "Couldn't save profile '{0}.json'", prof.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(path + $@"\{prof.Name}.json", json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ProfileModel> ReadProfiles()
|
private static List<ProfileModel> ReadProfiles()
|
||||||
|
|||||||
@ -25,13 +25,16 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
CueSDK.Initialize();
|
CueSDK.Initialize();
|
||||||
|
|
||||||
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
||||||
|
|
||||||
|
if (CanUse)
|
||||||
|
CueSDK.HeadsetSDK.UpdateMode = UpdateMode.Manual;
|
||||||
|
|
||||||
return CanUse;
|
return CanUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (CueSDK.IsInitialized)
|
throw new NotImplementedException("Can only disable a keyboard");
|
||||||
CueSDK.Reinitialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateDevice(Bitmap bitmap)
|
public override void UpdateDevice(Bitmap bitmap)
|
||||||
@ -51,7 +54,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
{
|
{
|
||||||
var col = ledIndex == 0
|
var col = ledIndex == 0
|
||||||
? bitmap.GetPixel(0, 0)
|
? bitmap.GetPixel(0, 0)
|
||||||
: bitmap.GetPixel((int)((ledIndex + 1) * step - 1), (int)((ledIndex + 1) * step - 1));
|
: bitmap.GetPixel((int) ((ledIndex + 1)*step - 1), (int) ((ledIndex + 1)*step - 1));
|
||||||
|
|
||||||
corsairLed.Color = col;
|
corsairLed.Color = col;
|
||||||
ledIndex++;
|
ledIndex++;
|
||||||
|
|||||||
@ -11,12 +11,12 @@ using Point = System.Drawing.Point;
|
|||||||
|
|
||||||
namespace Artemis.DeviceProviders.Corsair
|
namespace Artemis.DeviceProviders.Corsair
|
||||||
{
|
{
|
||||||
public class CorsairRGB : KeyboardProvider
|
public class CorsairKeyboards : KeyboardProvider
|
||||||
{
|
{
|
||||||
private CorsairKeyboard _keyboard;
|
private CorsairKeyboard _keyboard;
|
||||||
private ImageBrush _keyboardBrush;
|
private ImageBrush _keyboardBrush;
|
||||||
|
|
||||||
public CorsairRGB(ILogger logger)
|
public CorsairKeyboards(ILogger logger)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
Name = "Corsair RGB Keyboards";
|
Name = "Corsair RGB Keyboards";
|
||||||
@ -68,6 +68,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
}
|
}
|
||||||
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
||||||
Slug = "corsair-" + _keyboard.DeviceInfo.Model.Replace(' ', '-').ToLower();
|
Slug = "corsair-" + _keyboard.DeviceInfo.Model.Replace(' ', '-').ToLower();
|
||||||
|
|
||||||
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +25,16 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
CueSDK.Initialize();
|
CueSDK.Initialize();
|
||||||
|
|
||||||
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
||||||
|
|
||||||
|
if (CanUse)
|
||||||
|
CueSDK.MouseSDK.UpdateMode = UpdateMode.Manual;
|
||||||
|
|
||||||
return CanUse;
|
return CanUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (CueSDK.IsInitialized)
|
throw new NotImplementedException("Can only disable a keyboard");
|
||||||
CueSDK.Reinitialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateDevice(Bitmap bitmap)
|
public override void UpdateDevice(Bitmap bitmap)
|
||||||
|
|||||||
@ -45,6 +45,7 @@ namespace Artemis.DeviceProviders
|
|||||||
{
|
{
|
||||||
Keyboard,
|
Keyboard,
|
||||||
Mouse,
|
Mouse,
|
||||||
Headset
|
Headset,
|
||||||
|
Generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
21
Artemis/Artemis/DeviceProviders/Logitech/G810.cs
Normal file
21
Artemis/Artemis/DeviceProviders/Logitech/G810.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using Artemis.Properties;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
|
{
|
||||||
|
internal class G810 : LogitechKeyboard
|
||||||
|
{
|
||||||
|
public G810()
|
||||||
|
{
|
||||||
|
Name = "Logitech G810 RGB";
|
||||||
|
Slug = "logitech-g910"; // Shares slugs with the G910 because the layout is identical
|
||||||
|
CantEnableText = "Couldn't connect to your Logitech G810.\n" +
|
||||||
|
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||||
|
"A minimum version of 8.81.15 is required.\n\n" +
|
||||||
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
|
Height = 6;
|
||||||
|
Width = 21;
|
||||||
|
PreviewSettings = new PreviewSettings(675, 185, new Thickness(0, 35, 0, 0), Resources.g810);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Artemis/Artemis/DeviceProviders/Logitech/G910.cs
Normal file
21
Artemis/Artemis/DeviceProviders/Logitech/G910.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using Artemis.Properties;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
|
{
|
||||||
|
internal class G910 : LogitechKeyboard
|
||||||
|
{
|
||||||
|
public G910()
|
||||||
|
{
|
||||||
|
Name = "Logitech G910 RGB";
|
||||||
|
Slug = "logitech-g910";
|
||||||
|
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
||||||
|
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||||
|
"A minimum version of 8.81.15 is required.\n\n" +
|
||||||
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
|
Height = 6;
|
||||||
|
Width = 21;
|
||||||
|
PreviewSettings = new PreviewSettings(540, 154, new Thickness(25, -80, 0, 0), Resources.g910);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Artemis/Artemis/DeviceProviders/Logitech/LogitechGeneric.cs
Normal file
58
Artemis/Artemis/DeviceProviders/Logitech/LogitechGeneric.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
|
using Ninject.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
|
{
|
||||||
|
// TODO: Handle shutdown, maybe implement Disable() afterall?
|
||||||
|
public class LogitechGeneric : DeviceProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A generic Logitech DeviceProvider. Because the Logitech SDK currently doesn't allow specific
|
||||||
|
/// device targeting (only very broad per-key-RGB and full RGB etc..)
|
||||||
|
/// </summary>
|
||||||
|
public LogitechGeneric(ILogger logger)
|
||||||
|
{
|
||||||
|
Logger = logger;
|
||||||
|
Type = DeviceType.Generic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
|
public override void UpdateDevice(Bitmap bitmap)
|
||||||
|
{
|
||||||
|
if (!CanUse || bitmap == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (bitmap)
|
||||||
|
{
|
||||||
|
var col = bitmap.GetPixel(bitmap.Width/2, bitmap.Height/2);
|
||||||
|
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB);
|
||||||
|
LogitechGSDK.LogiLedSetLighting((int) (col.R/2.55), (int) (col.G/2.55), (int) (col.B/2.55));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryEnable()
|
||||||
|
{
|
||||||
|
var majorNum = 0;
|
||||||
|
var minorNum = 0;
|
||||||
|
var buildNum = 0;
|
||||||
|
|
||||||
|
LogitechGSDK.LogiLedInit();
|
||||||
|
LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
|
||||||
|
|
||||||
|
// Turn it into one long number...
|
||||||
|
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
||||||
|
CanUse = version >= 88115;
|
||||||
|
Logger.Debug("Attempted to enable Logitech generic device. CanUse: {0}", CanUse);
|
||||||
|
|
||||||
|
return CanUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Can only disable a keyboard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,36 +2,21 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.Properties;
|
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.LogitechDll;
|
using Artemis.Utilities.LogitechDll;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Logitech
|
namespace Artemis.DeviceProviders.Logitech
|
||||||
{
|
{
|
||||||
internal class Orion : KeyboardProvider
|
public abstract class LogitechKeyboard : KeyboardProvider
|
||||||
{
|
{
|
||||||
public Orion()
|
|
||||||
{
|
|
||||||
Name = "Logitech G910 RGB";
|
|
||||||
Slug = "logitech-g910";
|
|
||||||
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
|
||||||
"Please check your cables and updating the Logitech Gaming Software\n" +
|
|
||||||
"A minimum version of 8.81.15 is required.\n\n" +
|
|
||||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
|
||||||
Height = 6;
|
|
||||||
Width = 21;
|
|
||||||
PreviewSettings = new PreviewSettings(540, 154, new Thickness(25, -80, 0, 0), Resources.g910);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanEnable()
|
public override bool CanEnable()
|
||||||
{
|
{
|
||||||
//Check to see if VC++ 2012 x64 is installed.
|
//Check to see if VC++ 2012 x64 is installed.
|
||||||
|
|
||||||
if (Registry.LocalMachine.OpenSubKey(
|
if (Registry.LocalMachine.OpenSubKey(
|
||||||
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
||||||
{
|
{
|
||||||
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
||||||
"The Visual C 2012 Redistributable could not be found, which is required.\n" +
|
"The Visual C 2012 Redistributable could not be found, which is required.\n" +
|
||||||
"Please download it by going to the following URL:\n\n" +
|
"Please download it by going to the following URL:\n\n" +
|
||||||
"https://www.microsoft.com/download/confirmation.aspx?id=30679";
|
"https://www.microsoft.com/download/confirmation.aspx?id=30679";
|
||||||
@ -77,9 +62,9 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
|
||||||
LogitechGSDK.LogiLedSaveCurrentLighting();
|
LogitechGSDK.LogiLedSaveCurrentLighting();
|
||||||
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
|
||||||
|
|
||||||
// Disable keys we can't color
|
// Disable keys we can't color
|
||||||
|
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
||||||
LogitechGSDK.LogiLedSetLighting(0, 0, 0);
|
LogitechGSDK.LogiLedSetLighting(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +77,7 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
|
|
||||||
public override void DrawBitmap(Bitmap bitmap)
|
public override void DrawBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
|
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
||||||
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
|
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Razer
|
|||||||
{
|
{
|
||||||
if (!Chroma.IsSdkAvailable())
|
if (!Chroma.IsSdkAvailable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Some people have Synapse installed, but not a Chroma keyboard, deal with this
|
// Some people have Synapse installed, but not a Chroma keyboard, deal with this
|
||||||
var blackWidowFound = Chroma.Instance.Query(Devices.Blackwidow).Connected;
|
var blackWidowFound = Chroma.Instance.Query(Devices.Blackwidow).Connected;
|
||||||
var blackWidowTeFound = Chroma.Instance.Query(Devices.BlackwidowTe).Connected;
|
var blackWidowTeFound = Chroma.Instance.Query(Devices.BlackwidowTe).Connected;
|
||||||
|
|||||||
@ -17,6 +17,7 @@ using Artemis.Profiles.Layers.Animations;
|
|||||||
using Artemis.Profiles.Layers.Conditions;
|
using Artemis.Profiles.Layers.Conditions;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Types.Folder;
|
using Artemis.Profiles.Layers.Types.Folder;
|
||||||
|
using Artemis.Profiles.Layers.Types.Generic;
|
||||||
using Artemis.Profiles.Layers.Types.Headset;
|
using Artemis.Profiles.Layers.Types.Headset;
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
||||||
@ -54,13 +55,16 @@ namespace Artemis.InjectionModules
|
|||||||
#region Devices
|
#region Devices
|
||||||
|
|
||||||
// Keyboards
|
// Keyboards
|
||||||
Bind<DeviceProvider>().To<CorsairRGB>().InSingletonScope();
|
Bind<DeviceProvider>().To<CorsairKeyboards>().InSingletonScope();
|
||||||
Bind<DeviceProvider>().To<Orion>().InSingletonScope();
|
Bind<DeviceProvider>().To<G910>().InSingletonScope();
|
||||||
|
Bind<DeviceProvider>().To<G810>().InSingletonScope();
|
||||||
Bind<DeviceProvider>().To<BlackWidow>().InSingletonScope();
|
Bind<DeviceProvider>().To<BlackWidow>().InSingletonScope();
|
||||||
// Mice
|
// Mice
|
||||||
Bind<DeviceProvider>().To<CorsairMice>().InSingletonScope();
|
Bind<DeviceProvider>().To<CorsairMice>().InSingletonScope();
|
||||||
// Headsets
|
// Headsets
|
||||||
Bind<DeviceProvider>().To<CorsairHeadsets>().InSingletonScope();
|
Bind<DeviceProvider>().To<CorsairHeadsets>().InSingletonScope();
|
||||||
|
// Other
|
||||||
|
Bind<DeviceProvider>().To<LogitechGeneric>().InSingletonScope();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -83,6 +87,7 @@ namespace Artemis.InjectionModules
|
|||||||
Bind<ILayerType>().To<KeyboardType>();
|
Bind<ILayerType>().To<KeyboardType>();
|
||||||
Bind<ILayerType>().To<KeyboardGifType>();
|
Bind<ILayerType>().To<KeyboardGifType>();
|
||||||
Bind<ILayerType>().To<MouseType>();
|
Bind<ILayerType>().To<MouseType>();
|
||||||
|
Bind<ILayerType>().To<GenericType>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,13 +30,14 @@ namespace Artemis.Managers
|
|||||||
.Cast<KeyboardProvider>().ToList();
|
.Cast<KeyboardProvider>().ToList();
|
||||||
MiceProviders = deviceProviders.Where(d => d.Type == DeviceType.Mouse).ToList();
|
MiceProviders = deviceProviders.Where(d => d.Type == DeviceType.Mouse).ToList();
|
||||||
HeadsetProviders = deviceProviders.Where(d => d.Type == DeviceType.Headset).ToList();
|
HeadsetProviders = deviceProviders.Where(d => d.Type == DeviceType.Headset).ToList();
|
||||||
|
GenericProviders = deviceProviders.Where(d => d.Type == DeviceType.Generic).ToList();
|
||||||
|
|
||||||
_logger.Info("Intialized DeviceManager with {0} device providers", deviceProviders.Count);
|
_logger.Info("Intialized DeviceManager with {0} device providers", deviceProviders.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DeviceProvider> HeadsetProviders { get; set; }
|
|
||||||
|
|
||||||
public List<DeviceProvider> MiceProviders { get; set; }
|
public List<DeviceProvider> MiceProviders { get; set; }
|
||||||
|
public List<DeviceProvider> HeadsetProviders { get; set; }
|
||||||
|
public List<DeviceProvider> GenericProviders { get; set; }
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public MetroDialogService DialogService { get; set; }
|
public MetroDialogService DialogService { get; set; }
|
||||||
@ -133,6 +134,8 @@ namespace Artemis.Managers
|
|||||||
mouseProvider.TryEnableAsync();
|
mouseProvider.TryEnableAsync();
|
||||||
foreach (var headsetProvider in HeadsetProviders)
|
foreach (var headsetProvider in HeadsetProviders)
|
||||||
headsetProvider.TryEnableAsync();
|
headsetProvider.TryEnableAsync();
|
||||||
|
foreach (var genericProvider in GenericProviders)
|
||||||
|
genericProvider.TryEnableAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,24 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Artemis.Events;
|
using Artemis.DeviceProviders;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Ninject.Extensions.Logging;
|
using Ninject.Extensions.Logging;
|
||||||
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
namespace Artemis.Managers
|
namespace Artemis.Managers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages the main programn loop
|
/// Manages the main programn loop
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoopManager : IDisposable, IHandle<ActiveKeyboardChanged>, IHandle<ActiveEffectChanged>
|
public class LoopManager : IDisposable
|
||||||
{
|
{
|
||||||
private readonly DeviceManager _deviceManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly EffectManager _effectManager;
|
private readonly EffectManager _effectManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly Timer _loopTimer;
|
private readonly Timer _loopTimer;
|
||||||
private Bitmap _keyboardBitmap;
|
|
||||||
|
|
||||||
public LoopManager(IEventAggregator events, ILogger logger, EffectManager effectManager,
|
public LoopManager(IEventAggregator events, ILogger logger, EffectManager effectManager,
|
||||||
DeviceManager deviceManager)
|
DeviceManager deviceManager)
|
||||||
@ -45,19 +46,6 @@ namespace Artemis.Managers
|
|||||||
{
|
{
|
||||||
_loopTimer.Stop();
|
_loopTimer.Stop();
|
||||||
_loopTimer.Dispose();
|
_loopTimer.Dispose();
|
||||||
_keyboardBitmap?.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
|
||||||
{
|
|
||||||
if (_deviceManager.ActiveKeyboard != null && _effectManager.ActiveEffect != null)
|
|
||||||
_keyboardBitmap = _deviceManager.ActiveKeyboard.KeyboardBitmap(_effectManager.ActiveEffect.KeyboardScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Handle(ActiveKeyboardChanged message)
|
|
||||||
{
|
|
||||||
if (_deviceManager.ActiveKeyboard != null && _effectManager.ActiveEffect != null)
|
|
||||||
_keyboardBitmap = _deviceManager.ActiveKeyboard.KeyboardBitmap(_effectManager.ActiveEffect.KeyboardScale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task StartAsync()
|
public Task StartAsync()
|
||||||
@ -74,6 +62,10 @@ namespace Artemis.Managers
|
|||||||
|
|
||||||
if (_deviceManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
_deviceManager.EnableLastKeyboard();
|
_deviceManager.EnableLastKeyboard();
|
||||||
|
|
||||||
|
while (_deviceManager.ChangingKeyboard)
|
||||||
|
Thread.Sleep(200);
|
||||||
|
|
||||||
// If still null, no last keyboard, so stop.
|
// If still null, no last keyboard, so stop.
|
||||||
if (_deviceManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
@ -104,13 +96,11 @@ namespace Artemis.Managers
|
|||||||
Running = false;
|
Running = false;
|
||||||
|
|
||||||
_deviceManager.ReleaseActiveKeyboard();
|
_deviceManager.ReleaseActiveKeyboard();
|
||||||
_keyboardBitmap?.Dispose();
|
|
||||||
_keyboardBitmap = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Render(object sender, ElapsedEventArgs e)
|
private void Render(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Running)
|
if (!Running || _deviceManager.ChangingKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop if no active effect
|
// Stop if no active effect
|
||||||
@ -122,9 +112,6 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
var renderEffect = _effectManager.ActiveEffect;
|
var renderEffect = _effectManager.ActiveEffect;
|
||||||
|
|
||||||
if (_deviceManager.ChangingKeyboard || _keyboardBitmap == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Stop if no active keyboard
|
// Stop if no active keyboard
|
||||||
if (_deviceManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
@ -143,32 +130,69 @@ namespace Artemis.Managers
|
|||||||
if (renderEffect.Initialized)
|
if (renderEffect.Initialized)
|
||||||
renderEffect.Update();
|
renderEffect.Update();
|
||||||
|
|
||||||
// Get ActiveEffect's bitmap
|
// Get the devices that must be rendered to
|
||||||
Bitmap mouseBitmap = null;
|
|
||||||
Bitmap headsetBitmap = null;
|
|
||||||
var mice = _deviceManager.MiceProviders.Where(m => m.CanUse).ToList();
|
var mice = _deviceManager.MiceProviders.Where(m => m.CanUse).ToList();
|
||||||
var headsets = _deviceManager.HeadsetProviders.Where(m => m.CanUse).ToList();
|
var headsets = _deviceManager.HeadsetProviders.Where(m => m.CanUse).ToList();
|
||||||
|
var generics = _deviceManager.GenericProviders.Where(m => m.CanUse).ToList();
|
||||||
|
|
||||||
if (renderEffect.Initialized)
|
// Setup the frame for this tick
|
||||||
renderEffect.Render(_keyboardBitmap, out mouseBitmap, out headsetBitmap, mice.Any(), headsets.Any());
|
using (var frame = new RenderFrame(_deviceManager.ActiveKeyboard))
|
||||||
|
|
||||||
// Draw enabled overlays on top of the renderEffect
|
|
||||||
foreach (var overlayModel in _effectManager.EnabledOverlays)
|
|
||||||
{
|
{
|
||||||
overlayModel.Update();
|
if (renderEffect.Initialized)
|
||||||
overlayModel.RenderOverlay(_keyboardBitmap, ref mouseBitmap, ref headsetBitmap, mice.Any(),
|
renderEffect.Render(frame, !mice.Any() && !headsets.Any() && !generics.Any());
|
||||||
headsets.Any());
|
|
||||||
|
// Draw enabled overlays on top of the renderEffect
|
||||||
|
foreach (var overlayModel in _effectManager.EnabledOverlays)
|
||||||
|
{
|
||||||
|
overlayModel.Update();
|
||||||
|
overlayModel.RenderOverlay(frame, !mice.Any() && !headsets.Any() && !generics.Any());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the keyboard
|
||||||
|
_deviceManager.ActiveKeyboard?.DrawBitmap(frame.KeyboardBitmap);
|
||||||
|
|
||||||
|
// Update the other devices
|
||||||
|
foreach (var mouse in mice)
|
||||||
|
mouse.UpdateDevice(frame.MouseBitmap);
|
||||||
|
foreach (var headset in headsets)
|
||||||
|
headset.UpdateDevice(frame.HeadsetBitmap);
|
||||||
|
foreach (var generic in generics)
|
||||||
|
generic.UpdateDevice(frame.GenericBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update mice and headsets
|
|
||||||
foreach (var mouse in mice)
|
|
||||||
mouse.UpdateDevice(mouseBitmap);
|
|
||||||
foreach (var headset in headsets)
|
|
||||||
headset.UpdateDevice(headsetBitmap);
|
|
||||||
|
|
||||||
// Update the keyboard
|
|
||||||
_deviceManager.ActiveKeyboard?.DrawBitmap(_keyboardBitmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RenderFrame : IDisposable
|
||||||
|
{
|
||||||
|
public RenderFrame(KeyboardProvider keyboard)
|
||||||
|
{
|
||||||
|
KeyboardBitmap = keyboard.KeyboardBitmap(4);
|
||||||
|
MouseBitmap = new Bitmap(40, 40);
|
||||||
|
HeadsetBitmap = new Bitmap(40, 40);
|
||||||
|
GenericBitmap = new Bitmap(40, 40);
|
||||||
|
|
||||||
|
using (var g = Graphics.FromImage(KeyboardBitmap))
|
||||||
|
g.Clear(Color.Black);
|
||||||
|
using (var g = Graphics.FromImage(MouseBitmap))
|
||||||
|
g.Clear(Color.Black);
|
||||||
|
using (var g = Graphics.FromImage(HeadsetBitmap))
|
||||||
|
g.Clear(Color.Black);
|
||||||
|
using (var g = Graphics.FromImage(GenericBitmap))
|
||||||
|
g.Clear(Color.Black);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap KeyboardBitmap { get; set; }
|
||||||
|
public Bitmap MouseBitmap { get; set; }
|
||||||
|
public Bitmap HeadsetBitmap { get; set; }
|
||||||
|
public Bitmap GenericBitmap { get; set; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
KeyboardBitmap.Dispose();
|
||||||
|
MouseBitmap.Dispose();
|
||||||
|
HeadsetBitmap.Dispose();
|
||||||
|
GenericBitmap.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -122,9 +122,6 @@ namespace Artemis.Managers
|
|||||||
if (EffectManager.ActiveEffect != null)
|
if (EffectManager.ActiveEffect != null)
|
||||||
EffectManager.DisableInactiveGame();
|
EffectManager.DisableInactiveGame();
|
||||||
|
|
||||||
if (EffectManager.ActiveEffect is ProfilePreviewModel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If the currently active effect is a no longer running game, get rid of it.
|
// If the currently active effect is a no longer running game, get rid of it.
|
||||||
var activeGame = EffectManager.ActiveEffect as GameModel;
|
var activeGame = EffectManager.ActiveEffect as GameModel;
|
||||||
if (activeGame != null)
|
if (activeGame != null)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using Artemis.Models;
|
||||||
using Artemis.Modules.Effects.ProfilePreview;
|
using Artemis.Modules.Effects.ProfilePreview;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
@ -63,7 +64,7 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_effectManager.ActiveEffect != ProfilePreviewModel)
|
if (_effectManager.ActiveEffect != ProfilePreviewModel && !(_effectManager.ActiveEffect is GameModel))
|
||||||
{
|
{
|
||||||
_logger.Debug("Activate profile preview");
|
_logger.Debug("Activate profile preview");
|
||||||
_effectManager.ChangeEffect(ProfilePreviewModel);
|
_effectManager.ChangeEffect(ProfilePreviewModel);
|
||||||
|
|||||||
@ -6,9 +6,8 @@ using System.Windows;
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
using Artemis.Profiles;
|
using Artemis.Profiles;
|
||||||
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Headset;
|
|
||||||
using Artemis.Profiles.Layers.Types.Mouse;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Artemis.Models
|
namespace Artemis.Models
|
||||||
@ -43,59 +42,61 @@ namespace Artemis.Models
|
|||||||
public abstract void Update();
|
public abstract void Update();
|
||||||
|
|
||||||
// Called after every update
|
// Called after every update
|
||||||
public virtual void Render(Bitmap keyboard, out Bitmap mouse, out Bitmap headset, bool renderMice,
|
/// <summary>
|
||||||
bool renderHeadsets)
|
/// Renders the currently active profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frame"></param>
|
||||||
|
/// <param name="keyboardOnly"></param>
|
||||||
|
public virtual void Render(RenderFrame frame, bool keyboardOnly)
|
||||||
{
|
{
|
||||||
mouse = null;
|
|
||||||
headset = null;
|
|
||||||
|
|
||||||
if (Profile == null || DataModel == null || MainManager.DeviceManager.ActiveKeyboard == null)
|
if (Profile == null || DataModel == null || MainManager.DeviceManager.ActiveKeyboard == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get all enabled layers who's conditions are met
|
lock (DataModel)
|
||||||
var renderLayers = GetRenderLayers(renderMice, renderHeadsets);
|
|
||||||
|
|
||||||
// Render the keyboard layer-by-layer
|
|
||||||
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
|
||||||
{
|
{
|
||||||
// Fill the bitmap's background with black to avoid trailing colors on some keyboards
|
// Get all enabled layers who's conditions are met
|
||||||
g.Clear(Color.Black);
|
var renderLayers = GetRenderLayers(keyboardOnly);
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.MustDraw()), DataModel, keyboardRect, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render the mouse layer-by-layer
|
// Render the keyboard layer-by-layer
|
||||||
var smallRect = new Rect(0, 0, 40, 40);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||||
mouse = new Bitmap(40, 40);
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
using (var g = Graphics.FromImage(mouse))
|
{
|
||||||
{
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
||||||
// Not all SDK's handle transparency
|
DataModel, keyboardRect, false, true);
|
||||||
g.Clear(Color.Black);
|
}
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType is MouseType), DataModel, smallRect,
|
// Render mice layer-by-layer
|
||||||
false, true);
|
var devRec = new Rect(0, 0, 40, 40);
|
||||||
}
|
using (var g = Graphics.FromImage(frame.MouseBitmap))
|
||||||
|
{
|
||||||
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mouse), DataModel,
|
||||||
|
devRec, false, true);
|
||||||
|
}
|
||||||
|
// Render headsets layer-by-layer
|
||||||
|
using (var g = Graphics.FromImage(frame.HeadsetBitmap))
|
||||||
|
{
|
||||||
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Headset),
|
||||||
|
DataModel, devRec, false, true);
|
||||||
|
}
|
||||||
|
// Render generic devices layer-by-layer
|
||||||
|
using (var g = Graphics.FromImage(frame.GenericBitmap))
|
||||||
|
{
|
||||||
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Generic),
|
||||||
|
DataModel, devRec, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Render the headset layer-by-layer
|
// Trace debugging
|
||||||
headset = new Bitmap(40, 40);
|
if (DateTime.Now.AddSeconds(-2) <= LastTrace)
|
||||||
using (var g = Graphics.FromImage(headset))
|
return;
|
||||||
{
|
LastTrace = DateTime.Now;
|
||||||
// Not all SDK's handle transparency
|
MainManager.Logger.Trace("Effect datamodel as JSON: \r\n{0}",
|
||||||
g.Clear(Color.Black);
|
JsonConvert.SerializeObject(DataModel, Formatting.Indented));
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType is HeadsetType), DataModel, smallRect,
|
MainManager.Logger.Trace("Effect {0} has to render {1} layers", Name, renderLayers.Count);
|
||||||
false, true);
|
foreach (var renderLayer in renderLayers)
|
||||||
|
MainManager.Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name,
|
||||||
|
renderLayer.LayerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trace debugging
|
|
||||||
if (DateTime.Now.AddSeconds(-2) <= LastTrace)
|
|
||||||
return;
|
|
||||||
LastTrace = DateTime.Now;
|
|
||||||
MainManager.Logger.Trace("Effect datamodel as JSON: \r\n{0}",
|
|
||||||
JsonConvert.SerializeObject(DataModel, Formatting.Indented));
|
|
||||||
MainManager.Logger.Trace("Effect {0} has to render {1} layers", Name, renderLayers.Count);
|
|
||||||
foreach (var renderLayer in renderLayers)
|
|
||||||
MainManager.Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name, renderLayer.LayerType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets);
|
public abstract List<LayerModel> GetRenderLayers(bool keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Drawing;
|
using Artemis.Managers;
|
||||||
using Artemis.Managers;
|
|
||||||
|
|
||||||
namespace Artemis.Models
|
namespace Artemis.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +27,6 @@ namespace Artemis.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void RenderOverlay(Bitmap keyboard, ref Bitmap mouse, ref Bitmap headset, bool renderMice,
|
public abstract void RenderOverlay(RenderFrame frame, bool keyboardOnly);
|
||||||
bool renderHeadsets);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,28 +1,23 @@
|
|||||||
namespace Artemis.Modules.Effects.AudioVisualizer {
|
using System.ComponentModel;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
|
{
|
||||||
// This class allows you to handle specific events on the settings class:
|
// This class allows you to handle specific events on the settings class:
|
||||||
// The SettingChanging event is raised before a setting's value is changed.
|
// The SettingChanging event is raised before a setting's value is changed.
|
||||||
// The PropertyChanged event is raised after a setting's value is changed.
|
// The PropertyChanged event is raised after a setting's value is changed.
|
||||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||||
// The SettingsSaving event is raised before the setting values are saved.
|
// The SettingsSaving event is raised before the setting values are saved.
|
||||||
internal sealed partial class AudioVisualization {
|
internal sealed partial class AudioVisualization
|
||||||
|
{
|
||||||
public AudioVisualization() {
|
private void SettingChangingEventHandler(object sender, SettingChangingEventArgs e)
|
||||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
{
|
||||||
//
|
|
||||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
|
||||||
//
|
|
||||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
|
||||||
// Add code to handle the SettingChangingEvent event here.
|
// Add code to handle the SettingChangingEvent event here.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
private void SettingsSavingEventHandler(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
// Add code to handle the SettingsSaving event here.
|
// Add code to handle the SettingsSaving event here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,24 +182,20 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(Bitmap keyboard, out Bitmap mouse, out Bitmap headset, bool renderMice,
|
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||||
bool renderHeadsets)
|
|
||||||
{
|
{
|
||||||
mouse = null;
|
|
||||||
headset = null;
|
|
||||||
|
|
||||||
if (SpectrumData == null || SoundRectangles == null)
|
if (SpectrumData == null || SoundRectangles == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Lock the _spectrumData array while busy with it
|
// Lock the _spectrumData array while busy with it
|
||||||
_generating = true;
|
_generating = true;
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
{
|
{
|
||||||
foreach (var soundRectangle in SoundRectangles)
|
foreach (var soundRectangle in SoundRectangles)
|
||||||
soundRectangle.Draw(g);
|
soundRectangle.Draw(g);
|
||||||
|
|||||||
@ -1,28 +1,23 @@
|
|||||||
namespace Artemis.Modules.Effects.Bubbles {
|
using System.ComponentModel;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Effects.Bubbles
|
||||||
|
{
|
||||||
// This class allows you to handle specific events on the settings class:
|
// This class allows you to handle specific events on the settings class:
|
||||||
// The SettingChanging event is raised before a setting's value is changed.
|
// The SettingChanging event is raised before a setting's value is changed.
|
||||||
// The PropertyChanged event is raised after a setting's value is changed.
|
// The PropertyChanged event is raised after a setting's value is changed.
|
||||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||||
// The SettingsSaving event is raised before the setting values are saved.
|
// The SettingsSaving event is raised before the setting values are saved.
|
||||||
internal sealed partial class Bubbles {
|
internal sealed partial class Bubbles
|
||||||
|
{
|
||||||
public Bubbles() {
|
private void SettingChangingEventHandler(object sender, SettingChangingEventArgs e)
|
||||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
{
|
||||||
//
|
|
||||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
|
||||||
//
|
|
||||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
|
||||||
// Add code to handle the SettingChangingEvent event here.
|
// Add code to handle the SettingChangingEvent event here.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
private void SettingsSavingEventHandler(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
// Add code to handle the SettingsSaving event here.
|
// Add code to handle the SettingsSaving event here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,20 +88,16 @@ namespace Artemis.Modules.Effects.Bubbles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(Bitmap keyboard, out Bitmap mouse, out Bitmap headset, bool renderMice,
|
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||||
bool renderHeadsets)
|
|
||||||
{
|
{
|
||||||
mouse = null;
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
headset = null;
|
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
|
||||||
{
|
{
|
||||||
foreach (var bubble in _bubbles)
|
foreach (var bubble in _bubbles)
|
||||||
bubble.Draw(g);
|
bubble.Draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,8 @@ using System.Windows;
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Headset;
|
|
||||||
using Artemis.Profiles.Layers.Types.Mouse;
|
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.ProfilePreview
|
namespace Artemis.Modules.Effects.ProfilePreview
|
||||||
{
|
{
|
||||||
@ -32,47 +31,50 @@ namespace Artemis.Modules.Effects.ProfilePreview
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets, true);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(Bitmap keyboard, out Bitmap mouse, out Bitmap headset, bool renderMice,
|
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||||
bool renderHeadsets)
|
|
||||||
{
|
{
|
||||||
mouse = null;
|
if (Profile == null || DataModel == null || MainManager.DeviceManager.ActiveKeyboard == null)
|
||||||
headset = null;
|
|
||||||
|
|
||||||
if (Profile == null || DataModel == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get all enabled layers who's conditions are met
|
lock (DataModel)
|
||||||
var renderLayers = GetRenderLayers(renderMice, renderHeadsets);
|
|
||||||
|
|
||||||
// Render the keyboard layer-by-layer
|
|
||||||
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
|
||||||
{
|
{
|
||||||
// Fill the bitmap's background with black to avoid trailing colors on some keyboards
|
// Get all enabled layers who's conditions are met
|
||||||
g.Clear(Color.Black);
|
var renderLayers = GetRenderLayers(keyboardOnly);
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.MustDraw()), DataModel, keyboardRect, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render the mouse layer-by-layer
|
// Render the keyboard layer-by-layer
|
||||||
var smallRect = new Rect(0, 0, 40, 40);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||||
mouse = new Bitmap(40, 40);
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
using (var g = Graphics.FromImage(mouse))
|
{
|
||||||
{
|
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType is MouseType), DataModel, smallRect,
|
DataModel,
|
||||||
true, true);
|
keyboardRect, true, true);
|
||||||
}
|
}
|
||||||
|
// Render mice layer-by-layer
|
||||||
// Render the headset layer-by-layer
|
var devRec = new Rect(0, 0, 40, 40);
|
||||||
headset = new Bitmap(40, 40);
|
using (var g = Graphics.FromImage(frame.MouseBitmap))
|
||||||
using (var g = Graphics.FromImage(headset))
|
{
|
||||||
{
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mouse), DataModel,
|
||||||
Profile.DrawLayers(g, renderLayers.Where(rl => rl.LayerType is HeadsetType), DataModel, smallRect,
|
devRec, true, true);
|
||||||
true, true);
|
}
|
||||||
|
// Render headsets layer-by-layer
|
||||||
|
using (var g = Graphics.FromImage(frame.HeadsetBitmap))
|
||||||
|
{
|
||||||
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Headset),
|
||||||
|
DataModel,
|
||||||
|
devRec, true, true);
|
||||||
|
}
|
||||||
|
// Render generic devices layer-by-layer
|
||||||
|
using (var g = Graphics.FromImage(frame.GenericBitmap))
|
||||||
|
{
|
||||||
|
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Generic),
|
||||||
|
DataModel,
|
||||||
|
devRec, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ using System.Drawing;
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.DeviceProviders.Corsair;
|
|
||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
@ -89,17 +88,13 @@ namespace Artemis.Modules.Effects.TypeWave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(Bitmap keyboard, out Bitmap mouse, out Bitmap headset, bool renderMice,
|
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||||
bool renderHeadsets)
|
|
||||||
{
|
{
|
||||||
mouse = null;
|
|
||||||
headset = null;
|
|
||||||
|
|
||||||
if (_waves.Count == 0)
|
if (_waves.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -113,19 +108,13 @@ namespace Artemis.Modules.Effects.TypeWave
|
|||||||
path.AddEllipse(_waves[i].Point.X - _waves[i].Size/2, _waves[i].Point.Y - _waves[i].Size/2,
|
path.AddEllipse(_waves[i].Point.X - _waves[i].Size/2, _waves[i].Point.Y - _waves[i].Size/2,
|
||||||
_waves[i].Size, _waves[i].Size);
|
_waves[i].Size, _waves[i].Size);
|
||||||
|
|
||||||
Color fillColor;
|
|
||||||
if (MainManager.DeviceManager.ActiveKeyboard is CorsairRGB)
|
|
||||||
fillColor = Color.Black;
|
|
||||||
else
|
|
||||||
fillColor = Color.Transparent;
|
|
||||||
|
|
||||||
var pthGrBrush = new PathGradientBrush(path)
|
var pthGrBrush = new PathGradientBrush(path)
|
||||||
{
|
{
|
||||||
SurroundColors = new[] {_waves[i].Color},
|
SurroundColors = new[] {_waves[i].Color},
|
||||||
CenterColor = fillColor
|
CenterColor = Color.Transparent
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
{
|
{
|
||||||
g.FillPath(pthGrBrush, path);
|
g.FillPath(pthGrBrush, path);
|
||||||
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
||||||
|
|||||||
@ -24,7 +24,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
public int Hours12 { get; set; }
|
public int Hours12 { get; set; }
|
||||||
public int Minutes { get; set; }
|
public int Minutes { get; set; }
|
||||||
public int Seconds { get; set; }
|
public int Seconds { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CpuDataModel
|
public class CpuDataModel
|
||||||
|
|||||||
@ -60,7 +60,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class WindowsProfileModel : EffectModel
|
public class WindowsProfileModel : EffectModel
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
@ -101,6 +100,19 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
UpdateDay(dataModel);
|
UpdateDay(dataModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Current Time
|
||||||
|
|
||||||
|
private void UpdateDay(WindowsProfileDataModel dataModel)
|
||||||
|
{
|
||||||
|
var now = DateTime.Now;
|
||||||
|
dataModel.CurrentTime.Hours24 = int.Parse(now.ToString("HH"));
|
||||||
|
dataModel.CurrentTime.Hours12 = int.Parse(now.ToString("hh"));
|
||||||
|
dataModel.CurrentTime.Minutes = int.Parse(now.ToString("mm"));
|
||||||
|
dataModel.CurrentTime.Seconds = int.Parse(now.ToString("ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region CPU
|
#region CPU
|
||||||
|
|
||||||
private void SetupCpu()
|
private void SetupCpu()
|
||||||
@ -163,9 +175,9 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
dataModel.Performance.RAMUsage = (int) percentOccupied;
|
dataModel.Performance.RAMUsage = (int) percentOccupied;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets, false);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PerformanceCounter GetOverallPerformanceCounter()
|
public static PerformanceCounter GetOverallPerformanceCounter()
|
||||||
@ -194,19 +206,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Current Time
|
|
||||||
private void UpdateDay(WindowsProfileDataModel dataModel)
|
|
||||||
{
|
|
||||||
|
|
||||||
var now = DateTime.Now;
|
|
||||||
dataModel.CurrentTime.Hours24 = int.Parse(now.ToString("HH"));
|
|
||||||
dataModel.CurrentTime.Hours12 = int.Parse(now.ToString("hh"));
|
|
||||||
dataModel.CurrentTime.Minutes = int.Parse(now.ToString("mm"));
|
|
||||||
dataModel.CurrentTime.Seconds = int.Parse(now.ToString("ss"));
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Spotify
|
#region Spotify
|
||||||
|
|
||||||
public void SetupSpotify()
|
public void SetupSpotify()
|
||||||
|
|||||||
@ -57,13 +57,13 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
base.OnActivate();
|
base.OnActivate();
|
||||||
ProfileEditor.ProfileViewModel.Activate();
|
ProfileEditor.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDeactivate(bool close)
|
protected override void OnDeactivate(bool close)
|
||||||
{
|
{
|
||||||
base.OnDeactivate(close);
|
base.OnDeactivate(close);
|
||||||
ProfileEditor.ProfileViewModel.Deactivate();
|
ProfileEditor.Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||||
|
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||||
<Profiles />
|
<Profiles />
|
||||||
<Settings>
|
<Settings>
|
||||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||||
|
|||||||
@ -64,9 +64,9 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Dota2" GeneratedClassName="Dota2">
|
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||||
|
GeneratedClassNamespace="Artemis.Modules.Games.Dota2" GeneratedClassName="Dota2">
|
||||||
<Profiles />
|
<Profiles />
|
||||||
<Settings>
|
<Settings>
|
||||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||||
|
|||||||
@ -64,9 +64,9 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
DataModel = JsonConvert.DeserializeObject<Dota2DataModel>(jsonString);
|
DataModel = JsonConvert.DeserializeObject<Dota2DataModel>(jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,8 +115,6 @@ namespace Artemis.Modules.Games.Overwatch
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_events.PublishOnUIThread(new RazerColorArrayChanged(colors));
|
_events.PublishOnUIThread(new RazerColorArrayChanged(colors));
|
||||||
//MainManager.Logger.Trace("DataModel: \r\n{0}",
|
|
||||||
// JsonConvert.SerializeObject(gameDataModel, Formatting.Indented));
|
|
||||||
|
|
||||||
// Determine general game state
|
// Determine general game state
|
||||||
ParseGameSate(gameDataModel, colors);
|
ParseGameSate(gameDataModel, colors);
|
||||||
@ -222,9 +220,9 @@ namespace Artemis.Modules.Games.Overwatch
|
|||||||
gameDataModel.Ability2Ready = colors[2, 4].Equals(Color.FromRgb(4, 141, 144));
|
gameDataModel.Ability2Ready = colors[2, 4].Equals(Color.FromRgb(4, 141, 144));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,23 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
Scale = 4;
|
Scale = 4;
|
||||||
Enabled = Settings.Enabled;
|
Enabled = Settings.Enabled;
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
|
// Generate a new offset when the game is updated
|
||||||
|
//var offset = new GamePointersCollection
|
||||||
|
//{
|
||||||
|
// Game = "RocketLeague",
|
||||||
|
// GameVersion = "1.21",
|
||||||
|
// GameAddresses = new List<GamePointer>
|
||||||
|
// {
|
||||||
|
// new GamePointer
|
||||||
|
// {
|
||||||
|
// Description = "Boost",
|
||||||
|
// BasePointer = new IntPtr(0x016AD528),
|
||||||
|
// Offsets = new[] {0x304, 0x8, 0x50, 0x720, 0x224}
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
//var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
@ -57,15 +74,13 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
|
|
||||||
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
||||||
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
||||||
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
var boostInt = (int) (_memory.ReadFloat(boostAddress)*100);
|
||||||
|
if (boostInt > 100)
|
||||||
|
boostInt = 100;
|
||||||
|
if (boostInt < 0)
|
||||||
|
boostInt = 0;
|
||||||
|
|
||||||
((RocketLeagueDataModel) DataModel).Boost = (int) Math.Ceiling(boostFloat);
|
((RocketLeagueDataModel) DataModel).Boost = boostInt;
|
||||||
|
|
||||||
// Take care of any reading errors resulting in an OutOfMemory on draw
|
|
||||||
if (((RocketLeagueDataModel) DataModel).Boost < 0)
|
|
||||||
((RocketLeagueDataModel) DataModel).Boost = 0;
|
|
||||||
if (((RocketLeagueDataModel) DataModel).Boost > 100)
|
|
||||||
((RocketLeagueDataModel) DataModel).Boost = 100;
|
|
||||||
|
|
||||||
if (DateTime.Now.AddSeconds(-2) <= LastTrace)
|
if (DateTime.Now.AddSeconds(-2) <= LastTrace)
|
||||||
return;
|
return;
|
||||||
@ -74,12 +89,12 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
JsonConvert.SerializeObject(_pointer.GameAddresses, Formatting.Indented));
|
JsonConvert.SerializeObject(_pointer.GameAddresses, Formatting.Indented));
|
||||||
MainManager.Logger.Trace("RL specific offsets: {0}", offsets);
|
MainManager.Logger.Trace("RL specific offsets: {0}", offsets);
|
||||||
MainManager.Logger.Trace("Boost address: {0}", boostAddress);
|
MainManager.Logger.Trace("Boost address: {0}", boostAddress);
|
||||||
MainManager.Logger.Trace("Boost float: {0}", boostFloat);
|
MainManager.Logger.Trace("Boost int: {0}", boostInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,9 +129,9 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
// DataModel updating is done whenever a pipe message is received
|
// DataModel updating is done whenever a pipe message is received
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,9 +136,9 @@ namespace Artemis.Modules.Games.Witcher3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return Profile.GetRenderLayers(DataModel, renderMice, renderHeadsets);
|
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -77,13 +77,12 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
VolumeDisplay.Transparancy = 255;
|
VolumeDisplay.Transparancy = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RenderOverlay(Bitmap keyboard, ref Bitmap mouse, ref Bitmap headset, bool renderMice,
|
public override void RenderOverlay(RenderFrame frame, bool keyboardOnly)
|
||||||
bool renderHeadsets)
|
|
||||||
{
|
{
|
||||||
if (MainManager.DeviceManager.ActiveKeyboard == null || VolumeDisplay == null || VolumeDisplay.Ttl < 1)
|
if (MainManager.DeviceManager.ActiveKeyboard == null || VolumeDisplay == null || VolumeDisplay.Ttl < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(keyboard))
|
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||||
{
|
{
|
||||||
VolumeDisplay.Draw(g);
|
VolumeDisplay.Draw(g);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
using System.Drawing;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Brush = System.Windows.Media.Brush;
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Abstract
|
||||||
{
|
{
|
||||||
public abstract class LayerPropertiesViewModel : PropertyChangedBase
|
public abstract class LayerPropertiesViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private LayerModel _layerModel;
|
|
||||||
private Brush _brush;
|
private Brush _brush;
|
||||||
|
private LayerModel _layerModel;
|
||||||
|
|
||||||
protected LayerPropertiesViewModel(LayerModel layerModel, IDataModel dataModel)
|
protected LayerPropertiesViewModel(LayerModel layerModel, IDataModel dataModel)
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
||||||
|
|
||||||
var s1 = new Rect(new Point(rect.X, rect.Y + props.AnimationProgress), new Size(rect.Width, rect.Height));
|
var s1 = new Rect(new Point(rect.X, rect.Y + props.AnimationProgress), new Size(rect.Width, rect.Height));
|
||||||
var s2 = new Rect(new Point(s1.X, s1.Y - rect.Height), new Size(rect.Width, rect.Height));
|
var s2 = new Rect(new Point(s1.X, s1.Y - rect.Height), new Size(rect.Width, rect.Height + .5));
|
||||||
|
|
||||||
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
||||||
|
|
||||||
var s1 = new Rect(new Point(rect.X - props.AnimationProgress, rect.Y),
|
var s1 = new Rect(new Point(rect.X - props.AnimationProgress, rect.Y),
|
||||||
new Size(rect.Width + 0.05, rect.Height));
|
new Size(rect.Width + .5, rect.Height));
|
||||||
var s2 = new Rect(new Point(s1.X + rect.Width, rect.Y), new Size(rect.Width, rect.Height));
|
var s2 = new Rect(new Point(s1.X + rect.Width, rect.Y), new Size(rect.Width, rect.Height));
|
||||||
|
|
||||||
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
||||||
|
|
||||||
var s1 = new Rect(new Point(rect.X + props.AnimationProgress, rect.Y), new Size(rect.Width, rect.Height));
|
var s1 = new Rect(new Point(rect.X + props.AnimationProgress, rect.Y), new Size(rect.Width, rect.Height));
|
||||||
var s2 = new Rect(new Point(s1.X - rect.Width, rect.Y), new Size(rect.Width + 1, rect.Height));
|
var s2 = new Rect(new Point(s1.X - rect.Width, rect.Y), new Size(rect.Width + .5, rect.Height));
|
||||||
|
|
||||||
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale)
|
? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale)
|
||||||
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
|
||||||
|
|
||||||
var s1 = new Rect(new Point(rect.X, rect.Y - props.AnimationProgress), new Size(rect.Width, rect.Height));
|
var s1 = new Rect(new Point(rect.X, rect.Y - props.AnimationProgress),
|
||||||
|
new Size(rect.Width, rect.Height + .5));
|
||||||
var s2 = new Rect(new Point(s1.X, s1.Y + rect.Height), new Size(rect.Width, rect.Height));
|
var s2 = new Rect(new Point(s1.X, s1.Y + rect.Height), new Size(rect.Width, rect.Height));
|
||||||
|
|
||||||
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Interfaces
|
namespace Artemis.Profiles.Layers.Interfaces
|
||||||
{
|
{
|
||||||
public interface ILayerAnimation
|
public interface ILayerAnimation
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
void Update(LayerModel layerModel, bool updateAnimations);
|
void Update(LayerModel layerModel, bool updateAnimations);
|
||||||
void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c);
|
void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c);
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Interfaces
|
namespace Artemis.Profiles.Layers.Interfaces
|
||||||
{
|
{
|
||||||
@ -11,12 +12,21 @@ namespace Artemis.Profiles.Layers.Interfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Layer type name
|
/// Layer type name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets whether this type must be drawn on the keyboard/the editor or not
|
/// Gets whether this type must be drawn in the editor or not. Setting this to true
|
||||||
|
/// enables moving and resizing the layer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool MustDraw { get; }
|
[JsonIgnore]
|
||||||
|
bool ShowInEdtor { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets for what kind of device this layer should be drawn.
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
DrawType DrawType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The the thumbnail for this layer type
|
/// The the thumbnail for this layer type
|
||||||
@ -52,6 +62,16 @@ namespace Artemis.Profiles.Layers.Interfaces
|
|||||||
/// <param name="layerAnimations"></param>
|
/// <param name="layerAnimations"></param>
|
||||||
/// <param name="dataModel">The datamodel to use in the new viewmodel</param>
|
/// <param name="dataModel">The datamodel to use in the new viewmodel</param>
|
||||||
/// <param name="proposedLayer">The layer to use in the new viewmodel</param>
|
/// <param name="proposedLayer">The layer to use in the new viewmodel</param>
|
||||||
LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel, List<ILayerAnimation> layerAnimations, IDataModel dataModel, LayerModel proposedLayer);
|
LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
||||||
|
List<ILayerAnimation> layerAnimations, IDataModel dataModel, LayerModel proposedLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DrawType
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Keyboard,
|
||||||
|
Mouse,
|
||||||
|
Headset,
|
||||||
|
Generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,11 +3,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Animations;
|
||||||
using Artemis.Profiles.Layers.Conditions;
|
using Artemis.Profiles.Layers.Conditions;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Types.Headset;
|
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
using Artemis.Profiles.Layers.Types.Mouse;
|
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.ParentChild;
|
using Artemis.Utilities.ParentChild;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -114,7 +113,7 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
return false;
|
return false;
|
||||||
parent = parent.Parent;
|
parent = parent.Parent;
|
||||||
}
|
}
|
||||||
return Enabled && LayerType.MustDraw;
|
return Enabled && LayerType.ShowInEdtor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -146,6 +145,7 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
Order = -1,
|
Order = -1,
|
||||||
LayerType = new KeyboardType(),
|
LayerType = new KeyboardType(),
|
||||||
LayerCondition = new DataModelCondition(),
|
LayerCondition = new DataModelCondition(),
|
||||||
|
LayerAnimation = new NoneAnimation(),
|
||||||
Properties = new KeyboardPropertiesModel
|
Properties = new KeyboardPropertiesModel
|
||||||
{
|
{
|
||||||
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor()),
|
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor()),
|
||||||
@ -192,49 +192,31 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Replace(LayerModel layer)
|
|
||||||
{
|
|
||||||
layer.Order = Order;
|
|
||||||
layer.Parent = null;
|
|
||||||
layer.Profile = null;
|
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
{
|
|
||||||
Parent.Children.Add(layer);
|
|
||||||
Parent.Children.Remove(this);
|
|
||||||
}
|
|
||||||
else if (Profile != null)
|
|
||||||
{
|
|
||||||
Profile.Layers.Add(layer);
|
|
||||||
Profile.Layers.Remove(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a flat list containing all layers that must be rendered on the keyboard,
|
/// Generates a flat list containing all layers that must be rendered on the keyboard,
|
||||||
/// the first mouse layer to be rendered and the first headset layer to be rendered
|
/// the first mouse layer to be rendered and the first headset layer to be rendered
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The game data model to base the conditions on</typeparam>
|
/// <typeparam name="T">The game data model to base the conditions on</typeparam>
|
||||||
/// <param name="dataModel">Instance of said game data model</param>
|
/// <param name="dataModel">Instance of said game data model</param>
|
||||||
/// <param name="includeMice">Whether or not to include mice in the list</param>
|
/// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param>
|
||||||
/// <param name="includeHeadsets">Whether or not to include headsets in the list</param>
|
|
||||||
/// <param name="ignoreConditions"></param>
|
/// <param name="ignoreConditions"></param>
|
||||||
/// <returns>A flat list containing all layers that must be rendered</returns>
|
/// <returns>A flat list containing all layers that must be rendered</returns>
|
||||||
public List<LayerModel> GetRenderLayers(IDataModel dataModel, bool includeMice, bool includeHeadsets,
|
public List<LayerModel> GetRenderLayers(IDataModel dataModel, bool keyboardOnly, bool ignoreConditions = false)
|
||||||
bool ignoreConditions = false)
|
|
||||||
{
|
{
|
||||||
var layers = new List<LayerModel>();
|
var layers = new List<LayerModel>();
|
||||||
foreach (var layerModel in Children.OrderByDescending(c => c.Order))
|
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||||
{
|
{
|
||||||
if (!layerModel.Enabled || !includeMice && layerModel.LayerType is MouseType ||
|
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||||
!includeHeadsets && layerModel.LayerType is HeadsetType)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ignoreConditions && !layerModel.ConditionsMet(dataModel))
|
if (!ignoreConditions)
|
||||||
continue;
|
{
|
||||||
|
if (!layerModel.ConditionsMet(dataModel))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
layers.Add(layerModel);
|
layers.Add(layerModel);
|
||||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, includeMice, includeHeadsets, ignoreConditions));
|
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||||
}
|
}
|
||||||
|
|
||||||
return layers;
|
return layers;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Utilities.Converters;
|
using Artemis.Utilities.Converters;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -7,6 +8,8 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
{
|
{
|
||||||
public abstract class LayerPropertiesModel
|
public abstract class LayerPropertiesModel
|
||||||
{
|
{
|
||||||
|
private Brush _brush;
|
||||||
|
|
||||||
public LayerPropertiesModel(LayerPropertiesModel source = null)
|
public LayerPropertiesModel(LayerPropertiesModel source = null)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null)
|
||||||
@ -25,8 +28,6 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
Brush = source.Brush;
|
Brush = source.Brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Brush _brush;
|
|
||||||
|
|
||||||
public double X { get; set; }
|
public double X { get; set; }
|
||||||
public double Y { get; set; }
|
public double Y { get; set; }
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
@ -38,7 +39,6 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
public List<DynamicPropertiesModel> DynamicProperties { get; set; } = new List<DynamicPropertiesModel>();
|
public List<DynamicPropertiesModel> DynamicProperties { get; set; } = new List<DynamicPropertiesModel>();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
||||||
public double AnimationProgress { get; set; }
|
public double AnimationProgress { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(BrushJsonConverter))]
|
[JsonConverter(typeof(BrushJsonConverter))]
|
||||||
@ -65,5 +65,10 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
_brush = cloned;
|
_brush = cloned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rect GetRect(int scale = 4)
|
||||||
|
{
|
||||||
|
return new Rect(X * scale, Y * scale, Width * scale, Height * scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="Artemis.Views.Profiles.Layers.FolderPropertiesView"
|
<UserControl x:Class="Artemis.Profiles.Layers.Types.Folder.FolderPropertiesView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Folder
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for FolderPropertiesView.xaml
|
/// Interaction logic for FolderPropertiesView.xaml
|
||||||
@ -1,7 +1,8 @@
|
|||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Folder
|
||||||
{
|
{
|
||||||
public class FolderPropertiesViewModel : LayerPropertiesViewModel
|
public class FolderPropertiesViewModel : LayerPropertiesViewModel
|
||||||
{
|
{
|
||||||
@ -2,18 +2,20 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Folder
|
namespace Artemis.Profiles.Layers.Types.Folder
|
||||||
{
|
{
|
||||||
public class FolderType : ILayerType
|
public class FolderType : ILayerType
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Folder";
|
public string Name { get; } = "Folder";
|
||||||
public bool MustDraw { get; } = false;
|
public bool ShowInEdtor { get; } = false;
|
||||||
|
// FolderType pretents to be a keyboard so it's children get drawn
|
||||||
|
public DrawType DrawType { get; } = DrawType.Keyboard;
|
||||||
|
|
||||||
public ImageSource DrawThumbnail(LayerModel layer)
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
<UserControl x:Class="Artemis.Profiles.Layers.Types.Generic.GenericPropertiesView"
|
||||||
|
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:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="600" d:DesignWidth="500">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- Animation -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Height="18" />
|
||||||
|
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||||
|
Height="22">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<!-- Animation Speed -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||||
|
VerticalAlignment="Center" Height="18" />
|
||||||
|
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||||
|
TickPlacement="None" TickFrequency="0.05"
|
||||||
|
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||||
|
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||||
|
|
||||||
|
<!-- Colors -->
|
||||||
|
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||||
|
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||||
|
VerticalAlignment="Top" Height="18" Width="130" />
|
||||||
|
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||||
|
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||||
|
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Dynamic -->
|
||||||
|
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||||
|
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||||
|
|
||||||
|
<!-- Dynamic property views -->
|
||||||
|
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||||
|
|
||||||
|
<!-- Note -->
|
||||||
|
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||||
|
Foreground="{DynamicResource HighlightBrush}"
|
||||||
|
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap">
|
||||||
|
<Run Text="Note: Generic devices are devices over which Artemis has limited control." /><LineBreak />
|
||||||
|
<Run /><LineBreak />
|
||||||
|
<Run Text="You can use this layer type to assign a color to all generic devices at once." /><LineBreak />
|
||||||
|
<Run
|
||||||
|
Text="Should your generic device have multiple LEDs, Artemis will try to take the colors from the Brush and spread them over the LEDs." />
|
||||||
|
<LineBreak /><Run /><LineBreak /><Run Text="Examples of supported generic devices:" /><LineBreak />
|
||||||
|
<Run Text="- Logitech mice and headsets" /><LineBreak /><Run Text="- Logitech G19" /><LineBreak />
|
||||||
|
<Run Text="- Logitech G510" /><LineBreak /><Run />
|
||||||
|
</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Artemis.Profiles.Layers.Types.Generic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for GenericPropertiesView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class GenericPropertiesView : UserControl
|
||||||
|
{
|
||||||
|
public GenericPropertiesView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels.Profiles;
|
||||||
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
namespace Artemis.Profiles.Layers.Types.Generic
|
||||||
|
{
|
||||||
|
public class GenericPropertiesViewModel : LayerPropertiesViewModel
|
||||||
|
{
|
||||||
|
private ILayerAnimation _selectedLayerAnimation;
|
||||||
|
|
||||||
|
public GenericPropertiesViewModel(LayerModel layerModel, IDataModel dataModel,
|
||||||
|
IEnumerable<ILayerAnimation> layerAnimations) : base(layerModel, dataModel)
|
||||||
|
{
|
||||||
|
LayerAnimations = new BindableCollection<ILayerAnimation>(layerAnimations);
|
||||||
|
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity",
|
||||||
|
new BindableCollection<GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel)),
|
||||||
|
layerModel.Properties);
|
||||||
|
|
||||||
|
SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == layerModel.LayerAnimation?.Name) ??
|
||||||
|
LayerAnimations.First(l => l.Name == "None");
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<ILayerAnimation> LayerAnimations { get; set; }
|
||||||
|
public LayerDynamicPropertiesViewModel OpacityProperties { get; set; }
|
||||||
|
|
||||||
|
public ILayerAnimation SelectedLayerAnimation
|
||||||
|
{
|
||||||
|
get { return _selectedLayerAnimation; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _selectedLayerAnimation)) return;
|
||||||
|
_selectedLayerAnimation = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedLayerAnimation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ApplyProperties()
|
||||||
|
{
|
||||||
|
OpacityProperties.Apply(LayerModel);
|
||||||
|
LayerModel.Properties.Brush = Brush;
|
||||||
|
LayerModel.LayerAnimation = SelectedLayerAnimation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
96
Artemis/Artemis/Profiles/Layers/Types/Generic/GenericType.cs
Normal file
96
Artemis/Artemis/Profiles/Layers/Types/Generic/GenericType.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
|
using Artemis.Profiles.Layers.Animations;
|
||||||
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.Properties;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
|
||||||
|
namespace Artemis.Profiles.Layers.Types.Generic
|
||||||
|
{
|
||||||
|
public class GenericType : ILayerType
|
||||||
|
{
|
||||||
|
public string Name { get; } = "Generic (Logitech)";
|
||||||
|
public bool ShowInEdtor { get; } = false;
|
||||||
|
public DrawType DrawType { get; } = DrawType.Generic;
|
||||||
|
|
||||||
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
|
{
|
||||||
|
var thumbnailRect = new Rect(0, 0, 18, 18);
|
||||||
|
var visual = new DrawingVisual();
|
||||||
|
using (var c = visual.RenderOpen())
|
||||||
|
{
|
||||||
|
c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.generic), thumbnailRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
var image = new DrawingImage(visual.Drawing);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Draw(LayerModel layer, DrawingContext c)
|
||||||
|
{
|
||||||
|
// If an animation is present, let it handle the drawing
|
||||||
|
if (layer.LayerAnimation != null && !(layer.LayerAnimation is NoneAnimation))
|
||||||
|
{
|
||||||
|
layer.LayerAnimation.Draw(layer.Properties, layer.AppliedProperties, c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise draw the rectangle with its applied dimensions and brush
|
||||||
|
var rect = new Rect(layer.AppliedProperties.X*4,
|
||||||
|
layer.AppliedProperties.Y*4,
|
||||||
|
layer.AppliedProperties.Width*4,
|
||||||
|
layer.AppliedProperties.Height*4);
|
||||||
|
|
||||||
|
c.PushClip(new RectangleGeometry(rect));
|
||||||
|
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
|
||||||
|
c.Pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(LayerModel layerModel, IDataModel dataModel, bool isPreview = false)
|
||||||
|
{
|
||||||
|
// Generic layers are always drawn 10*10 (which is 40*40 when scaled up)
|
||||||
|
layerModel.Properties.Width = 10;
|
||||||
|
layerModel.Properties.Height = 10;
|
||||||
|
layerModel.Properties.X = 0;
|
||||||
|
layerModel.Properties.Y = 0;
|
||||||
|
layerModel.Properties.Contain = true;
|
||||||
|
|
||||||
|
layerModel.AppliedProperties = new SimplePropertiesModel(layerModel.Properties);
|
||||||
|
|
||||||
|
if (isPreview || dataModel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If not previewing, apply dynamic properties according to datamodel
|
||||||
|
var props = (SimplePropertiesModel) layerModel.AppliedProperties;
|
||||||
|
foreach (var dynamicProperty in props.DynamicProperties)
|
||||||
|
dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupProperties(LayerModel layerModel)
|
||||||
|
{
|
||||||
|
if (layerModel.Properties is SimplePropertiesModel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
layerModel.Properties = new SimplePropertiesModel(layerModel.Properties);
|
||||||
|
|
||||||
|
// Remove height and width dynamic properties since they are not applicable
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Height"));
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Width"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
||||||
|
List<ILayerAnimation> layerAnimations, IDataModel dataModel, LayerModel proposedLayer)
|
||||||
|
{
|
||||||
|
if (layerPropertiesViewModel is GenericPropertiesViewModel)
|
||||||
|
return layerPropertiesViewModel;
|
||||||
|
return new GenericPropertiesViewModel(proposedLayer, dataModel, layerAnimations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<UserControl x:Class="Artemis.Profiles.Layers.Types.Headset.HeadsetPropertiesView"
|
||||||
|
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:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- Animation -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Height="18" />
|
||||||
|
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||||
|
Height="22">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<!-- Animation Speed -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||||
|
VerticalAlignment="Center" Height="18" />
|
||||||
|
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||||
|
TickPlacement="None" TickFrequency="0.05"
|
||||||
|
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||||
|
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||||
|
|
||||||
|
<!-- Colors -->
|
||||||
|
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||||
|
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||||
|
VerticalAlignment="Top" Height="18" Width="130" />
|
||||||
|
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||||
|
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||||
|
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Dynamic -->
|
||||||
|
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||||
|
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||||
|
|
||||||
|
<!-- Dynamic property views -->
|
||||||
|
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||||
|
|
||||||
|
<!-- Note -->
|
||||||
|
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||||
|
Foreground="{DynamicResource HighlightBrush}"
|
||||||
|
Text="Note: If your headset has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||||
|
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Headset
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for HeadsetPropertiesView.xaml
|
/// Interaction logic for HeadsetPropertiesView.xaml
|
||||||
@ -1,11 +1,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Headset
|
||||||
{
|
{
|
||||||
public class HeadsetPropertiesViewModel : LayerPropertiesViewModel
|
public class HeadsetPropertiesViewModel : LayerPropertiesViewModel
|
||||||
{
|
{
|
||||||
@ -18,6 +21,9 @@ namespace Artemis.ViewModels.Profiles.Layers
|
|||||||
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity",
|
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity",
|
||||||
new BindableCollection<GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel)),
|
new BindableCollection<GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel)),
|
||||||
layerModel.Properties);
|
layerModel.Properties);
|
||||||
|
|
||||||
|
SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == layerModel.LayerAnimation?.Name) ??
|
||||||
|
LayerAnimations.First(l => l.Name == "None");
|
||||||
}
|
}
|
||||||
|
|
||||||
public BindableCollection<ILayerAnimation> LayerAnimations { get; set; }
|
public BindableCollection<ILayerAnimation> LayerAnimations { get; set; }
|
||||||
@ -1,21 +1,22 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Animations;
|
using Artemis.Profiles.Layers.Animations;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Headset
|
namespace Artemis.Profiles.Layers.Types.Headset
|
||||||
{
|
{
|
||||||
public class HeadsetType : ILayerType
|
public class HeadsetType : ILayerType
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Headset";
|
public string Name { get; } = "Headset";
|
||||||
public bool MustDraw { get; } = false;
|
public bool ShowInEdtor { get; } = false;
|
||||||
|
public DrawType DrawType { get; } = DrawType.Headset;
|
||||||
|
|
||||||
public ImageSource DrawThumbnail(LayerModel layer)
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
{
|
{
|
||||||
@ -38,10 +39,10 @@ namespace Artemis.Profiles.Layers.Types.Headset
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise draw the rectangle with its applied dimensions and brush
|
// Otherwise draw the rectangle with its applied dimensions and brush
|
||||||
var rect = new Rect(layer.AppliedProperties.X * 4,
|
var rect = new Rect(layer.AppliedProperties.X*4,
|
||||||
layer.AppliedProperties.Y * 4,
|
layer.AppliedProperties.Y*4,
|
||||||
layer.AppliedProperties.Width * 4,
|
layer.AppliedProperties.Width*4,
|
||||||
layer.AppliedProperties.Height * 4);
|
layer.AppliedProperties.Height*4);
|
||||||
|
|
||||||
c.PushClip(new RectangleGeometry(rect));
|
c.PushClip(new RectangleGeometry(rect));
|
||||||
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
|
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
|
||||||
@ -63,7 +64,7 @@ namespace Artemis.Profiles.Layers.Types.Headset
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// If not previewing, apply dynamic properties according to datamodel
|
// If not previewing, apply dynamic properties according to datamodel
|
||||||
var props = (SimplePropertiesModel)layerModel.AppliedProperties;
|
var props = (SimplePropertiesModel) layerModel.AppliedProperties;
|
||||||
foreach (var dynamicProperty in props.DynamicProperties)
|
foreach (var dynamicProperty in props.DynamicProperties)
|
||||||
dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties);
|
dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties);
|
||||||
}
|
}
|
||||||
@ -74,6 +75,12 @@ namespace Artemis.Profiles.Layers.Types.Headset
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
layerModel.Properties = new SimplePropertiesModel(layerModel.Properties);
|
layerModel.Properties = new SimplePropertiesModel(layerModel.Properties);
|
||||||
|
|
||||||
|
// Remove height and width dynamic properties since they are not applicable
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Height"));
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Width"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
public LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Windows;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Models;
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Keyboard
|
namespace Artemis.Profiles.Layers.Types.Keyboard
|
||||||
{
|
{
|
||||||
@ -10,10 +9,5 @@ namespace Artemis.Profiles.Layers.Types.Keyboard
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string GifFile { get; set; }
|
public string GifFile { get; set; }
|
||||||
|
|
||||||
public Rect GetRect(int scale = 4)
|
|
||||||
{
|
|
||||||
return new Rect(X*scale, Y*scale, Width*scale, Height*scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="Artemis.Views.Profiles.Layers.KeyboardPropertiesView"
|
<UserControl x:Class="Artemis.Profiles.Layers.Types.Keyboard.KeyboardPropertiesView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -28,10 +28,11 @@
|
|||||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Height="18" />
|
Height="18" />
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top" Height="22">
|
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||||
|
Height="22">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}"/>
|
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Keyboard
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for KeyboardPropertiesView.xaml
|
/// Interaction logic for KeyboardPropertiesView.xaml
|
||||||
@ -2,13 +2,14 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using static Artemis.Utilities.GeneralHelpers;
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Keyboard
|
||||||
{
|
{
|
||||||
public class KeyboardPropertiesViewModel : LayerPropertiesViewModel
|
public class KeyboardPropertiesViewModel : LayerPropertiesViewModel
|
||||||
{
|
{
|
||||||
@ -20,7 +21,8 @@ namespace Artemis.ViewModels.Profiles.Layers
|
|||||||
{
|
{
|
||||||
LayerAnimations = new BindableCollection<ILayerAnimation>(layerAnimations);
|
LayerAnimations = new BindableCollection<ILayerAnimation>(layerAnimations);
|
||||||
|
|
||||||
var dataModelProps = new BindableCollection<PropertyCollection>(GenerateTypeMap(dataModel));
|
var dataModelProps =
|
||||||
|
new BindableCollection<GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel));
|
||||||
HeightProperties = new LayerDynamicPropertiesViewModel("Height", dataModelProps, layerModel.Properties);
|
HeightProperties = new LayerDynamicPropertiesViewModel("Height", dataModelProps, layerModel.Properties);
|
||||||
WidthProperties = new LayerDynamicPropertiesViewModel("Width", dataModelProps, layerModel.Properties);
|
WidthProperties = new LayerDynamicPropertiesViewModel("Width", dataModelProps, layerModel.Properties);
|
||||||
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", dataModelProps, layerModel.Properties);
|
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", dataModelProps, layerModel.Properties);
|
||||||
@ -31,7 +33,7 @@ namespace Artemis.ViewModels.Profiles.Layers
|
|||||||
|
|
||||||
public bool ShowGif => IsGif;
|
public bool ShowGif => IsGif;
|
||||||
public bool ShowBrush => !IsGif;
|
public bool ShowBrush => !IsGif;
|
||||||
public BindableCollection<PropertyCollection> DataModelProps { get; set; }
|
public BindableCollection<GeneralHelpers.PropertyCollection> DataModelProps { get; set; }
|
||||||
public BindableCollection<ILayerAnimation> LayerAnimations { get; set; }
|
public BindableCollection<ILayerAnimation> LayerAnimations { get; set; }
|
||||||
public LayerDynamicPropertiesViewModel HeightProperties { get; set; }
|
public LayerDynamicPropertiesViewModel HeightProperties { get; set; }
|
||||||
public LayerDynamicPropertiesViewModel WidthProperties { get; set; }
|
public LayerDynamicPropertiesViewModel WidthProperties { get; set; }
|
||||||
@ -2,19 +2,18 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Animations;
|
using Artemis.Profiles.Layers.Animations;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Utilities;
|
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Keyboard
|
namespace Artemis.Profiles.Layers.Types.Keyboard
|
||||||
{
|
{
|
||||||
public class KeyboardType : ILayerType
|
public class KeyboardType : ILayerType
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Keyboard";
|
public string Name { get; } = "Keyboard";
|
||||||
public bool MustDraw { get; } = true;
|
public bool ShowInEdtor { get; } = true;
|
||||||
|
public DrawType DrawType { get; } = DrawType.Keyboard;
|
||||||
|
|
||||||
public ImageSource DrawThumbnail(LayerModel layer)
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,20 +4,20 @@ using System.IO;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
||||||
{
|
{
|
||||||
internal class KeyboardGifType : ILayerType
|
internal class KeyboardGifType : ILayerType
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Keyboard - GIF";
|
public string Name { get; } = "Keyboard - GIF";
|
||||||
public bool MustDraw { get; } = true;
|
public bool ShowInEdtor { get; } = true;
|
||||||
|
public DrawType DrawType { get; } = DrawType.Keyboard;
|
||||||
|
|
||||||
public ImageSource DrawThumbnail(LayerModel layer)
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="Artemis.Views.Profiles.Layers.MousePropertiesView"
|
<UserControl x:Class="Artemis.Profiles.Layers.Types.Mouse.MousePropertiesView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -25,10 +25,11 @@
|
|||||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Height="18" />
|
Height="18" />
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top" Height="22">
|
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||||
|
Height="22">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}"/>
|
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
@ -40,7 +41,7 @@
|
|||||||
TickPlacement="None" TickFrequency="0.05"
|
TickPlacement="None" TickFrequency="0.05"
|
||||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||||
|
|
||||||
<!-- Colors -->
|
<!-- Colors -->
|
||||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Mouse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MousePropertiesView.xaml
|
/// Interaction logic for MousePropertiesView.xaml
|
||||||
@ -1,12 +1,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Layers
|
namespace Artemis.Profiles.Layers.Types.Mouse
|
||||||
{
|
{
|
||||||
public class MousePropertiesViewModel : LayerPropertiesViewModel
|
public class MousePropertiesViewModel : LayerPropertiesViewModel
|
||||||
{
|
{
|
||||||
@ -1,29 +1,31 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Animations;
|
using Artemis.Profiles.Layers.Animations;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Mouse
|
namespace Artemis.Profiles.Layers.Types.Mouse
|
||||||
{
|
{
|
||||||
public class MouseType : ILayerType
|
public class MouseType : ILayerType
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Mouse";
|
public string Name { get; } = "Mouse";
|
||||||
public bool MustDraw { get; } = false;
|
public bool ShowInEdtor { get; } = false;
|
||||||
|
public DrawType DrawType { get; } = DrawType.Mouse;
|
||||||
|
|
||||||
public ImageSource DrawThumbnail(LayerModel layer)
|
public ImageSource DrawThumbnail(LayerModel layer)
|
||||||
{
|
{
|
||||||
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.mouse), thumbnailRect);
|
c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.mouse), thumbnailRect);
|
||||||
|
}
|
||||||
|
|
||||||
var image = new DrawingImage(visual.Drawing);
|
var image = new DrawingImage(visual.Drawing);
|
||||||
return image;
|
return image;
|
||||||
@ -39,10 +41,10 @@ namespace Artemis.Profiles.Layers.Types.Mouse
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise draw the rectangle with its applied dimensions and brush
|
// Otherwise draw the rectangle with its applied dimensions and brush
|
||||||
var rect = new Rect(layer.AppliedProperties.X * 4,
|
var rect = new Rect(layer.AppliedProperties.X*4,
|
||||||
layer.AppliedProperties.Y * 4,
|
layer.AppliedProperties.Y*4,
|
||||||
layer.AppliedProperties.Width * 4,
|
layer.AppliedProperties.Width*4,
|
||||||
layer.AppliedProperties.Height * 4);
|
layer.AppliedProperties.Height*4);
|
||||||
|
|
||||||
c.PushClip(new RectangleGeometry(rect));
|
c.PushClip(new RectangleGeometry(rect));
|
||||||
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
|
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
|
||||||
@ -64,7 +66,7 @@ namespace Artemis.Profiles.Layers.Types.Mouse
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// If not previewing, apply dynamic properties according to datamodel
|
// If not previewing, apply dynamic properties according to datamodel
|
||||||
var props = (SimplePropertiesModel)layerModel.AppliedProperties;
|
var props = (SimplePropertiesModel) layerModel.AppliedProperties;
|
||||||
foreach (var dynamicProperty in props.DynamicProperties)
|
foreach (var dynamicProperty in props.DynamicProperties)
|
||||||
dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties);
|
dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties);
|
||||||
}
|
}
|
||||||
@ -75,6 +77,12 @@ namespace Artemis.Profiles.Layers.Types.Mouse
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
layerModel.Properties = new SimplePropertiesModel(layerModel.Properties);
|
layerModel.Properties = new SimplePropertiesModel(layerModel.Properties);
|
||||||
|
|
||||||
|
// Remove height and width dynamic properties since they are not applicable
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Height"));
|
||||||
|
layerModel.Properties.DynamicProperties.Remove(
|
||||||
|
layerModel.Properties.DynamicProperties.FirstOrDefault(d => d.LayerProperty == "Width"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
public LayerPropertiesViewModel SetupViewModel(LayerPropertiesViewModel layerPropertiesViewModel,
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Artemis.DeviceProviders;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Headset;
|
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
|
||||||
using Artemis.Profiles.Layers.Types.Mouse;
|
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.ParentChild;
|
using Artemis.Utilities.ParentChild;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -31,9 +31,10 @@ namespace Artemis.Profiles
|
|||||||
public bool IsDefault { get; set; }
|
public bool IsDefault { get; set; }
|
||||||
public string KeyboardSlug { get; set; }
|
public string KeyboardSlug { get; set; }
|
||||||
public string GameName { get; set; }
|
public string GameName { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
||||||
public DrawingVisual DrawingVisual { get; set; }
|
public DrawingVisual DrawingVisual { get; set; }
|
||||||
|
|
||||||
public void FixOrder()
|
public void FixOrder()
|
||||||
@ -88,52 +89,30 @@ namespace Artemis.Profiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The game data model to base the conditions on</typeparam>
|
/// <typeparam name="T">The game data model to base the conditions on</typeparam>
|
||||||
/// <param name="dataModel">Instance of said game data model</param>
|
/// <param name="dataModel">Instance of said game data model</param>
|
||||||
/// <param name="includeMice">Whether or not to include mice in the list</param>
|
/// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param>
|
||||||
/// <param name="includeHeadsets">Whether or not to include headsets in the list</param>
|
|
||||||
/// <param name="ignoreConditions"></param>
|
/// <param name="ignoreConditions"></param>
|
||||||
/// <returns>A flat list containing all layers that must be rendered</returns>
|
/// <returns>A flat list containing all layers that must be rendered</returns>
|
||||||
public List<LayerModel> GetRenderLayers(IDataModel dataModel, bool includeMice, bool includeHeadsets,
|
public List<LayerModel> GetRenderLayers(IDataModel dataModel, bool keyboardOnly, bool ignoreConditions = false)
|
||||||
bool ignoreConditions = false)
|
|
||||||
{
|
{
|
||||||
var layers = new List<LayerModel>();
|
var layers = new List<LayerModel>();
|
||||||
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
||||||
{
|
{
|
||||||
if (!layerModel.Enabled || !includeMice && layerModel.LayerType is MouseType ||
|
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||||
!includeHeadsets && layerModel.LayerType is HeadsetType)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ignoreConditions && !layerModel.ConditionsMet(dataModel))
|
if (!ignoreConditions)
|
||||||
continue;
|
{
|
||||||
|
if (!layerModel.ConditionsMet(dataModel))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
layers.Add(layerModel);
|
layers.Add(layerModel);
|
||||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, includeMice, includeHeadsets, ignoreConditions));
|
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||||
}
|
}
|
||||||
|
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks at all the layers wthin the profile and makes sure they are within boundaries of the given rectangle
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="keyboardRectangle"></param>
|
|
||||||
public void FixBoundaries(Rect keyboardRectangle)
|
|
||||||
{
|
|
||||||
foreach (var layer in GetLayers())
|
|
||||||
{
|
|
||||||
if (!layer.LayerType.MustDraw)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var props = (KeyboardPropertiesModel) layer.Properties;
|
|
||||||
var layerRect = new Rect(new Point(props.X, props.Y), new Size(props.Width, props.Height));
|
|
||||||
if (keyboardRectangle.Contains(layerRect))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
props.X = 0;
|
|
||||||
props.Y = 0;
|
|
||||||
layer.Properties = props;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draw all the given layers on the given rect
|
/// Draw all the given layers on the given rect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -168,6 +147,47 @@ namespace Artemis.Profiles
|
|||||||
g.DrawImage(bmp, new PointF(0, 0));
|
g.DrawImage(bmp, new PointF(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks at all the layers wthin the profile and makes sure they are within boundaries of the given rectangle
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyboardRectangle"></param>
|
||||||
|
public void FixBoundaries(Rect keyboardRectangle)
|
||||||
|
{
|
||||||
|
foreach (var layer in GetLayers())
|
||||||
|
{
|
||||||
|
if (!layer.LayerType.ShowInEdtor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var props = layer.Properties;
|
||||||
|
var layerRect = new Rect(new Point(props.X, props.Y), new Size(props.Width, props.Height));
|
||||||
|
if (keyboardRectangle.Contains(layerRect))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
props.X = 0;
|
||||||
|
props.Y = 0;
|
||||||
|
layer.Properties = props;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resizes layers that are shown in the editor and match exactly the full keyboard widht and height
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The keyboard the profile was made for</param>
|
||||||
|
/// <param name="target">The new keyboard to adjust the layers for</param>
|
||||||
|
public void ResizeLayers(KeyboardProvider target)
|
||||||
|
{
|
||||||
|
foreach (var layer in GetLayers())
|
||||||
|
{
|
||||||
|
if (!layer.LayerType.ShowInEdtor ||
|
||||||
|
!(Math.Abs(layer.Properties.Width - Width) < 0.01) ||
|
||||||
|
!(Math.Abs(layer.Properties.Height - Height) < 0.01))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
layer.Properties.Width = target.Width;
|
||||||
|
layer.Properties.Height = target.Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Compare
|
#region Compare
|
||||||
|
|
||||||
protected bool Equals(ProfileModel other)
|
protected bool Equals(ProfileModel other)
|
||||||
|
|||||||
20
Artemis/Artemis/Properties/Resources.Designer.cs
generated
20
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -158,6 +158,16 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap g810 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("g810", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -168,6 +178,16 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap generic {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("generic", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -181,4 +181,10 @@
|
|||||||
<data name="Witcher3Artemis" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Witcher3Artemis" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Witcher3\Witcher3Artemis.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>..\Resources\Witcher3\Witcher3Artemis.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="g810" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Keyboards\g810.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="generic" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\generic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Binary file not shown.
BIN
Artemis/Artemis/Resources/Keyboards/g810.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/g810.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 287 KiB |
BIN
Artemis/Artemis/Resources/generic.png
Normal file
BIN
Artemis/Artemis/Resources/generic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@ -8,7 +8,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
namespace Artemis.Utilities.Converters
|
namespace Artemis.Utilities.Converters
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores a brush by temporarily serializing it to XAML because Json.NET has trouble
|
/// Stores a brush by temporarily serializing it to XAML because Json.NET has trouble
|
||||||
/// saving it as JSON
|
/// saving it as JSON
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrushJsonConverter : JsonConverter
|
public class BrushJsonConverter : JsonConverter
|
||||||
|
|||||||
@ -68,12 +68,12 @@ namespace Artemis.Utilities.Converters
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return value == null ? 0.0 : ((TimeSpan)value).TotalMilliseconds;
|
return value == null ? 0.0 : ((TimeSpan) value).TotalMilliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return value == null ? new TimeSpan() : TimeSpan.FromMilliseconds((double)value);
|
return value == null ? new TimeSpan() : TimeSpan.FromMilliseconds((double) value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ namespace Artemis.Utilities
|
|||||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||||
TypeNameHandling = TypeNameHandling.Auto
|
TypeNameHandling = TypeNameHandling.Auto
|
||||||
};
|
};
|
||||||
return (T)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source), source.GetType(),
|
return (T) JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source), source.GetType(),
|
||||||
deserializeSettings);
|
deserializeSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,12 +15,12 @@ namespace Artemis.Utilities
|
|||||||
{
|
{
|
||||||
public static class Updater
|
public static class Updater
|
||||||
{
|
{
|
||||||
public static int CurrentVersion = 113;
|
public static int CurrentVersion = 120;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
|
public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
|
||||||
{
|
{
|
||||||
Logger.Info("Checking for updates - Current version: 1.1.3");
|
Logger.Info("Checking for updates - Current version: 1.2.0");
|
||||||
if (!General.Default.CheckForUpdates)
|
if (!General.Default.CheckForUpdates)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@ -108,13 +108,13 @@ namespace Artemis.ViewModels.Abstract
|
|||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
base.OnActivate();
|
base.OnActivate();
|
||||||
ProfileEditor.ProfileViewModel.Activate();
|
ProfileEditor.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDeactivate(bool close)
|
protected override void OnDeactivate(bool close)
|
||||||
{
|
{
|
||||||
base.OnDeactivate(close);
|
base.OnDeactivate(close);
|
||||||
ProfileEditor.ProfileViewModel.Deactivate();
|
ProfileEditor.Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ using Artemis.Profiles.Layers.Models;
|
|||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles.Events
|
namespace Artemis.ViewModels.Profiles.Events
|
||||||
{
|
{
|
||||||
public class EventPropertiesViewModel : PropertyChangedBase
|
public class EventPropertiesViewModel : PropertyChangedBase
|
||||||
|
|||||||
@ -213,7 +213,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
SelectedDataModelProp = DataModelProps.FirstOrDefault(m => m.Path == LayerConditionModel.Field);
|
SelectedDataModelProp = DataModelProps.FirstOrDefault(m => m.Path == LayerConditionModel.Field);
|
||||||
SelectedOperator = Operators.FirstOrDefault(o => o.Value == LayerConditionModel.Operator);
|
SelectedOperator = Operators.FirstOrDefault(o => o.Value == LayerConditionModel.Operator);
|
||||||
LayerConditionModel.Type = SelectedDataModelProp.Type;
|
LayerConditionModel.Type = SelectedDataModelProp.Type;
|
||||||
if (LayerConditionModel.Type == "Enum")
|
if (LayerConditionModel.Type == "Enum" || LayerConditionModel.Type == "Boolean")
|
||||||
SelectedEnum = LayerConditionModel.Value;
|
SelectedEnum = LayerConditionModel.Value;
|
||||||
else
|
else
|
||||||
UserValue = LayerConditionModel.Value;
|
UserValue = LayerConditionModel.Value;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ using Artemis.Utilities;
|
|||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Castle.Core.Internal;
|
using Castle.Core.Internal;
|
||||||
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles
|
namespace Artemis.ViewModels.Profiles
|
||||||
{
|
{
|
||||||
public sealed class LayerDynamicPropertiesViewModel : PropertyChangedBase
|
public sealed class LayerDynamicPropertiesViewModel : PropertyChangedBase
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.ComponentModel;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
@ -11,9 +12,7 @@ using Artemis.Profiles.Layers.Types.KeyboardGif;
|
|||||||
using Artemis.Services;
|
using Artemis.Services;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Profiles.Events;
|
using Artemis.ViewModels.Profiles.Events;
|
||||||
using Artemis.ViewModels.Profiles.Layers;
|
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
|
|
||||||
@ -35,20 +34,20 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
_dataModel = dataModel;
|
_dataModel = dataModel;
|
||||||
_layerAnimations = layerAnimations;
|
_layerAnimations = layerAnimations;
|
||||||
|
|
||||||
|
LayerTypes = new BindableCollection<ILayerType>(layerTypes);
|
||||||
|
DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>(
|
||||||
|
GeneralHelpers.GenerateTypeMap(dataModel));
|
||||||
|
|
||||||
Layer = layer;
|
Layer = layer;
|
||||||
ProposedLayer = GeneralHelpers.Clone(layer);
|
ProposedLayer = GeneralHelpers.Clone(layer);
|
||||||
|
|
||||||
if (Layer.Properties == null)
|
if (Layer.Properties == null)
|
||||||
Layer.SetupProperties();
|
Layer.SetupProperties();
|
||||||
|
|
||||||
LayerTypes = new BindableCollection<ILayerType>(layerTypes);
|
|
||||||
DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>(
|
|
||||||
GeneralHelpers.GenerateTypeMap(dataModel));
|
|
||||||
LayerConditionVms = new BindableCollection<LayerConditionViewModel>(
|
LayerConditionVms = new BindableCollection<LayerConditionViewModel>(
|
||||||
layer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c, DataModelProps)));
|
layer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c, DataModelProps)));
|
||||||
|
|
||||||
PropertyChanged += PropertiesViewModelHandler;
|
PropertyChanged += PropertiesViewModelHandler;
|
||||||
|
|
||||||
PreSelect();
|
PreSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +165,25 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
public void Apply()
|
public void Apply()
|
||||||
{
|
{
|
||||||
LayerPropertiesViewModel?.ApplyProperties();
|
LayerPropertiesViewModel?.ApplyProperties();
|
||||||
Layer = GeneralHelpers.Clone(ProposedLayer);
|
var appliedLayer = GeneralHelpers.Clone(ProposedLayer);
|
||||||
|
|
||||||
|
// Fix relations
|
||||||
|
if (Layer.Parent != null)
|
||||||
|
{
|
||||||
|
Layer.Parent.Children.Add(appliedLayer);
|
||||||
|
Layer.Parent.Children.Remove(Layer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Layer.Profile.Layers.Add(appliedLayer);
|
||||||
|
Layer.Profile.Layers.Remove(Layer);
|
||||||
|
}
|
||||||
|
appliedLayer.Children.Clear();
|
||||||
|
foreach (var layerModel in Layer.Children)
|
||||||
|
appliedLayer.Children.Add(layerModel);
|
||||||
|
|
||||||
|
Layer = appliedLayer;
|
||||||
|
|
||||||
// TODO: EventPropVM must have layer too
|
// TODO: EventPropVM must have layer too
|
||||||
if (EventPropertiesViewModel != null)
|
if (EventPropertiesViewModel != null)
|
||||||
Layer.EventProperties = EventPropertiesViewModel.GetAppliedProperties();
|
Layer.EventProperties = EventPropertiesViewModel.GetAppliedProperties();
|
||||||
@ -201,8 +217,20 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
foreach (var conditionViewModel in LayerConditionVms)
|
foreach (var conditionViewModel in LayerConditionVms)
|
||||||
ProposedLayer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel);
|
ProposedLayer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel);
|
||||||
|
|
||||||
|
// Ignore children on the comparison
|
||||||
|
var currentNoChildren = GeneralHelpers.Clone(Layer);
|
||||||
|
currentNoChildren.Children.Clear();
|
||||||
|
// If not a keyboard, ignore size and position
|
||||||
|
if (ProposedLayer.LayerType.DrawType != DrawType.Keyboard)
|
||||||
|
{
|
||||||
|
ProposedLayer.Properties.Width = currentNoChildren.Properties.Width;
|
||||||
|
ProposedLayer.Properties.Height = currentNoChildren.Properties.Height;
|
||||||
|
ProposedLayer.Properties.X = currentNoChildren.Properties.X;
|
||||||
|
ProposedLayer.Properties.Y = currentNoChildren.Properties.Y;
|
||||||
|
ProposedLayer.Properties.Contain = currentNoChildren.Properties.Contain;
|
||||||
|
}
|
||||||
|
|
||||||
var current = JsonConvert.SerializeObject(Layer, Formatting.Indented);
|
var current = JsonConvert.SerializeObject(currentNoChildren, Formatting.Indented);
|
||||||
var proposed = JsonConvert.SerializeObject(ProposedLayer, Formatting.Indented);
|
var proposed = JsonConvert.SerializeObject(ProposedLayer, Formatting.Indented);
|
||||||
|
|
||||||
if (current.Equals(proposed))
|
if (current.Equals(proposed))
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
using System.ComponentModel;
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
@ -21,12 +23,12 @@ using Artemis.Utilities;
|
|||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using GongSolutions.Wpf.DragDrop;
|
using GongSolutions.Wpf.DragDrop;
|
||||||
using MahApps.Metro.Controls.Dialogs;
|
using MahApps.Metro.Controls.Dialogs;
|
||||||
|
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using DragDropEffects = System.Windows.DragDropEffects;
|
using DragDropEffects = System.Windows.DragDropEffects;
|
||||||
using IDropTarget = GongSolutions.Wpf.DragDrop.IDropTarget;
|
using IDropTarget = GongSolutions.Wpf.DragDrop.IDropTarget;
|
||||||
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
using Screen = Caliburn.Micro.Screen;
|
using Screen = Caliburn.Micro.Screen;
|
||||||
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles
|
namespace Artemis.ViewModels.Profiles
|
||||||
{
|
{
|
||||||
@ -35,9 +37,11 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
private readonly EffectModel _gameModel;
|
private readonly EffectModel _gameModel;
|
||||||
private readonly ILayerEditorVmFactory _layerEditorVmFactory;
|
private readonly ILayerEditorVmFactory _layerEditorVmFactory;
|
||||||
private readonly MainManager _mainManager;
|
private readonly MainManager _mainManager;
|
||||||
|
private readonly Timer _saveTimer;
|
||||||
private ImageSource _keyboardPreview;
|
private ImageSource _keyboardPreview;
|
||||||
private BindableCollection<LayerModel> _layers;
|
private BindableCollection<LayerModel> _layers;
|
||||||
private BindableCollection<ProfileModel> _profiles;
|
private BindableCollection<ProfileModel> _profiles;
|
||||||
|
private bool _saving;
|
||||||
private ProfileModel _selectedProfile;
|
private ProfileModel _selectedProfile;
|
||||||
|
|
||||||
public ProfileEditorViewModel(IEventAggregator events, MainManager mainManager, EffectModel gameModel,
|
public ProfileEditorViewModel(IEventAggregator events, MainManager mainManager, EffectModel gameModel,
|
||||||
@ -56,8 +60,13 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
events.Subscribe(this);
|
events.Subscribe(this);
|
||||||
|
|
||||||
ProfileViewModel.PropertyChanged += PropertyChangeHandler;
|
|
||||||
PropertyChanged += PropertyChangeHandler;
|
PropertyChanged += EditorStateHandler;
|
||||||
|
ProfileViewModel.PropertyChanged += LayerSelectedHandler;
|
||||||
|
|
||||||
|
_saveTimer = new Timer(5000);
|
||||||
|
_saveTimer.Elapsed += ProfileSaveHandler;
|
||||||
|
|
||||||
LoadProfiles();
|
LoadProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,38 +210,16 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
LoadProfiles();
|
LoadProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void Activate()
|
||||||
/// Handles refreshing the layer preview
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void PropertyChangeHandler(object sender, PropertyChangedEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (e.PropertyName == "KeyboardPreview")
|
ProfileViewModel.Activate();
|
||||||
return;
|
_saveTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
if (e.PropertyName == "SelectedLayer")
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => LayerSelected);
|
ProfileViewModel.Deactivate();
|
||||||
return;
|
_saveTimer.Stop();
|
||||||
}
|
|
||||||
|
|
||||||
if (SelectedProfile != null)
|
|
||||||
ProfileProvider.AddOrUpdate(SelectedProfile);
|
|
||||||
|
|
||||||
if (e.PropertyName != "SelectedProfile")
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Update editor enabled state
|
|
||||||
NotifyOfPropertyChange(() => EditorEnabled);
|
|
||||||
// Update ProfileViewModel
|
|
||||||
ProfileViewModel.SelectedProfile = SelectedProfile;
|
|
||||||
// Update interface
|
|
||||||
Layers.Clear();
|
|
||||||
if (SelectedProfile != null)
|
|
||||||
Layers.AddRange(SelectedProfile.Layers);
|
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => ProfileSelected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -267,7 +254,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
if (ProfileViewModel.SelectedLayer == null)
|
if (ProfileViewModel.SelectedLayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EditLayer(ProfileViewModel.SelectedLayer);
|
var selectedLayer = ProfileViewModel.SelectedLayer;
|
||||||
|
EditLayer(selectedLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -276,8 +264,12 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
/// <param name="layer">The layer to open the view for</param>
|
/// <param name="layer">The layer to open the view for</param>
|
||||||
public void EditLayer(LayerModel layer)
|
public void EditLayer(LayerModel layer)
|
||||||
{
|
{
|
||||||
|
if (layer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
IWindowManager manager = new WindowManager();
|
IWindowManager manager = new WindowManager();
|
||||||
var editorVm = _layerEditorVmFactory.CreateLayerEditorVm(_gameModel.DataModel, layer);
|
var editorVm = _layerEditorVmFactory.CreateLayerEditorVm(_gameModel.DataModel, layer);
|
||||||
|
|
||||||
dynamic settings = new ExpandoObject();
|
dynamic settings = new ExpandoObject();
|
||||||
var icon = ImageUtilities.GenerateWindowIcon();
|
var icon = ImageUtilities.GenerateWindowIcon();
|
||||||
|
|
||||||
@ -286,9 +278,9 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
manager.ShowDialog(editorVm, null, settings);
|
manager.ShowDialog(editorVm, null, settings);
|
||||||
|
|
||||||
// The layer editor VM may have created a new instance of the layer, reapply it to the list
|
//// The layer editor VM may have created a new instance of the layer, reapply it to the list
|
||||||
layer.Replace(editorVm.Layer);
|
//layer.Replace(editorVm.Layer);
|
||||||
layer = editorVm.Layer;
|
//layer = editorVm.Layer;
|
||||||
|
|
||||||
// If the layer was a folder, but isn't anymore, assign it's children to it's parent.
|
// If the layer was a folder, but isn't anymore, assign it's children to it's parent.
|
||||||
if (!(layer.LayerType is FolderType) && layer.Children.Any())
|
if (!(layer.LayerType is FolderType) && layer.Children.Any())
|
||||||
@ -316,10 +308,10 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new layer to the profile and selects it
|
/// Adds a new layer to the profile and selects it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddLayer()
|
public LayerModel AddLayer()
|
||||||
{
|
{
|
||||||
if (SelectedProfile == null)
|
if (SelectedProfile == null)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
// Create a new layer
|
// Create a new layer
|
||||||
var layer = LayerModel.CreateLayer();
|
var layer = LayerModel.CreateLayer();
|
||||||
@ -333,6 +325,20 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateLayerList(layer);
|
UpdateLayerList(layer);
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerModel AddFolder()
|
||||||
|
{
|
||||||
|
var layer = AddLayer();
|
||||||
|
if (layer == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
layer.Name = "New folder";
|
||||||
|
layer.LayerType = new FolderType();
|
||||||
|
layer.LayerType.SetupProperties(layer);
|
||||||
|
|
||||||
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -408,6 +414,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
{
|
{
|
||||||
var clone = GeneralHelpers.Clone(layer);
|
var clone = GeneralHelpers.Clone(layer);
|
||||||
layer.InsertAfter(clone);
|
layer.InsertAfter(clone);
|
||||||
|
foreach (var layerModel in layer.Children)
|
||||||
|
clone.Children.Add(GeneralHelpers.Clone(layerModel));
|
||||||
|
|
||||||
UpdateLayerList(clone);
|
UpdateLayerList(clone);
|
||||||
}
|
}
|
||||||
@ -487,6 +495,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
KeyboardSlug = _mainManager.DeviceManager.ActiveKeyboard.Slug,
|
KeyboardSlug = _mainManager.DeviceManager.ActiveKeyboard.Slug,
|
||||||
|
Width = _mainManager.DeviceManager.ActiveKeyboard.Width,
|
||||||
|
Height = _mainManager.DeviceManager.ActiveKeyboard.Height,
|
||||||
GameName = _gameModel.Name
|
GameName = _gameModel.Name
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -613,7 +623,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the keyboard
|
// Verify the keyboard
|
||||||
if (profile.KeyboardSlug != _mainManager.DeviceManager.ActiveKeyboard.Slug)
|
var deviceManager = _mainManager.DeviceManager;
|
||||||
|
if (profile.KeyboardSlug != deviceManager.ActiveKeyboard.Slug)
|
||||||
{
|
{
|
||||||
var adjustKeyboard = await DialogService.ShowQuestionMessageBox("Profile not inteded for this keyboard",
|
var adjustKeyboard = await DialogService.ShowQuestionMessageBox("Profile not inteded for this keyboard",
|
||||||
$"Watch out, this profile wasn't ment for this keyboard, but for the {profile.KeyboardSlug}. " +
|
$"Watch out, this profile wasn't ment for this keyboard, but for the {profile.KeyboardSlug}. " +
|
||||||
@ -622,9 +633,16 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
if (!adjustKeyboard.Value)
|
if (!adjustKeyboard.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
profile.KeyboardSlug = _mainManager.DeviceManager.ActiveKeyboard.Slug;
|
// Resize layers that are on the full keyboard width
|
||||||
|
profile.ResizeLayers(deviceManager.ActiveKeyboard);
|
||||||
|
// Put layers back into the canvas if they fell outside it
|
||||||
|
profile.FixBoundaries(deviceManager.ActiveKeyboard.KeyboardRectangle(1));
|
||||||
|
|
||||||
|
// Setup profile metadata to match the new keyboard
|
||||||
|
profile.KeyboardSlug = deviceManager.ActiveKeyboard.Slug;
|
||||||
|
profile.Width = deviceManager.ActiveKeyboard.Width;
|
||||||
|
profile.Height = deviceManager.ActiveKeyboard.Height;
|
||||||
profile.IsDefault = false;
|
profile.IsDefault = false;
|
||||||
profile.FixBoundaries(_mainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the name
|
// Verify the name
|
||||||
@ -656,5 +674,48 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
ProfileProvider.ExportProfile(SelectedProfile, dialog.FileName);
|
ProfileProvider.ExportProfile(SelectedProfile, dialog.FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditorStateHandler(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName != "SelectedProfile")
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Update editor enabled state
|
||||||
|
NotifyOfPropertyChange(() => EditorEnabled);
|
||||||
|
// Update ProfileViewModel
|
||||||
|
ProfileViewModel.SelectedProfile = SelectedProfile;
|
||||||
|
// Update interface
|
||||||
|
Layers.Clear();
|
||||||
|
|
||||||
|
if (SelectedProfile != null)
|
||||||
|
Layers.AddRange(SelectedProfile.Layers);
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(() => ProfileSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LayerSelectedHandler(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName != "SelectedLayer")
|
||||||
|
return;
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(() => LayerSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProfileSaveHandler(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_saving || SelectedProfile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_saving = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProfileProvider.AddOrUpdate(SelectedProfile);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
_saving = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,11 +110,12 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);
|
drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);
|
||||||
|
|
||||||
// Draw the layers
|
// Draw the layers
|
||||||
var drawLayers = SelectedProfile.GetRenderLayers(new ProfilePreviewDataModel(), false, false, true);
|
var drawLayers = SelectedProfile.GetRenderLayers(new ProfilePreviewDataModel(), false, true);
|
||||||
foreach (var layer in drawLayers)
|
foreach (var layer in drawLayers)
|
||||||
{
|
{
|
||||||
layer.Update(null, true, false);
|
layer.Update(null, true, false);
|
||||||
layer.Draw(null, drawingContext, true, false);
|
if (layer.LayerType.ShowInEdtor)
|
||||||
|
layer.Draw(null, drawingContext, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the selection color
|
// Get the selection color
|
||||||
@ -127,7 +128,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
// Draw the selection outline and resize indicator
|
// Draw the selection outline and resize indicator
|
||||||
if (SelectedLayer != null && SelectedLayer.MustDraw())
|
if (SelectedLayer != null && SelectedLayer.MustDraw())
|
||||||
{
|
{
|
||||||
var layerRect = ((KeyboardPropertiesModel) SelectedLayer.Properties).GetRect();
|
var layerRect = SelectedLayer.Properties.GetRect();
|
||||||
// Deflate the rect so that the border is drawn on the inside
|
// Deflate the rect so that the border is drawn on the inside
|
||||||
layerRect.Inflate(-0.2, -0.2);
|
layerRect.Inflate(-0.2, -0.2);
|
||||||
|
|
||||||
@ -200,9 +201,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
var hoverLayer = SelectedProfile.GetLayers()
|
var hoverLayer = SelectedProfile.GetLayers()
|
||||||
.Where(l => l.MustDraw())
|
.Where(l => l.MustDraw())
|
||||||
.FirstOrDefault(l => ((KeyboardPropertiesModel) l.Properties)
|
.FirstOrDefault(l => l.Properties.GetRect(1).Contains(x, y));
|
||||||
.GetRect(1)
|
|
||||||
.Contains(x, y));
|
|
||||||
|
|
||||||
SelectedLayer = hoverLayer;
|
SelectedLayer = hoverLayer;
|
||||||
}
|
}
|
||||||
@ -222,8 +221,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
var y = pos.Y/((double) keyboard.PreviewSettings.Height/keyboard.Height);
|
var y = pos.Y/((double) keyboard.PreviewSettings.Height/keyboard.Height);
|
||||||
var hoverLayer = SelectedProfile.GetLayers()
|
var hoverLayer = SelectedProfile.GetLayers()
|
||||||
.Where(l => l.MustDraw())
|
.Where(l => l.MustDraw())
|
||||||
.FirstOrDefault(l => ((KeyboardPropertiesModel) l.Properties)
|
.FirstOrDefault(l => l.Properties.GetRect(1).Contains(x, y));
|
||||||
.GetRect(1).Contains(x, y));
|
|
||||||
|
|
||||||
HandleDragging(e, x, y, hoverLayer);
|
HandleDragging(e, x, y, hoverLayer);
|
||||||
|
|
||||||
@ -233,11 +231,10 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Turn the mouse pointer into a hand if hovering over an active layer
|
// Turn the mouse pointer into a hand if hovering over an active layer
|
||||||
if (hoverLayer == SelectedLayer)
|
if (hoverLayer == SelectedLayer)
|
||||||
{
|
{
|
||||||
var rect = ((KeyboardPropertiesModel) hoverLayer.Properties).GetRect(1);
|
var rect = hoverLayer.Properties.GetRect(1);
|
||||||
KeyboardPreviewCursor =
|
KeyboardPreviewCursor =
|
||||||
Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6
|
Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6
|
||||||
? Cursors.SizeNWSE
|
? Cursors.SizeNWSE
|
||||||
@ -276,16 +273,15 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedLayer == null)
|
if (SelectedLayer == null || (SelectedLayer.LayerType != null && !SelectedLayer.LayerType.ShowInEdtor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Setup the dragging state on mouse press
|
// Setup the dragging state on mouse press
|
||||||
if (_draggingLayerOffset == null && hoverLayer != null && e.LeftButton == MouseButtonState.Pressed)
|
if (_draggingLayerOffset == null && hoverLayer != null && e.LeftButton == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
var layerRect = ((KeyboardPropertiesModel) hoverLayer.Properties).GetRect(1);
|
var layerRect = hoverLayer.Properties.GetRect(1);
|
||||||
var selectedProps = (KeyboardPropertiesModel) SelectedLayer.Properties;
|
|
||||||
|
|
||||||
_draggingLayerOffset = new Point(x - selectedProps.X, y - selectedProps.Y);
|
_draggingLayerOffset = new Point(x - SelectedLayer.Properties.X, y - SelectedLayer.Properties.Y);
|
||||||
_draggingLayer = hoverLayer;
|
_draggingLayer = hoverLayer;
|
||||||
// Detect dragging if cursor is in the bottom right
|
// Detect dragging if cursor is in the bottom right
|
||||||
_resizing = Math.Sqrt(Math.Pow(x - layerRect.BottomRight.X, 2) +
|
_resizing = Math.Sqrt(Math.Pow(x - layerRect.BottomRight.X, 2) +
|
||||||
@ -295,8 +291,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
if (_draggingLayerOffset == null || _draggingLayer == null || (_draggingLayer != SelectedLayer))
|
if (_draggingLayerOffset == null || _draggingLayer == null || (_draggingLayer != SelectedLayer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var draggingProps = (KeyboardPropertiesModel) _draggingLayer?.Properties;
|
var draggingProps = _draggingLayer.Properties;
|
||||||
|
|
||||||
// If no setup or reset was done, handle the actual dragging action
|
// If no setup or reset was done, handle the actual dragging action
|
||||||
if (_resizing)
|
if (_resizing)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -113,7 +113,7 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" />
|
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" />
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.1.3" VerticalAlignment="Center"
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.2.0" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
<Button Grid.Row="1" Grid.Column="1" Focusable="False"
|
<Button Grid.Row="1" Grid.Column="1" Focusable="False"
|
||||||
Style="{StaticResource AccentedSquareButtonStyle}"
|
Style="{StaticResource AccentedSquareButtonStyle}"
|
||||||
|
|||||||
@ -49,10 +49,10 @@
|
|||||||
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,12" FontSize="13.333" Text="Type:"
|
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,12" FontSize="13.333" Text="Type:"
|
||||||
VerticalAlignment="Center" Height="18" />
|
VerticalAlignment="Center" Height="18" />
|
||||||
|
|
||||||
<ComboBox Grid.Row="1" Grid.Column="3" Margin="10" Width="120" x:Name="LayerTypes" >
|
<ComboBox Grid.Row="1" Grid.Column="3" Margin="10" Width="120" x:Name="LayerTypes">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}"/>
|
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
<UserControl x:Class="Artemis.Views.Profiles.Layers.HeadsetPropertiesView"
|
|
||||||
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:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<!-- Colors -->
|
|
||||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
|
||||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
|
||||||
VerticalAlignment="Top" Height="18" Width="130" />
|
|
||||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
|
||||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
|
||||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" />
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
|
||||||
Foreground="{DynamicResource HighlightBrush}"
|
|
||||||
Text="Note: If your headset has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
|
||||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
|
||||||
</Grid>
|
|
||||||
</UserControl>
|
|
||||||
@ -205,6 +205,19 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button x:Name="AddFolder" VerticalAlignment="Top"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
|
Width="26" Height="26" ToolTip="Add folder" HorizontalAlignment="Left" Margin="10,0,0,0">
|
||||||
|
<Button.Content>
|
||||||
|
<Rectangle
|
||||||
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
|
Width="12" Height="12">
|
||||||
|
<Rectangle.OpacityMask>
|
||||||
|
<VisualBrush Visual="{StaticResource appbar_folder}" Stretch="Fill" />
|
||||||
|
</Rectangle.OpacityMask>
|
||||||
|
</Rectangle>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
IsEnabled="{Binding Path=LayerSelected}">
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" />
|
<package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
|
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
|
||||||
|
|||||||
@ -88,10 +88,14 @@
|
|||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<BrowseInformation>true</BrowseInformation>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>Razer2Artemis.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>Razer2Artemis.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Bscmake>
|
||||||
|
<PreserveSbr>true</PreserveSbr>
|
||||||
|
</Bscmake>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user