1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profile editor - Added focusing

This commit is contained in:
Robert 2022-08-14 14:11:39 +02:00
parent 3f52279305
commit 1f311d2295
8 changed files with 154 additions and 33 deletions

View File

@ -55,6 +55,11 @@ public interface IProfileEditorService : IArtemisSharedUIService
/// Gets an observable of the suspended keybindings state. /// Gets an observable of the suspended keybindings state.
/// </summary> /// </summary>
IObservable<bool> SuspendedKeybindings { get; } IObservable<bool> SuspendedKeybindings { get; }
/// <summary>
/// Gets an observable of the suspended keybindings state.
/// </summary>
IObservable<ProfileEditorFocusMode> FocusMode { get; }
/// <summary> /// <summary>
/// Gets an observable read only collection of all available editor tools. /// Gets an observable read only collection of all available editor tools.
@ -108,6 +113,12 @@ public interface IProfileEditorService : IArtemisSharedUIService
/// <param name="suspend">The new suspended state.</param> /// <param name="suspend">The new suspended state.</param>
void ChangeSuspendedKeybindings(bool suspend); void ChangeSuspendedKeybindings(bool suspend);
/// <summary>
/// Changes the current focus mode.
/// </summary>
/// <param name="focusMode">The new focus mode.</param>
void ChangeFocusMode(ProfileEditorFocusMode focusMode);
/// <summary> /// <summary>
/// Selects the provided keyframe. /// Selects the provided keyframe.
/// </summary> /// </summary>

View File

@ -0,0 +1,22 @@
namespace Artemis.UI.Shared.Services.ProfileEditor;
/// <summary>
/// Represents a mode of focus in the editor.
/// </summary>
public enum ProfileEditorFocusMode
{
/// <summary>
/// Disable focusing.
/// </summary>
None,
/// <summary>
/// Focus the folder of the current element.
/// </summary>
Folder,
/// <summary>
/// Focus the current element.
/// </summary>
Selection
}

View File

@ -31,12 +31,12 @@ internal class ProfileEditorService : IProfileEditorService
private readonly IProfileService _profileService; private readonly IProfileService _profileService;
private readonly BehaviorSubject<bool> _suspendedEditingSubject = new(false); private readonly BehaviorSubject<bool> _suspendedEditingSubject = new(false);
private readonly BehaviorSubject<bool> _suspendedKeybindingsSubject = new(false); private readonly BehaviorSubject<bool> _suspendedKeybindingsSubject = new(false);
private readonly BehaviorSubject<ProfileEditorFocusMode> _focusModeSubject = new(ProfileEditorFocusMode.None);
private readonly BehaviorSubject<TimeSpan> _timeSubject = new(TimeSpan.Zero); private readonly BehaviorSubject<TimeSpan> _timeSubject = new(TimeSpan.Zero);
private readonly SourceList<IToolViewModel> _tools; private readonly SourceList<IToolViewModel> _tools;
private readonly SourceList<ILayerPropertyKeyframe> _selectedKeyframes; private readonly SourceList<ILayerPropertyKeyframe> _selectedKeyframes;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private ProfileEditorCommandScope? _profileEditorHistoryScope; private ProfileEditorCommandScope? _profileEditorHistoryScope;
private readonly PluginSetting<bool> _focusSelectedLayer;
public ProfileEditorService(ILogger logger, public ProfileEditorService(ILogger logger,
IProfileService profileService, IProfileService profileService,
@ -44,8 +44,7 @@ internal class ProfileEditorService : IProfileEditorService
IRgbService rgbService, IRgbService rgbService,
ILayerBrushService layerBrushService, ILayerBrushService layerBrushService,
IMainWindowService mainWindowService, IMainWindowService mainWindowService,
IWindowService windowService, IWindowService windowService)
ISettingsService settingsService)
{ {
_logger = logger; _logger = logger;
_profileService = profileService; _profileService = profileService;
@ -53,8 +52,7 @@ internal class ProfileEditorService : IProfileEditorService
_rgbService = rgbService; _rgbService = rgbService;
_layerBrushService = layerBrushService; _layerBrushService = layerBrushService;
_windowService = windowService; _windowService = windowService;
_focusSelectedLayer = settingsService.GetSetting("ProfileEditor.FocusSelectedLayer", false);
_tools = new SourceList<IToolViewModel>(); _tools = new SourceList<IToolViewModel>();
_selectedKeyframes = new SourceList<ILayerPropertyKeyframe>(); _selectedKeyframes = new SourceList<ILayerPropertyKeyframe>();
_tools.Connect().AutoRefreshOnObservable(t => t.WhenAnyValue(vm => vm.IsSelected)).Subscribe(OnToolSelected); _tools.Connect().AutoRefreshOnObservable(t => t.WhenAnyValue(vm => vm.IsSelected)).Subscribe(OnToolSelected);
@ -70,6 +68,8 @@ internal class ProfileEditorService : IProfileEditorService
SuspendedEditing = _suspendedEditingSubject.AsObservable(); SuspendedEditing = _suspendedEditingSubject.AsObservable();
SuspendedKeybindings = _suspendedKeybindingsSubject.AsObservable(); SuspendedKeybindings = _suspendedKeybindingsSubject.AsObservable();
PixelsPerSecond = _pixelsPerSecondSubject.AsObservable(); PixelsPerSecond = _pixelsPerSecondSubject.AsObservable();
FocusMode = _focusModeSubject.AsObservable();
Tools = tools; Tools = tools;
SelectedKeyframes = selectedKeyframes; SelectedKeyframes = selectedKeyframes;
@ -88,7 +88,6 @@ internal class ProfileEditorService : IProfileEditorService
// When the main window closes, stop editing // When the main window closes, stop editing
mainWindowService.MainWindowClosed += (_, _) => ChangeCurrentProfileConfiguration(null); mainWindowService.MainWindowClosed += (_, _) => ChangeCurrentProfileConfiguration(null);
_focusSelectedLayer.SettingChanged += FocusSelectedLayerOnSettingChanged;
} }
public IObservable<ProfileConfiguration?> ProfileConfiguration { get; } public IObservable<ProfileConfiguration?> ProfileConfiguration { get; }
@ -100,6 +99,7 @@ internal class ProfileEditorService : IProfileEditorService
public IObservable<TimeSpan> Time { get; } public IObservable<TimeSpan> Time { get; }
public IObservable<bool> Playing { get; } public IObservable<bool> Playing { get; }
public IObservable<int> PixelsPerSecond { get; } public IObservable<int> PixelsPerSecond { get; }
public IObservable<ProfileEditorFocusMode> FocusMode { get; }
public ReadOnlyObservableCollection<IToolViewModel> Tools { get; } public ReadOnlyObservableCollection<IToolViewModel> Tools { get; }
public ReadOnlyObservableCollection<ILayerPropertyKeyframe> SelectedKeyframes { get; } public ReadOnlyObservableCollection<ILayerPropertyKeyframe> SelectedKeyframes { get; }
@ -156,7 +156,8 @@ internal class ProfileEditorService : IProfileEditorService
{ {
_selectedKeyframes.Clear(); _selectedKeyframes.Clear();
_profileElementSubject.OnNext(renderProfileElement); _profileElementSubject.OnNext(renderProfileElement);
_profileService.EditorFocus = _focusSelectedLayer.Value ? renderProfileElement : null;
ApplyFocusMode();
ChangeCurrentLayerProperty(null); ChangeCurrentLayerProperty(null);
} }
@ -190,6 +191,8 @@ internal class ProfileEditorService : IProfileEditorService
_profileService.RenderForEditor = true; _profileService.RenderForEditor = true;
Tick(_timeSubject.Value); Tick(_timeSubject.Value);
} }
ApplyFocusMode();
} }
public void ChangeSuspendedKeybindings(bool suspend) public void ChangeSuspendedKeybindings(bool suspend)
@ -200,6 +203,15 @@ internal class ProfileEditorService : IProfileEditorService
_suspendedKeybindingsSubject.OnNext(suspend); _suspendedKeybindingsSubject.OnNext(suspend);
} }
public void ChangeFocusMode(ProfileEditorFocusMode focusMode)
{
if (_focusModeSubject.Value == focusMode)
return;
_focusModeSubject.OnNext(focusMode);
ApplyFocusMode();
}
public void SelectKeyframe(ILayerPropertyKeyframe? keyframe, bool expand, bool toggle) public void SelectKeyframe(ILayerPropertyKeyframe? keyframe, bool expand, bool toggle)
{ {
if (keyframe == null) if (keyframe == null)
@ -509,9 +521,18 @@ internal class ProfileEditorService : IProfileEditorService
TickProfileElement(child, time); TickProfileElement(child, time);
} }
} }
private void FocusSelectedLayerOnSettingChanged(object? sender, EventArgs e) private void ApplyFocusMode()
{ {
_profileService.EditorFocus = _focusSelectedLayer.Value ? _profileElementSubject.Value : null; if (_suspendedEditingSubject.Value)
_profileService.EditorFocus = null;
_profileService.EditorFocus = _focusModeSubject.Value switch
{
ProfileEditorFocusMode.None => null,
ProfileEditorFocusMode.Folder => _profileElementSubject.Value?.Parent,
ProfileEditorFocusMode.Selection => _profileElementSubject.Value,
_ => _profileService.EditorFocus
};
} }
} }

View File

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:menuBar="clr-namespace:Artemis.UI.Screens.ProfileEditor.MenuBar" xmlns:menuBar="clr-namespace:Artemis.UI.Screens.ProfileEditor.MenuBar"
xmlns:profileEditor="clr-namespace:Artemis.UI.Shared.Services.ProfileEditor;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.ProfileEditor.MenuBar.MenuBarView" x:Class="Artemis.UI.Screens.ProfileEditor.MenuBar.MenuBarView"
x:DataType="menuBar:MenuBarViewModel"> x:DataType="menuBar:MenuBarViewModel">
@ -97,8 +98,8 @@
<avalonia:MaterialIcon Kind="SwapHorizontal" /> <avalonia:MaterialIcon Kind="SwapHorizontal" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem Header="Switch Run Mode on Focus Loss" <MenuItem Header="Switch Run Mode on Focus Loss"
ToolTip.Tip="If enabled, run mode is set to normal on focus loss" ToolTip.Tip="If enabled, run mode is set to normal on focus loss"
InputGesture="Shift+F5" InputGesture="Shift+F5"
Command="{CompiledBinding ToggleBooleanSetting}" Command="{CompiledBinding ToggleBooleanSetting}"
CommandParameter="{CompiledBinding AutoSuspend}"> CommandParameter="{CompiledBinding AutoSuspend}">
@ -108,12 +109,28 @@
</MenuItem> </MenuItem>
</MenuItem> </MenuItem>
<MenuItem Header="_Options"> <MenuItem Header="_Options">
<MenuItem Header="Focus Selected Layer" ToolTip.Tip="If enabled, displays only the layer you currently have selected" <MenuItem Header="Focus Mode" InputGesture="F">
Command="{CompiledBinding ToggleBooleanSetting}" <MenuItem Header="None"
CommandParameter="{CompiledBinding FocusSelectedLayer}"> Command="{CompiledBinding ChangeFocusMode}"
<MenuItem.Icon> CommandParameter="{x:Static profileEditor:ProfileEditorFocusMode.None}">
<avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding FocusSelectedLayer.Value}" /> <MenuItem.Icon>
</MenuItem.Icon> <avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding FocusNone}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Current Folder"
Command="{CompiledBinding ChangeFocusMode}"
CommandParameter="{x:Static profileEditor:ProfileEditorFocusMode.Folder}">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding FocusFolder}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Current Selection"
Command="{CompiledBinding ChangeFocusMode}"
CommandParameter="{x:Static profileEditor:ProfileEditorFocusMode.Selection}">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding FocusSelection}" />
</MenuItem.Icon>
</MenuItem>
</MenuItem> </MenuItem>
<MenuItem Header="Display Data Model Values" <MenuItem Header="Display Data Model Values"
Command="{CompiledBinding ToggleBooleanSetting}" Command="{CompiledBinding ToggleBooleanSetting}"

View File

@ -31,6 +31,9 @@ public class MenuBarViewModel : ActivatableViewModelBase
private ObservableAsPropertyHelper<ProfileConfiguration?>? _profileConfiguration; private ObservableAsPropertyHelper<ProfileConfiguration?>? _profileConfiguration;
private ObservableAsPropertyHelper<RenderProfileElement?>? _profileElement; private ObservableAsPropertyHelper<RenderProfileElement?>? _profileElement;
private ObservableAsPropertyHelper<bool>? _suspendedEditing; private ObservableAsPropertyHelper<bool>? _suspendedEditing;
private ObservableAsPropertyHelper<bool>? _focusNone;
private ObservableAsPropertyHelper<bool>? _focusFolder;
private ObservableAsPropertyHelper<bool>? _focusSelection;
public MenuBarViewModel(ILogger logger, IProfileEditorService profileEditorService, IProfileService profileService, ISettingsService settingsService, IWindowService windowService) public MenuBarViewModel(ILogger logger, IProfileEditorService profileEditorService, IProfileService profileService, ISettingsService settingsService, IWindowService windowService)
{ {
@ -50,6 +53,10 @@ public class MenuBarViewModel : ActivatableViewModelBase
.Switch() .Switch()
.ToProperty(this, vm => vm.IsSuspended) .ToProperty(this, vm => vm.IsSuspended)
.DisposeWith(d); .DisposeWith(d);
_focusNone = profileEditorService.FocusMode.Select(f => f == ProfileEditorFocusMode.None).ToProperty(this, vm => vm.FocusNone).DisposeWith(d);
_focusFolder = profileEditorService.FocusMode.Select(f => f == ProfileEditorFocusMode.Folder).ToProperty(this, vm => vm.FocusFolder).DisposeWith(d);
_focusSelection = profileEditorService.FocusMode.Select(f => f == ProfileEditorFocusMode.Selection).ToProperty(this, vm => vm.FocusSelection).DisposeWith(d);
}); });
AddFolder = ReactiveCommand.Create(ExecuteAddFolder); AddFolder = ReactiveCommand.Create(ExecuteAddFolder);
@ -62,8 +69,10 @@ public class MenuBarViewModel : ActivatableViewModelBase
ExportProfile = ReactiveCommand.CreateFromTask(ExecuteExportProfile, this.WhenAnyValue(vm => vm.ProfileConfiguration).Select(c => c != null)); ExportProfile = ReactiveCommand.CreateFromTask(ExecuteExportProfile, this.WhenAnyValue(vm => vm.ProfileConfiguration).Select(c => c != null));
DuplicateProfile = ReactiveCommand.Create(ExecuteDuplicateProfile, this.WhenAnyValue(vm => vm.ProfileConfiguration).Select(c => c != null)); DuplicateProfile = ReactiveCommand.Create(ExecuteDuplicateProfile, this.WhenAnyValue(vm => vm.ProfileConfiguration).Select(c => c != null));
ToggleSuspendedEditing = ReactiveCommand.Create(ExecuteToggleSuspendedEditing); ToggleSuspendedEditing = ReactiveCommand.Create(ExecuteToggleSuspendedEditing);
ToggleBooleanSetting = ReactiveCommand.Create<PluginSetting<bool>>(ExecuteToggleBooleanSetting);
OpenUri = ReactiveCommand.Create<string>(s => Process.Start(new ProcessStartInfo(s) {UseShellExecute = true, Verb = "open"})); OpenUri = ReactiveCommand.Create<string>(s => Process.Start(new ProcessStartInfo(s) {UseShellExecute = true, Verb = "open"}));
ToggleBooleanSetting = ReactiveCommand.Create<PluginSetting<bool>>(ExecuteToggleBooleanSetting);
CycleFocusMode = ReactiveCommand.Create(ExecuteCycleFocusMode);
ChangeFocusMode = ReactiveCommand.Create<ProfileEditorFocusMode>(ExecuteChangeFocusMode);
} }
public ReactiveCommand<Unit, Unit> AddFolder { get; } public ReactiveCommand<Unit, Unit> AddFolder { get; }
@ -78,18 +87,23 @@ public class MenuBarViewModel : ActivatableViewModelBase
public ReactiveCommand<PluginSetting<bool>, Unit> ToggleBooleanSetting { get; } public ReactiveCommand<PluginSetting<bool>, Unit> ToggleBooleanSetting { get; }
public ReactiveCommand<string, Unit> OpenUri { get; } public ReactiveCommand<string, Unit> OpenUri { get; }
public ReactiveCommand<Unit, Unit> ToggleSuspendedEditing { get; } public ReactiveCommand<Unit, Unit> ToggleSuspendedEditing { get; }
public ReactiveCommand<Unit, Unit> CycleFocusMode { get; }
public ReactiveCommand<ProfileEditorFocusMode, Unit> ChangeFocusMode { get; }
public ProfileConfiguration? ProfileConfiguration => _profileConfiguration?.Value; public ProfileConfiguration? ProfileConfiguration => _profileConfiguration?.Value;
public RenderProfileElement? ProfileElement => _profileElement?.Value; public RenderProfileElement? ProfileElement => _profileElement?.Value;
public bool IsSuspended => _isSuspended?.Value ?? false; public bool IsSuspended => _isSuspended?.Value ?? false;
public bool SuspendedEditing => _suspendedEditing?.Value ?? false; public bool SuspendedEditing => _suspendedEditing?.Value ?? false;
public bool FocusNone => _focusNone?.Value ?? false;
public bool FocusFolder => _focusFolder?.Value ?? false;
public bool FocusSelection => _focusSelection?.Value ?? false;
public PluginSetting<bool> AutoSuspend => _settingsService.GetSetting("ProfileEditor.AutoSuspend", true); public PluginSetting<bool> AutoSuspend => _settingsService.GetSetting("ProfileEditor.AutoSuspend", true);
public PluginSetting<bool> FocusSelectedLayer => _settingsService.GetSetting("ProfileEditor.FocusSelectedLayer", false);
public PluginSetting<bool> ShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false); public PluginSetting<bool> ShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
public PluginSetting<bool> ShowFullPaths => _settingsService.GetSetting("ProfileEditor.ShowFullPaths", false); public PluginSetting<bool> ShowFullPaths => _settingsService.GetSetting("ProfileEditor.ShowFullPaths", false);
public PluginSetting<bool> AlwaysShowValues => _settingsService.GetSetting("ProfileEditor.AlwaysShowValues", true); public PluginSetting<bool> AlwaysShowValues => _settingsService.GetSetting("ProfileEditor.AlwaysShowValues", true);
public PluginSetting<bool> AlwaysApplyDataBindings => _settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", false); public PluginSetting<bool> AlwaysApplyDataBindings => _settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", false);
public PluginSetting<ProfileEditorFocusMode> FocusMode => _settingsService.GetSetting("ProfileEditor.FocusMode", ProfileEditorFocusMode.Folder);
public ProfileEditorHistory? History public ProfileEditorHistory? History
{ {
@ -125,7 +139,7 @@ public class MenuBarViewModel : ActivatableViewModelBase
("profileConfiguration", ProfileConfiguration) ("profileConfiguration", ProfileConfiguration)
); );
} }
private async Task ExecuteViewScripts() private async Task ExecuteViewScripts()
{ {
if (ProfileConfiguration?.Profile == null) if (ProfileConfiguration?.Profile == null)
@ -218,4 +232,24 @@ public class MenuBarViewModel : ActivatableViewModelBase
setting.Value = !setting.Value; setting.Value = !setting.Value;
setting.Save(); setting.Save();
} }
private void ExecuteCycleFocusMode()
{
if (FocusMode.Value == ProfileEditorFocusMode.None)
FocusMode.Value = ProfileEditorFocusMode.Folder;
else if (FocusMode.Value == ProfileEditorFocusMode.Folder)
FocusMode.Value = ProfileEditorFocusMode.Selection;
else if (FocusMode.Value == ProfileEditorFocusMode.Selection)
FocusMode.Value = ProfileEditorFocusMode.None;
FocusMode.Save();
_profileEditorService.ChangeFocusMode(FocusMode.Value);
}
private void ExecuteChangeFocusMode(ProfileEditorFocusMode focusMode)
{
FocusMode.Value = focusMode;
FocusMode.Save();
_profileEditorService.ChangeFocusMode(FocusMode.Value);
}
} }

View File

@ -90,8 +90,8 @@
</Style> </Style>
</UserControl.Styles> </UserControl.Styles>
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<TreeView Name="ProfileTreeView" Classes="no-right-margin draggable" <TreeView Name="ProfileTreeView" Classes="no-right-margin draggable"
Items="{CompiledBinding Children}" Items="{CompiledBinding Children}"
SelectedItem="{CompiledBinding SelectedChild}" SelectedItem="{CompiledBinding SelectedChild}"
SelectionChanged="ProfileTreeView_OnSelectionChanged"> SelectionChanged="ProfileTreeView_OnSelectionChanged">
<TreeView.Styles> <TreeView.Styles>
@ -152,14 +152,25 @@
</TreeDataTemplate> </TreeDataTemplate>
</TreeView.ItemTemplate> </TreeView.ItemTemplate>
</TreeView> </TreeView>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"> <Grid Grid.Row="1">
<Button Classes="icon-button" ToolTip.Tip="Add new folder to root" Command="{CompiledBinding AddFolder}"> <Grid.ColumnDefinitions>
<avalonia:MaterialIcon Kind="FolderAdd" /> <ColumnDefinition />
</Button> <ColumnDefinition />
<Button Classes="icon-button" ToolTip.Tip="Add new layer to root" Command="{CompiledBinding AddLayer}" Margin="2 0 0 0"> </Grid.ColumnDefinitions>
<avalonia:MaterialIcon Kind="LayersPlus" /> <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Spacing="5" ToolTip.Tip="Focus Mode - Use to disable parts of the profile you're not working on (F to change)">
</Button> <avalonia:MaterialIcon Kind="ImageFilterCenterFocusStrong" />
</StackPanel> <TextBlock Text="{CompiledBinding FocusMode.Value}" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button Classes="icon-button" ToolTip.Tip="Add new folder to root" Command="{CompiledBinding AddFolder}">
<avalonia:MaterialIcon Kind="FolderAdd" />
</Button>
<Button Classes="icon-button" ToolTip.Tip="Add new layer to root" Command="{CompiledBinding AddLayer}" Margin="2 0 0 0">
<avalonia:MaterialIcon Kind="LayersPlus" />
</Button>
</StackPanel>
</Grid>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.Core; using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Ninject.Factories; using Artemis.UI.Ninject.Factories;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor;
@ -17,7 +18,7 @@ public class ProfileTreeViewModel : TreeItemViewModel
private readonly IProfileEditorService _profileEditorService; private readonly IProfileEditorService _profileEditorService;
private TreeItemViewModel? _selectedChild; private TreeItemViewModel? _selectedChild;
public ProfileTreeViewModel(IWindowService windowService, IProfileEditorService profileEditorService, IProfileEditorVmFactory profileEditorVmFactory) public ProfileTreeViewModel(IWindowService windowService, IProfileEditorService profileEditorService, IProfileEditorVmFactory profileEditorVmFactory, ISettingsService settingsService)
: base(null, null, windowService, profileEditorService, profileEditorVmFactory) : base(null, null, windowService, profileEditorService, profileEditorVmFactory)
{ {
_profileEditorService = profileEditorService; _profileEditorService = profileEditorService;
@ -44,8 +45,11 @@ public class ProfileTreeViewModel : TreeItemViewModel
if (model?.ProfileElement is RenderProfileElement renderProfileElement) if (model?.ProfileElement is RenderProfileElement renderProfileElement)
profileEditorService.ChangeCurrentProfileElement(renderProfileElement); profileEditorService.ChangeCurrentProfileElement(renderProfileElement);
}); });
FocusMode = settingsService.GetSetting("ProfileEditor.FocusMode", ProfileEditorFocusMode.Folder);
} }
public PluginSetting<ProfileEditorFocusMode> FocusMode { get; }
public TreeItemViewModel? SelectedChild public TreeItemViewModel? SelectedChild
{ {
get => _selectedChild; get => _selectedChild;

View File

@ -28,6 +28,7 @@
<KeyBinding Command="{CompiledBinding ToggleAutoSuspend}" Gesture="Shift+F5" /> <KeyBinding Command="{CompiledBinding ToggleAutoSuspend}" Gesture="Shift+F5" />
<KeyBinding Command="{CompiledBinding PropertiesViewModel.PlaybackViewModel.TogglePlay}" Gesture="Space" /> <KeyBinding Command="{CompiledBinding PropertiesViewModel.PlaybackViewModel.TogglePlay}" Gesture="Space" />
<KeyBinding Command="{CompiledBinding PropertiesViewModel.PlaybackViewModel.PlayFromStart}" Gesture="Shift+Space" /> <KeyBinding Command="{CompiledBinding PropertiesViewModel.PlaybackViewModel.PlayFromStart}" Gesture="Shift+Space" />
<KeyBinding Command="{Binding TitleBarViewModel.MenuBarViewModel.CycleFocusMode}" Gesture="F" />
</UserControl.KeyBindings> </UserControl.KeyBindings>
<UserControl.Styles> <UserControl.Styles>
<Style Selector="GridSplitter.editor-grid-splitter-vertical"> <Style Selector="GridSplitter.editor-grid-splitter-vertical">