mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Added back hotkeys for the tools
Profile editor - Fixed hotkeys not always working
This commit is contained in:
1 parent
f985682e78
commit
543b62a715
16 files changed
+106
-38
No files matched your search
@@ -11,7 +11,12 @@ public interface IMainWindowService : IArtemisSharedUIService
|
||||
/// Gets a boolean indicating whether the main window is currently open
|
||||
/// </summary>
|
||||
bool IsMainWindowOpen { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the main window is currently focused
|
||||
/// </summary>
|
||||
bool IsMainWindowFocused { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets up the main window provider that controls the state of the main window
|
||||
/// </summary>
|
||||
|
||||
@@ -10,6 +10,9 @@ internal class MainWindowService : IMainWindowService
|
||||
/// <inheritdoc />
|
||||
public bool IsMainWindowOpen { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMainWindowFocused { get; private set; }
|
||||
|
||||
protected virtual void OnMainWindowOpened()
|
||||
{
|
||||
MainWindowOpened?.Invoke(this, EventArgs.Empty);
|
||||
@@ -24,11 +27,13 @@ internal class MainWindowService : IMainWindowService
|
||||
protected virtual void OnMainWindowFocused()
|
||||
{
|
||||
MainWindowFocused?.Invoke(this, EventArgs.Empty);
|
||||
IsMainWindowFocused = true;
|
||||
}
|
||||
|
||||
protected virtual void OnMainWindowUnfocused()
|
||||
{
|
||||
MainWindowUnfocused?.Invoke(this, EventArgs.Empty);
|
||||
IsMainWindowFocused = false;
|
||||
}
|
||||
|
||||
private void SyncWithManager()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Avalonia.Input;
|
||||
using Material.Icons;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor;
|
||||
@@ -43,6 +45,11 @@ public interface IToolViewModel : IDisposable
|
||||
/// Gets the tooltip which this tool should show in the toolbar.
|
||||
/// </summary>
|
||||
public string ToolTip { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyboard hotkey that activates the tool.
|
||||
/// </summary>
|
||||
Hotkey? Hotkey { get; }
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IToolViewModel" />
|
||||
@@ -98,5 +105,8 @@ public abstract class ToolViewModel : ActivatableViewModelBase, IToolViewModel
|
||||
/// <inheritdoc />
|
||||
public abstract string ToolTip { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract Hotkey? Hotkey { get; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -22,10 +22,11 @@ public static class UI
|
||||
|
||||
static UI()
|
||||
{
|
||||
KeyBindingsEnabled = InputElement.GotFocusEvent.Raised.Select(e => e.Item2.Source is not TextBox).StartWith(true);
|
||||
CurrentKeyBindingsEnabled = InputElement.GotFocusEvent.Raised.Select(e => e.Item2.Source is not TextBox).StartWith(true);
|
||||
CurrentKeyBindingsEnabled.Subscribe(b => KeyBindingsEnabled = b);
|
||||
MicaEnabled = MicaEnabledSubject.AsObservable();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current IoC locator.
|
||||
/// </summary>
|
||||
@@ -36,10 +37,15 @@ public static class UI
|
||||
/// </summary>
|
||||
public static IClipboard Clipboard { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an observable boolean indicating whether hotkeys are to be disabled.
|
||||
/// </summary>
|
||||
public static IObservable<bool> CurrentKeyBindingsEnabled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether hotkeys are to be disabled.
|
||||
/// </summary>
|
||||
public static IObservable<bool> KeyBindingsEnabled { get; }
|
||||
public static bool KeyBindingsEnabled { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the Mica effect should be enabled.
|
||||
|
||||
Reference in new issue
Block a user