浏览代码

Added documentation to most classes in PixiEditor.ChangeableDocument.Changeables

CPKreuz 3 年之前
父节点
当前提交
4e5d1fdf0b

+ 12 - 3
src/PixiEditor.ChangeableDocument/Changeables/Folder.cs

@@ -6,9 +6,15 @@ namespace PixiEditor.ChangeableDocument.Changeables;
 internal class Folder : StructureMember, IReadOnlyFolder
 {
     // Don't forget to update CreateFolder_ChangeInfo, DocumentUpdater.ProcessCreateStructureMember, and Folder.Clone when adding new properties
+    /// <summary>
+    /// The children of the folder
+    /// </summary>
     public ImmutableList<StructureMember> Children { get; set; } = ImmutableList<StructureMember>.Empty;
     IReadOnlyList<IReadOnlyStructureMember> IReadOnlyFolder.Children => Children;
 
+    /// <summary>
+    /// Creates a clone of the folder, it's mask and all of it's children
+    /// </summary>
     internal override Folder Clone()
     {
         var builder = ImmutableList<StructureMember>.Empty.ToBuilder();
@@ -18,7 +24,7 @@ internal class Folder : StructureMember, IReadOnlyFolder
             builder.Add(child.Clone());
         }
 
-        return new Folder()
+        return new Folder
         {
             GuidValue = GuidValue,
             IsVisible = IsVisible,
@@ -32,11 +38,14 @@ internal class Folder : StructureMember, IReadOnlyFolder
         };
     }
 
+    /// <summary>
+    /// Disposes all children and the mask
+    /// </summary>
     public override void Dispose()
     {
-        for (var i = 0; i < Children.Count; i++)
+        foreach (var child in Children)
         {
-            Children[i].Dispose();
+            child.Dispose();
         }
         Mask?.Dispose();
     }

+ 17 - 2
src/PixiEditor.ChangeableDocument/Changeables/Interfaces/IReadOnlyDocument.cs

@@ -3,12 +3,17 @@
 namespace PixiEditor.ChangeableDocument.Changeables.Interfaces;
 
 public interface IReadOnlyDocument
-{
+{    /// <summary>
+    /// The root folder of the document
+    /// </summary>
     IReadOnlyFolder StructureRoot { get; }
     /// <summary>
     /// The selection of the document
     /// </summary>
     IReadOnlySelection Selection { get; }
+    /// <summary>
+    /// The size of the document
+    /// </summary>
     VecI Size { get; }
     /// <summary>
     /// Is the horizontal symmetry axis enabled (Mirrors top and bottom)
@@ -55,6 +60,16 @@ public interface IReadOnlyDocument
     /// <param name="guid">The <see cref="StructureMember.GuidValue"/> of the member</param>
     /// <exception cref="ArgumentException">Thrown if the member could not be found</exception>
     IReadOnlyStructureMember FindMemberOrThrow(Guid guid);
-    (IReadOnlyStructureMember, IReadOnlyFolder) FindChildAndParentOrThrow(Guid guid);
+    /// <summary>
+    /// Find's a member with the <paramref name="childGuid"/>  and it's parent, throws a ArgumentException if they can't be found
+    /// </summary>
+    /// <param name="childGuid">The <see cref="IReadOnlyStructureMember.GuidValue"/> of the member</param>
+    /// <returns>A value tuple consisting of child (<see cref="ValueTuple{T, T}.Item1"/>) and parent (<see cref="ValueTuple{T, T}.Item2"/>)</returns>
+    /// <exception cref="ArgumentException">Thrown if the member and parent could not be found</exception>
+    (IReadOnlyStructureMember, IReadOnlyFolder) FindChildAndParentOrThrow(Guid childGuid);
+    /// <summary>
+    /// Find's the path to the member with <paramref name="guid"/>, the first element will be the member
+    /// </summary>
+    /// <param name="guid">The <see cref="IReadOnlyStructureMember.GuidValue"/> of the member</param>
     IReadOnlyList<IReadOnlyStructureMember> FindMemberPath(Guid guid);
 }

+ 3 - 0
src/PixiEditor.ChangeableDocument/Changeables/Interfaces/IReadOnlyFolder.cs

@@ -2,5 +2,8 @@
 
 public interface IReadOnlyFolder : IReadOnlyStructureMember
 {
+    /// <summary>
+    /// The children of the folder
+    /// </summary>
     IReadOnlyList<IReadOnlyStructureMember> Children { get; }
 }

+ 6 - 0
src/PixiEditor.ChangeableDocument/Changeables/Interfaces/IReadOnlyLayer.cs

@@ -2,6 +2,12 @@
 
 public interface IReadOnlyLayer : IReadOnlyStructureMember
 {
+    /// <summary>
+    /// The chunky image of the layer
+    /// </summary>
     IReadOnlyChunkyImage LayerImage { get; }
+    /// <summary>
+    /// Locks the transparency of the layer
+    /// </summary>
     bool LockTransparency { get; }
 }

+ 3 - 0
src/PixiEditor.ChangeableDocument/Changeables/Interfaces/IReadOnlySelection.cs

@@ -4,5 +4,8 @@ namespace PixiEditor.ChangeableDocument.Changeables.Interfaces;
 
 public interface IReadOnlySelection
 {
+    /// <summary>
+    /// The path of the selection
+    /// </summary>
     public SKPath SelectionPath { get; }
 }

+ 23 - 2
src/PixiEditor.ChangeableDocument/Changeables/Interfaces/IReadOnlyStructureMember.cs

@@ -4,12 +4,33 @@ namespace PixiEditor.ChangeableDocument.Changeables.Interfaces;
 
 public interface IReadOnlyStructureMember
 {
+    /// <summary>
+    /// Is the member visible. Defaults to true
+    /// </summary>
     bool IsVisible { get; }
-    bool MaskIsVisible { get; }
+    /// <summary>
+    /// The opacity of the member (Randing from 0f to 1f)
+    /// </summary>
+    float Opacity { get; }
     bool ClipToMemberBelow { get; }
+    /// <summary>
+    /// The name of the member. Defaults to "Unnamed"
+    /// </summary>
     string Name { get; }
+    /// <summary>
+    /// The guid of the member
+    /// </summary>
     Guid GuidValue { get; }
-    float Opacity { get; }
+    /// <summary>
+    /// The blend mode of the member
+    /// </summary>
     BlendMode BlendMode { get; }
+    /// <summary>
+    /// Is the mask of the member visible. Defaults to true
+    /// </summary>
+    bool MaskIsVisible { get; }
+    /// <summary>
+    /// The mask of the member
+    /// </summary>
     IReadOnlyChunkyImage? Mask { get; }
 }

+ 7 - 0
src/PixiEditor.ChangeableDocument/Changeables/Layer.cs

@@ -19,12 +19,19 @@ internal class Layer : StructureMember, IReadOnlyLayer
         LayerImage = image;
     }
 
+    /// <summary>
+    /// Disposes the layer's image and mask
+    /// </summary>
     public override void Dispose()
     {
         LayerImage.Dispose();
         Mask?.Dispose();
     }
 
+    /// <summary>
+    /// Creates a clone of the layer, it's image and it's mask
+    /// </summary>
+    /// <returns></returns>
     internal override Layer Clone()
     {
         return new Layer(LayerImage.CloneFromCommitted())

+ 0 - 1
src/PixiEditor.ChangeableDocument/Changeables/StructureMember.cs

@@ -16,7 +16,6 @@ internal abstract class StructureMember : IChangeable, IReadOnlyStructureMember,
     public ChunkyImage? Mask { get; set; } = null;
     public bool MaskIsVisible { get; set; } = true;
     IReadOnlyChunkyImage? IReadOnlyStructureMember.Mask => Mask;
-
     internal abstract StructureMember Clone();
     public abstract void Dispose();
 }