Browse Source

Fix most of the warnings from rider

Equbuxu 3 years ago
parent
commit
cef76c03dc
40 changed files with 111 additions and 160 deletions
  1. 8 8
      src/ChunkyImageLib/ChunkyImage.cs
  2. 6 5
      src/ChunkyImageLib/DataHolders/ShapeCorners.cs
  3. 2 2
      src/ChunkyImageLib/Operations/ChunkyImageOperation.cs
  4. 3 3
      src/ChunkyImageLib/Operations/EllipseOperation.cs
  5. 1 1
      src/ChunkyImageLib/Operations/OperationHelper.cs
  6. 1 1
      src/ChunkyImageLibTest/ChunkyImageTests.cs
  7. 1 1
      src/ChunkyImageLibTest/OperationHelperTests.cs
  8. 1 1
      src/ChunkyImageLibTest/RectITests.cs
  9. 1 1
      src/ChunkyImageLibTest/RectangleOperationTests.cs
  10. 1 7
      src/ChunkyImageLibVis/App.xaml.cs
  11. 1 1
      src/PixiEditor.ChangeableDocument.Gen/ChangeActionGenerator.cs
  12. 4 4
      src/PixiEditor.ChangeableDocument.Gen/UpdateableChangeActionGenerator.cs
  13. 1 3
      src/PixiEditor.ChangeableDocument/Actions/Undo/ChangeBoundary_Action.cs
  14. 1 3
      src/PixiEditor.ChangeableDocument/Actions/Undo/DeleteRecordedChanges_Action.cs
  15. 1 3
      src/PixiEditor.ChangeableDocument/Actions/Undo/Redo_Action.cs
  16. 1 3
      src/PixiEditor.ChangeableDocument/Actions/Undo/Undo_Action.cs
  17. 1 1
      src/PixiEditor.ChangeableDocument/Changes/Drawing/DrawRectangle_UpdateableChange.cs
  18. 17 18
      src/PixiEditor.ChangeableDocument/Changes/Drawing/FloodFill/FloodFillHelper.cs
  19. 0 2
      src/PixiEditor.ChangeableDocument/Changes/Drawing/PathBasedPen_UpdateableChange.cs
  20. 1 1
      src/PixiEditor.ChangeableDocument/Changes/Selection/SelectLasso_UpdateableChange.cs
  21. 3 3
      src/PixiEditor.ChangeableDocument/Changes/Structure/CreateStructureMember_Change.cs
  22. 1 1
      src/PixiEditor.ChangeableDocument/Changes/Structure/DeleteStructureMember_Change.cs
  23. 5 5
      src/PixiEditor.ChangeableDocument/DocumentChangeTracker.cs
  24. 5 7
      src/PixiEditor.ChangeableDocument/Rendering/ChunkRenderer.cs
  25. 1 4
      src/PixiEditor.Zoombox/ZoomDragOperation.cs
  26. 3 2
      src/PixiEditor.Zoombox/Zoombox.xaml.cs
  27. 10 0
      src/PixiEditorPrototype.sln.DotSettings
  28. 1 7
      src/PixiEditorPrototype/App.xaml.cs
  29. 1 1
      src/PixiEditorPrototype/Behaviors/SliderUpdateBehavior.cs
  30. 0 28
      src/PixiEditorPrototype/Converters/IndexToChunkResolutionConverter.cs
  31. 6 5
      src/PixiEditorPrototype/CustomControls/TransformOverlay/TransformOverlay.cs
  32. 10 11
      src/PixiEditorPrototype/CustomControls/TransformOverlay/TransformUpdateHelper.cs
  33. 1 1
      src/PixiEditorPrototype/Models/DocumentHelpers.cs
  34. 2 2
      src/PixiEditorPrototype/Models/Rendering/AffectedChunkGatherer.cs
  35. 1 3
      src/PixiEditorPrototype/Models/Rendering/WriteableBitmapUpdater.cs
  36. 3 3
      src/PixiEditorPrototype/RelayCommand.cs
  37. 2 2
      src/PixiEditorPrototype/ReverseOrderStackPanel.cs
  38. 3 4
      src/PixiEditorPrototype/ViewModels/DocumentViewModel.cs
  39. 0 1
      src/PixiEditorPrototype/ViewModels/ViewModelMain.cs
  40. 0 1
      src/PixiEditorPrototype/Views/MainWindow.xaml

+ 8 - 8
src/ChunkyImageLib/ChunkyImage.cs

@@ -79,7 +79,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
 
 
     private Dictionary<ChunkResolution, Dictionary<VecI, Chunk>> committedChunks;
     private Dictionary<ChunkResolution, Dictionary<VecI, Chunk>> committedChunks;
     private Dictionary<ChunkResolution, Dictionary<VecI, Chunk>> latestChunks;
     private Dictionary<ChunkResolution, Dictionary<VecI, Chunk>> latestChunks;
-    private Dictionary<ChunkResolution, Dictionary<VecI, LatestChunkData>> latestChunksData = new();
+    private Dictionary<ChunkResolution, Dictionary<VecI, LatestChunkData>> latestChunksData;
 
 
     public ChunkyImage(VecI size)
     public ChunkyImage(VecI size)
     {
     {
@@ -172,13 +172,13 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
 
 
             // combine with committed and then draw
             // combine with committed and then draw
             using var tempChunk = Chunk.Create(resolution);
             using var tempChunk = Chunk.Create(resolution);
-            tempChunk.Surface.SkiaSurface.Canvas.DrawSurface(committedChunk!.Surface.SkiaSurface, 0, 0, ReplacingPaint);
+            tempChunk.Surface.SkiaSurface.Canvas.DrawSurface(committedChunk.Surface.SkiaSurface, 0, 0, ReplacingPaint);
             blendModePaint.BlendMode = blendMode;
             blendModePaint.BlendMode = blendMode;
             tempChunk.Surface.SkiaSurface.Canvas.DrawSurface(latestChunk.AsT2.Surface.SkiaSurface, 0, 0, blendModePaint);
             tempChunk.Surface.SkiaSurface.Canvas.DrawSurface(latestChunk.AsT2.Surface.SkiaSurface, 0, 0, blendModePaint);
             if (lockTransparency)
             if (lockTransparency)
                 OperationHelper.ClampAlpha(tempChunk.Surface.SkiaSurface, committedChunk.Surface.SkiaSurface);
                 OperationHelper.ClampAlpha(tempChunk.Surface.SkiaSurface, committedChunk.Surface.SkiaSurface);
             tempChunk.DrawOnSurface(surface, pos, paint);
             tempChunk.DrawOnSurface(surface, pos, paint);
-
+            
             return true;
             return true;
         }
         }
     }
     }
@@ -620,7 +620,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
         }
         }
 
 
         // delete committed low res chunks that weren't updated
         // delete committed low res chunks that weren't updated
-        foreach (var (pos, chunk) in latestChunks[ChunkResolution.Full])
+        foreach (var (pos, _) in latestChunks[ChunkResolution.Full])
         {
         {
             foreach (var (resolution, _) in latestChunks)
             foreach (var (resolution, _) in latestChunks)
             {
             {
@@ -628,10 +628,10 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
                     continue;
                     continue;
                 if (!latestChunksData[resolution].TryGetValue(pos, out var halfChunk) || halfChunk.QueueProgress != queuedOperations.Count)
                 if (!latestChunksData[resolution].TryGetValue(pos, out var halfChunk) || halfChunk.QueueProgress != queuedOperations.Count)
                 {
                 {
-                    if (committedChunks[resolution].TryGetValue(pos, out var commitedLowResChunk))
+                    if (committedChunks[resolution].TryGetValue(pos, out var committedLowResChunk))
                     {
                     {
                         committedChunks[resolution].Remove(pos);
                         committedChunks[resolution].Remove(pos);
-                        commitedLowResChunk.Dispose();
+                        committedLowResChunk.Dispose();
                     }
                     }
                 }
                 }
             }
             }
@@ -907,13 +907,13 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
 
 
         // for low res chunks: full res version exists
         // for low res chunks: full res version exists
         Chunk? existingFullResChunk = MaybeGetCommittedChunk(chunkPos, ChunkResolution.Full);
         Chunk? existingFullResChunk = MaybeGetCommittedChunk(chunkPos, ChunkResolution.Full);
-        if (resolution != ChunkResolution.Full && existingFullResChunk is not null)
+        if (existingFullResChunk is not null)
         {
         {
             var newChunk = Chunk.Create(resolution);
             var newChunk = Chunk.Create(resolution);
             newChunk.Surface.SkiaSurface.Canvas.Save();
             newChunk.Surface.SkiaSurface.Canvas.Save();
             newChunk.Surface.SkiaSurface.Canvas.Scale((float)resolution.Multiplier());
             newChunk.Surface.SkiaSurface.Canvas.Scale((float)resolution.Multiplier());
 
 
-            newChunk.Surface.SkiaSurface.Canvas.DrawSurface(existingFullResChunk!.Surface.SkiaSurface, 0, 0, SmoothReplacingPaint);
+            newChunk.Surface.SkiaSurface.Canvas.DrawSurface(existingFullResChunk.Surface.SkiaSurface, 0, 0, SmoothReplacingPaint);
             newChunk.Surface.SkiaSurface.Canvas.Restore();
             newChunk.Surface.SkiaSurface.Canvas.Restore();
             committedChunks[resolution][chunkPos] = newChunk;
             committedChunks[resolution][chunkPos] = newChunk;
             return newChunk;
             return newChunk;

+ 6 - 5
src/ChunkyImageLib/DataHolders/ShapeCorners.cs

@@ -1,7 +1,7 @@
 namespace ChunkyImageLib.DataHolders;
 namespace ChunkyImageLib.DataHolders;
 public struct ShapeCorners
 public struct ShapeCorners
 {
 {
-    public ShapeCorners(VecD center, VecD size, double angle)
+    public ShapeCorners(VecD center, VecD size)
     {
     {
         TopLeft = center - size / 2;
         TopLeft = center - size / 2;
         TopRight = center + new VecD(size.X / 2, -size.Y / 2);
         TopRight = center + new VecD(size.X / 2, -size.Y / 2);
@@ -85,18 +85,19 @@ public struct ShapeCorners
         return crossTop == crossRight && crossTop == crossLeft && crossTop == crossBottom;
         return crossTop == crossRight && crossTop == crossLeft && crossTop == crossBottom;
     }
     }
 
 
-    public ShapeCorners AsMirroredAcrossHorAxis(int horAxisY) => this with
+    public ShapeCorners AsMirroredAcrossHorAxis(int horAxisY) => new ShapeCorners
     {
     {
         BottomLeft = BottomLeft.ReflectY(horAxisY),
         BottomLeft = BottomLeft.ReflectY(horAxisY),
         BottomRight = BottomRight.ReflectY(horAxisY),
         BottomRight = BottomRight.ReflectY(horAxisY),
         TopLeft = TopLeft.ReflectY(horAxisY),
         TopLeft = TopLeft.ReflectY(horAxisY),
-        TopRight = TopRight.ReflectY(horAxisY),
+        TopRight = TopRight.ReflectY(horAxisY)
     };
     };
-    public ShapeCorners AsMirroredAcrossVerAxis(int verAxisX) => this with
+    
+    public ShapeCorners AsMirroredAcrossVerAxis(int verAxisX) => new ShapeCorners
     {
     {
         BottomLeft = BottomLeft.ReflectX(verAxisX),
         BottomLeft = BottomLeft.ReflectX(verAxisX),
         BottomRight = BottomRight.ReflectX(verAxisX),
         BottomRight = BottomRight.ReflectX(verAxisX),
         TopLeft = TopLeft.ReflectX(verAxisX),
         TopLeft = TopLeft.ReflectX(verAxisX),
-        TopRight = TopRight.ReflectX(verAxisX),
+        TopRight = TopRight.ReflectX(verAxisX)
     };
     };
 }
 }

+ 2 - 2
src/ChunkyImageLib/Operations/ChunkyImageOperation.cs

@@ -40,12 +40,12 @@ internal class ChunkyImageOperation : IDrawOperation
         VecI chunkSize = chunk.PixelSize;
         VecI chunkSize = chunk.PixelSize;
         if (mirrorHorizontal)
         if (mirrorHorizontal)
         {
         {
-            chunk.Surface.SkiaSurface.Canvas.Scale(-1, 1, chunkSize.X / 2, chunkSize.Y / 2);
+            chunk.Surface.SkiaSurface.Canvas.Scale(-1, 1, chunkSize.X / 2f, chunkSize.Y / 2f);
             chunkCenterOnImage.X = -chunkCenterOnImage.X;
             chunkCenterOnImage.X = -chunkCenterOnImage.X;
         }
         }
         if (mirrorVertical)
         if (mirrorVertical)
         {
         {
-            chunk.Surface.SkiaSurface.Canvas.Scale(1, -1, chunkSize.X / 2, chunkSize.Y / 2);
+            chunk.Surface.SkiaSurface.Canvas.Scale(1, -1, chunkSize.X / 2f, chunkSize.Y / 2f);
             chunkCenterOnImage.Y = -chunkCenterOnImage.Y;
             chunkCenterOnImage.Y = -chunkCenterOnImage.Y;
         }
         }
 
 

+ 3 - 3
src/ChunkyImageLib/Operations/EllipseOperation.cs

@@ -6,12 +6,12 @@ internal class EllipseOperation : IDrawOperation
 {
 {
     public bool IgnoreEmptyChunks => false;
     public bool IgnoreEmptyChunks => false;
 
 
-    public readonly RectI location;
+    private readonly RectI location;
     private readonly SKColor strokeColor;
     private readonly SKColor strokeColor;
     private readonly SKColor fillColor;
     private readonly SKColor fillColor;
     private readonly int strokeWidth;
     private readonly int strokeWidth;
     private bool init = false;
     private bool init = false;
-    private SKPaint paint = new();
+    private readonly SKPaint paint = new();
     private SKPath? outerPath;
     private SKPath? outerPath;
     private SKPath? innerPath;
     private SKPath? innerPath;
     private SKPoint[]? ellipse;
     private SKPoint[]? ellipse;
@@ -112,7 +112,7 @@ internal class EllipseOperation : IDrawOperation
 
 
     public void Dispose()
     public void Dispose()
     {
     {
-        paint?.Dispose();
+        paint.Dispose();
         outerPath?.Dispose();
         outerPath?.Dispose();
         innerPath?.Dispose();
         innerPath?.Dispose();
     }
     }

+ 1 - 1
src/ChunkyImageLib/Operations/OperationHelper.cs

@@ -48,7 +48,7 @@ public static class OperationHelper
                         Half newR = (Half)(r * newA);
                         Half newR = (Half)(r * newA);
                         Half newG = (Half)(g * newA);
                         Half newG = (Half)(g * newA);
                         Half newB = (Half)(b * newA);
                         Half newB = (Half)(b * newA);
-                        *offset = ((long)*(ushort*)(&newR)) | ((long)*(ushort*)(&newG)) << 16 | ((long)*(ushort*)(&newB)) << 32 | ((long)*(ushort*)(refAlpha)) << 48;
+                        *offset = (*(ushort*)(&newR)) | ((long)*(ushort*)(&newG)) << 16 | ((long)*(ushort*)(&newB)) << 32 | ((long)*(ushort*)(refAlpha)) << 48;
                     }
                     }
                 }
                 }
             }
             }

+ 1 - 1
src/ChunkyImageLibTest/ChunkyImageTests.cs

@@ -13,7 +13,7 @@ public class ChunkyImageTests
         image.EnqueueDrawRectangle(new(new(5, 5), new(80, 80), 0, 2, SKColors.AliceBlue, SKColors.Snow));
         image.EnqueueDrawRectangle(new(new(5, 5), new(80, 80), 0, 2, SKColors.AliceBlue, SKColors.Snow));
         using (Chunk target = Chunk.Create())
         using (Chunk target = Chunk.Create())
         {
         {
-            image.DrawMostUpToDateChunkOn(new(0, 0), ChunkyImageLib.DataHolders.ChunkResolution.Full, target.Surface.SkiaSurface, VecI.Zero);
+            image.DrawMostUpToDateChunkOn(new(0, 0), ChunkResolution.Full, target.Surface.SkiaSurface, VecI.Zero);
             image.CancelChanges();
             image.CancelChanges();
             image.EnqueueResize(new(ChunkyImage.FullChunkSize * 4, ChunkyImage.FullChunkSize * 4));
             image.EnqueueResize(new(ChunkyImage.FullChunkSize * 4, ChunkyImage.FullChunkSize * 4));
             image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow, SKBlendMode.Multiply));
             image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow, SKBlendMode.Multiply));

+ 1 - 1
src/ChunkyImageLibTest/OperationHelperTests.cs

@@ -96,7 +96,7 @@ public class OperationHelperTests
     public void FindChunksTouchingEllipse_EllipseSpanningTwoChunks_FindsChunks()
     public void FindChunksTouchingEllipse_EllipseSpanningTwoChunks_FindsChunks()
     {
     {
         int cS = ChunkyImage.FullChunkSize;
         int cS = ChunkyImage.FullChunkSize;
-        var chunks = OperationHelper.FindChunksTouchingEllipse((cS, cS / 2), cS / 2, cS / 4, cS);
+        var chunks = OperationHelper.FindChunksTouchingEllipse((cS, cS / 2.0), cS / 2.0, cS / 4.0, cS);
         Assert.Equal(new HashSet<VecI>() { (0, 0), (1, 0) }, chunks);
         Assert.Equal(new HashSet<VecI>() { (0, 0), (1, 0) }, chunks);
     }
     }
 }
 }

+ 1 - 1
src/ChunkyImageLibTest/RectITests.cs

@@ -133,7 +133,7 @@ public class RectITests
         var rect1 = new RectI(new(4, 5), new(1, 1));
         var rect1 = new RectI(new(4, 5), new(1, 1));
         Assert.Equal(rect1, rect1.Standardize());
         Assert.Equal(rect1, rect1.Standardize());
         var rect2 = new RectI(new(-4, -5), new(1, 1));
         var rect2 = new RectI(new(-4, -5), new(1, 1));
-        Assert.Equal(rect1, rect1.Standardize());
+        Assert.Equal(rect2, rect2.Standardize());
     }
     }
 
 
     [Fact]
     [Fact]

+ 1 - 1
src/ChunkyImageLibTest/RectangleOperationTests.cs

@@ -109,7 +109,7 @@ public class RectangleOperationTests
     [Fact]
     [Fact]
     public void FindAffectedChunks_SmallButThick_FindsCorrectChunks()
     public void FindAffectedChunks_SmallButThick_FindsCorrectChunks()
     {
     {
-        var (x, y, w, h) = (chunkSize / 2 - 0.5, chunkSize / 2 - 0.5, 1, 1);
+        var (x, y, w, h) = (chunkSize / 2f - 0.5, chunkSize / 2f - 0.5, 1, 1);
         RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, SKColors.Black, SKColors.White));
         RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, SKColors.Black, SKColors.White));
 
 
         HashSet<VecI> expected = new() { new(0, 0) };
         HashSet<VecI> expected = new() { new(0, 0) };

+ 1 - 7
src/ChunkyImageLibVis/App.xaml.cs

@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
+using System.Windows;
 
 
 namespace ChunkyImageLibVis;
 namespace ChunkyImageLibVis;
 
 

+ 1 - 1
src/PixiEditor.ChangeableDocument.Gen/ChangeActionGenerator.cs

@@ -32,7 +32,7 @@ namespace PixiEditor.ChangeableDocument.Gen
 
 
             // generate action source code
             // generate action source code
             var actionSourceCodeProvider = contructorSymbolProvider.Select(
             var actionSourceCodeProvider = contructorSymbolProvider.Select(
-                static (constructor, cancelToken) =>
+                static (constructor, _) =>
                 {
                 {
                     var info = Helpers.ExtractMethodInfo(constructor!);
                     var info = Helpers.ExtractMethodInfo(constructor!);
                     return new NamedSourceCode(info.ContainingClass.NameWithNamespace + "MakeChangeAction", Helpers.CreateMakeChangeAction(info));
                     return new NamedSourceCode(info.ContainingClass.NameWithNamespace + "MakeChangeAction", Helpers.CreateMakeChangeAction(info));

+ 4 - 4
src/PixiEditor.ChangeableDocument.Gen/UpdateableChangeActionGenerator.cs

@@ -39,7 +39,7 @@ public class UpdateableChangeActionGenerator : IIncrementalGenerator
 
 
         // here we are sure we are inside an updateable change, time to find the update method
         // here we are sure we are inside an updateable change, time to find the update method
         MethodDeclarationSyntax? methodSyntax = null;
         MethodDeclarationSyntax? methodSyntax = null;
-        var members = containingClass.Members.Where(node => node is MethodDeclarationSyntax);
+        var members = containingClass.Members.Where(node => node is MethodDeclarationSyntax).ToList();
         const string errorMessage = $"Update method isn't marked with {UpdateMethodAttribute}";
         const string errorMessage = $"Update method isn't marked with {UpdateMethodAttribute}";
         if (!members.Any())
         if (!members.Any())
             return Result<(IMethodSymbol, IMethodSymbol, ClassDeclarationSyntax)>.Error
             return Result<(IMethodSymbol, IMethodSymbol, ClassDeclarationSyntax)>.Error
@@ -63,10 +63,10 @@ public class UpdateableChangeActionGenerator : IIncrementalGenerator
 
 
         // finally, get symbols
         // finally, get symbols
         var methodSymbol = context.SemanticModel.GetDeclaredSymbol(methodSyntax, cancelToken);
         var methodSymbol = context.SemanticModel.GetDeclaredSymbol(methodSyntax, cancelToken);
-        var contructorSymbol = context.SemanticModel.GetDeclaredSymbol(constructorSyntax, cancelToken);
-        if (contructorSymbol is not IMethodSymbol || methodSymbol is not IMethodSymbol)
+        var constructorSymbol = context.SemanticModel.GetDeclaredSymbol(constructorSyntax, cancelToken);
+        if (constructorSymbol is not IMethodSymbol || methodSymbol is not IMethodSymbol)
             return null;
             return null;
-        return ((IMethodSymbol)contructorSymbol, (IMethodSymbol)methodSymbol, containingClass);
+        return ((IMethodSymbol)constructorSymbol, (IMethodSymbol)methodSymbol, containingClass);
     }
     }
 
 
     private static Result<(NamedSourceCode, NamedSourceCode)> GenerateActions
     private static Result<(NamedSourceCode, NamedSourceCode)> GenerateActions

+ 1 - 3
src/PixiEditor.ChangeableDocument/Actions/Undo/ChangeBoundary_Action.cs

@@ -1,5 +1,3 @@
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 
 
-public record class ChangeBoundary_Action : IAction
-{
-}
+public record class ChangeBoundary_Action : IAction;

+ 1 - 3
src/PixiEditor.ChangeableDocument/Actions/Undo/DeleteRecordedChanges_Action.cs

@@ -1,5 +1,3 @@
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 
 
-public record class DeleteRecordedChanges_Action : IAction
-{
-}
+public record class DeleteRecordedChanges_Action : IAction;

+ 1 - 3
src/PixiEditor.ChangeableDocument/Actions/Undo/Redo_Action.cs

@@ -1,5 +1,3 @@
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 
 
-public record class Redo_Action : IAction
-{
-}
+public record class Redo_Action : IAction;

+ 1 - 3
src/PixiEditor.ChangeableDocument/Actions/Undo/Undo_Action.cs

@@ -1,5 +1,3 @@
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 namespace PixiEditor.ChangeableDocument.Actions.Undo;
 
 
-public record class Undo_Action : IAction
-{
-}
+public record class Undo_Action : IAction;

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changes/Drawing/DrawRectangle_UpdateableChange.cs

@@ -53,7 +53,7 @@ internal class DrawRectangle_UpdateableChange : UpdateableChange
     {
     {
         ChunkyImage targetImage = DrawingChangeHelper.GetTargetImageOrThrow(target, memberGuid, drawOnMask);
         ChunkyImage targetImage = DrawingChangeHelper.GetTargetImageOrThrow(target, memberGuid, drawOnMask);
         var affectedChunks = UpdateRectangle(target, targetImage);
         var affectedChunks = UpdateRectangle(target, targetImage);
-        storedChunks = new CommittedChunkStorage(targetImage, affectedChunks!);
+        storedChunks = new CommittedChunkStorage(targetImage, affectedChunks);
         targetImage.CommitChanges();
         targetImage.CommitChanges();
 
 
         ignoreInUndo = false;
         ignoreInUndo = false;

+ 17 - 18
src/PixiEditor.ChangeableDocument/Changes/Drawing/FloodFill/FloodFillHelper.cs

@@ -3,11 +3,10 @@ using ChunkyImageLib.Operations;
 using SkiaSharp;
 using SkiaSharp;
 
 
 namespace PixiEditor.ChangeableDocument.Changes.Drawing.FloodFill;
 namespace PixiEditor.ChangeableDocument.Changes.Drawing.FloodFill;
-internal class FloodFillHelper
+internal static class FloodFillHelper
 {
 {
-    private const byte NOT_VISITED = 0;
-    private const byte IN_SELECTION = 1;
-    private const byte VISITED = 2;
+    private const byte InSelection = 1;
+    private const byte Visited = 2;
 
 
     public static FloodFillChunkStorage FloodFill(ChunkyImage image, SKPath? selection, VecI startingPos, SKColor drawingColor)
     public static FloodFillChunkStorage FloodFill(ChunkyImage image, SKPath? selection, VecI startingPos, SKColor drawingColor)
     {
     {
@@ -25,7 +24,7 @@ internal class FloodFillHelper
 
 
         RectI globalSelectionBounds = (RectI?)selection?.TightBounds ?? new RectI(VecI.Zero, image.LatestSize);
         RectI globalSelectionBounds = (RectI?)selection?.TightBounds ?? new RectI(VecI.Zero, image.LatestSize);
 
 
-        // Premultiplies the color and convert it to floats. Since floats are inprecise, a range is used.
+        // Premultiplies the color and convert it to floats. Since floats are imprecise, a range is used.
         // Used for faster pixel checking
         // Used for faster pixel checking
         FloodFillColorRange colorRange = new(colorToReplace);
         FloodFillColorRange colorRange = new(colorToReplace);
         ulong uLongColor = ToULong(drawingColor);
         ulong uLongColor = ToULong(drawingColor);
@@ -68,13 +67,13 @@ internal class FloodFillHelper
                 continue;
                 continue;
             for (int i = 0; i < chunkSize; i++)
             for (int i = 0; i < chunkSize; i++)
             {
             {
-                if (chunkPos.Y > 0 && maybeArray[i] == VISITED)
+                if (chunkPos.Y > 0 && maybeArray[i] == Visited)
                     positionsToFloodFill.Push((new(chunkPos.X, chunkPos.Y - 1), new(i, chunkSize - 1)));
                     positionsToFloodFill.Push((new(chunkPos.X, chunkPos.Y - 1), new(i, chunkSize - 1)));
-                if (chunkPos.Y < imageSizeInChunks.Y - 1 && maybeArray[chunkSize * (chunkSize - 1) + i] == VISITED)
+                if (chunkPos.Y < imageSizeInChunks.Y - 1 && maybeArray[chunkSize * (chunkSize - 1) + i] == Visited)
                     positionsToFloodFill.Push((new(chunkPos.X, chunkPos.Y + 1), new(i, 0)));
                     positionsToFloodFill.Push((new(chunkPos.X, chunkPos.Y + 1), new(i, 0)));
-                if (chunkPos.X > 0 && maybeArray[i * chunkSize] == VISITED)
+                if (chunkPos.X > 0 && maybeArray[i * chunkSize] == Visited)
                     positionsToFloodFill.Push((new(chunkPos.X - 1, chunkPos.Y), new(chunkSize - 1, i)));
                     positionsToFloodFill.Push((new(chunkPos.X - 1, chunkPos.Y), new(chunkSize - 1, i)));
-                if (chunkPos.X < imageSizeInChunks.X - 1 && maybeArray[i * chunkSize + (chunkSize - 1)] == VISITED)
+                if (chunkPos.X < imageSizeInChunks.X - 1 && maybeArray[i * chunkSize + (chunkSize - 1)] == Visited)
                     positionsToFloodFill.Push((new(chunkPos.X + 1, chunkPos.Y), new(0, i)));
                     positionsToFloodFill.Push((new(chunkPos.X + 1, chunkPos.Y), new(0, i)));
             }
             }
         }
         }
@@ -93,7 +92,7 @@ internal class FloodFillHelper
         return result;
         return result;
     }
     }
 
 
-    private unsafe static bool IsWithinBounds(ref FloodFillColorRange bounds, Half* pixel)
+    private static unsafe bool IsWithinBounds(ref FloodFillColorRange bounds, Half* pixel)
     {
     {
         float r = (float)pixel[0];
         float r = (float)pixel[0];
         float g = (float)pixel[1];
         float g = (float)pixel[1];
@@ -138,22 +137,22 @@ internal class FloodFillHelper
             int pixelOffset = curPos.X + curPos.Y * chunkSize;
             int pixelOffset = curPos.X + curPos.Y * chunkSize;
             Half* pixel = array + pixelOffset * 4;
             Half* pixel = array + pixelOffset * 4;
             *(ulong*)pixel = colorBits;
             *(ulong*)pixel = colorBits;
-            pixelStates[pixelOffset] = VISITED;
+            pixelStates[pixelOffset] = Visited;
 
 
-            if (curPos.X > 0 && pixelStates[pixelOffset - 1] == IN_SELECTION && IsWithinBounds(ref bounds, pixel - 4))
+            if (curPos.X > 0 && pixelStates[pixelOffset - 1] == InSelection && IsWithinBounds(ref bounds, pixel - 4))
                 toVisit.Push(new(curPos.X - 1, curPos.Y));
                 toVisit.Push(new(curPos.X - 1, curPos.Y));
-            if (curPos.X < chunkSize - 1 && pixelStates[pixelOffset + 1] == IN_SELECTION && IsWithinBounds(ref bounds, pixel + 4))
+            if (curPos.X < chunkSize - 1 && pixelStates[pixelOffset + 1] == InSelection && IsWithinBounds(ref bounds, pixel + 4))
                 toVisit.Push(new(curPos.X + 1, curPos.Y));
                 toVisit.Push(new(curPos.X + 1, curPos.Y));
-            if (curPos.Y > 0 && pixelStates[pixelOffset - chunkSize] == IN_SELECTION && IsWithinBounds(ref bounds, pixel - 4 * chunkSize))
+            if (curPos.Y > 0 && pixelStates[pixelOffset - chunkSize] == InSelection && IsWithinBounds(ref bounds, pixel - 4 * chunkSize))
                 toVisit.Push(new(curPos.X, curPos.Y - 1));
                 toVisit.Push(new(curPos.X, curPos.Y - 1));
-            if (curPos.Y < chunkSize - 1 && pixelStates[pixelOffset + chunkSize] == IN_SELECTION && IsWithinBounds(ref bounds, pixel + 4 * chunkSize))
+            if (curPos.Y < chunkSize - 1 && pixelStates[pixelOffset + chunkSize] == InSelection && IsWithinBounds(ref bounds, pixel + 4 * chunkSize))
                 toVisit.Push(new(curPos.X, curPos.Y + 1));
                 toVisit.Push(new(curPos.X, curPos.Y + 1));
         }
         }
         return pixelStates;
         return pixelStates;
     }
     }
 
 
     /// <summary>
     /// <summary>
-    /// Use skia to set all pixels in array that are inside selection to IN_SELECTION
+    /// Use skia to set all pixels in array that are inside selection to InSelection
     /// </summary>
     /// </summary>
     private static unsafe void DrawSelection(byte[] array, SKPath? selection, RectI globalBounds, VecI chunkPos, int chunkSize)
     private static unsafe void DrawSelection(byte[] array, SKPath? selection, RectI globalBounds, VecI chunkPos, int chunkSize)
     {
     {
@@ -161,7 +160,7 @@ internal class FloodFillHelper
         {
         {
             fixed (byte* arr = array)
             fixed (byte* arr = array)
             {
             {
-                Unsafe.InitBlockUnaligned(arr, IN_SELECTION, (uint)(chunkSize * chunkSize));
+                Unsafe.InitBlockUnaligned(arr, InSelection, (uint)(chunkSize * chunkSize));
             }
             }
             return;
             return;
         }
         }
@@ -177,7 +176,7 @@ internal class FloodFillHelper
             using SKSurface drawingSurface = SKSurface.Create(
             using SKSurface drawingSurface = SKSurface.Create(
                 new SKImageInfo(localBounds.Right, localBounds.Bottom, SKColorType.Gray8, SKAlphaType.Opaque), (IntPtr)arr, chunkSize);
                 new SKImageInfo(localBounds.Right, localBounds.Bottom, SKColorType.Gray8, SKAlphaType.Opaque), (IntPtr)arr, chunkSize);
             drawingSurface.Canvas.ClipPath(shiftedSelection);
             drawingSurface.Canvas.ClipPath(shiftedSelection);
-            drawingSurface.Canvas.Clear(new SKColor(IN_SELECTION, IN_SELECTION, IN_SELECTION));
+            drawingSurface.Canvas.Clear(new SKColor(InSelection, InSelection, InSelection));
             drawingSurface.Canvas.Flush();
             drawingSurface.Canvas.Flush();
         }
         }
     }
     }

+ 0 - 2
src/PixiEditor.ChangeableDocument/Changes/Drawing/PathBasedPen_UpdateableChange.cs

@@ -75,7 +75,6 @@ internal class PathBasedPen_UpdateableChange : UpdateableChange
         var (mid, _) = FindCubicPoints(points[^3], points[^2], points[^1], points[^1]);
         var (mid, _) = FindCubicPoints(points[^3], points[^2], points[^1], points[^1]);
         tempPath.MoveTo((SKPoint)points[^2]);
         tempPath.MoveTo((SKPoint)points[^2]);
         tempPath.QuadTo((SKPoint)mid, (SKPoint)points[^1]);
         tempPath.QuadTo((SKPoint)mid, (SKPoint)points[^1]);
-        return;
     }
     }
 
 
     private void UpdateTempPath(int pointsCount)
     private void UpdateTempPath(int pointsCount)
@@ -97,7 +96,6 @@ internal class PathBasedPen_UpdateableChange : UpdateableChange
         var (mid1, mid2) = FindCubicPoints(points[pointsCount - 4], points[pointsCount - 3], points[pointsCount - 2], points[pointsCount - 1]);
         var (mid1, mid2) = FindCubicPoints(points[pointsCount - 4], points[pointsCount - 3], points[pointsCount - 2], points[pointsCount - 1]);
         tempPath.MoveTo((SKPoint)points[pointsCount - 3]);
         tempPath.MoveTo((SKPoint)points[pointsCount - 3]);
         tempPath.CubicTo((SKPoint)mid1, (SKPoint)mid2, (SKPoint)points[pointsCount - 2]);
         tempPath.CubicTo((SKPoint)mid1, (SKPoint)mid2, (SKPoint)points[pointsCount - 2]);
-        return;
     }
     }
 
 
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, out bool ignoreInUndo)
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, out bool ignoreInUndo)

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changes/Selection/SelectLasso_UpdateableChange.cs

@@ -66,6 +66,6 @@ internal class SelectLasso_UpdateableChange : UpdateableChange
     public override void Dispose()
     public override void Dispose()
     {
     {
         originalPath?.Dispose();
         originalPath?.Dispose();
-        path?.Dispose();
+        path.Dispose();
     }
     }
 }
 }

+ 3 - 3
src/PixiEditor.ChangeableDocument/Changes/Structure/CreateStructureMember_Change.cs

@@ -51,10 +51,10 @@ internal class CreateStructureMember_Change : Change
 
 
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Revert(Document document)
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Revert(Document document)
     {
     {
-        var folder = (Folder)document.FindMemberOrThrow(parentFolderGuid);
-        var child = document.FindMemberOrThrow(newMemberGuid);
+        Folder folder = (Folder)document.FindMemberOrThrow(parentFolderGuid);
+        StructureMember child = document.FindMemberOrThrow(newMemberGuid);
         child.Dispose();
         child.Dispose();
-        folder.Children = folder.Children.RemoveAt(folder.Children.FindIndex(child => child.GuidValue == newMemberGuid));
+        folder.Children = folder.Children.RemoveAt(folder.Children.FindIndex(member => member.GuidValue == newMemberGuid));
 
 
         return new DeleteStructureMember_ChangeInfo(newMemberGuid, parentFolderGuid);
         return new DeleteStructureMember_ChangeInfo(newMemberGuid, parentFolderGuid);
     }
     }

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changes/Structure/DeleteStructureMember_Change.cs

@@ -47,7 +47,7 @@ internal class DeleteStructureMember_Change : Change
             Layer => CreateLayer_ChangeInfo.FromLayer(parentGuid, originalIndex, (Layer)copy),
             Layer => CreateLayer_ChangeInfo.FromLayer(parentGuid, originalIndex, (Layer)copy),
             Folder => CreateFolder_ChangeInfo.FromFolder(parentGuid, originalIndex, (Folder)copy),
             Folder => CreateFolder_ChangeInfo.FromFolder(parentGuid, originalIndex, (Folder)copy),
             _ => throw new NotSupportedException(),
             _ => throw new NotSupportedException(),
-        }; ;
+        };
     }
     }
 
 
     public override void Dispose()
     public override void Dispose()

+ 5 - 5
src/PixiEditor.ChangeableDocument/DocumentChangeTracker.cs

@@ -4,7 +4,7 @@ using PixiEditor.ChangeableDocument.Actions.Undo;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
 using PixiEditor.ChangeableDocument.Changes;
 using PixiEditor.ChangeableDocument.Changes;
 
 
-namespace ChangeableDocument;
+namespace PixiEditor.ChangeableDocument;
 
 
 public class DocumentChangeTracker : IDisposable
 public class DocumentChangeTracker : IDisposable
 {
 {
@@ -133,7 +133,7 @@ public class DocumentChangeTracker : IDisposable
             changePacket[i].Apply(document, out _).Switch(
             changePacket[i].Apply(document, out _).Switch(
                 (None _) => { },
                 (None _) => { },
                 (IChangeInfo info) => changeInfos.Add(info),
                 (IChangeInfo info) => changeInfos.Add(info),
-                (List<IChangeInfo> infos) => changeInfos.AddRange(infos)); ;
+                (List<IChangeInfo> infos) => changeInfos.AddRange(infos));
         }
         }
 
 
         undoStack.Push(changePacket);
         undoStack.Push(changePacket);
@@ -232,7 +232,7 @@ public class DocumentChangeTracker : IDisposable
         void AddInfo(OneOf<None, IChangeInfo, List<IChangeInfo>> info) =>
         void AddInfo(OneOf<None, IChangeInfo, List<IChangeInfo>> info) =>
             info.Switch(
             info.Switch(
                 static (None _) => { },
                 static (None _) => { },
-                (IChangeInfo info) => changeInfos.Add(info),
+                (IChangeInfo changeInfo) => changeInfos.Add(changeInfo),
                 (List<IChangeInfo> infos) => changeInfos.AddRange(infos));
                 (List<IChangeInfo> infos) => changeInfos.AddRange(infos));
 
 
         foreach (var action in actions)
         foreach (var action in actions)
@@ -248,10 +248,10 @@ public class DocumentChangeTracker : IDisposable
                 case IEndChangeAction act:
                 case IEndChangeAction act:
                     AddInfo(ProcessEndChangeAction(act));
                     AddInfo(ProcessEndChangeAction(act));
                     break;
                     break;
-                case Undo_Action act:
+                case Undo_Action:
                     AddInfo(Undo());
                     AddInfo(Undo());
                     break;
                     break;
-                case Redo_Action act:
+                case Redo_Action:
                     AddInfo(Redo());
                     AddInfo(Redo());
                     break;
                     break;
                 case ChangeBoundary_Action:
                 case ChangeBoundary_Action:

+ 5 - 7
src/PixiEditor.ChangeableDocument/Rendering/ChunkRenderer.cs

@@ -6,19 +6,18 @@ namespace PixiEditor.ChangeableDocument.Rendering;
 
 
 public static class ChunkRenderer
 public static class ChunkRenderer
 {
 {
-    private static SKPaint ReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src };
-    private static SKPaint ClippingPaint = new SKPaint() { BlendMode = SKBlendMode.DstIn };
+    private static readonly SKPaint ClippingPaint = new SKPaint() { BlendMode = SKBlendMode.DstIn };
 
 
     public static OneOf<Chunk, EmptyChunk> MergeWholeStructure(VecI pos, ChunkResolution resolution, IReadOnlyFolder root)
     public static OneOf<Chunk, EmptyChunk> MergeWholeStructure(VecI pos, ChunkResolution resolution, IReadOnlyFolder root)
     {
     {
-        using (RenderingContext context = new())
-            return MergeFolderContents(context, pos, resolution, root, new All());
+        using RenderingContext context = new();
+        return MergeFolderContents(context, pos, resolution, root, new All());
     }
     }
 
 
     public static OneOf<Chunk, EmptyChunk> MergeChosenMembers(VecI pos, ChunkResolution resolution, IReadOnlyFolder root, HashSet<Guid> members)
     public static OneOf<Chunk, EmptyChunk> MergeChosenMembers(VecI pos, ChunkResolution resolution, IReadOnlyFolder root, HashSet<Guid> members)
     {
     {
-        using (RenderingContext context = new())
-            return MergeFolderContents(context, pos, resolution, root, members);
+        using RenderingContext context = new();
+        return MergeFolderContents(context, pos, resolution, root, members);
     }
     }
 
 
     private static OneOf<EmptyChunk, Chunk> RenderLayerWithMask
     private static OneOf<EmptyChunk, Chunk> RenderLayerWithMask
@@ -209,7 +208,6 @@ public static class ChunkRenderer
                 {
                 {
                     RenderFolder(context, targetChunk, chunkPos, resolution, innerFolder, clippingChunk, innerMembersToMerge);
                     RenderFolder(context, targetChunk, chunkPos, resolution, innerFolder, clippingChunk, innerMembersToMerge);
                 }
                 }
-                continue;
             }
             }
         }
         }
         if (clippingChunk.IsT2)
         if (clippingChunk.IsT2)

+ 1 - 4
src/PixiEditor.Zoombox/ZoomDragOperation.cs

@@ -6,9 +6,7 @@ namespace PixiEditor.Zoombox;
 
 
 internal class ZoomDragOperation : IDragOperation
 internal class ZoomDragOperation : IDragOperation
 {
 {
-    private Zoombox parent;
-
-    private double initScale;
+    private readonly Zoombox parent;
 
 
     private VecD scaleOrigin;
     private VecD scaleOrigin;
     private VecD screenScaleOrigin;
     private VecD screenScaleOrigin;
@@ -21,7 +19,6 @@ internal class ZoomDragOperation : IDragOperation
     {
     {
         screenScaleOrigin = parent.ToZoomboxSpace(Zoombox.ToVecD(e.GetPosition(parent.mainCanvas)));
         screenScaleOrigin = parent.ToZoomboxSpace(Zoombox.ToVecD(e.GetPosition(parent.mainCanvas)));
         scaleOrigin = parent.ToZoomboxSpace(screenScaleOrigin);
         scaleOrigin = parent.ToZoomboxSpace(screenScaleOrigin);
-        initScale = parent.Scale;
         parent.mainCanvas.CaptureMouse();
         parent.mainCanvas.CaptureMouse();
     }
     }
 
 

+ 3 - 2
src/PixiEditor.Zoombox/Zoombox.xaml.cs

@@ -318,9 +318,10 @@ public partial class Zoombox : ContentControl, INotifyPropertyChanged
 
 
     private void OnScroll(object sender, MouseWheelEventArgs e)
     private void OnScroll(object sender, MouseWheelEventArgs e)
     {
     {
-        for (int i = 0; i < Math.Abs(e.Delta / 100); i++)
+        double abs = Math.Abs(e.Delta / 100.0);
+        for (int i = 0; i < abs; i++)
         {
         {
-            ZoomInto(ToVecD(e.GetPosition(mainCanvas)), e.Delta / 100);
+            ZoomInto(ToVecD(e.GetPosition(mainCanvas)), e.Delta / 100.0);
         }
         }
     }
     }
 
 

+ 10 - 0
src/PixiEditorPrototype.sln.DotSettings

@@ -0,0 +1,10 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CompareOfFloatsByEqualityOperator/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalVariableHidesMember/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ParameterHidesMember/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArgumentDefaultValue/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantDefaultMemberInitializer/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantExtendsListEntry/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantNamespaceAlias/@EntryIndexedValue">SUGGESTION</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
+	<s:Boolean x:Key="/Default/UserDictionary/Words/=Zoombox/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

+ 1 - 7
src/PixiEditorPrototype/App.xaml.cs

@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
+using System.Windows;
 
 
 namespace PixiEditorPrototype;
 namespace PixiEditorPrototype;
 
 

+ 1 - 1
src/PixiEditorPrototype/Behaviors/SliderUpdateBehavior.cs

@@ -87,7 +87,7 @@ internal class SliderUpdateBehavior : Behavior<Slider>
     private void Thumb_DragCompleted(object sender, DragCompletedEventArgs e)
     private void Thumb_DragCompleted(object sender, DragCompletedEventArgs e)
     {
     {
         dragging = false;
         dragging = false;
-        if (valueChangedWhileDragging == true && DragEnded is not null && DragEnded.CanExecute(null))
+        if (valueChangedWhileDragging && DragEnded is not null && DragEnded.CanExecute(null))
             DragEnded.Execute(null);
             DragEnded.Execute(null);
         valueChangedWhileDragging = false;
         valueChangedWhileDragging = false;
     }
     }

+ 0 - 28
src/PixiEditorPrototype/Converters/IndexToChunkResolutionConverter.cs

@@ -1,28 +0,0 @@
-using ChunkyImageLib.DataHolders;
-using System;
-using System.Globalization;
-using System.Windows.Data;
-
-namespace PixiEditorPrototype.Converters;
-
-internal class IndexToChunkResolutionConverter : IValueConverter
-{
-    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
-    {
-        throw new NotImplementedException();
-    }
-
-    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
-    {
-        if (value is not int res)
-            return ChunkResolution.Full;
-        return res switch
-        {
-            0 => ChunkResolution.Full,
-            1 => ChunkResolution.Half,
-            2 => ChunkResolution.Quarter,
-            3 => ChunkResolution.Eighth,
-            _ => ChunkResolution.Full
-        };
-    }
-}

+ 6 - 5
src/PixiEditorPrototype/CustomControls/TransformOverlay/TransformOverlay.cs

@@ -9,15 +9,15 @@ namespace PixiEditorPrototype.CustomControls.TransformOverlay;
 
 
 internal class TransformOverlay : Control
 internal class TransformOverlay : Control
 {
 {
-    public static DependencyProperty RequestedCornersProperty =
+    public static readonly DependencyProperty RequestedCornersProperty =
         DependencyProperty.Register(nameof(RequestedCorners), typeof(ShapeCorners), typeof(TransformOverlay),
         DependencyProperty.Register(nameof(RequestedCorners), typeof(ShapeCorners), typeof(TransformOverlay),
-            new FrameworkPropertyMetadata(default(ShapeCorners), FrameworkPropertyMetadataOptions.AffectsRender, new(OnRequestedCorners)));
+            new FrameworkPropertyMetadata(default(ShapeCorners), FrameworkPropertyMetadataOptions.AffectsRender, OnRequestedCorners));
 
 
-    public static DependencyProperty CornersProperty =
+    public static readonly DependencyProperty CornersProperty =
         DependencyProperty.Register(nameof(Corners), typeof(ShapeCorners), typeof(TransformOverlay),
         DependencyProperty.Register(nameof(Corners), typeof(ShapeCorners), typeof(TransformOverlay),
             new FrameworkPropertyMetadata(default(ShapeCorners), FrameworkPropertyMetadataOptions.AffectsRender));
             new FrameworkPropertyMetadata(default(ShapeCorners), FrameworkPropertyMetadataOptions.AffectsRender));
 
 
-    public static DependencyProperty ZoomboxScaleProperty =
+    public static readonly DependencyProperty ZoomboxScaleProperty =
         DependencyProperty.Register(nameof(ZoomboxScale), typeof(double), typeof(TransformOverlay),
         DependencyProperty.Register(nameof(ZoomboxScale), typeof(double), typeof(TransformOverlay),
             new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsRender));
             new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsRender));
 
 
@@ -206,7 +206,8 @@ internal class TransformOverlay : Control
             HandleCapturedAnchorMovement(e);
             HandleCapturedAnchorMovement(e);
             return;
             return;
         }
         }
-        else if (isMoving)
+
+        if (isMoving)
         {
         {
             var pos = TransformHelper.ToVecD(e.GetPosition(this));
             var pos = TransformHelper.ToVecD(e.GetPosition(this));
             var delta = pos - mousePosOnStartMove;
             var delta = pos - mousePosOnStartMove;

+ 10 - 11
src/PixiEditorPrototype/CustomControls/TransformOverlay/TransformUpdateHelper.cs

@@ -15,9 +15,9 @@ internal static class TransformUpdateHelper
 
 
         if (freedom is TransformCornerFreedom.ScaleProportionally or TransformCornerFreedom.Scale)
         if (freedom is TransformCornerFreedom.ScaleProportionally or TransformCornerFreedom.Scale)
         {
         {
-            var targetPos = TransformHelper.GetAnchorPosition(corners, targetCorner);
-            var opposite = TransformHelper.GetOpposite(targetCorner);
-            var oppositePos = TransformHelper.GetAnchorPosition(corners, opposite);
+            VecD targetPos = TransformHelper.GetAnchorPosition(corners, targetCorner);
+            Anchor opposite = TransformHelper.GetOpposite(targetCorner);
+            VecD oppositePos = TransformHelper.GetAnchorPosition(corners, opposite);
 
 
             if (freedom == TransformCornerFreedom.ScaleProportionally)
             if (freedom == TransformCornerFreedom.ScaleProportionally)
             {
             {
@@ -25,14 +25,14 @@ internal static class TransformUpdateHelper
                 desiredPos = desiredPos.ProjectOntoLine(oppositePos, oppositePos + VecD.FromAngleAndLength(correctAngle, 1));
                 desiredPos = desiredPos.ProjectOntoLine(oppositePos, oppositePos + VecD.FromAngleAndLength(correctAngle, 1));
             }
             }
 
 
-            var (leftNeighbor, rightNeighbor) = TransformHelper.GetNeighboringCorners(targetCorner);
-            var leftNeighborPos = TransformHelper.GetAnchorPosition(corners, leftNeighbor);
-            var rightNeighborPos = TransformHelper.GetAnchorPosition(corners, rightNeighbor);
+            (Anchor leftNeighbor, Anchor rightNeighbor) = TransformHelper.GetNeighboringCorners(targetCorner);
+            VecD leftNeighborPos = TransformHelper.GetAnchorPosition(corners, leftNeighbor);
+            VecD rightNeighborPos = TransformHelper.GetAnchorPosition(corners, rightNeighbor);
 
 
             double angle = corners.RectRotation;
             double angle = corners.RectRotation;
-            var targetTrans = (targetPos - oppositePos).Rotate(-angle);
-            var leftNeighTrans = (leftNeighborPos - oppositePos).Rotate(-angle);
-            var rightNeighTrans = (rightNeighborPos - oppositePos).Rotate(-angle);
+            VecD targetTrans = (targetPos - oppositePos).Rotate(-angle);
+            VecD leftNeighTrans = (leftNeighborPos - oppositePos).Rotate(-angle);
+            VecD rightNeighTrans = (rightNeighborPos - oppositePos).Rotate(-angle);
 
 
             VecD delta = (desiredPos - targetPos).Rotate(-angle);
             VecD delta = (desiredPos - targetPos).Rotate(-angle);
 
 
@@ -48,8 +48,7 @@ internal static class TransformUpdateHelper
 
 
         if (freedom == TransformCornerFreedom.Free)
         if (freedom == TransformCornerFreedom.Free)
         {
         {
-            var targetPos = TransformHelper.GetAnchorPosition(corners, targetCorner);
-            var newCorners = TransformHelper.UpdateCorner(corners, targetCorner, desiredPos);
+            ShapeCorners newCorners = TransformHelper.UpdateCorner(corners, targetCorner, desiredPos);
             return newCorners.IsLegal ? newCorners : null;
             return newCorners.IsLegal ? newCorners : null;
         }
         }
         throw new ArgumentException($"Freedom degree {freedom} is not supported");
         throw new ArgumentException($"Freedom degree {freedom} is not supported");

+ 1 - 1
src/PixiEditorPrototype/Models/DocumentHelpers.cs

@@ -1,4 +1,4 @@
-using ChangeableDocument;
+using PixiEditor.ChangeableDocument;
 using PixiEditorPrototype.ViewModels;
 using PixiEditorPrototype.ViewModels;
 
 
 namespace PixiEditorPrototype.Models;
 namespace PixiEditorPrototype.Models;

+ 2 - 2
src/PixiEditorPrototype/Models/Rendering/AffectedChunkGatherer.cs

@@ -1,8 +1,8 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using ChangeableDocument;
 using ChunkyImageLib;
 using ChunkyImageLib;
 using ChunkyImageLib.DataHolders;
 using ChunkyImageLib.DataHolders;
+using PixiEditor.ChangeableDocument;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
 using PixiEditor.ChangeableDocument.ChangeInfos;
 using PixiEditor.ChangeableDocument.ChangeInfos;
 using PixiEditor.ChangeableDocument.ChangeInfos.Drawing;
 using PixiEditor.ChangeableDocument.ChangeInfos.Drawing;
@@ -59,7 +59,7 @@ internal class AffectedChunkGatherer
                     if (info.ParentFromGuid != info.ParentToGuid)
                     if (info.ParentFromGuid != info.ParentToGuid)
                         AddWholeCanvasToImagePreviews(info.ParentFromGuid);
                         AddWholeCanvasToImagePreviews(info.ParentFromGuid);
                     break;
                     break;
-                case Size_ChangeInfo info:
+                case Size_ChangeInfo:
                     AddWholeCanvasToMainImage();
                     AddWholeCanvasToMainImage();
                     AddWholeCanvasToEveryImagePreview();
                     AddWholeCanvasToEveryImagePreview();
                     AddWholeCanvasToEveryMaskPreview();
                     AddWholeCanvasToEveryMaskPreview();

+ 1 - 3
src/PixiEditorPrototype/Models/Rendering/WriteableBitmapUpdater.cs

@@ -18,10 +18,8 @@ internal class WriteableBitmapUpdater
     private readonly DocumentViewModel doc;
     private readonly DocumentViewModel doc;
     private readonly DocumentHelpers helpers;
     private readonly DocumentHelpers helpers;
 
 
-    private static readonly SKPaint BlendingPaint = new SKPaint() { BlendMode = SKBlendMode.SrcOver };
     private static readonly SKPaint ReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src };
     private static readonly SKPaint ReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src };
     private static readonly SKPaint SmoothReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src, FilterQuality = SKFilterQuality.Medium, IsAntialias = true };
     private static readonly SKPaint SmoothReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src, FilterQuality = SKFilterQuality.Medium, IsAntialias = true };
-    private static readonly SKPaint SelectionPaint = new SKPaint() { BlendMode = SKBlendMode.SrcOver, Color = new(0xa0FFFFFF) };
     private static readonly SKPaint ClearPaint = new SKPaint() { BlendMode = SKBlendMode.Src, Color = SKColors.Transparent };
     private static readonly SKPaint ClearPaint = new SKPaint() { BlendMode = SKBlendMode.Src, Color = SKColors.Transparent };
 
 
     private readonly Dictionary<ChunkResolution, HashSet<VecI>> globalPostponedChunks = new()
     private readonly Dictionary<ChunkResolution, HashSet<VecI>> globalPostponedChunks = new()
@@ -218,7 +216,7 @@ internal class WriteableBitmapUpdater
                 screenSurface.Canvas.DrawSurface(chunk.Surface.SkiaSurface, chunkPos.Multiply(chunk.PixelSize), ReplacingPaint);
                 screenSurface.Canvas.DrawSurface(chunk.Surface.SkiaSurface, chunkPos.Multiply(chunk.PixelSize), ReplacingPaint);
                 chunk.Dispose();
                 chunk.Dispose();
             },
             },
-            (EmptyChunk chunk) =>
+            (EmptyChunk _) =>
             {
             {
                 var pos = chunkPos * resolution.PixelSize();
                 var pos = chunkPos * resolution.PixelSize();
                 screenSurface.Canvas.DrawRect(pos.X, pos.Y, resolution.PixelSize(), resolution.PixelSize(), ClearPaint);
                 screenSurface.Canvas.DrawRect(pos.X, pos.Y, resolution.PixelSize(), resolution.PixelSize(), ClearPaint);

+ 3 - 3
src/PixiEditorPrototype/RelayCommand.cs

@@ -7,8 +7,8 @@ internal class RelayCommand : ICommand
 {
 {
     public event EventHandler? CanExecuteChanged;
     public event EventHandler? CanExecuteChanged;
 
 
-    private Action<object?> execute;
-    private Func<object?, bool>? canExecute;
+    private readonly Action<object?> execute;
+    private readonly Func<object?, bool>? canExecute;
 
 
     public RelayCommand(Action<object?> execute, Func<object?, bool> canExecute)
     public RelayCommand(Action<object?> execute, Func<object?, bool> canExecute)
     {
     {
@@ -33,6 +33,6 @@ internal class RelayCommand : ICommand
 
 
     public void Execute(object? parameter)
     public void Execute(object? parameter)
     {
     {
-        execute?.Invoke(parameter);
+        execute.Invoke(parameter);
     }
     }
 }
 }

+ 2 - 2
src/PixiEditorPrototype/ReverseOrderStackPanel.cs

@@ -13,8 +13,8 @@ public class ReversedOrderStackPanel : StackPanel
         Rect rcChild = new Rect(arrangeSize);
         Rect rcChild = new Rect(arrangeSize);
         double previousChildSize = 0.0;
         double previousChildSize = 0.0;
 
 
-        System.Collections.Generic.IEnumerable<UIElement> children = InternalChildren.Cast<UIElement>().Reverse();
-        foreach (UIElement child in children)
+        System.Collections.Generic.IEnumerable<UIElement?> children = InternalChildren.Cast<UIElement?>().Reverse();
+        foreach (UIElement? child in children)
         {
         {
             if (child is null)
             if (child is null)
                 continue;
                 continue;

+ 3 - 4
src/PixiEditorPrototype/ViewModels/DocumentViewModel.cs

@@ -27,7 +27,6 @@ internal class DocumentViewModel : INotifyPropertyChanged
     public RelayCommand? CreateNewLayerCommand { get; }
     public RelayCommand? CreateNewLayerCommand { get; }
     public RelayCommand? CreateNewFolderCommand { get; }
     public RelayCommand? CreateNewFolderCommand { get; }
     public RelayCommand? DeleteStructureMemberCommand { get; }
     public RelayCommand? DeleteStructureMemberCommand { get; }
-    public RelayCommand? ChangeSelectedItemCommand { get; }
     public RelayCommand? ResizeCanvasCommand { get; }
     public RelayCommand? ResizeCanvasCommand { get; }
     public RelayCommand? CombineCommand { get; }
     public RelayCommand? CombineCommand { get; }
     public RelayCommand? ClearHistoryCommand { get; }
     public RelayCommand? ClearHistoryCommand { get; }
@@ -300,7 +299,7 @@ internal class DocumentViewModel : INotifyPropertyChanged
 
 
     private void ClipToMemberBelow(object? obj)
     private void ClipToMemberBelow(object? obj)
     {
     {
-        if (updateableChangeActive || FindFirstSelectedMember() is not StructureMemberViewModel member)
+        if (updateableChangeActive || FindFirstSelectedMember() is not { } member)
             return;
             return;
         member.ClipToMemberBelowEnabledBindable = !member.ClipToMemberBelowEnabledBindable;
         member.ClipToMemberBelowEnabledBindable = !member.ClipToMemberBelowEnabledBindable;
     }
     }
@@ -406,7 +405,7 @@ internal class DocumentViewModel : INotifyPropertyChanged
         drawingRectangle = true;
         drawingRectangle = true;
         var member = FindFirstSelectedMember();
         var member = FindFirstSelectedMember();
         Helpers.ActionAccumulator.AddActions(new DrawRectangle_Action(member!.GuidValue, data, member.ShouldDrawOnMask));
         Helpers.ActionAccumulator.AddActions(new DrawRectangle_Action(member!.GuidValue, data, member.ShouldDrawOnMask));
-        lastShape = new ShapeCorners(data.Center, data.Size, data.Angle);
+        lastShape = new ShapeCorners(data.Center, data.Size);
         lastShapeData = data;
         lastShapeData = data;
     }
     }
 
 
@@ -589,7 +588,7 @@ internal class DocumentViewModel : INotifyPropertyChanged
 
 
     private void DeleteStructureMember(object? param)
     private void DeleteStructureMember(object? param)
     {
     {
-        if (updateableChangeActive || FindFirstSelectedMember() is not StructureMemberViewModel member)
+        if (updateableChangeActive || FindFirstSelectedMember() is not { } member)
             return;
             return;
         Helpers.ActionAccumulator.AddFinishedActions(new DeleteStructureMember_Action(member.GuidValue));
         Helpers.ActionAccumulator.AddFinishedActions(new DeleteStructureMember_Action(member.GuidValue));
     }
     }

+ 0 - 1
src/PixiEditorPrototype/ViewModels/ViewModelMain.cs

@@ -172,7 +172,6 @@ internal class ViewModelMain : INotifyPropertyChanged
         {
         {
             case Tool.Rectangle:
             case Tool.Rectangle:
                 {
                 {
-                    var size = (VecI)canvasPos - (VecI)mouseDownCanvasPos;
                     var rect = RectI.FromTwoPixels((VecI)mouseDownCanvasPos, (VecI)canvasPos);
                     var rect = RectI.FromTwoPixels((VecI)mouseDownCanvasPos, (VecI)canvasPos);
                     ActiveDocument!.StartUpdateRectangle(new ShapeData(
                     ActiveDocument!.StartUpdateRectangle(new ShapeData(
                                 rect.Center,
                                 rect.Center,

+ 0 - 1
src/PixiEditorPrototype/Views/MainWindow.xaml

@@ -22,7 +22,6 @@
         <vm:ViewModelMain/>
         <vm:ViewModelMain/>
     </Window.DataContext>
     </Window.DataContext>
     <Window.Resources>
     <Window.Resources>
-        <conv:IndexToChunkResolutionConverter x:Key="IndexToChunkResolutionConverter"/>
         <conv:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
         <conv:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
         <conv:BlendModeToStringConverter x:Key="BlendModeToStringConverter"/>
         <conv:BlendModeToStringConverter x:Key="BlendModeToStringConverter"/>
     </Window.Resources>
     </Window.Resources>