UI - Removed Fody, begone arrogant devs!

This commit is contained in:
Robert committed 2020-06-30 14:39:12 +02:00
1 parent 3bc1da8ca6
commit 88a15abc8c
49 files changed
+1011 -232

No files matched your search

@@ -18,12 +18,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
EasingFunction = easingFunction;
Description = easingFunction.Humanize();
CreateEasingPoints();
EasingPoints = new PointCollection();
for (var i = 1; i <= 10; i++)
{
var x = i;
var y = Easings.Interpolate(i / 10.0, EasingFunction) * 10;
EasingPoints.Add(new Point(x, y));
}
}
public Easings.Functions EasingFunction { get; }
public PointCollection EasingPoints { get; set; }
public string Description { get; set; }
public PointCollection EasingPoints { get; }
public string Description { get; }
public bool IsEasingModeSelected
{
@@ -35,16 +41,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
_keyframeViewModel.SelectEasingMode(this);
}
}
private void CreateEasingPoints()
{
EasingPoints = new PointCollection();
for (var i = 1; i <= 10; i++)
{
var x = i;
var y = Easings.Interpolate(i / 10.0, EasingFunction) * 10;
EasingPoints.Add(new Point(x, y));
}
}
}
}
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Windows;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Utilities;
using Artemis.UI.Shared.Services.Interfaces;
@@ -47,7 +46,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public abstract class TimelineKeyframeViewModel : PropertyChangedBase
{
private readonly IProfileEditorService _profileEditorService;
private BindableCollection<TimelineEasingViewModel> _easingViewModels;
private bool _isSelected;
private int _pixelsPerSecond;
private string _timestamp;
private double _x;
protected TimelineKeyframeViewModel(IProfileEditorService profileEditorService, BaseLayerPropertyKeyframe baseLayerPropertyKeyframe)
{
@@ -57,13 +60,30 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
}
public BaseLayerPropertyKeyframe BaseLayerPropertyKeyframe { get; }
public BindableCollection<TimelineEasingViewModel> EasingViewModels { get; set; }
public bool IsSelected { get; set; }
public double X { get; set; }
public string Timestamp { get; set; }
public BindableCollection<TimelineEasingViewModel> EasingViewModels
{
get => _easingViewModels;
set => SetAndNotify(ref _easingViewModels, value);
}
public UIElement ParentView { get; set; }
public bool IsSelected
{
get => _isSelected;
set => SetAndNotify(ref _isSelected, value);
}
public double X
{
get => _x;
set => SetAndNotify(ref _x, value);
}
public string Timestamp
{
get => _timestamp;
set => SetAndNotify(ref _timestamp, value);
}
public void Update(int pixelsPerSecond)
{
@@ -8,6 +8,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{
public class TimelinePropertyGroupViewModel : PropertyChangedBase
{
private BindableCollection<double> _timelineKeyframeViewModels;
public TimelinePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
{
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
@@ -19,7 +21,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
}
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
public BindableCollection<double> TimelineKeyframeViewModels { get; set; }
public BindableCollection<double> TimelineKeyframeViewModels
{
get => _timelineKeyframeViewModels;
set => SetAndNotify(ref _timelineKeyframeViewModels, value);
}
public void UpdateKeyframes()
{
@@ -65,6 +65,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public abstract class TimelinePropertyViewModel : PropertyChangedBase, IDisposable
{
private BindableCollection<TimelineKeyframeViewModel> _timelineKeyframeViewModels;
protected TimelinePropertyViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
{
LayerPropertyBaseViewModel = layerPropertyBaseViewModel;
@@ -72,7 +74,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
}
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
public BindableCollection<TimelineKeyframeViewModel> TimelineKeyframeViewModels { get; set; }
public BindableCollection<TimelineKeyframeViewModel> TimelineKeyframeViewModels
{
get => _timelineKeyframeViewModels;
set => SetAndNotify(ref _timelineKeyframeViewModels, value);
}
public abstract void Dispose();
@@ -6,7 +6,6 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Shared.Utilities;
@@ -18,6 +17,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
private readonly IProfileEditorService _profileEditorService;
private RectangleGeometry _selectionRectangle;
private double _width;
public TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups,
IProfileEditorService profileEditorService)
@@ -32,8 +33,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; }
public double Width { get; set; }
public RectangleGeometry SelectionRectangle { get; set; }
public double Width
{
get => _width;
set => SetAndNotify(ref _width, value);
}
public RectangleGeometry SelectionRectangle
{
get => _selectionRectangle;
set => SetAndNotify(ref _selectionRectangle, value);
}
public void UpdateKeyframes()
{
@@ -60,7 +70,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
if (viewModel == null)
return;
((IInputElement)sender).CaptureMouse();
((IInputElement) sender).CaptureMouse();
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift) && !viewModel.IsSelected)
SelectKeyframe(viewModel, true, false);
else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
@@ -76,7 +86,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
_profileEditorService.UpdateSelectedProfileElement();
ReleaseSelectedKeyframes();
((IInputElement)sender).ReleaseMouseCapture();
((IInputElement) sender).ReleaseMouseCapture();
}
public void KeyframeMouseMove(object sender, MouseEventArgs e)
@@ -176,10 +186,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
if (e.LeftButton == MouseButtonState.Released)
return;
((IInputElement)sender).CaptureMouse();
((IInputElement) sender).CaptureMouse();
SelectionRectangle.Rect = new Rect();
_mouseDragStartPoint = e.GetPosition((IInputElement)sender);
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
_mouseDragging = true;
e.Handled = true;
}
@@ -190,25 +200,25 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
if (!_mouseDragging)
return;
var position = e.GetPosition((IInputElement)sender);
var position = e.GetPosition((IInputElement) sender);
var selectedRect = new Rect(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
var keyframeViewModels = GetAllKeyframeViewModels();
var selectedKeyframes = HitTestUtilities.GetHitViewModels<TimelineKeyframeViewModel>((Visual)sender, SelectionRectangle);
var selectedKeyframes = HitTestUtilities.GetHitViewModels<TimelineKeyframeViewModel>((Visual) sender, SelectionRectangle);
foreach (var keyframeViewModel in keyframeViewModels)
keyframeViewModel.IsSelected = selectedKeyframes.Contains(keyframeViewModel);
_mouseDragging = false;
e.Handled = true;
((IInputElement)sender).ReleaseMouseCapture();
((IInputElement) sender).ReleaseMouseCapture();
}
public void TimelineCanvasMouseMove(object sender, MouseEventArgs e)
{
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
{
var position = e.GetPosition((IInputElement)sender);
var position = e.GetPosition((IInputElement) sender);
var selectedRect = new Rect(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
e.Handled = true;
@@ -264,7 +274,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
viewModels.AddRange(layerPropertyGroupViewModel.GetAllChildren());
var keyframes = viewModels.Where(vm => vm is LayerPropertyViewModel)
.SelectMany(vm => ((LayerPropertyViewModel)vm).TimelinePropertyBaseViewModel.TimelineKeyframeViewModels)
.SelectMany(vm => ((LayerPropertyViewModel) vm).TimelinePropertyBaseViewModel.TimelineKeyframeViewModels)
.ToList();
return keyframes;