mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Profile editor - Finished most of the refactor except databindings
This commit is contained in:
1 parent
5b321b25c9
commit
d49b574bda
56 files changed
+866
-459
No files matched your search
+19
-12
@@ -1,8 +1,10 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Properties;
|
||||
using Artemis.UI.Shared.Services;
|
||||
|
||||
@@ -10,10 +12,14 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
public class SelectionToolViewModel : VisualizationToolViewModel
|
||||
{
|
||||
private readonly ILayerBrushService _layerBrushService;
|
||||
private Rect _dragRectangle;
|
||||
|
||||
public SelectionToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
||||
public SelectionToolViewModel(ProfileViewModel profileViewModel,
|
||||
IProfileEditorService profileEditorService,
|
||||
ILayerBrushService layerBrushService) : base(profileViewModel, profileEditorService)
|
||||
{
|
||||
_layerBrushService = layerBrushService;
|
||||
using (var stream = new MemoryStream(Resources.aero_crosshair))
|
||||
{
|
||||
Cursor = new Cursor(stream);
|
||||
@@ -52,20 +58,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
|
||||
}
|
||||
// If no layer selected, apply it to a new layer in the selected folder
|
||||
else if (ProfileEditorService.SelectedProfileElement is Folder folder)
|
||||
{
|
||||
var newLayer = new Layer(folder, "New layer");
|
||||
newLayer.AddLeds(selectedLeds);
|
||||
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
CreateLayer(folder, selectedLeds);
|
||||
// If no folder selected, apply it to a new layer in the root folder
|
||||
else
|
||||
{
|
||||
var rootFolder = ProfileEditorService.SelectedProfile.GetRootFolder();
|
||||
var newLayer = new Layer(rootFolder, "New layer");
|
||||
newLayer.AddLeds(selectedLeds);
|
||||
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
CreateLayer(rootFolder, selectedLeds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,5 +87,14 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
|
||||
|
||||
DragRectangle = selectedRect;
|
||||
}
|
||||
|
||||
private void CreateLayer(Folder folder, List<ArtemisLed> selectedLeds)
|
||||
{
|
||||
var newLayer = new Layer(folder, "New layer");
|
||||
newLayer.ChangeLayerBrush(_layerBrushService.GetDefaultLayerBrush());
|
||||
newLayer.AddLeds(selectedLeds);
|
||||
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user