Browse Source

Merge branch 'master' into multiple-layers-selection

Krzysztof Krysiński 4 years ago
parent
commit
61892cf3e8

+ 2 - 0
PixiEditor/Models/Controllers/BitmapManager.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Diagnostics;
 using System.Linq;
 using System.Windows;
 using System.Windows.Input;
@@ -18,6 +19,7 @@ using PixiEditor.Models.Tools.ToolSettings.Settings;
 
 namespace PixiEditor.Models.Controllers
 {
+    [DebuggerDisplay("{Documents.Count} Document(s)")]
     public class BitmapManager : NotifyableObject
     {
         private Document activeDocument;

+ 2 - 0
PixiEditor/Models/Controllers/UndoManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Reflection;
 using PixiEditor.Models.Undo;
@@ -7,6 +8,7 @@ using PixiEditor.ViewModels;
 
 namespace PixiEditor.Models.Controllers
 {
+    [DebuggerDisplay("{UndoStack.Count} undo steps, {RedoStack.Count} redo step(s)")]
     public class UndoManager
     {
         private bool lastChangeWasUndo;

+ 2 - 0
PixiEditor/Models/DataHolders/Document/Document.cs

@@ -3,6 +3,7 @@ using System.Buffers;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Threading;
@@ -22,6 +23,7 @@ using PixiEditor.ViewModels;
 
 namespace PixiEditor.Models.DataHolders
 {
+    [DebuggerDisplay("'{Name, nq}' {width}x{height} {Layers.Count} Layer(s)")]
     public partial class Document : NotifyableObject
     {
         private int height;

+ 2 - 0
PixiEditor/Models/Layers/Layer.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Windows;
 using System.Windows.Media;
@@ -11,6 +12,7 @@ using PixiEditor.ViewModels;
 
 namespace PixiEditor.Models.Layers
 {
+    [DebuggerDisplay("'{name,nq}' {width}x{height}")]
     public class Layer : BasicLayer
     {
         private const int SizeOfArgb = 4;

+ 2 - 0
PixiEditor/Models/UserPreferences/PreferencesSettings.cs

@@ -1,11 +1,13 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using Newtonsoft.Json;
 using PixiEditor.ViewModels;
 
 namespace PixiEditor.Models.UserPreferences
 {
+    [DebuggerDisplay("{Preferences.Count + LocalPreferences.Count} Preference(s)")]
     public class PreferencesSettings : IPreferences
     {
         public static IPreferences Current => ViewModelMain.Current.Preferences;

+ 13 - 0
PixiEditor/ViewModels/SubViewModels/Main/DebugViewModel.cs

@@ -0,0 +1,13 @@
+using System.Diagnostics;
+using PixiEditor.Helpers;
+
+namespace PixiEditor.ViewModels.SubViewModels.Main
+{
+    public class DebugViewModel : SubViewModel<ViewModelMain>
+    {
+        public DebugViewModel(ViewModelMain owner)
+            : base(owner)
+        {
+        }
+    }
+}

+ 18 - 1
PixiEditor/ViewModels/ViewModelMain.cs

@@ -58,6 +58,10 @@ namespace PixiEditor.ViewModels
 
         public DiscordViewModel DiscordViewModel { get; set; }
 
+#if DEBUG
+        public DebugViewModel DebugSubViewModel { get; set; }
+#endif
+
         public BitmapManager BitmapManager { get; set; }
 
         public PixelChangesController ChangesController { get; set; }
@@ -66,6 +70,16 @@ namespace PixiEditor.ViewModels
 
         public IPreferences Preferences { get; set; }
 
+        public bool IsDebug
+        {
+            get =>
+#if DEBUG
+                true;
+#else
+                false;
+#endif
+        }
+
         public ViewModelMain(IServiceProvider services)
         {
             Current = this;
@@ -97,6 +111,9 @@ namespace PixiEditor.ViewModels
             DocumentSubViewModel = new DocumentViewModel(this);
             MiscSubViewModel = new MiscViewModel(this);
             DiscordViewModel = new DiscordViewModel(this, "764168193685979138");
+#if DEBUG
+            DebugSubViewModel = new DebugViewModel(this);
+#endif
 
             ShortcutController = new ShortcutController
             {
@@ -146,7 +163,7 @@ namespace PixiEditor.ViewModels
                     new Shortcut(Key.F2, LayersSubViewModel.RenameLayerCommand, BitmapManager.ActiveDocument?.ActiveLayerGuid),
 
                     // View
-                    new Shortcut(Key.OemTilde, ViewportSubViewModel.ToggleGridLinesCommand, modifier: ModifierKeys.Control)
+                    new Shortcut(Key.OemTilde, ViewportSubViewModel.ToggleGridLinesCommand, modifier: ModifierKeys.Control),
                 }
             };
             BitmapManager.PrimaryColor = ColorsSubViewModel.PrimaryColor;

+ 1 - 1
PixiEditor/Views/MainWindow.xaml

@@ -1,4 +1,4 @@
-<Window x:Class="PixiEditor.MainWindow" MinHeight="500" MinWidth="1100"
+<Window x:Class="PixiEditor.MainWindow" MinHeight="500" MinWidth="1100"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"