mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added undo/redo to profile editor
Added shape anchor point display and movement
This commit is contained in:
1 parent
e9677f2070
commit
c97b479779
25 files changed
+386
-68
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Surface;
|
||||
@@ -17,6 +18,8 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
PluginInfo = pluginInfo;
|
||||
Name = name;
|
||||
UndoStack = new Stack<string>();
|
||||
RedoStack = new Stack<string>();
|
||||
|
||||
AddChild(new Folder(this, null, "Root folder"));
|
||||
ApplyToEntity();
|
||||
@@ -28,14 +31,10 @@ namespace Artemis.Core.Models.Profile
|
||||
EntityId = profileEntity.Id;
|
||||
|
||||
PluginInfo = pluginInfo;
|
||||
Name = profileEntity.Name;
|
||||
UndoStack = new Stack<string>();
|
||||
RedoStack = new Stack<string>();
|
||||
|
||||
// Populate the profile starting at the root, the rest is populated recursively
|
||||
var rootFolder = profileEntity.Folders.FirstOrDefault(f => f.ParentId == new Guid());
|
||||
if (rootFolder == null)
|
||||
AddChild(new Folder(this, null, "Root folder"));
|
||||
else
|
||||
AddChild(new Folder(this, null, rootFolder));
|
||||
ApplyToProfile();
|
||||
}
|
||||
|
||||
public PluginInfo PluginInfo { get; }
|
||||
@@ -43,6 +42,9 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
internal ProfileEntity ProfileEntity { get; set; }
|
||||
|
||||
internal Stack<string> UndoStack { get; set; }
|
||||
internal Stack<string> RedoStack { get; set; }
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
lock (this)
|
||||
@@ -89,6 +91,22 @@ namespace Artemis.Core.Models.Profile
|
||||
ProfileEntity.Layers.AddRange(GetAllLayers().Select(f => f.LayerEntity));
|
||||
}
|
||||
|
||||
public void ApplyToProfile()
|
||||
{
|
||||
Name = ProfileEntity.Name;
|
||||
|
||||
lock (_children)
|
||||
{
|
||||
_children.Clear();
|
||||
// Populate the profile starting at the root, the rest is populated recursively
|
||||
var rootFolder = ProfileEntity.Folders.FirstOrDefault(f => f.ParentId == new Guid());
|
||||
if (rootFolder == null)
|
||||
AddChild(new Folder(this, null, "Root folder"));
|
||||
else
|
||||
AddChild(new Folder(this, null, rootFolder));
|
||||
}
|
||||
}
|
||||
|
||||
internal void Activate(ArtemisSurface surface)
|
||||
{
|
||||
lock (this)
|
||||
|
||||
Reference in new issue
Block a user