mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Layer properties - Improved error messaging
Profile editor - Fixed layer creation in selection tool not initializing the layer Device visualizer - Better handle missing images
This commit is contained in:
1 parent
92faafe1de
commit
1bcee06cb2
10 files changed
+46
-24
No files matched your search
+1
-2
@@ -122,8 +122,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
|
||||
if (!SupportsChildren)
|
||||
throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name);
|
||||
|
||||
var layer = _layerService.CreateLayer(ProfileElement.Profile, ProfileElement, "New layer");
|
||||
ProfileElement.AddChild(layer);
|
||||
_layerService.CreateLayer(ProfileElement.Profile, ProfileElement, "New layer");
|
||||
UpdateProfileElements();
|
||||
_profileEditorService.UpdateSelectedProfile();
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
private void Update()
|
||||
{
|
||||
IsSelected = _profileEditorService.SelectedProfileElement == Layer;
|
||||
|
||||
CreateLayerGeometry();
|
||||
CreateShapeGeometry();
|
||||
CreateViewportRectangle();
|
||||
@@ -223,6 +224,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
|
||||
private void ProfileEditorServiceOnProfilePreviewUpdated(object sender, EventArgs e)
|
||||
{
|
||||
if (!Layer.Transform.PropertiesInitialized || !Layer.General.PropertiesInitialized)
|
||||
return;
|
||||
|
||||
CreateShapeGeometry();
|
||||
CreateViewportRectangle();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.UI.Events;
|
||||
using Artemis.UI.Extensions;
|
||||
@@ -24,6 +25,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
public class ProfileViewModel : ProfileEditorPanelViewModel, IHandle<MainWindowFocusChangedEvent>, IHandle<MainWindowKeyEvent>
|
||||
{
|
||||
private readonly ILayerEditorService _layerEditorService;
|
||||
private readonly ILayerService _layerService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IProfileLayerVmFactory _profileLayerVmFactory;
|
||||
private readonly ISettingsService _settingsService;
|
||||
@@ -35,6 +37,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
|
||||
public ProfileViewModel(IProfileEditorService profileEditorService,
|
||||
ILayerEditorService layerEditorService,
|
||||
ILayerService layerService,
|
||||
ISurfaceService surfaceService,
|
||||
ISettingsService settingsService,
|
||||
IEventAggregator eventAggregator,
|
||||
@@ -42,6 +45,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
_layerEditorService = layerEditorService;
|
||||
_layerService = layerService;
|
||||
_surfaceService = surfaceService;
|
||||
_settingsService = settingsService;
|
||||
_profileLayerVmFactory = profileLayerVmFactory;
|
||||
@@ -228,7 +232,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
ActiveToolViewModel = new EditToolViewModel(this, _profileEditorService, _layerEditorService);
|
||||
break;
|
||||
case 2:
|
||||
ActiveToolViewModel = new SelectionToolViewModel(this, _profileEditorService);
|
||||
ActiveToolViewModel = new SelectionToolViewModel(this, _profileEditorService, _layerService);
|
||||
break;
|
||||
case 3:
|
||||
ActiveToolViewModel = new SelectionRemoveToolViewModel(this, _profileEditorService);
|
||||
|
||||
+11
-3
@@ -3,6 +3,8 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Properties;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
@@ -11,8 +13,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
public class SelectionToolViewModel : VisualizationToolViewModel
|
||||
{
|
||||
public SelectionToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
||||
private readonly ILayerService _layerService;
|
||||
|
||||
public SelectionToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService, ILayerService layerService)
|
||||
: base(profileViewModel, profileEditorService)
|
||||
{
|
||||
_layerService = layerService;
|
||||
using (var stream = new MemoryStream(Resources.aero_crosshair))
|
||||
{
|
||||
Cursor = new Cursor(stream);
|
||||
@@ -48,19 +54,21 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
// If no layer selected, apply it to a new layer in the selected folder
|
||||
else if (ProfileEditorService.SelectedProfileElement is Folder folder)
|
||||
{
|
||||
var newLayer = folder.AddLayer("New layer");
|
||||
var newLayer = _layerService.CreateLayer(folder.Profile, folder, "New layer");
|
||||
newLayer.AddLeds(selectedLeds);
|
||||
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
ProfileEditorService.UpdateSelectedProfile();
|
||||
}
|
||||
// If no folder selected, apply it to a new layer in the root folder
|
||||
else
|
||||
{
|
||||
var rootFolder = ProfileEditorService.SelectedProfile.GetRootFolder();
|
||||
var newLayer = rootFolder.AddLayer("New layer");
|
||||
var newLayer = _layerService.CreateLayer(rootFolder.Profile, rootFolder, "New layer");
|
||||
newLayer.AddLeds(selectedLeds);
|
||||
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
ProfileEditorService.UpdateSelectedProfile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user