mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Added basic layer copy/paste
This commit is contained in:
1 parent
253c2f069b
commit
f694f39219
9 files changed
+87
-12
No files matched your search
@@ -36,6 +36,8 @@
|
||||
<TreeView.InputBindings>
|
||||
<KeyBinding Key="F2" Command="{s:Action RenameElement}" s:View.ActionTarget="{Binding SelectedTreeItem}"/>
|
||||
<KeyBinding Key="Delete" Command="{s:Action DeleteElement}" s:View.ActionTarget="{Binding SelectedTreeItem}"/>
|
||||
<KeyBinding Key="C" Modifiers="Control" Command="{s:Action CopyElement}" s:View.ActionTarget="{Binding SelectedTreeItem}"/>
|
||||
<KeyBinding Key="V" Modifiers="Control" Command="{s:Action PasteElement}" s:View.ActionTarget="{Binding SelectedTreeItem}"/>
|
||||
</TreeView.InputBindings>
|
||||
<b:Interaction.Behaviors>
|
||||
<behaviors:TreeViewSelectionBehavior ExpandSelected="True" SelectedItem="{Binding SelectedTreeItem}" />
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<materialDesign:PackIcon Kind="RenameBox" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Copy" Command="{s:Action CopyElement}">
|
||||
<MenuItem Header="Duplicate" Command="{s:Action DuplicateElement}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="ContentCopy" />
|
||||
</MenuItem.Icon>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
_profileEditorService = profileEditorService;
|
||||
}
|
||||
|
||||
public void CopyElement()
|
||||
public void DuplicateElement()
|
||||
{
|
||||
Layer layer = Layer.CreateCopy();
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@ using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.ProfileEditor.Dialogs;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Utilities;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
@@ -185,6 +187,29 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
_profileEditorService.ChangeSelectedProfileElement(null);
|
||||
}
|
||||
|
||||
public void CopyElement()
|
||||
{
|
||||
if (ProfileElement is Layer layer)
|
||||
JsonClipboard.SetObject(layer.LayerEntity);
|
||||
else if (ProfileElement is Folder folder)
|
||||
JsonClipboard.SetObject(folder.FolderEntity);
|
||||
}
|
||||
|
||||
public void PasteElement()
|
||||
{
|
||||
object? clipboardObject = JsonClipboard.GetData();
|
||||
if (clipboardObject is LayerEntity layerEntity)
|
||||
{
|
||||
layerEntity.Id = Guid.NewGuid();
|
||||
layerEntity.Name += " - copy";
|
||||
Layer pasted = new Layer(ProfileElement.Profile, ProfileElement.Parent, layerEntity);
|
||||
ProfileElement.Parent.AddChild(pasted, ProfileElement.Order - 1);
|
||||
}
|
||||
else if (clipboardObject is FolderEntity folderEntity)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateProfileElements()
|
||||
{
|
||||
// Remove VMs that are no longer a child
|
||||
|
||||
Reference in new issue
Block a user