diff --git a/src/Artemis.UI/App.xaml b/src/Artemis.UI/App.xaml
index 5b27fb1c2..062eb31e9 100644
--- a/src/Artemis.UI/App.xaml
+++ b/src/Artemis.UI/App.xaml
@@ -29,11 +29,6 @@
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Teal.xaml" />
-
-
-
-
-
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index b97b8fa26..f4e825062 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -147,9 +147,6 @@
-
-
-
@@ -157,7 +154,7 @@
-
+
@@ -172,19 +169,6 @@
Code
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
@@ -201,7 +185,7 @@
Designer
MSBuild:Compile
-
+
MSBuild:Compile
Designer
@@ -213,10 +197,6 @@
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
@@ -260,8 +240,7 @@
-
-
+
diff --git a/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs
deleted file mode 100644
index d875e61c8..000000000
--- a/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-using RGB.NET.Core;
-
-namespace Artemis.UI.Controls.Visualizers
-{
- ///
- ///
- /// Visualizes a in an wpf-application.
- ///
- public class LedVisualizer : Control
- {
- public void Select()
- {
- BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
- }
-
- public void Deselect()
- {
- BorderBrush = new SolidColorBrush(Colors.Black);
- }
-
- #region DependencyProperties
-
- // ReSharper disable InconsistentNaming
-
- ///
- /// Backing-property for the -property.
- ///
- public static readonly DependencyProperty LedProperty = DependencyProperty.Register(
- "Led", typeof(Led), typeof(LedVisualizer), new PropertyMetadata(default(Led)));
-
- ///
- /// Gets or sets the to visualize.
- ///
- public Led Led
- {
- get => (Led) GetValue(LedProperty);
- set => SetValue(LedProperty, value);
- }
-
- // ReSharper restore InconsistentNaming
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs
deleted file mode 100644
index 111d59a76..000000000
--- a/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using RGB.NET.Core;
-
-namespace Artemis.UI.Controls.Visualizers
-{
- ///
- ///
- /// Visualizes a in an wpf-application.
- ///
- [TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
- public class RGBDeviceVisualizer : Control
- {
- #region Constants
-
- private const string PART_CANVAS = "PART_Canvas";
-
- #endregion
-
- #region Properties & Fields
-
- public Canvas Canvas { get; private set; }
-
- #endregion
-
- #region DependencyProperties
-
- // ReSharper disable InconsistentNaming
-
- ///
- /// Backing-property for the -property.
- ///
- public static readonly DependencyProperty DeviceProperty = DependencyProperty.Register(
- "Device", typeof(IRGBDevice), typeof(RGBDeviceVisualizer), new PropertyMetadata(default(IRGBDevice), DeviceChanged));
-
- ///
- /// Gets or sets the to visualize.
- ///
- public IRGBDevice Device
- {
- get => (IRGBDevice) GetValue(DeviceProperty);
- set => SetValue(DeviceProperty, value);
- }
-
- // ReSharper restore InconsistentNaming
-
- #endregion
-
- #region Methods
-
- ///
- public override void OnApplyTemplate()
- {
- Canvas = (Canvas) GetTemplateChild(PART_CANVAS);
-
- LayoutLeds();
- }
-
- private static void DeviceChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
- {
- ((RGBDeviceVisualizer) dependencyObject).LayoutLeds();
- }
-
- private void LayoutLeds()
- {
- if (Canvas == null) return;
-
- Canvas.Children.Clear();
-
- if (Device == null) return;
-
- foreach (var led in Device)
- Canvas.Children.Add(new LedVisualizer {Led = led});
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs
deleted file mode 100644
index d05fd77c1..000000000
--- a/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using Artemis.UI.Adorners;
-using RGB.NET.Core;
-using RGB.NET.Groups;
-using Point = System.Windows.Point;
-
-namespace Artemis.UI.Controls.Visualizers
-{
- ///
- ///
- /// Visualizes the in an wpf-application.
- ///
- [TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
- public class RGBSurfaceVisualizer : Control
- {
- #region Constants
-
- private const string PART_CANVAS = "PART_Canvas";
-
- #endregion
-
- #region Properties & Fields
-
- private RGBSurface _surface;
- private Canvas _canvas;
- private BoundingBoxAdorner _boundingBox;
- private Point _startingPoint;
-
- //TODO DarthAffe 17.06.2017: This is ugly - redesign how device connect/disconnect is generally handled!
- private readonly List _newDevices = new List();
-
- #endregion
-
- #region Constructors
-
- ///
- ///
- /// Initializes a new instance of the class.
- ///
- public RGBSurfaceVisualizer()
- {
- Loaded += OnLoaded;
- Unloaded += OnUnloaded;
- }
-
- private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
- {
- _surface = RGBSurface.Instance;
-
- _surface.SurfaceLayoutChanged += RGBSurfaceOnSurfaceLayoutChanged;
- foreach (var device in _surface.Devices)
- _newDevices.Add(device);
-
- UpdateSurface();
- }
-
- private void OnUnloaded(object sender, RoutedEventArgs routedEventArgs)
- {
- _surface.SurfaceLayoutChanged -= RGBSurfaceOnSurfaceLayoutChanged;
- _canvas?.Children.Clear();
- _newDevices.Clear();
- }
-
- private void RGBSurfaceOnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs args)
- {
- if (args.DeviceAdded)
- foreach (var device in args.Devices)
- _newDevices.Add(device);
-
- UpdateSurface();
- }
-
- #endregion
-
- #region Methods
-
- ///
- public override void OnApplyTemplate()
- {
- // Detach any existing event handlers
- if (_canvas != null)
- {
- _canvas.MouseLeftButtonDown -= ScrollViewerOnMouseLeftButtonDown;
- _canvas.MouseLeftButtonUp -= ScrollViewerOnMouseLeftButtonUp;
- }
-
- _canvas?.Children.Clear();
- _canvas = (Canvas) GetTemplateChild(PART_CANVAS);
-
- UpdateSurface();
-
- if (_canvas == null) return;
- _canvas.MouseLeftButtonDown += ScrollViewerOnMouseLeftButtonDown;
- _canvas.MouseLeftButtonUp += ScrollViewerOnMouseLeftButtonUp;
- _canvas.MouseMove += ScrollViewerOnMouseMove;
- }
-
-
- private void ScrollViewerOnMouseLeftButtonDown(object sender, MouseButtonEventArgs mouseButtonEventArgs)
- {
- _canvas.CaptureMouse();
- _startingPoint = mouseButtonEventArgs.GetPosition(_canvas);
- _boundingBox = new BoundingBoxAdorner(_canvas, Colors.RoyalBlue);
-
- var adornerLayer = AdornerLayer.GetAdornerLayer(_canvas);
- adornerLayer.Add(_boundingBox);
- }
-
- private void ScrollViewerOnMouseLeftButtonUp(object sender, MouseButtonEventArgs mouseButtonEventArgs)
- {
- _canvas.ReleaseMouseCapture();
- var adornerLayer = AdornerLayer.GetAdornerLayer(_canvas);
- var adorners = adornerLayer.GetAdorners(_canvas);
- if (adorners == null) return;
- foreach (var adorner in adorners)
- adornerLayer.Remove(adorner);
-
- _boundingBox = null;
- }
-
- private void ScrollViewerOnMouseMove(object sender, MouseEventArgs mouseEventArgs)
- {
- if (_boundingBox == null) return;
- var currentPoint = mouseEventArgs.GetPosition(_canvas);
- _boundingBox.Update(_startingPoint, currentPoint);
-
- var ledStart = new RGB.NET.Core.Point(_startingPoint.X, _startingPoint.Y);
- var ledEnd = new RGB.NET.Core.Point(currentPoint.X, currentPoint.Y);
- var selection = new RectangleLedGroup(ledStart, ledEnd, 0.1);
-
- // Deselect all LED of each device
- var deviceLeds = new List();
- foreach (var rgbDeviceVisualizer in _canvas.Children.Cast())
- deviceLeds.AddRange(rgbDeviceVisualizer.Canvas.Children.Cast());
-
- foreach (var ledVisualizer in deviceLeds)
- ledVisualizer?.Deselect();
-
- // Select all LEDs in the bounding box
- foreach (var led in selection.GetLeds())
- {
- var ledVisualizer = deviceLeds.FirstOrDefault(l => l.Led == led);
- ledVisualizer?.Select();
- }
- }
-
- private void UpdateSurface()
- {
- if (_canvas == null || _surface == null) return;
-
- if (_newDevices.Count > 0)
- {
- foreach (var device in _newDevices)
- _canvas.Children.Add(new RGBDeviceVisualizer {Device = device});
- _newDevices.Clear();
- }
-
- _canvas.Width = _surface.SurfaceRectangle.Size.Width;
- _canvas.Height = _surface.SurfaceRectangle.Size.Height;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Properties/Resources.Designer.cs b/src/Artemis.UI/Properties/Resources.Designer.cs
index 7f76887ff..30752e0a5 100644
--- a/src/Artemis.UI/Properties/Resources.Designer.cs
+++ b/src/Artemis.UI/Properties/Resources.Designer.cs
@@ -79,5 +79,15 @@ namespace Artemis.UI.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap tile {
+ get {
+ object obj = ResourceManager.GetObject("tile", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
}
}
diff --git a/src/Artemis.UI/Properties/Resources.resx b/src/Artemis.UI/Properties/Resources.resx
index 3024e066c..eac736e2b 100644
--- a/src/Artemis.UI/Properties/Resources.resx
+++ b/src/Artemis.UI/Properties/Resources.resx
@@ -124,4 +124,7 @@
..\Resources\logo-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\tile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Resources/tile.png b/src/Artemis.UI/Resources/tile.png
new file mode 100644
index 000000000..b793d7906
Binary files /dev/null and b/src/Artemis.UI/Resources/tile.png differ
diff --git a/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml
deleted file mode 100644
index 9bfb6bd80..000000000
--- a/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml
deleted file mode 100644
index a96f8cbc5..000000000
--- a/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml
deleted file mode 100644
index d590a1bad..000000000
--- a/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs b/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs
deleted file mode 100644
index b2ec110a5..000000000
--- a/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Linq;
-using Artemis.Core.Events;
-using Artemis.Core.Services.Interfaces;
-using Artemis.UI.ViewModels.Controls.RgbDevice;
-using RGB.NET.Core;
-using Stylet;
-
-namespace Artemis.UI.ViewModels.Controls.Editor
-{
- public class SurfaceEditorViewModel
- {
- private readonly IRgbService _rgbService;
-
- public SurfaceEditorViewModel(IRgbService rgbService)
- {
- Devices = new ObservableCollection();
-
- _rgbService = rgbService;
- _rgbService.DeviceLoaded += RgbServiceOnDeviceLoaded;
- _rgbService.Surface.Updated += SurfaceOnUpdated;
-
- foreach (var surfaceDevice in _rgbService.Surface.Devices)
- Devices.Add(new RgbDeviceViewModel(surfaceDevice));
- }
-
-
- public ObservableCollection Devices { get; set; }
-
- private void RgbServiceOnDeviceLoaded(object sender, DeviceEventArgs e)
- {
- Execute.OnUIThread(() =>
- {
- if (Devices.All(d => d.Device != e.Device))
- Devices.Add(new RgbDeviceViewModel(e.Device));
- });
- }
-
- private void SurfaceOnUpdated(UpdatedEventArgs args)
- {
- foreach (var rgbDeviceViewModel in Devices)
- {
- rgbDeviceViewModel.Update();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs
index e7f6a35bd..251e0c5e0 100644
--- a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs
@@ -1,9 +1,13 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Input;
using RGB.NET.Core;
+using Stylet;
namespace Artemis.UI.ViewModels.Controls.RgbDevice
{
- public class RgbDeviceViewModel
+ public class RgbDeviceViewModel : PropertyChangedBase
{
private readonly List _leds;
@@ -16,6 +20,9 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
_leds.Add(new RgbLedViewModel(led));
}
+ public Cursor Cursor { get; set; }
+ public SelectionStatus SelectionStatus { get; set; }
+
public IRGBDevice Device { get; }
public IReadOnlyCollection Leds => _leds.AsReadOnly();
@@ -24,5 +31,20 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
foreach (var rgbLedViewModel in _leds)
rgbLedViewModel.Update();
}
+
+ public void SetColorsEnabled(bool enabled)
+ {
+ foreach (var rgbLedViewModel in _leds)
+ rgbLedViewModel.ColorsEnabled = enabled;
+ }
+
+ public Rect DeviceRectangle => new Rect(Device.Location.X, Device.Location.Y, Device.Size.Width, Device.Size.Height);
+ }
+
+ public enum SelectionStatus
+ {
+ None,
+ Hover,
+ Selected
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs
index d4d937b95..2dc94e738 100644
--- a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows;
+using System.Windows.Input;
using System.Windows.Media;
using Artemis.UI.Extensions;
using PropertyChanged;
@@ -14,7 +15,7 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
public RgbLedViewModel(Led led)
{
Led = led;
-
+
Execute.OnUIThread(CreateLedGeometry);
Update();
}
@@ -30,6 +31,7 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
public Geometry DisplayGeometry { get; private set; }
public Geometry StrokeGeometry { get; private set; }
public Color DisplayColor { get; private set; }
+ public bool ColorsEnabled { get; set; } = true;
public string Tooltip => $"{Led.Id} - {Led.LedRectangle}";
@@ -93,8 +95,11 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
public void Update()
{
- var newColor = Led.Color.ToMediaColor();
- SetColor(newColor);
+ if (ColorsEnabled)
+ {
+ var newColor = Led.Color.ToMediaColor();
+ SetColor(newColor);
+ }
if (Math.Abs(Led.LedRectangle.X - X) > 0.1)
X = Led.LedRectangle.X;
diff --git a/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs b/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs
index c96dd7b56..43313873d 100644
--- a/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs
@@ -1,6 +1,6 @@
namespace Artemis.UI.ViewModels.Interfaces
{
- public interface IEditorViewModel : IScreenViewModel
+ public interface ISurfaceEditorViewModel : IScreenViewModel
{
}
diff --git a/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs b/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs
deleted file mode 100644
index 6279828a4..000000000
--- a/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Artemis.Core.Services.Interfaces;
-using Artemis.UI.ViewModels.Controls.Editor;
-using Artemis.UI.ViewModels.Interfaces;
-using Stylet;
-
-namespace Artemis.UI.ViewModels.Screens
-{
- public class EditorViewModel : Screen, IEditorViewModel
- {
- public EditorViewModel(IRgbService rgbService)
- {
- SurfaceEditorViewModel = new SurfaceEditorViewModel(rgbService);
- }
-
- public SurfaceEditorViewModel SurfaceEditorViewModel { get; set; }
- public string Title => "Editor";
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs b/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
index 4a7e4b70c..88f1f6fb5 100644
--- a/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
@@ -102,8 +102,8 @@ namespace Artemis.UI.ViewModels.Screens
case "Workshop":
// ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(WorkshopViewModel)));
break;
- case "Editor":
- ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(EditorViewModel)));
+ case "SurfaceEditor":
+ ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(SurfaceEditorViewModel)));
break;
case "Settings":
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(SettingsViewModel)));
diff --git a/src/Artemis.UI/ViewModels/Screens/SurfaceEditorViewModel.cs b/src/Artemis.UI/ViewModels/Screens/SurfaceEditorViewModel.cs
new file mode 100644
index 000000000..7fc9440c8
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Screens/SurfaceEditorViewModel.cs
@@ -0,0 +1,126 @@
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Media;
+using Artemis.Core.Events;
+using Artemis.Core.Services.Interfaces;
+using Artemis.UI.ViewModels.Controls.RgbDevice;
+using Artemis.UI.ViewModels.Interfaces;
+using RGB.NET.Core;
+using Stylet;
+using Point = System.Windows.Point;
+
+namespace Artemis.UI.ViewModels.Screens
+{
+ public class SurfaceEditorViewModel : Screen, ISurfaceEditorViewModel
+ {
+ private readonly IRgbService _rgbService;
+
+
+ public SurfaceEditorViewModel(IRgbService rgbService)
+ {
+ Devices = new ObservableCollection();
+ SelectionRectangle = new RectangleGeometry();
+
+ _rgbService = rgbService;
+ _rgbService.DeviceLoaded += RgbServiceOnDeviceLoaded;
+ _rgbService.Surface.Updated += SurfaceOnUpdated;
+
+ foreach (var surfaceDevice in _rgbService.Surface.Devices)
+ {
+ var device = new RgbDeviceViewModel(surfaceDevice) {Cursor = Cursors.Hand};
+ device.SetColorsEnabled(false);
+
+ Devices.Add(device);
+ }
+ }
+
+ public RectangleGeometry SelectionRectangle { get; set; }
+ public ObservableCollection Devices { get; set; }
+
+ public string Title => "Surface Editor";
+
+ private void RgbServiceOnDeviceLoaded(object sender, DeviceEventArgs e)
+ {
+ Execute.OnUIThread(() =>
+ {
+ if (Devices.All(d => d.Device != e.Device))
+ {
+ var device = new RgbDeviceViewModel(e.Device) {Cursor = Cursors.Hand};
+ device.SetColorsEnabled(false);
+ Devices.Add(device);
+ }
+ });
+ }
+
+ private void SurfaceOnUpdated(UpdatedEventArgs args)
+ {
+ foreach (var rgbDeviceViewModel in Devices)
+ rgbDeviceViewModel.Update();
+ }
+
+ #region Selection
+
+ private bool _editorSelecting;
+ private Point _selectionStartPoint;
+
+ private void StartSelection(Point position)
+ {
+ _selectionStartPoint = position;
+ _editorSelecting = true;
+
+ SelectionRectangle.Rect = new Rect();
+ Mouse.OverrideCursor = Cursors.Arrow;
+ }
+
+ private void StopSelection(Point position)
+ {
+ _editorSelecting = false;
+ Mouse.OverrideCursor = null;
+
+ var selectedRect = new Rect(_selectionStartPoint, position);
+ foreach (var device in Devices)
+ {
+ if (device.DeviceRectangle.IntersectsWith(selectedRect))
+ device.SelectionStatus = SelectionStatus.Selected;
+ else
+ device.SelectionStatus = SelectionStatus.None;
+ }
+ }
+
+ private void UpdateSelection(Point position)
+ {
+ var selectedRect = new Rect(_selectionStartPoint, position);
+ SelectionRectangle.Rect = selectedRect;
+
+ foreach (var device in Devices)
+ {
+ if (device.DeviceRectangle.IntersectsWith(selectedRect))
+ device.SelectionStatus = SelectionStatus.Selected;
+ else
+ device.SelectionStatus = SelectionStatus.None;
+ }
+ }
+
+ public void EditorGridMouseClick(object sender, MouseEventArgs e)
+ {
+ var position = e.GetPosition((IInputElement) sender);
+ if (e.LeftButton == MouseButtonState.Pressed)
+ StartSelection(position);
+ else
+ StopSelection(position);
+ }
+
+ public void EditorGridMouseMove(object sender, MouseEventArgs e)
+ {
+ if (!_editorSelecting)
+ return;
+
+ var position = e.GetPosition((IInputElement) sender);
+ UpdateSelection(position);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml b/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml
deleted file mode 100644
index 070e831ae..000000000
--- a/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- Surface editor view
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml b/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml
index a2377915c..5c98fa8ef 100644
--- a/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml
+++ b/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml
@@ -7,9 +7,11 @@
xmlns:xaml="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance rgbDevice:RgbDeviceViewModel}"
- d:DesignHeight="450" d:DesignWidth="800">
+ d:DesignHeight="450" d:DesignWidth="800"
+ Cursor="{Binding Cursor}">
+
-
+
@@ -24,9 +26,50 @@
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml b/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml
index 25aa13f82..e1b3cb6c1 100644
--- a/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml
+++ b/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml
@@ -6,18 +6,20 @@
xmlns:rgbDevice="clr-namespace:Artemis.UI.ViewModels.Controls.RgbDevice"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance rgbDevice:RgbLedViewModel}"
- d:DesignHeight="450" d:DesignWidth="800">
+ d:DesignHeight="25" d:DesignWidth="25"
+ ToolTip="{Binding Tooltip}"
+ ToolTipService.IsEnabled="{Binding ColorsEnabled}">
-
+
-
+
diff --git a/src/Artemis.UI/Views/Screens/EditorView.xaml b/src/Artemis.UI/Views/Screens/EditorView.xaml
deleted file mode 100644
index 929b215b4..000000000
--- a/src/Artemis.UI/Views/Screens/EditorView.xaml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
- In the editor you can either edit your surface layout or edit a profile.
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Screens/RootView.xaml b/src/Artemis.UI/Views/Screens/RootView.xaml
index c78ba1e17..34f6973c6 100644
--- a/src/Artemis.UI/Views/Screens/RootView.xaml
+++ b/src/Artemis.UI/Views/Screens/RootView.xaml
@@ -104,11 +104,11 @@
Workshop
-
+
- Editor
+ Surface Editor
diff --git a/src/Artemis.UI/Views/Screens/SurfaceEditorView.xaml b/src/Artemis.UI/Views/Screens/SurfaceEditorView.xaml
new file mode 100644
index 000000000..11dd5da70
--- /dev/null
+++ b/src/Artemis.UI/Views/Screens/SurfaceEditorView.xaml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The surface is a digital representation of your LED setup. Set this up accurately and effects will seamlessly move from one device to the other.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file