From 1b737b42112d8cbb0bd003cd3869b678e4c93592 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 10 Dec 2020 20:43:03 +0100 Subject: [PATCH] Profile editor - Profile tree ordering fixes Profile editor - Add new layers on top again Profile editor - Don't willy nilly expand folders --- src/Artemis.Core/Models/Profile/Layer.cs | 2 +- src/Artemis.Core/Models/Profile/ProfileElement.cs | 2 +- src/Artemis.Core/Services/Registration/LayerBrushService.cs | 4 ++-- src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs | 2 +- .../Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml | 2 +- .../ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 2554d7cb1..8d6ba6b77 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -42,7 +42,7 @@ namespace Artemis.Core _leds = new List(); Initialize(); - Parent.AddChild(this); + Parent.AddChild(this, 0); } /// diff --git a/src/Artemis.Core/Models/Profile/ProfileElement.cs b/src/Artemis.Core/Models/Profile/ProfileElement.cs index 52c5b3f8e..87e8574b2 100644 --- a/src/Artemis.Core/Models/Profile/ProfileElement.cs +++ b/src/Artemis.Core/Models/Profile/ProfileElement.cs @@ -120,7 +120,7 @@ namespace Artemis.Core #region Hierarchy /// - /// Adds a profile element to the collection, optionally at the given position (1-based) + /// Adds a profile element to the collection, optionally at the given position (0-based) /// /// The profile element to add /// The order where to place the child (0-based), defaults to the end of the collection diff --git a/src/Artemis.Core/Services/Registration/LayerBrushService.cs b/src/Artemis.Core/Services/Registration/LayerBrushService.cs index 667ecde87..c3bb68a59 100644 --- a/src/Artemis.Core/Services/Registration/LayerBrushService.cs +++ b/src/Artemis.Core/Services/Registration/LayerBrushService.cs @@ -39,11 +39,11 @@ namespace Artemis.Core.Services PluginSetting defaultReference = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference { LayerBrushProviderId = "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba", - BrushType = "ColorBrush" + BrushType = "SolidBrush" }); defaultReference.Value.LayerBrushProviderId ??= "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba"; - defaultReference.Value.BrushType ??= "ColorBrush"; + defaultReference.Value.BrushType ??= "SolidBrush"; return LayerBrushStore.Get(defaultReference.Value.LayerBrushProviderId, defaultReference.Value.BrushType)?.LayerBrushDescriptor; } } diff --git a/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs b/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs index fd3c1f42d..0188dfba8 100644 --- a/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs +++ b/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs @@ -119,7 +119,7 @@ namespace Artemis.UI.Behaviors // If the selected item is a parent of this model - expand else { - bool isParentOfModel = HierarchyPredicate?.Invoke(SelectedItem, model) ?? true; + bool isParentOfModel = HierarchyPredicate?.Invoke(SelectedItem, model) ?? false; if (isParentOfModel) item.IsExpanded = true; } diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml index 7a2ba5afb..a949eee63 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml @@ -83,7 +83,7 @@ - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs index f9f9a629f..f4c5e1db5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs @@ -216,7 +216,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem public void PasteElement() { if (ProfileElement.Parent is Folder parent) - _profileEditorService.PasteProfileElement(parent, ProfileElement.Order); + _profileEditorService.PasteProfileElement(parent, ProfileElement.Order - 1); } public void UpdateProfileElements()