mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
UI - Centralized default editors registration into a service
Display conditions - Added more test operators Display conditions - Implemented operator selection Display conditions - Implemented property selection and rules
This commit is contained in:
1 parent
71f6706eec
commit
f944a675f1
26 files changed
+470
-179
No files matched your search
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.DataModelVisualization;
|
||||
using Artemis.UI.DataModelVisualization.Display;
|
||||
using Artemis.UI.Screens.Settings.Debug;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -15,21 +15,12 @@ namespace Artemis.UI.Services
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IDataModelVisualizationService _dataModelVisualizationService;
|
||||
private DebugViewModel _debugViewModel;
|
||||
|
||||
public DebugService(IKernel kernel, IWindowManager windowManager, IDataModelVisualizationService dataModelVisualizationService)
|
||||
public DebugService(IKernel kernel, IWindowManager windowManager)
|
||||
{
|
||||
_kernel = kernel;
|
||||
_windowManager = windowManager;
|
||||
_dataModelVisualizationService = dataModelVisualizationService;
|
||||
|
||||
RegisterBuiltInDataModelDisplays();
|
||||
}
|
||||
|
||||
private void RegisterBuiltInDataModelDisplays()
|
||||
{
|
||||
_dataModelVisualizationService.RegisterDataModelDisplay<SKColorDataModelDisplayViewModel>(Constants.CorePluginInfo);
|
||||
}
|
||||
|
||||
public void ShowDebugger()
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.PropertyInput;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
@@ -14,14 +12,11 @@ namespace Artemis.UI.Services
|
||||
{
|
||||
public class LayerEditorService : ILayerEditorService
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
|
||||
public LayerEditorService(ISettingsService settingsService, IProfileEditorService profileEditorService)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
_profileEditorService = profileEditorService;
|
||||
RegisterBuiltInPropertyEditors();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -138,16 +133,5 @@ namespace Artemis.UI.Services
|
||||
// The difference between the two is the offset
|
||||
return topLeft - tempTopLeft;
|
||||
}
|
||||
|
||||
private void RegisterBuiltInPropertyEditors()
|
||||
{
|
||||
_profileEditorService.RegisterPropertyInput<BrushPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<ColorGradientPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<FloatPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<IntPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKColorPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKPointPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKSizePropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.DataModelVisualization.Display;
|
||||
using Artemis.UI.DataModelVisualization.Input;
|
||||
using Artemis.UI.PropertyInput;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
|
||||
namespace Artemis.UI.Services
|
||||
{
|
||||
public class RegistrationService : IRegistrationService
|
||||
{
|
||||
private readonly IDataModelVisualizationService _dataModelVisualizationService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private bool _registeredBuiltInDataModelDisplays;
|
||||
private bool _registeredBuiltInDataModelInputs;
|
||||
private bool _registeredBuiltInPropertyEditors;
|
||||
|
||||
public RegistrationService(IDataModelVisualizationService dataModelVisualizationService, IProfileEditorService profileEditorService)
|
||||
{
|
||||
_dataModelVisualizationService = dataModelVisualizationService;
|
||||
_profileEditorService = profileEditorService;
|
||||
}
|
||||
|
||||
public void RegisterBuiltInDataModelDisplays()
|
||||
{
|
||||
if (_registeredBuiltInDataModelDisplays)
|
||||
return;
|
||||
|
||||
_dataModelVisualizationService.RegisterDataModelDisplay<SKColorDataModelDisplayViewModel>(Constants.CorePluginInfo);
|
||||
|
||||
_registeredBuiltInDataModelDisplays = true;
|
||||
}
|
||||
|
||||
public void RegisterBuiltInDataModelInputs()
|
||||
{
|
||||
if (_registeredBuiltInDataModelInputs)
|
||||
return;
|
||||
|
||||
_dataModelVisualizationService.RegisterDataModelInput<StringDataModelInputViewModel>(Constants.CorePluginInfo);
|
||||
|
||||
_registeredBuiltInDataModelInputs = true;
|
||||
}
|
||||
|
||||
public void RegisterBuiltInPropertyEditors()
|
||||
{
|
||||
if (_registeredBuiltInPropertyEditors)
|
||||
return;
|
||||
|
||||
_profileEditorService.RegisterPropertyInput<BrushPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<ColorGradientPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<FloatPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<IntPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKColorPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKPointPropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
_profileEditorService.RegisterPropertyInput<SKSizePropertyInputViewModel>(Constants.CorePluginInfo);
|
||||
|
||||
_registeredBuiltInPropertyEditors = true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IRegistrationService : IArtemisUIService
|
||||
{
|
||||
void RegisterBuiltInDataModelDisplays();
|
||||
void RegisterBuiltInDataModelInputs();
|
||||
void RegisterBuiltInPropertyEditors();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user