mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profiles - Save folder open/closed state
Profiles editor - Save last selected element and reselect it Profile editor - Save pan/zoom position Profile editor - Added option to resume normal playback on focus loss
This commit is contained in:
1 parent
ab754942d5
commit
8728599dcc
24 files changed
+415
-191
No files matched your search
@@ -27,12 +27,12 @@ namespace Artemis.UI.Shared
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum value
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MinProperty = DependencyProperty.Register(nameof(Min), typeof(float?), typeof(DraggableFloat));
|
||||
public static readonly DependencyProperty MinProperty = DependencyProperty.Register(nameof(Min), typeof(object), typeof(DraggableFloat));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MaxProperty = DependencyProperty.Register(nameof(Max), typeof(float?), typeof(DraggableFloat));
|
||||
public static readonly DependencyProperty MaxProperty = DependencyProperty.Register(nameof(Max), typeof(object), typeof(DraggableFloat));
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the value has changed
|
||||
@@ -90,18 +90,18 @@ namespace Artemis.UI.Shared
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum value
|
||||
/// </summary>
|
||||
public float? Min
|
||||
public object? Min
|
||||
{
|
||||
get => (float?) GetValue(MinProperty);
|
||||
get => (object?) GetValue(MinProperty);
|
||||
set => SetValue(MinProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value
|
||||
/// </summary>
|
||||
public float? Max
|
||||
public object? Max
|
||||
{
|
||||
get => (float?) GetValue(MaxProperty);
|
||||
get => (object?) GetValue(MaxProperty);
|
||||
set => SetValue(MaxProperty, value);
|
||||
}
|
||||
|
||||
@@ -207,10 +207,11 @@ namespace Artemis.UI.Shared
|
||||
stepSize = stepSize * 10;
|
||||
|
||||
float value = (float) RoundToNearestOf(startValue + stepSize * (x - startX), stepSize);
|
||||
if (Min != null)
|
||||
value = Math.Max(value, Min.Value);
|
||||
if (Max != null)
|
||||
value = Math.Min(value, Max.Value);
|
||||
|
||||
if (Min != null && float.TryParse(Min.ToString(), out float minFloat))
|
||||
value = Math.Max(value, minFloat);
|
||||
if (Max != null && float.TryParse(Max.ToString(), out float maxFloat))
|
||||
value = Math.Min(value, maxFloat);
|
||||
|
||||
Value = value;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,17 @@ namespace Artemis.UI.Shared.Services
|
||||
/// </summary>
|
||||
ProfileConfiguration? SelectedProfileConfiguration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the previous selected profile configuration
|
||||
/// </summary>
|
||||
ProfileConfiguration? PreviousSelectedProfileConfiguration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently selected profile
|
||||
/// <para><see langword="null" /> if the editor is closed, always equal to <see cref="SelectedProfileConfiguration" />.<see cref="Profile" /></para>
|
||||
/// <para>
|
||||
/// <see langword="null" /> if the editor is closed, always equal to <see cref="SelectedProfileConfiguration" />.
|
||||
/// <see cref="Profile" />
|
||||
/// </para>
|
||||
/// </summary>
|
||||
Profile? SelectedProfile { get; }
|
||||
|
||||
@@ -53,6 +61,11 @@ namespace Artemis.UI.Shared.Services
|
||||
/// </summary>
|
||||
bool Playing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether editing should be suspended
|
||||
/// </summary>
|
||||
bool SuspendEditing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Changes the selected profile by its <see cref="ProfileConfiguration" />
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.UI.Shared.Services.Models;
|
||||
@@ -30,6 +29,7 @@ namespace Artemis.UI.Shared.Services
|
||||
private TimeSpan _currentTime;
|
||||
private bool _doTick;
|
||||
private int _pixelsPerSecond;
|
||||
private bool _suspendEditing;
|
||||
|
||||
public ProfileEditorService(IKernel kernel, ILogger logger, IProfileService profileService, ICoreService coreService, IRgbService rgbService, IModuleService moduleService)
|
||||
{
|
||||
@@ -76,7 +76,7 @@ namespace Artemis.UI.Shared.Services
|
||||
|
||||
private void Tick()
|
||||
{
|
||||
if (SelectedProfile == null || _doTick)
|
||||
if (SelectedProfile == null || _doTick || SuspendEditing)
|
||||
return;
|
||||
|
||||
TickProfileElement(SelectedProfile.GetRootFolder());
|
||||
@@ -106,6 +106,27 @@ namespace Artemis.UI.Shared.Services
|
||||
public ReadOnlyCollection<PropertyInputRegistration> RegisteredPropertyEditors => _registeredPropertyEditors.AsReadOnly();
|
||||
|
||||
public bool Playing { get; set; }
|
||||
|
||||
public bool SuspendEditing
|
||||
{
|
||||
get => _suspendEditing;
|
||||
set
|
||||
{
|
||||
_suspendEditing = value;
|
||||
if (value)
|
||||
{
|
||||
Playing = false;
|
||||
_profileService.RenderForEditor = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SelectedProfileConfiguration != null)
|
||||
_profileService.RenderForEditor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ProfileConfiguration? PreviousSelectedProfileConfiguration { get; private set; }
|
||||
public ProfileConfiguration? SelectedProfileConfiguration { get; private set; }
|
||||
public Profile? SelectedProfile => SelectedProfileConfiguration?.Profile;
|
||||
public RenderProfileElement? SelectedProfileElement { get; private set; }
|
||||
@@ -152,13 +173,18 @@ namespace Artemis.UI.Shared.Services
|
||||
SelectedProfileConfiguration.IsBeingEdited = false;
|
||||
|
||||
// The new profile may need activation
|
||||
PreviousSelectedProfileConfiguration = SelectedProfileConfiguration;
|
||||
SelectedProfileConfiguration = profileConfiguration;
|
||||
;
|
||||
if (SelectedProfileConfiguration != null)
|
||||
{
|
||||
SelectedProfileConfiguration.IsBeingEdited = true;
|
||||
_moduleService.SetActivationOverride(SelectedProfileConfiguration.Module);
|
||||
_profileService.ActivateProfile(SelectedProfileConfiguration);
|
||||
_profileService.RenderForEditor = true;
|
||||
|
||||
if (SelectedProfileConfiguration.Profile?.LastSelectedProfileElement is RenderProfileElement renderProfileElement)
|
||||
ChangeSelectedProfileElement(renderProfileElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,6 +205,7 @@ namespace Artemis.UI.Shared.Services
|
||||
if (SelectedProfile == null)
|
||||
return;
|
||||
|
||||
SelectedProfile.LastSelectedProfileElement = SelectedProfileElement;
|
||||
_profileService.SaveProfile(SelectedProfile, true);
|
||||
OnSelectedProfileUpdated(new ProfileConfigurationEventArgs(SelectedProfileConfiguration));
|
||||
UpdateProfilePreview();
|
||||
|
||||
Reference in new issue
Block a user