mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Profile editor - Started implementing property add/remove handling
This commit is contained in:
1 parent
f1a1c7d34c
commit
b3e1ba6d1c
11 files changed
+98
-24
No files matched your search
+11
-1
@@ -35,7 +35,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
public BaseLayerProperty LayerProperty { get; }
|
||||
|
||||
public LayerPropertyViewModel Parent { get; }
|
||||
public List<LayerPropertyViewModel> Children { get; set; }
|
||||
public List<LayerPropertyViewModel> Children { get; }
|
||||
|
||||
public bool IsExpanded { get; set; }
|
||||
|
||||
@@ -78,5 +78,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
match.Initialize(this);
|
||||
return match;
|
||||
}
|
||||
|
||||
public IEnumerable<LayerPropertyViewModel> GetAllChildren()
|
||||
{
|
||||
var children = new List<LayerPropertyViewModel>();
|
||||
children.AddRange(Children);
|
||||
foreach (var layerPropertyViewModel in children)
|
||||
children.AddRange(layerPropertyViewModel.GetAllChildren());
|
||||
|
||||
return children;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -4,13 +4,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
{
|
||||
public class PropertyTreeChildViewModel : PropertyTreeItemViewModel
|
||||
{
|
||||
public PropertyTreeChildViewModel(LayerPropertyViewModel layerPropertyViewModel)
|
||||
public PropertyTreeChildViewModel(LayerPropertyViewModel layerPropertyViewModel) : base(layerPropertyViewModel)
|
||||
{
|
||||
LayerPropertyViewModel = layerPropertyViewModel;
|
||||
PropertyInputViewModel = layerPropertyViewModel.GetPropertyInputViewModel();
|
||||
}
|
||||
|
||||
public LayerPropertyViewModel LayerPropertyViewModel { get; }
|
||||
public PropertyInputViewModel PropertyInputViewModel { get; set; }
|
||||
|
||||
public override void Update(bool forceUpdate)
|
||||
|
||||
+7
@@ -4,6 +4,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
{
|
||||
public abstract class PropertyTreeItemViewModel : PropertyChangedBase
|
||||
{
|
||||
public LayerPropertyViewModel LayerPropertyViewModel { get; }
|
||||
|
||||
protected PropertyTreeItemViewModel(LayerPropertyViewModel layerPropertyViewModel)
|
||||
{
|
||||
LayerPropertyViewModel = layerPropertyViewModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the tree item's input if it is visible and has keyframes enabled
|
||||
/// </summary>
|
||||
|
||||
+31
-3
@@ -1,13 +1,13 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core.Events;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
{
|
||||
public class PropertyTreeParentViewModel : PropertyTreeItemViewModel
|
||||
{
|
||||
public PropertyTreeParentViewModel(LayerPropertyViewModel layerPropertyViewModel)
|
||||
public PropertyTreeParentViewModel(LayerPropertyViewModel layerPropertyViewModel) : base(layerPropertyViewModel)
|
||||
{
|
||||
LayerPropertyViewModel = layerPropertyViewModel;
|
||||
Children = new BindableCollection<PropertyTreeItemViewModel>();
|
||||
|
||||
foreach (var childProperty in layerPropertyViewModel.Children)
|
||||
@@ -17,9 +17,37 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
else
|
||||
Children.Add(new PropertyTreeChildViewModel(childProperty));
|
||||
}
|
||||
|
||||
LayerPropertyViewModel.LayerProperty.Layer.LayerPropertyRegistered += LayerOnLayerPropertyRegistered;
|
||||
LayerPropertyViewModel.LayerProperty.Layer.LayerPropertyRemoved += LayerOnLayerPropertyRemoved;
|
||||
}
|
||||
|
||||
private void LayerOnLayerPropertyRegistered(object sender, LayerPropertyEventArgs e)
|
||||
{
|
||||
if (e.LayerProperty.Parent == LayerPropertyViewModel.LayerProperty)
|
||||
{
|
||||
// Problem is we don't have a LayerPropertyViewModel here..
|
||||
}
|
||||
}
|
||||
|
||||
private void LayerOnLayerPropertyRemoved(object sender, LayerPropertyEventArgs e)
|
||||
{
|
||||
// Remove self
|
||||
if (e.LayerProperty == LayerPropertyViewModel.LayerProperty)
|
||||
{
|
||||
LayerPropertyViewModel.LayerProperty.Layer.LayerPropertyRemoved -= LayerOnLayerPropertyRegistered;
|
||||
LayerPropertyViewModel.LayerProperty.Layer.LayerPropertyRemoved -= LayerOnLayerPropertyRemoved;
|
||||
}
|
||||
|
||||
// Remove child
|
||||
if (e.LayerProperty.Parent == LayerPropertyViewModel.LayerProperty)
|
||||
{
|
||||
var child = Children.FirstOrDefault(c => c.LayerPropertyViewModel.LayerProperty == e.LayerProperty);
|
||||
if (child != null)
|
||||
Children.Remove(child);
|
||||
}
|
||||
}
|
||||
|
||||
public LayerPropertyViewModel LayerPropertyViewModel { get; }
|
||||
public BindableCollection<PropertyTreeItemViewModel> Children { get; set; }
|
||||
|
||||
public override void Update(bool forceUpdate)
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Stylet;
|
||||
|
||||
@@ -43,6 +44,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
PropertyTreeItemViewModels.Clear();
|
||||
}
|
||||
|
||||
public void AddLayerProperty(BaseLayerProperty layerProperty)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the tree item's input if it is visible and has keyframes enabled
|
||||
/// </summary>
|
||||
|
||||
+6
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Stylet;
|
||||
@@ -60,6 +61,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
CreateViewModels(child);
|
||||
}
|
||||
|
||||
public void AddLayerProperty(BaseLayerProperty layerProperty)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ClearProperties()
|
||||
{
|
||||
PropertyTrackViewModels.Clear();
|
||||
|
||||
+2
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Stylet;
|
||||
|
||||
@@ -21,6 +22,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
UpdateKeyframes(PropertyTimelineViewModel.LayerPropertiesViewModel.PixelsPerSecond);
|
||||
}
|
||||
|
||||
|
||||
public PropertyTimelineViewModel PropertyTimelineViewModel { get; }
|
||||
public LayerPropertyViewModel LayerPropertyViewModel { get; }
|
||||
public BindableCollection<PropertyTrackKeyframeViewModel> KeyframeViewModels { get; set; }
|
||||
|
||||
Reference in new issue
Block a user