mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Rename folders and layers in a dialog to avoid hotkey issues
UI - Fixed renaming an effect executing twice, requiring two undo-actions to undo it UI - Always disable editor hotkeys when typing in any input
This commit is contained in:
1 parent
0b5866a2b8
commit
192b4f0df2
20 files changed
+166
-147
No files matched your search
@@ -51,11 +51,6 @@ public interface IProfileEditorService : IArtemisSharedUIService
|
||||
/// </summary>
|
||||
IObservable<bool> SuspendedEditing { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an observable of the suspended keybindings state.
|
||||
/// </summary>
|
||||
IObservable<bool> SuspendedKeybindings { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an observable of the suspended keybindings state.
|
||||
/// </summary>
|
||||
@@ -102,12 +97,6 @@ public interface IProfileEditorService : IArtemisSharedUIService
|
||||
/// <param name="suspend">The new suspended state.</param>
|
||||
void ChangeSuspendedEditing(bool suspend);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the current suspended keybindings state.
|
||||
/// </summary>
|
||||
/// <param name="suspend">The new suspended state.</param>
|
||||
void ChangeSuspendedKeybindings(bool suspend);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the current focus mode.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,7 +31,6 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
private readonly IRgbService _rgbService;
|
||||
private readonly SourceList<ILayerPropertyKeyframe> _selectedKeyframes;
|
||||
private readonly BehaviorSubject<bool> _suspendedEditingSubject = new(false);
|
||||
private readonly BehaviorSubject<bool> _suspendedKeybindingsSubject = new(false);
|
||||
private readonly BehaviorSubject<TimeSpan> _timeSubject = new(TimeSpan.Zero);
|
||||
private readonly IWindowService _windowService;
|
||||
private ProfileEditorCommandScope? _profileEditorHistoryScope;
|
||||
@@ -61,7 +60,6 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
Time = _timeSubject.AsObservable();
|
||||
Playing = _playingSubject.AsObservable();
|
||||
SuspendedEditing = _suspendedEditingSubject.AsObservable();
|
||||
SuspendedKeybindings = _suspendedKeybindingsSubject.AsObservable();
|
||||
PixelsPerSecond = _pixelsPerSecondSubject.AsObservable();
|
||||
FocusMode = _focusModeSubject.AsObservable();
|
||||
SelectedKeyframes = selectedKeyframes;
|
||||
@@ -210,7 +208,6 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
|
||||
_profileConfigurationSubject.OnNext(profileConfiguration);
|
||||
ChangeTime(TimeSpan.Zero);
|
||||
ChangeSuspendedKeybindings(false);
|
||||
}
|
||||
|
||||
public void ChangeCurrentProfileElement(RenderProfileElement? renderProfileElement)
|
||||
@@ -255,15 +252,7 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
|
||||
ApplyFocusMode();
|
||||
}
|
||||
|
||||
public void ChangeSuspendedKeybindings(bool suspend)
|
||||
{
|
||||
if (_suspendedKeybindingsSubject.Value == suspend)
|
||||
return;
|
||||
|
||||
_suspendedKeybindingsSubject.OnNext(suspend);
|
||||
}
|
||||
|
||||
|
||||
public void ChangeFocusMode(ProfileEditorFocusMode focusMode)
|
||||
{
|
||||
if (_focusModeSubject.Value == focusMode)
|
||||
|
||||
@@ -1,8 +1,43 @@
|
||||
using DryIoc;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using IContainer = DryIoc.IContainer;
|
||||
|
||||
namespace Artemis.UI.Shared;
|
||||
|
||||
internal static class UI
|
||||
/// <summary>
|
||||
/// Static UI helpers.
|
||||
/// </summary>
|
||||
public static class UI
|
||||
{
|
||||
private static readonly BehaviorSubject<bool> KeyBindingsEnabledSubject = new(false);
|
||||
|
||||
static UI()
|
||||
{
|
||||
if (KeyboardDevice.Instance != null)
|
||||
KeyboardDevice.Instance.PropertyChanged += InstanceOnPropertyChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current IoC locator.
|
||||
/// </summary>
|
||||
public static IContainer Locator { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether hotkeys are to be disabled.
|
||||
/// </summary>
|
||||
public static IObservable<bool> KeyBindingsEnabled { get; } = KeyBindingsEnabledSubject.AsObservable();
|
||||
|
||||
private static void InstanceOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (KeyboardDevice.Instance == null || e.PropertyName != nameof(KeyboardDevice.FocusedElement))
|
||||
return;
|
||||
|
||||
bool enabled = KeyboardDevice.Instance.FocusedElement is not TextBox;
|
||||
if (KeyBindingsEnabledSubject.Value != enabled)
|
||||
KeyBindingsEnabledSubject.OnNext(enabled);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user