소스 검색

minor formatting changes

Equbuxu 4 년 전
부모
커밋
cd138f7fab

+ 9 - 10
PixiEditor/Models/Layers/StructuredLayerTree.cs

@@ -1,10 +1,9 @@
-using System;
-using System.Collections;
+using PixiEditor.Helpers;
+using PixiEditor.Helpers.Extensions;
+using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
-using PixiEditor.Helpers;
-using PixiEditor.Helpers.Extensions;
 
 namespace PixiEditor.Models.Layers
 {
@@ -16,7 +15,7 @@ namespace PixiEditor.Models.Layers
 
         public StructuredLayerTree(ObservableCollection<Layer> layers, LayerStructure structure)
         {
-            if(layers == null || structure == null)
+            if (layers == null || structure == null)
             {
                 return;
             }
@@ -39,8 +38,8 @@ namespace PixiEditor.Models.Layers
         private void PlaceItems(List<LayerGroup> parsedFolders, ObservableCollection<Layer> layers)
         {
             LayerGroup currentFolder = null;
-            List<LayerGroup> groupsAtIndex = new ();
-            Stack<LayerGroup> unfinishedFolders = new ();
+            List<LayerGroup> groupsAtIndex = new();
+            Stack<LayerGroup> unfinishedFolders = new();
 
             for (int i = 0; i < layers.Count; i++)
             {
@@ -145,7 +144,7 @@ namespace PixiEditor.Models.Layers
 
             structureItemLayers.Reverse();
 
-            LayerGroup folder = new (structureItemLayers, subFolders, structureItem.Name,
+            LayerGroup folder = new(structureItemLayers, subFolders, structureItem.Name,
                 structureItem.GroupGuid, displayIndex, displayIndex + structureItemLayers.Count - 1, structureItem)
             {
                 IsExpanded = structureItem.IsExpanded,
@@ -164,7 +163,7 @@ namespace PixiEditor.Models.Layers
             var startLayer = layers.FirstOrDefault(x => x.LayerGuid == structureItem.StartLayerGuid);
             var endLayer = layers.FirstOrDefault(x => x.LayerGuid == structureItem.EndLayerGuid);
 
-            if(startLayer == null || endLayer == null)
+            if (startLayer == null || endLayer == null)
             {
                 return Array.Empty<Guid>();
             }
@@ -196,4 +195,4 @@ namespace PixiEditor.Models.Layers
             endIndex = tmp;
         }
     }
-}
+}

+ 8 - 10
PixiEditor/ViewModels/SubViewModels/Main/LayersViewModel.cs

@@ -1,12 +1,10 @@
-using System;
-using System.Linq;
-using System.Security.RightsManagement;
-using System.Windows.Input;
-using PixiEditor.Helpers;
+using PixiEditor.Helpers;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Layers;
-using PixiEditor.Models.Layers.Utils;
 using PixiEditor.Views.UserControls;
+using System;
+using System.Linq;
+using System.Windows.Input;
 
 namespace PixiEditor.ViewModels.SubViewModels.Main
 {
@@ -74,12 +72,12 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
 
         public bool CanDeleteSelected(object parameter)
         {
-            return (parameter is not null and(Layer or LayerGroup)) || (Owner.BitmapManager?.ActiveDocument?.ActiveLayer != null);
+            return (parameter is not null and (Layer or LayerGroup)) || (Owner.BitmapManager?.ActiveDocument?.ActiveLayer != null);
         }
 
         public void DeleteSelected(object parameter)
         {
-            if(parameter is Layer layer)
+            if (parameter is Layer layer)
             {
                 DeleteLayer(Owner.BitmapManager.ActiveDocument.Layers.IndexOf(layer));
             }
@@ -87,7 +85,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             {
                 DeleteLayer(Owner.BitmapManager.ActiveDocument.Layers.IndexOf(Owner.BitmapManager.ActiveDocument.ActiveLayer));
             }
-            else if(parameter is LayerGroup group)
+            else if (parameter is LayerGroup group)
             {
                 DeleteGroup(group.GroupGuid);
             }
@@ -345,4 +343,4 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             }
         }
     }
-}
+}

+ 6 - 14
PixiEditor/Views/UserControls/LayerGroupControl.xaml.cs

@@ -1,14 +1,13 @@
-using System;
+using PixiEditor.Models.ImageManipulation;
+using PixiEditor.Models.Layers;
+using PixiEditor.Models.Undo;
+using PixiEditor.ViewModels.SubViewModels.Main;
+using System;
 using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.ImageManipulation;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Undo;
-using PixiEditor.ViewModels.SubViewModels.Main;
 
 namespace PixiEditor.Views.UserControls
 {
@@ -26,7 +25,6 @@ namespace PixiEditor.Views.UserControls
         public const string LayerGroupControlDataName = "PixiEditor.Views.UserControls.LayerGroupControl";
         public const string LayerContainerDataName = "PixiEditor.Views.UserControls.LayerStructureItemContainer";
 
-        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty GroupGuidProperty =
             DependencyProperty.Register("GroupGuid", typeof(Guid), typeof(LayerGroupControl), new PropertyMetadata(Guid.NewGuid()));
 
@@ -36,7 +34,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(LayersViewModelProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty LayersViewModelProperty =
             DependencyProperty.Register("LayersViewModel", typeof(LayersViewModel), typeof(LayerGroupControl), new PropertyMetadata(default(LayersViewModel), LayersViewModelCallback));
 
@@ -46,7 +43,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(IsVisibleUndoTriggerableProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for IsVisibleUndoTriggerable.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty IsVisibleUndoTriggerableProperty =
             DependencyProperty.Register("IsVisibleUndoTriggerable", typeof(bool), typeof(LayerGroupControl), new PropertyMetadata(true));
 
@@ -56,7 +52,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(GroupOpacityProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for GroupOpacity.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty GroupOpacityProperty =
             DependencyProperty.Register("GroupOpacity", typeof(float), typeof(LayerGroupControl), new PropertyMetadata(1f));
 
@@ -81,7 +76,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(GroupNameProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for FolderName.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty GroupNameProperty =
             DependencyProperty.Register("GroupName", typeof(string), typeof(LayerGroupControl), new PropertyMetadata(default(string)));
 
@@ -91,7 +85,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(GroupDataProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty GroupDataProperty =
             DependencyProperty.Register("GroupData", typeof(GuidStructureItem), typeof(LayerGroupControl), new PropertyMetadata(default(GuidStructureItem), GroupDataChangedCallback));
 
@@ -116,7 +109,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(PreviewImageProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for PreviewImage.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty PreviewImageProperty =
             DependencyProperty.Register("PreviewImage", typeof(WriteableBitmap), typeof(LayerGroupControl), new PropertyMetadata(default(WriteableBitmap)));
 
@@ -317,4 +309,4 @@ namespace PixiEditor.Views.UserControls
             middleDropGrid.Visibility = Visibility.Collapsed;
         }
     }
-}
+}

+ 2 - 2
PixiEditor/Views/UserControls/LayerItem.xaml

@@ -24,7 +24,7 @@
             <Grid.RowDefinitions>
                 <RowDefinition Height="10"/>
                 <RowDefinition Height="25"/>
- 
+
             </Grid.RowDefinitions>
             <Grid AllowDrop="True" DragEnter="Grid_DragEnter" Drop="Grid_Drop_Top" DragLeave="Grid_DragLeave" Grid.Row="0" Grid.ColumnSpan="3" Background="Transparent"/>
             <Grid Grid.Row="1" Grid.RowSpan="3" Margin="0,-10,0,0" VerticalAlignment="Center" AllowDrop="False">
@@ -50,7 +50,7 @@
                 </StackPanel>
                 <Grid Margin="0, 0, 0, -2.5" DragEnter="Grid_DragEnter" VerticalAlignment="Bottom" Height="10" Drop="Grid_Drop_Below"  DragLeave="Grid_DragLeave" Grid.Row="2" Grid.Column="0" AllowDrop="True"  Background="Transparent" Name="dropBelowGrid"/>
                 <Grid Margin="0, 0, 0, -2.5" VerticalAlignment="Bottom" Height="10" Grid.Row="2" Grid.Column="1" Background="{Binding ElementName=dropBelowGrid, Path=Background}"/>
-                
+
                 <Grid Margin="0, 0, 0, -2.5" DragEnter="Grid_DragEnter" VerticalAlignment="Bottom" Height="10" Drop="Grid_Drop_Bottom" DragLeave="Grid_DragLeave" Grid.Row="2" Grid.Column="2" AllowDrop="True"  Background="Transparent"/>
             </Grid>
         </Grid>

+ 5 - 9
PixiEditor/Views/UserControls/LayerItem.xaml.cs

@@ -1,12 +1,12 @@
-using System;
+using PixiEditor.Helpers;
+using PixiEditor.Models.DataHolders;
+using PixiEditor.Views.UserControls;
+using System;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
-using PixiEditor.Helpers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Views.UserControls;
 
 namespace PixiEditor.Views
 {
@@ -73,7 +73,6 @@ namespace PixiEditor.Views
             set { SetValue(LayerGuidProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for LayerGuid.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty LayerGuidProperty =
             DependencyProperty.Register("LayerGuid", typeof(Guid), typeof(LayerItem), new PropertyMetadata(default(Guid)));
 
@@ -86,7 +85,6 @@ namespace PixiEditor.Views
             set { SetValue(PreviewImageProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for PreviewImage.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty PreviewImageProperty =
             DependencyProperty.Register("PreviewImage", typeof(WriteableBitmap), typeof(LayerItem), new PropertyMetadata(null));
 
@@ -96,7 +94,6 @@ namespace PixiEditor.Views
             set { SetValue(LayerColorProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for LayerColor.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty LayerColorProperty =
             DependencyProperty.Register("LayerColor", typeof(string), typeof(LayerItem), new PropertyMetadata("#00000000"));
 
@@ -112,7 +109,6 @@ namespace PixiEditor.Views
             set { SetValue(MoveToBackCommandProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for MoveToBackCommand.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty MoveToBackCommandProperty =
             DependencyProperty.Register("MoveToBackCommand", typeof(RelayCommand), typeof(LayerItem), new PropertyMetadata(default(RelayCommand)));
 
@@ -207,4 +203,4 @@ namespace PixiEditor.Views
             HandleGridDrop(sender, e, false, true);
         }
     }
-}
+}

+ 3 - 3
PixiEditor/Views/UserControls/LayersManager.xaml

@@ -9,7 +9,7 @@
              xmlns:layers="clr-namespace:PixiEditor.Models.Layers"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters" 
              mc:Ignorable="d"
-             d:DesignHeight="450" d:DesignWidth="250" Name="layersManager">
+             d:DesignHeight="450" d:DesignWidth="250" x:Name="layersManager">
     <UserControl.Resources>
         <converters:IndexOfConverter x:Key="IndexOfConverter"/>
     </UserControl.Resources>
@@ -62,7 +62,7 @@
         </DockPanel>
         <Separator Grid.Row="1" Margin="0,-12, 0, 0" BorderBrush="{StaticResource DarkerAccentColor}" BorderThickness="2" />
         <DockPanel LastChildFill="True" Grid.Row="2" Margin="0, -12, 0, 0">
-        <TreeView DockPanel.Dock="Top" Name="treeView" ItemsSource="{Binding LayerTreeRoot, ElementName=layersManager}"  SelectedItemChanged="TreeView_SelectedItemChanged">
+            <TreeView DockPanel.Dock="Top" Name="treeView" ItemsSource="{Binding LayerTreeRoot, ElementName=layersManager}"  SelectedItemChanged="TreeView_SelectedItemChanged">
                 <TreeView.ItemsPanel>
                     <ItemsPanelTemplate>
                         <ui:ReversedOrderStackPanel/>
@@ -87,7 +87,7 @@
                     </DataTemplate>
                 </TreeView.Resources>
             </TreeView>
-        <Border Name="dropBorder" DragEnter="Grid_DragEnter" DragLeave="Grid_DragLeave" AllowDrop="True" Drop="Grid_Drop" Background="Transparent" BorderThickness="0, 5, 0, 0"></Border>
+            <Border Name="dropBorder" DragEnter="Grid_DragEnter" DragLeave="Grid_DragLeave" AllowDrop="True" Drop="Grid_Drop" Background="Transparent" BorderThickness="0, 5, 0, 0"></Border>
         </DockPanel>
     </Grid>
 </UserControl>

+ 0 - 4
PixiEditor/Views/UserControls/LayersManager.xaml.cs

@@ -21,7 +21,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(SelectedItemProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for SelectedItem.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty SelectedItemProperty =
             DependencyProperty.Register("SelectedItem", typeof(object), typeof(LayersManager), new PropertyMetadata(0));
 
@@ -32,7 +31,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(LayerTreeRootProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for LayerTreeRoot.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty LayerTreeRootProperty =
             DependencyProperty.Register(
                 "LayerTreeRoot",
@@ -45,7 +43,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(LayerCommandsViewModelProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for LayerCommandsViewModel.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty LayerCommandsViewModelProperty =
             DependencyProperty.Register("LayerCommandsViewModel", typeof(LayersViewModel), typeof(LayersManager), new PropertyMetadata(default(LayersViewModel), ViewModelChanged));
 
@@ -55,7 +52,6 @@ namespace PixiEditor.Views.UserControls
             set { SetValue(OpacityInputEnabledProperty, value); }
         }
 
-        // Using a DependencyProperty as the backing store for OpacityInputEnabled.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty OpacityInputEnabledProperty =
             DependencyProperty.Register("OpacityInputEnabled", typeof(bool), typeof(LayersManager), new PropertyMetadata(false));