mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
You can now see selected layers that are behind other layers. Selecting a layer also selects it in the list now.
This commit is contained in:
parent
8aeee846b4
commit
b3ac975c5f
@ -120,10 +120,6 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.0.0-rc1-177\lib\net45\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -152,12 +148,8 @@
|
||||
<HintPath>..\packages\CUE.NET.1.0.2.2\lib\net45\CUE.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ExpressionEvaluator, Version=2.0.4.0, Culture=neutral, PublicKeyToken=90d9f15d622e2348, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ExpressionEvaluator.2.0.4.0\lib\net40\ExpressionEvaluator.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Kaliko.ImageLibrary, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -180,11 +172,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Screna, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Screna.0.1.3\lib\Screna.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
@ -231,28 +219,28 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.DataGrid, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.DataGrid, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
@ -538,14 +526,13 @@
|
||||
<None Include="packages.config" />
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\bow.png" />
|
||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||
<Resource Include="Resources\Entypo-license.txt" />
|
||||
<Content Include="logo.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Resource Include="Resources\logo.ico" />
|
||||
<Resource Include="Resources\logo-disabled.ico" />
|
||||
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
||||
<Resource Include="Resources\Entypo.ttf" />
|
||||
<None Include="Resources\LogitechLED.dll" />
|
||||
<None Include="Resources\folder.png" />
|
||||
<Resource Include="Resources\Keyboards\k65.png" />
|
||||
@ -553,9 +540,10 @@
|
||||
<Resource Include="Resources\Keyboards\k95.png" />
|
||||
<Resource Include="Resources\Keyboards\strafe.png" />
|
||||
<Resource Include="Resources\Keyboards\g910.png" />
|
||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||
<Resource Include="Resources\Entypo-license.txt" />
|
||||
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
||||
<Content Include="Resources\Witcher3\artemis.txt" />
|
||||
<Resource Include="Resources\Entypo.ttf" />
|
||||
<None Include="Settings\Offsets.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Offsets.Designer.cs</LastGenOutput>
|
||||
|
||||
@ -37,13 +37,13 @@ namespace Artemis.ItemBehaviours
|
||||
set { SetValue(SelectedItemProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedItemProperty =
|
||||
DependencyProperty.Register("SelectedItem", typeof (object), typeof (BindableSelectedItemBehavior),
|
||||
new UIPropertyMetadata(null, OnSelectedItemChanged));
|
||||
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem",
|
||||
typeof (object), typeof (BindableSelectedItemBehavior), new UIPropertyMetadata(null, OnSelectedItemChanged));
|
||||
|
||||
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var item = e.NewValue as TreeViewItem;
|
||||
var item = ((BindableSelectedItemBehavior) sender).AssociatedObject
|
||||
.ItemContainerGenerator.ContainerFromItem(e.NewValue) as TreeViewItem;
|
||||
item?.SetValue(TreeViewItem.IsSelectedProperty, true);
|
||||
}
|
||||
|
||||
|
||||
@ -50,8 +50,8 @@ namespace Artemis.Managers
|
||||
GameStateWebServer.Start();
|
||||
|
||||
// Start the named pipe
|
||||
//PipeServer = new PipeServer();
|
||||
//PipeServer.Start("artemis");
|
||||
PipeServer = new PipeServer();
|
||||
PipeServer.Start("artemis");
|
||||
}
|
||||
|
||||
public PipeServer PipeServer { get; set; }
|
||||
|
||||
@ -11,7 +11,7 @@ namespace Artemis.Models.Profiles
|
||||
public class LayerModel
|
||||
{
|
||||
[XmlIgnore] private readonly LayerDrawer _drawer;
|
||||
private bool _mustDraw;
|
||||
[XmlIgnore] private bool _mustDraw;
|
||||
|
||||
public LayerModel()
|
||||
{
|
||||
@ -30,7 +30,7 @@ namespace Artemis.Models.Profiles
|
||||
public LayerType LayerType { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public LayerPropertiesModel UserProps { get; set; }
|
||||
|
||||
|
||||
public List<LayerModel> Children { get; set; }
|
||||
public List<LayerConditionModel> LayerConditions { get; set; }
|
||||
public List<LayerDynamicPropertiesModel> LayerProperties { get; set; }
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
using Artemis.Utilities;
|
||||
using CUE.NET.Helper;
|
||||
|
||||
namespace Artemis.Models.Profiles
|
||||
{
|
||||
@ -42,5 +45,32 @@ namespace Artemis.Models.Profiles
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new layer with default settings to the profile
|
||||
/// </summary>
|
||||
/// <returns>The newly added layer</returns>
|
||||
public LayerModel AddLayer()
|
||||
{
|
||||
var layer = new LayerModel
|
||||
{
|
||||
Name = "New layer",
|
||||
Enabled = true,
|
||||
LayerType = LayerType.KeyboardRectangle,
|
||||
UserProps = new LayerPropertiesModel
|
||||
{
|
||||
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor()),
|
||||
Animation = LayerAnimation.None,
|
||||
Height = 1,
|
||||
Width = 1,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Opacity = 1
|
||||
}
|
||||
};
|
||||
|
||||
Layers.Add(layer);
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,8 +89,6 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
||||
return;
|
||||
|
||||
Debug.WriteLine("Received data");
|
||||
|
||||
// Parse the JSON
|
||||
GameDataModel = JsonConvert.DeserializeObject<CounterStrikeDataModel>(jsonString);
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
@ -22,10 +23,16 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
PlaceConfigFile();
|
||||
|
||||
ProfileEditor = new ProfileEditorViewModel<CounterStrikeDataModel>(MainManager, GameModel);
|
||||
|
||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||
}
|
||||
|
||||
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "SelectedProfile")
|
||||
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||
}
|
||||
|
||||
public ProfileEditorViewModel<CounterStrikeDataModel> ProfileEditor { get; set; }
|
||||
|
||||
public static string Name => "CS:GO";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -28,6 +28,23 @@ namespace Artemis.Utilities
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
public static System.Windows.Media.Color GetRandomRainbowMediaColor()
|
||||
{
|
||||
var colors = new List<byte>();
|
||||
var rand = new Random();
|
||||
for (var i = 0; i < 3; i++)
|
||||
colors.Add((byte) rand.Next(0, 256));
|
||||
|
||||
var highest = colors.Max();
|
||||
var lowest = colors.Min();
|
||||
colors[colors.FindIndex(c => c == highest)] = 255;
|
||||
colors[colors.FindIndex(c => c == lowest)] = 0;
|
||||
|
||||
var returnColor = System.Windows.Media.Color.FromArgb(255, colors[0], colors[1], colors[2]);
|
||||
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
public static Color ShiftColor(Color c, int shiftAmount)
|
||||
{
|
||||
int newRed = c.R;
|
||||
|
||||
@ -30,8 +30,8 @@ namespace Artemis.ViewModels
|
||||
private LayerEditorViewModel<T> _editorVm;
|
||||
private Cursor _keyboardPreviewCursor;
|
||||
private BindableCollection<LayerModel> _layers;
|
||||
private BindableCollection<ProfileModel> _profileModels;
|
||||
private bool _resizeSourceRect;
|
||||
private BindableCollection<ProfileModel> _profiles;
|
||||
private bool _resizing;
|
||||
private LayerModel _selectedLayer;
|
||||
private ProfileModel _selectedProfile;
|
||||
|
||||
@ -40,7 +40,7 @@ namespace Artemis.ViewModels
|
||||
_mainManager = mainManager;
|
||||
_gameModel = gameModel;
|
||||
|
||||
ProfileModels = new BindableCollection<ProfileModel>();
|
||||
Profiles = new BindableCollection<ProfileModel>();
|
||||
Layers = new BindableCollection<LayerModel>();
|
||||
_mainManager.Events.Subscribe(this);
|
||||
|
||||
@ -48,14 +48,14 @@ namespace Artemis.ViewModels
|
||||
LoadProfiles();
|
||||
}
|
||||
|
||||
public BindableCollection<ProfileModel> ProfileModels
|
||||
public BindableCollection<ProfileModel> Profiles
|
||||
{
|
||||
get { return _profileModels; }
|
||||
get { return _profiles; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _profileModels)) return;
|
||||
_profileModels = value;
|
||||
NotifyOfPropertyChange(() => ProfileModels);
|
||||
if (Equals(value, _profiles)) return;
|
||||
_profiles = value;
|
||||
NotifyOfPropertyChange(() => Profiles);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_selectedProfile == null)
|
||||
if (_selectedProfile == null || ActiveKeyboard == null)
|
||||
return null;
|
||||
|
||||
var keyboardRect = ActiveKeyboard.KeyboardRectangle(4);
|
||||
@ -112,18 +112,21 @@ namespace Artemis.ViewModels
|
||||
drawingContext.PushClip(new RectangleGeometry(keyboardRect));
|
||||
drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);
|
||||
|
||||
// Get the selection color
|
||||
var penColor = (Color)ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
|
||||
var pen = new Pen(new SolidColorBrush(penColor), 0.4);
|
||||
|
||||
// Draw the layer
|
||||
// Draw the layers
|
||||
foreach (var layerModel in _selectedProfile.Layers)
|
||||
{
|
||||
layerModel.DrawPreview(drawingContext);
|
||||
if (layerModel != SelectedLayer || !layerModel.Enabled)
|
||||
continue;
|
||||
|
||||
var layerRect = layerModel.UserProps.GetRect();
|
||||
|
||||
// Get the selection color
|
||||
var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
|
||||
var pen = new Pen(new SolidColorBrush(color), 0.4);
|
||||
|
||||
// Draw the selection outline and resize indicator
|
||||
if (SelectedLayer != null && SelectedLayer.Enabled)
|
||||
{
|
||||
var layerRect = SelectedLayer.UserProps.GetRect();
|
||||
// Deflate the rect so that the border is drawn on the inside
|
||||
layerRect.Inflate(-0.2, -0.2);
|
||||
|
||||
// Draw an outline around the selected layer
|
||||
drawingContext.DrawRectangle(null, pen, layerRect);
|
||||
// Draw a resize indicator in the bottom-right
|
||||
@ -153,7 +156,7 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
using (var memory = new MemoryStream())
|
||||
{
|
||||
if (ActiveKeyboard?.PreviewSettings == null || ActiveKeyboard?.PreviewSettings.Image == null)
|
||||
if (ActiveKeyboard?.PreviewSettings.Image == null)
|
||||
return null;
|
||||
ActiveKeyboard.PreviewSettings.Image.Save(memory, ImageFormat.Png);
|
||||
memory.Position = 0;
|
||||
@ -194,23 +197,21 @@ namespace Artemis.ViewModels
|
||||
|
||||
private void PreviewRefresher(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "SelectedLayer" || e.PropertyName == "ProfileTree")
|
||||
if (e.PropertyName != "KeyboardPreview")
|
||||
NotifyOfPropertyChange(() => KeyboardPreview);
|
||||
}
|
||||
|
||||
private void LoadProfiles()
|
||||
{
|
||||
ProfileModels.Clear();
|
||||
ProfileModels.AddRange(ProfileProvider.GetAll(_gameModel));
|
||||
SelectedProfile = ProfileModels.FirstOrDefault();
|
||||
Profiles.Clear();
|
||||
Profiles.AddRange(ProfileProvider.GetAll(_gameModel));
|
||||
SelectedProfile = Profiles.FirstOrDefault();
|
||||
}
|
||||
|
||||
public async void AddProfile()
|
||||
{
|
||||
var name =
|
||||
await
|
||||
_mainManager.DialogService.ShowInputDialog("Add new profile",
|
||||
"Please provide a profile name unique to this game and keyboard.");
|
||||
var name = await _mainManager.DialogService.ShowInputDialog("Add new profile",
|
||||
"Please provide a profile name unique to this game and keyboard.");
|
||||
if (name.Length < 1)
|
||||
{
|
||||
_mainManager.DialogService.ShowMessageBox("Invalid profile name", "Please provide a valid profile name");
|
||||
@ -223,12 +224,11 @@ namespace Artemis.ViewModels
|
||||
KeyboardName = ActiveKeyboard.Name,
|
||||
GameName = _gameModel.Name
|
||||
};
|
||||
|
||||
if (ProfileProvider.GetAll().Contains(profile))
|
||||
{
|
||||
var overwrite =
|
||||
await
|
||||
_mainManager.DialogService.ShowQuestionMessageBox("Overwrite existing profile",
|
||||
"A profile with this name already exists for this game. Would you like to overwrite it?");
|
||||
var overwrite = await _mainManager.DialogService.ShowQuestionMessageBox("Overwrite existing profile",
|
||||
"A profile with this name already exists for this game. Would you like to overwrite it?");
|
||||
if (!overwrite.Value)
|
||||
return;
|
||||
}
|
||||
@ -247,8 +247,7 @@ namespace Artemis.ViewModels
|
||||
public void LayerEditor(LayerModel layer)
|
||||
{
|
||||
IWindowManager manager = new WindowManager();
|
||||
_editorVm = new LayerEditorViewModel<T>(ActiveKeyboard, SelectedProfile,
|
||||
layer);
|
||||
_editorVm = new LayerEditorViewModel<T>(ActiveKeyboard, SelectedProfile, layer);
|
||||
dynamic settings = new ExpandoObject();
|
||||
|
||||
settings.Title = "Artemis | Edit " + layer.Name;
|
||||
@ -258,7 +257,6 @@ namespace Artemis.ViewModels
|
||||
public void SetSelectedLayer(LayerModel layer)
|
||||
{
|
||||
SelectedLayer = layer;
|
||||
NotifyOfPropertyChange(() => KeyboardPreview);
|
||||
}
|
||||
|
||||
public void AddLayer()
|
||||
@ -266,23 +264,19 @@ namespace Artemis.ViewModels
|
||||
if (_selectedProfile == null)
|
||||
return;
|
||||
|
||||
var layer = new LayerModel
|
||||
{
|
||||
Name = "Layer " + (_selectedProfile.Layers.Count + 1),
|
||||
LayerType = LayerType.KeyboardRectangle,
|
||||
UserProps = new LayerPropertiesModel
|
||||
{
|
||||
Brush = new SolidColorBrush(Colors.Red),
|
||||
Animation = LayerAnimation.None,
|
||||
Height = 1,
|
||||
Width = 1,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Opacity = 1
|
||||
}
|
||||
};
|
||||
SelectedProfile.Layers.Add(layer);
|
||||
var layer = SelectedProfile.AddLayer();
|
||||
Layers.Add(layer);
|
||||
|
||||
SelectedLayer = layer;
|
||||
}
|
||||
|
||||
public void RemoveLayer()
|
||||
{
|
||||
if (_selectedProfile == null || _selectedLayer == null)
|
||||
return;
|
||||
|
||||
SelectedProfile.Layers.Remove(_selectedLayer);
|
||||
Layers.Remove(_selectedLayer);
|
||||
}
|
||||
|
||||
public void MouseDownKeyboardPreview(MouseButtonEventArgs e)
|
||||
@ -294,17 +288,17 @@ namespace Artemis.ViewModels
|
||||
public void MouseUpKeyboardPreview(MouseButtonEventArgs e)
|
||||
{
|
||||
var timeSinceDown = DateTime.Now - _downTime;
|
||||
if (timeSinceDown.TotalMilliseconds < 500)
|
||||
{
|
||||
var pos = e.GetPosition((Image) e.OriginalSource);
|
||||
var x = pos.X/((double) ActiveKeyboard.PreviewSettings.Width/ActiveKeyboard.Width);
|
||||
var y = pos.Y/((double) ActiveKeyboard.PreviewSettings.Height/ActiveKeyboard.Height);
|
||||
if (!(timeSinceDown.TotalMilliseconds < 500))
|
||||
return;
|
||||
|
||||
var hoverLayer = SelectedProfile.Layers.Where(l => l.Enabled)
|
||||
.FirstOrDefault(l => l.UserProps.GetRect(1).Contains(x, y));
|
||||
if (hoverLayer != null)
|
||||
SelectedLayer = hoverLayer;
|
||||
}
|
||||
var pos = e.GetPosition((Image) e.OriginalSource);
|
||||
var x = pos.X/((double) ActiveKeyboard.PreviewSettings.Width/ActiveKeyboard.Width);
|
||||
var y = pos.Y/((double) ActiveKeyboard.PreviewSettings.Height/ActiveKeyboard.Height);
|
||||
|
||||
var hoverLayer = SelectedProfile.Layers.Where(l => l.Enabled)
|
||||
.FirstOrDefault(l => l.UserProps.GetRect(1).Contains(x, y));
|
||||
if (hoverLayer != null)
|
||||
SelectedLayer = hoverLayer;
|
||||
}
|
||||
|
||||
public void MouseMoveKeyboardPreview(MouseEventArgs e)
|
||||
@ -327,11 +321,11 @@ namespace Artemis.ViewModels
|
||||
// Turn the mouse pointer into a hand if hovering over an active layer
|
||||
if (hoverLayer == SelectedLayer)
|
||||
{
|
||||
var layerRect = hoverLayer.UserProps.GetRect(1);
|
||||
if (Math.Sqrt(Math.Pow(x - layerRect.BottomRight.X, 2) + Math.Pow(y - layerRect.BottomRight.Y, 2)) < 0.6)
|
||||
KeyboardPreviewCursor = Cursors.SizeNWSE;
|
||||
else
|
||||
KeyboardPreviewCursor = Cursors.SizeAll;
|
||||
var rect = hoverLayer.UserProps.GetRect(1);
|
||||
KeyboardPreviewCursor =
|
||||
Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6
|
||||
? Cursors.SizeNWSE
|
||||
: Cursors.SizeAll;
|
||||
}
|
||||
else
|
||||
KeyboardPreviewCursor = Cursors.Hand;
|
||||
@ -358,16 +352,16 @@ namespace Artemis.ViewModels
|
||||
_draggingLayerOffset = new Point(x - SelectedLayer.UserProps.X, y - SelectedLayer.UserProps.Y);
|
||||
_draggingLayer = hoverLayer;
|
||||
if (Math.Sqrt(Math.Pow(x - layerRect.BottomRight.X, 2) + Math.Pow(y - layerRect.BottomRight.Y, 2)) < 0.6)
|
||||
_resizeSourceRect = true;
|
||||
_resizing = true;
|
||||
else
|
||||
_resizeSourceRect = false;
|
||||
_resizing = false;
|
||||
}
|
||||
|
||||
if (_draggingLayerOffset == null || _draggingLayer == null || (_draggingLayer != SelectedLayer))
|
||||
return;
|
||||
|
||||
// If no setup or reset was done, handle the actual dragging action
|
||||
if (_resizeSourceRect)
|
||||
if (_resizing)
|
||||
{
|
||||
_draggingLayer.UserProps.Width = (int) Math.Round(x - _draggingLayer.UserProps.X);
|
||||
_draggingLayer.UserProps.Height = (int) Math.Round(y - _draggingLayer.UserProps.Y);
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
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:local="clr-namespace:Artemis.Views"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
|
||||
@ -28,13 +26,10 @@
|
||||
<Border>
|
||||
<Border.Effect>
|
||||
<!-- TODO: Pulse 10-20 -->
|
||||
<DropShadowEffect ShadowDepth="0"
|
||||
Color="{DynamicResource HighlightColor}"
|
||||
Opacity="1"
|
||||
<DropShadowEffect ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1"
|
||||
BlurRadius="20" />
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
|
||||
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=KeyboardImage}" Margin="50" />
|
||||
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=KeyboardPreview}" Opacity="0.8"
|
||||
Width="{Binding Path=PreviewSettings.Width}"
|
||||
@ -44,26 +39,23 @@
|
||||
cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
|
||||
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
|
||||
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]" />
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
<!-- Profile management -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0">
|
||||
<Label Content="Active profile" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Width="110" VerticalAlignment="Top" x:Name="ProfileModels"
|
||||
DisplayMemberPath="Name" Margin="5,0,0,0" />
|
||||
<ComboBox Width="110" VerticalAlignment="Top" x:Name="Profiles" DisplayMemberPath="Name"
|
||||
Margin="5,0,0,0" />
|
||||
<Button x:Name="AddProfile" Content="Add profile" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0" />
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left" Margin="10,0,0,0" />
|
||||
<Button x:Name="RemoveProfile" Content="Remove profile" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Right"
|
||||
Margin="10,0,0,0" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Layer list -->
|
||||
<Label Grid.Column="1" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Layers"
|
||||
Margin="10,0,0,0" />
|
||||
<Label Grid.Column="1" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Layers" Margin="10,0,0,0" />
|
||||
<Border Grid.Column="1" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
|
||||
BorderThickness="3" Margin="10,0,0,0" Height="400" Width="250">
|
||||
<TreeView x:Name="ProfileTree" ItemsSource="{Binding Path=Layers}">
|
||||
@ -95,10 +87,20 @@
|
||||
</TreeView>
|
||||
</Border>
|
||||
<Grid Grid.Column="1" Grid.Row="2" Margin="10,5,0,0">
|
||||
<Button x:Name="AddLayer" Content="Add layer" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left" />
|
||||
<Button x:Name="RemoveLayer" Content="Remove layer" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Right" />
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" x:Name="AddLayer" Content="Add layer" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" />
|
||||
<Button Grid.Column="1" x:Name="LayerUp" Content="^" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="26" Margin="2,0,0,0" />
|
||||
<Button Grid.Column="2" x:Name="LayerDown" Content="v" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="26" Margin="0,0,2,0" />
|
||||
<Button Grid.Column="3" x:Name="RemoveLayer" Content="Remove layer" VerticalAlignment="Top"
|
||||
Style="{DynamicResource SquareButtonStyle}" Width="95" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,22 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Antlr" version="3.5.0.2" targetFramework="net452" />
|
||||
<package id="Autofac" version="4.0.0-rc1-177" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.AutofacBootstrap" version="2.0.9-beta" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Colore" version="4.0.0" targetFramework="net452" />
|
||||
<package id="CUE.NET" version="1.0.2.2" targetFramework="net452" />
|
||||
<package id="ExpressionEvaluator" version="2.0.4.0" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.6" targetFramework="net452" />
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.5" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
||||
<package id="ImageLibrary" version="2.0.5" targetFramework="net452" />
|
||||
<package id="log4net" version="2.0.5" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.2.4.0" targetFramework="net452" />
|
||||
<package id="MahApps.Metro.Resources" version="0.4.0.0" targetFramework="net452" />
|
||||
<package id="MahApps.Metro.Resources" version="0.5.0.0" targetFramework="net452" />
|
||||
<package id="NAudio" version="1.7.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
|
||||
<package id="Screna" version="0.1.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
|
||||
<package id="SharpDX" version="3.0.2" targetFramework="net452" />
|
||||
<package id="SharpDX.Direct3D11" version="3.0.2" targetFramework="net452" />
|
||||
<package id="SharpDX.DXGI" version="3.0.2" targetFramework="net452" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user