Layer properties - Added back most of the reworked VMs and views

This commit is contained in:
SpoinkyNL committed 2020-05-18 23:56:43 +02:00
1 parent 2fd522bafb
commit 3d244ff028
21 files changed
+862 -146

No files matched your search

@@ -7,7 +7,6 @@ using Artemis.UI.Events;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput.Abstract;
namespace Artemis.UI.Services.Interfaces
{
@@ -16,6 +15,7 @@ namespace Artemis.UI.Services.Interfaces
Profile SelectedProfile { get; }
ProfileElement SelectedProfileElement { get; }
TimeSpan CurrentTime { get; set; }
int PixelsPerSecond { get; set; }
LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription);
void ChangeSelectedProfile(Profile profile);
@@ -53,6 +53,11 @@ namespace Artemis.UI.Services.Interfaces
/// </summary>
event EventHandler CurrentTimeChanged;
/// <summary>
/// Occurs when the pixels per second (zoom level) is changed
/// </summary>
event EventHandler PixelsPerSecondChanged;
/// <summary>
/// Occurs when the profile preview has been updated
/// </summary>
@@ -29,6 +29,7 @@ namespace Artemis.UI.Services
private readonly IKernel _kernel;
private TimeSpan _currentTime;
private TimeSpan _lastUpdateTime;
private int _pixelsPerSecond;
public ProfileEditorService(ICoreService coreService, IProfileService profileService, IKernel kernel)
{
@@ -46,6 +47,7 @@ namespace Artemis.UI.Services
{typeof(SKPoint), typeof(SKPointPropertyInputViewModel)},
{typeof(SKSize), typeof(SKSizePropertyInputViewModel)}
};
PixelsPerSecond = 31;
}
public Dictionary<Type, Type> RegisteredPropertyEditors { get; set; }
@@ -66,6 +68,17 @@ namespace Artemis.UI.Services
}
}
public int PixelsPerSecond
{
get => _pixelsPerSecond;
set
{
_pixelsPerSecond = value;
OnPixelsPerSecondChanged();
}
}
public LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription)
{
// Go through the pain of instantiating a generic type VM now via reflection to make things a lot simpler down the line
@@ -93,7 +106,7 @@ namespace Artemis.UI.Services
{
new ConstructorArgument("layerPropertyViewModel", layerPropertyViewModel)
};
return new TreePropertyViewModel<T>(layerPropertyViewModel, (PropertyInputViewModel<T>) _kernel.Get(type, parameters));
return new TreePropertyViewModel<T>(layerPropertyViewModel, (PropertyInputViewModel<T>) _kernel.Get(type, parameters), this);
}
public void ChangeSelectedProfile(Profile profile)
@@ -181,8 +194,9 @@ namespace Artemis.UI.Services
public event EventHandler<ProfileElementEventArgs> ProfileElementSelected;
public event EventHandler<ProfileElementEventArgs> SelectedProfileElementUpdated;
public event EventHandler CurrentTimeChanged;
public event EventHandler PixelsPerSecondChanged;
public event EventHandler ProfilePreviewUpdated;
public void StopRegularRender()
{
_coreService.ModuleUpdatingDisabled = true;
@@ -218,6 +232,11 @@ namespace Artemis.UI.Services
CurrentTimeChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnPixelsPerSecondChanged()
{
PixelsPerSecondChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnProfilePreviewUpdated()
{
ProfilePreviewUpdated?.Invoke(this, EventArgs.Empty);