Browse Source

Delete unused code

Equbuxu 3 years ago
parent
commit
81cb1279eb
26 changed files with 24 additions and 823 deletions
  1. 0 106
      PixiEditor/Helpers/Behaviours/AllowableCharactersTextBoxBehavior.cs
  2. 0 72
      PixiEditor/Helpers/Behaviours/HintTextBehavior.cs
  3. 0 15
      PixiEditor/Helpers/Converters/BoolToBrushConverter.cs
  4. 0 34
      PixiEditor/Helpers/Converters/BrushTuple.cs
  5. 19 19
      PixiEditor/Helpers/Converters/EnumToStringConverter.cs
  6. 0 27
      PixiEditor/Helpers/Converters/FinalIsVisibleToVisiblityConverter.cs
  7. 0 27
      PixiEditor/Helpers/Converters/LayerToFinalOpacityConverter.cs
  8. 0 11
      PixiEditor/Helpers/Extensions/PixiParserHelper.cs
  9. 0 15
      PixiEditor/Helpers/Validators/SizeValidationRule.cs
  10. 0 21
      PixiEditor/Models/Controllers/BitmapChangedEventArgs.cs
  11. 1 1
      PixiEditor/Models/Controllers/BitmapOperationsUtility.cs
  12. 1 17
      PixiEditor/Models/Dialogs/ConfirmationDialog.cs
  13. 2 2
      PixiEditor/Models/Dialogs/ResizeDocumentDialog.cs
  14. 0 8
      PixiEditor/Models/Enums/CapType.cs
  15. 0 27
      PixiEditor/Models/ImageManipulation/BitmapUtils.cs
  16. 0 99
      PixiEditor/Models/ImageManipulation/Morphology.cs
  17. 0 31
      PixiEditor/Models/ImageManipulation/Transform.cs
  18. 0 19
      PixiEditor/Models/Position/MousePositionConverter.cs
  19. 0 41
      PixiEditor/ViewModels/MenuButtonViewModel.cs
  20. 1 1
      PixiEditor/ViewModels/ViewModelMain.cs
  21. 0 57
      PixiEditor/Views/UserControls/MenuButton.xaml
  22. 0 46
      PixiEditor/Views/UserControls/MenuButton.xaml.cs
  23. 0 16
      PixiEditor/Views/UserControls/Rotatebox.xaml
  24. 0 71
      PixiEditor/Views/UserControls/Rotatebox.xaml.cs
  25. 0 1
      PixiEditor/Views/UserControls/SizeInput.xaml
  26. 0 39
      PixiEditorTests/ModelsTests/ImageManipulationTests/TransformTests.cs

+ 0 - 106
PixiEditor/Helpers/Behaviours/AllowableCharactersTextBoxBehavior.cs

@@ -1,106 +0,0 @@
-using System;
-using System.Text.RegularExpressions;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Interactivity;
-
-namespace PixiEditor.Helpers.Behaviours
-{
-    public class AllowableCharactersTextBoxBehavior : Behavior<TextBox>
-    {
-        public static readonly DependencyProperty RegularExpressionProperty =
-            DependencyProperty.Register(
-                "RegularExpression",
-                typeof(string),
-                typeof(AllowableCharactersTextBoxBehavior),
-                new FrameworkPropertyMetadata(".*"));
-
-        public static readonly DependencyProperty MaxLengthProperty =
-            DependencyProperty.Register(
-                "MaxLength",
-                typeof(int),
-                typeof(AllowableCharactersTextBoxBehavior),
-                new FrameworkPropertyMetadata(int.MinValue));
-
-        public string RegularExpression
-        {
-            get => (string)GetValue(RegularExpressionProperty);
-            set => SetValue(RegularExpressionProperty, value);
-        }
-
-        public int MaxLength
-        {
-            get => (int)GetValue(MaxLengthProperty);
-            set => SetValue(MaxLengthProperty, value);
-        }
-
-        protected override void OnAttached()
-        {
-            base.OnAttached();
-            AssociatedObject.PreviewTextInput += OnPreviewTextInput;
-            DataObject.AddPastingHandler(AssociatedObject, OnPaste);
-        }
-
-        protected override void OnDetaching()
-        {
-            base.OnDetaching();
-            AssociatedObject.PreviewTextInput -= OnPreviewTextInput;
-            DataObject.RemovePastingHandler(AssociatedObject, OnPaste);
-        }
-
-        private void OnPaste(object sender, DataObjectPastingEventArgs e)
-        {
-            if (e.DataObject.GetDataPresent(DataFormats.Text))
-            {
-                string text = Convert.ToString(e.DataObject.GetData(DataFormats.Text));
-
-                if (!IsValid(text, true))
-                {
-                    e.CancelCommand();
-                }
-            }
-            else
-            {
-                e.CancelCommand();
-            }
-        }
-
-        private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
-        {
-            e.Handled = !IsValid(e.Text, false);
-        }
-
-        private bool IsValid(string newText, bool paste)
-        {
-            return !ExceedsMaxLength(newText, paste) && Regex.IsMatch(newText, RegularExpression);
-        }
-
-        private bool ExceedsMaxLength(string newText, bool paste)
-        {
-            if (MaxLength == 0)
-            {
-                return false;
-            }
-
-            return LengthOfModifiedText(newText, paste) > MaxLength;
-        }
-
-        private int LengthOfModifiedText(string newText, bool paste)
-        {
-            int countOfSelectedChars = AssociatedObject.SelectedText.Length;
-            int caretIndex = AssociatedObject.CaretIndex;
-            string text = AssociatedObject.Text;
-
-            if (countOfSelectedChars > 0 || paste)
-            {
-                text = text.Remove(caretIndex, countOfSelectedChars);
-                return text.Length + newText.Length;
-            }
-
-            bool insert = Keyboard.IsKeyToggled(Key.Insert);
-
-            return insert && caretIndex < text.Length ? text.Length : text.Length + newText.Length;
-        }
-    }
-}

+ 0 - 72
PixiEditor/Helpers/Behaviours/HintTextBehavior.cs

@@ -1,72 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Interactivity;
-using System.Windows.Media;
-
-namespace PixiEditor.Helpers.Behaviours
-{
-    internal class HintTextBehavior : Behavior<TextBox>
-    {
-        // Using a DependencyProperty as the backing store for Hint.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty HintProperty =
-            DependencyProperty.Register(
-                "Hint",
-                typeof(string),
-                typeof(HintTextBehavior),
-                new PropertyMetadata(string.Empty));
-
-        private Brush textColor;
-
-        public string Hint
-        {
-            get => (string)GetValue(HintProperty);
-            set => SetValue(HintProperty, value);
-        }
-
-        protected override void OnAttached()
-        {
-            base.OnAttached();
-            AssociatedObject.GotFocus += AssociatedObject_GotFocus;
-            AssociatedObject.LostFocus += AssociatedObject_LostFocus;
-            textColor = AssociatedObject.Foreground;
-            SetHint(true);
-        }
-
-        protected override void OnDetaching()
-        {
-            base.OnDetaching();
-            AssociatedObject.LostFocus -= AssociatedObject_LostFocus;
-            AssociatedObject.GotFocus -= AssociatedObject_GotFocus;
-        }
-
-        private void AssociatedObject_LostFocus(object sender, RoutedEventArgs e)
-        {
-            if (string.IsNullOrEmpty(AssociatedObject.Text))
-            {
-                SetHint(true);
-            }
-        }
-
-        private void AssociatedObject_GotFocus(object sender, RoutedEventArgs e)
-        {
-            if (AssociatedObject.Text == Hint)
-            {
-                SetHint(false);
-            }
-        }
-
-        private void SetHint(bool active)
-        {
-            if (active)
-            {
-                AssociatedObject.Foreground = (SolidColorBrush)new BrushConverter().ConvertFromString("#7B7B7B");
-                AssociatedObject.Text = Hint;
-            }
-            else
-            {
-                AssociatedObject.Text = string.Empty;
-                AssociatedObject.Foreground = textColor;
-            }
-        }
-    }
-}

+ 0 - 15
PixiEditor/Helpers/Converters/BoolToBrushConverter.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace PixiEditor.Helpers.Converters
-{
-    public class BoolToBrushConverter
-        : SingleInstanceConverter<BoolToBrushConverter>
-    {
-        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
-        {
-            BrushTuple tuple = (BrushTuple)parameter;
-            return (bool)value ? tuple.FirstBrush : tuple.SecondBrush;
-        }
-    }
-}

+ 0 - 34
PixiEditor/Helpers/Converters/BrushTuple.cs

@@ -1,34 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Windows.Media;
-
-namespace PixiEditor.Helpers.Converters
-{
-    public class BrushTuple : NotifyableObject, ITuple
-    {
-        public object this[int index] => index switch
-        {
-            0 => FirstBrush,
-            1 => SecondBrush,
-            _ => throw new ArgumentOutOfRangeException(nameof(index))
-        };
-
-        private Brush item1;
-
-        public Brush FirstBrush
-        {
-            get => item1;
-            set => SetProperty(ref item1, value);
-        }
-
-        private Brush item2;
-
-        public Brush SecondBrush
-        {
-            get => item2;
-            set => SetProperty(ref item2, value);
-        }
-
-        public int Length => 2;
-    }
-}

+ 19 - 19
PixiEditor/Helpers/Converters/EnumToStringConverter.cs

@@ -3,27 +3,27 @@ using System;
 
 namespace PixiEditor.Helpers.Converters
 {
-  internal class EnumToStringConverter : SingleInstanceConverter<EnumToStringConverter>
-  {
-    public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+    internal class EnumToStringConverter : SingleInstanceConverter<EnumToStringConverter>
     {
-      try
-      {
-        var type = value.GetType();
-        if (type == typeof(SizeUnit))
+        public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
-          var valueCasted = (SizeUnit)value;
-          if (valueCasted == SizeUnit.Percentage)
-            return "%";
-          
-          return "px";
+            try
+            {
+                var type = value.GetType();
+                if (type == typeof(SizeUnit))
+                {
+                    var valueCasted = (SizeUnit)value;
+                    if (valueCasted == SizeUnit.Percentage)
+                        return "%";
+
+                    return "px";
+                }
+                return Enum.GetName((value.GetType()), value);
+            }
+            catch
+            {
+                return string.Empty;
+            }
         }
-        return Enum.GetName((value.GetType()), value);
-      }
-      catch
-      {
-        return string.Empty;
-      }
     }
-  }
 }

+ 0 - 27
PixiEditor/Helpers/Converters/FinalIsVisibleToVisiblityConverter.cs

@@ -1,27 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Layers;
-using PixiEditor.ViewModels;
-using System;
-using System.Globalization;
-using System.Windows;
-using System.Windows.Data;
-using System.Windows.Markup;
-
-namespace PixiEditor.Helpers.Converters
-{
-    public class FinalIsVisibleToVisiblityConverter
-        : SingleInstanceMultiValueConverter<FinalIsVisibleToVisiblityConverter>
-    {
-        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
-        {
-            BitmapManager bitmapManager = ViewModelMain.Current?.BitmapManager;
-
-            return
-                (values[0] is not Layer layer ||
-                bitmapManager.ActiveDocument is null ||
-                bitmapManager.ActiveDocument.GetFinalLayerIsVisible(layer))
-                    ? Visibility.Visible
-                    : (object)Visibility.Collapsed;
-        }
-    }
-}

+ 0 - 27
PixiEditor/Helpers/Converters/LayerToFinalOpacityConverter.cs

@@ -1,27 +0,0 @@
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Layers.Utils;
-using PixiEditor.ViewModels;
-using System;
-using System.Globalization;
-
-namespace PixiEditor.Helpers.Converters
-{
-    public class LayerToFinalOpacityConverter
-        : SingleInstanceMultiValueConverter<LayerToFinalOpacityConverter>
-    {
-        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
-        {
-            if (values.Length > 0 && values[0] is Layer layer && ViewModelMain.Current?.BitmapManager?.ActiveDocument != null)
-            {
-                return (double)LayerStructureUtils.GetFinalLayerOpacity(layer, ViewModelMain.Current.BitmapManager.ActiveDocument.LayerStructure);
-            }
-
-            return null;
-        }
-
-        public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
-        {
-            return null;
-        }
-    }
-}

+ 0 - 11
PixiEditor/Helpers/Extensions/PixiParserHelper.cs

@@ -1,11 +0,0 @@
-using PixiEditor.Parser;
-using SkiaSharp;
-
-namespace PixiEditor.Helpers.Extensions
-{
-    public static class PixiParserHelper
-    {
-        public static SKRectI GetRect(this SerializableLayer layer) =>
-            SKRectI.Create(layer.OffsetX, layer.OffsetY, layer.Width, layer.Height);
-    }
-}

+ 0 - 15
PixiEditor/Helpers/Validators/SizeValidationRule.cs

@@ -1,15 +0,0 @@
-using System.Globalization;
-using System.Windows.Controls;
-
-namespace PixiEditor.Helpers.Validators
-{
-    public class SizeValidationRule : ValidationRule
-    {
-        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
-        {
-            int i = int.Parse(((string)value).Split(' ')[0]);
-
-            return new ValidationResult(i > 0, null); // Size is greater than 0
-        }
-    }
-}

+ 0 - 21
PixiEditor/Models/Controllers/BitmapChangedEventArgs.cs

@@ -1,21 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using System;
-
-namespace PixiEditor.Models.Controllers
-{
-    public class BitmapChangedEventArgs : EventArgs
-    {
-        public BitmapChangedEventArgs(BitmapPixelChanges pixelsChanged, BitmapPixelChanges oldPixelsValues, Guid changedLayerGuid)
-        {
-            PixelsChanged = pixelsChanged;
-            OldPixelsValues = oldPixelsValues;
-            ChangedLayerGuid = changedLayerGuid;
-        }
-
-        public BitmapPixelChanges PixelsChanged { get; set; }
-
-        public BitmapPixelChanges OldPixelsValues { get; set; }
-
-        public Guid ChangedLayerGuid { get; set; }
-    }
-}

+ 1 - 1
PixiEditor/Models/Controllers/BitmapOperationsUtility.cs

@@ -13,7 +13,7 @@ namespace PixiEditor.Models.Controllers
 {
     public class BitmapOperationsUtility
     {
-        public event EventHandler<BitmapChangedEventArgs> BitmapChanged;
+        public event EventHandler BitmapChanged;
 
         public BitmapManager Manager { get; set; }
 

+ 1 - 17
PixiEditor/Models/Dialogs/ConfirmationDialog.cs

@@ -1,26 +1,10 @@
 using PixiEditor.Models.Enums;
 using PixiEditor.Views;
-using System;
 
 namespace PixiEditor.Models.Dialogs
 {
     public static class ConfirmationDialog
-    {
-        [Obsolete(message: "Use Show(message, title) instead.")]
-        public static ConfirmationType Show(string message)
-        {
-            ConfirmationPopup popup = new ConfirmationPopup
-            {
-                Body = message
-            };
-            if (popup.ShowDialog().GetValueOrDefault())
-            {
-                return popup.Result ? ConfirmationType.Yes : ConfirmationType.No;
-            }
-
-            return ConfirmationType.Canceled;
-        }
-
+    {
         public static ConfirmationType Show(string message, string title)
         {
             ConfirmationPopup popup = new ConfirmationPopup

+ 2 - 2
PixiEditor/Models/Dialogs/ResizeDocumentDialog.cs

@@ -27,7 +27,7 @@ namespace PixiEditor.Models.Dialogs
                 if (width != value)
                 {
                     width = value;
-                    RaisePropertyChanged("Width");
+                    RaisePropertyChanged(nameof(Width));
                 }
             }
         }
@@ -40,7 +40,7 @@ namespace PixiEditor.Models.Dialogs
                 if (height != value)
                 {
                     height = value;
-                    RaisePropertyChanged("Height");
+                    RaisePropertyChanged(nameof(Height));
                 }
             }
         }

+ 0 - 8
PixiEditor/Models/Enums/CapType.cs

@@ -1,8 +0,0 @@
-namespace PixiEditor.Models.Enums
-{
-    public enum CapType
-    {
-        Square,
-        Round
-    }
-}

+ 0 - 27
PixiEditor/Models/ImageManipulation/BitmapUtils.cs

@@ -1,7 +1,6 @@
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers.Utils;
-using PixiEditor.Models.Position;
 using PixiEditor.Parser;
 using PixiEditor.Parser.Skia;
 using SkiaSharp;
@@ -129,32 +128,6 @@ namespace PixiEditor.Models.ImageManipulation
                 maxPreviewHeight);
         }
 
-        public static Dictionary<Guid, SKColor[]> GetPixelsForSelection(Layer[] layers, Coordinates[] selection)
-        {
-            Dictionary<Guid, SKColor[]> result = new();
-
-            foreach (Layer layer in layers)
-            {
-                SKColor[] pixels = new SKColor[selection.Length];
-
-                for (int j = 0; j < pixels.Length; j++)
-                {
-                    Coordinates position = layer.GetRelativePosition(selection[j]);
-                    if (position.X < 0 || position.X > layer.Width - 1 || position.Y < 0 ||
-                        position.Y > layer.Height - 1)
-                    {
-                        continue;
-                    }
-
-                    var cl = layer.GetPixel(position.X, position.Y);
-                    pixels[j] = cl;
-                }
-                result[layer.GuidValue] = pixels;
-            }
-
-            return result;
-        }
-
         public static SKColor BlendColors(SKColor bottomColor, SKColor topColor)
         {
             if ((topColor.Alpha < 255 && topColor.Alpha > 0))

+ 0 - 99
PixiEditor/Models/ImageManipulation/Morphology.cs

@@ -1,99 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using PixiEditor.Models.Position;
-
-namespace PixiEditor.Models.ImageManipulation
-{
-    public class Morphology
-    {
-        public static IEnumerable<Coordinates> ApplyDilation(Coordinates[] points, int kernelSize, int[,] mask)
-        {
-            int kernelDim = kernelSize;
-
-            // This is the offset of center pixel from border of the kernel
-            int kernelOffset = (kernelDim - 1) / 2;
-            int margin = kernelDim;
-
-            byte[,] byteImg = GetByteArrayForPoints(points, margin);
-            byte[,] outputArray = byteImg.Clone() as byte[,];
-            Coordinates offset = new Coordinates(points.Min(x => x.X) - margin, points.Min(x => x.Y) - margin);
-
-            int width = byteImg.GetLength(0);
-            int height = byteImg.GetLength(1);
-            for (int y = kernelOffset; y < height - kernelOffset; y++)
-            {
-                for (int x = kernelOffset; x < width - kernelOffset; x++)
-                {
-                    byte value = 0;
-
-                    // Apply dilation
-                    for (int ykernel = -kernelOffset; ykernel <= kernelOffset; ykernel++)
-                    {
-                        for (int xkernel = -kernelOffset; xkernel <= kernelOffset; xkernel++)
-                        {
-                            if (mask[xkernel + kernelOffset, ykernel + kernelOffset] == 1)
-                            {
-                                value = Math.Max(value, byteImg[x + xkernel, y + ykernel]);
-                            }
-                            else
-                            {
-                                continue;
-                            }
-                        }
-                    }
-
-                    // Write processed data into the second array
-                    outputArray[x, y] = value;
-                }
-            }
-
-            return ToCoordinates(outputArray, offset).Distinct();
-        }
-
-        private static IEnumerable<Coordinates> ToCoordinates(byte[,] byteArray, Coordinates offset)
-        {
-            List<Coordinates> output = new List<Coordinates>();
-            int width = byteArray.GetLength(0);
-
-            for (int y = 0; y < byteArray.GetLength(1); y++)
-            {
-                for (int x = 0; x < width; x++)
-                {
-                    if (byteArray[x, y] == 1)
-                    {
-                        output.Add(new Coordinates(x + offset.X, y + offset.Y));
-                    }
-                }
-            }
-
-            return output;
-        }
-
-        private static byte[,] GetByteArrayForPoints(Coordinates[] points, int margin)
-        {
-            Tuple<int, int> dimensions = GetDimensionsForPoints(points);
-            int minX = points.Min(x => x.X);
-            int minY = points.Min(x => x.Y);
-            byte[,] array = new byte[dimensions.Item1 + (margin * 2), dimensions.Item2 + (margin * 2)];
-
-            for (int y = 0; y < dimensions.Item2 + margin; y++)
-            {
-                for (int x = 0; x < dimensions.Item1 + margin; x++)
-                {
-                    Coordinates cords = new Coordinates(x + minX, y + minY);
-                    array[x + margin, y + margin] = points.Contains(cords) ? (byte)1 : (byte)0;
-                }
-            }
-
-            return array;
-        }
-
-        private static Tuple<int, int> GetDimensionsForPoints(Coordinates[] points)
-        {
-            int width = points.Max(x => x.X) - points.Min(x => x.X);
-            int height = points.Max(x => x.Y) - points.Min(x => x.Y);
-            return new Tuple<int, int>(width + 1, height + 1);
-        }
-    }
-}

+ 0 - 31
PixiEditor/Models/ImageManipulation/Transform.cs

@@ -1,31 +0,0 @@
-using PixiEditor.Models.Position;
-
-namespace PixiEditor.Models.ImageManipulation
-{
-    public static class Transform
-    {
-        /// <summary>
-        ///     Returns translation between two coordinates.
-        /// </summary>
-        /// <param name="from">Starting coordinate.</param>
-        /// <param name="to">New coordinate.</param>
-        /// <returns>Translation as coordinate.</returns>
-        public static Coordinates GetTranslation(Coordinates from, Coordinates to)
-        {
-            int translationX = to.X - from.X;
-            int translationY = to.Y - from.Y;
-            return new Coordinates(translationX, translationY);
-        }
-
-        public static Coordinates[] Translate(Coordinates[] points, Coordinates vector)
-        {
-            Coordinates[] translatedPoints = new Coordinates[points.Length];
-            for (int i = 0; i < translatedPoints.Length; i++)
-            {
-                translatedPoints[i] = new Coordinates(points[i].X + vector.X, points[i].Y + vector.Y);
-            }
-
-            return translatedPoints;
-        }
-    }
-}

+ 0 - 19
PixiEditor/Models/Position/MousePositionConverter.cs

@@ -1,19 +0,0 @@
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-namespace PixiEditor.Models.Position
-{
-    public static class MousePositionConverter
-    {
-        public static Coordinates CurrentCoordinates { get; set; }
-
-        public static Point GetCursorPosition()
-        {
-            GetCursorPos(out Point point);
-            return point;
-        }
-
-        [DllImport("user32.dll")]
-        private static extern bool GetCursorPos(out Point point);
-    }
-}

+ 0 - 41
PixiEditor/ViewModels/MenuButtonViewModel.cs

@@ -1,41 +0,0 @@
-using System.Windows;
-using PixiEditor.Helpers;
-
-namespace PixiEditor.ViewModels
-{
-    internal class MenuButtonViewModel : ViewModelBase
-    {
-        private Visibility listViewVisibility;
-
-        public MenuButtonViewModel()
-        {
-            OpenListViewCommand = new RelayCommand(OpenListView);
-            CloseListViewCommand = new RelayCommand(CloseListView);
-            ListViewVisibility = Visibility.Hidden;
-        }
-
-        public RelayCommand OpenListViewCommand { get; set; }
-
-        public RelayCommand CloseListViewCommand { get; set; }
-
-        public Visibility ListViewVisibility
-        {
-            get => listViewVisibility;
-            set
-            {
-                listViewVisibility = value;
-                RaisePropertyChanged("ListViewVisibility");
-            }
-        }
-
-        private void OpenListView(object parameter)
-        {
-            ListViewVisibility = ListViewVisibility == Visibility.Hidden ? Visibility.Visible : Visibility.Hidden;
-        }
-
-        private void CloseListView(object parameter)
-        {
-            ListViewVisibility = Visibility.Hidden;
-        }
-    }
-}

+ 1 - 1
PixiEditor/ViewModels/ViewModelMain.cs

@@ -367,7 +367,7 @@ namespace PixiEditor.ViewModels
             BitmapManager.ActiveDocument.CenterViewportTrigger.Execute(this, new Size(BitmapManager.ActiveDocument.Width, BitmapManager.ActiveDocument.Height));
         }
 
-        private void BitmapUtility_BitmapChanged(object sender, BitmapChangedEventArgs e)
+        private void BitmapUtility_BitmapChanged(object sender, EventArgs e)
         {
             BitmapManager.ActiveDocument.ChangesSaved = false;
             if (ToolsSubViewModel.ActiveTool is BitmapOperationTool)

+ 0 - 57
PixiEditor/Views/UserControls/MenuButton.xaml

@@ -1,57 +0,0 @@
-<UserControl x:Class="PixiEditor.Views.MenuButton"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:local="clr-namespace:PixiEditor.Views"
-             xmlns:vm="clr-namespace:PixiEditor.ViewModels"
-             xmlns:helpers="clr-namespace:PixiEditor.Helpers"
-             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
-             mc:Ignorable="d"
-             d:DesignHeight="40" d:DesignWidth="80" x:Name="menuButton"
-             DataContext="{DynamicResource MenuButtonViewModel}">
-    <UserControl.Resources>
-        <vm:MenuButtonViewModel x:Key="MenuButtonViewModel" />
-        <Style TargetType="ListViewItem">
-            <Style.Resources>
-                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Transparent" />
-                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
-
-            </Style.Resources>
-        </Style>
-    </UserControl.Resources>
-
-    <StackPanel Name="MainStackPanel">
-        <Button Content="{Binding ElementName=menuButton,Path=Text}" Style="{StaticResource MenuButton}"
-                HorizontalAlignment="Left" Command="{Binding OpenListViewCommand}" />
-        <ListView Visibility="{Binding ListViewVisibility}" Style="{StaticResource MenuListViewStyle}">
-            <ListView.ItemContainerStyle>
-                <Style TargetType="{x:Type ListViewItem}">
-                    <Setter Property="Background" Value="Transparent" />
-                    <Setter Property="VerticalContentAlignment"
-                            Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
-                    <Setter Property="Template">
-                        <Setter.Value>
-                            <ControlTemplate TargetType="{x:Type ListViewItem}">
-                                <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}"
-                                        BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent"
-                                        Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
-                                    <ContentPresenter
-                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
-                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
-                                </Border>
-                                <ControlTemplate.Triggers>
-                                    <Trigger Property="IsMouseOver" Value="True">
-                                        <Setter Property="BorderThickness" Value="1" />
-                                        <Setter Property="BorderBrush" Value="Transparent" />
-                                    </Trigger>
-                                </ControlTemplate.Triggers>
-                            </ControlTemplate>
-                        </Setter.Value>
-                    </Setter>
-                </Style>
-            </ListView.ItemContainerStyle>
-            <ContentPresenter Content="{Binding Item, ElementName=menuButton}" />
-        </ListView>
-    </StackPanel>
-</UserControl>

+ 0 - 46
PixiEditor/Views/UserControls/MenuButton.xaml.cs

@@ -1,46 +0,0 @@
-using PixiEditor.ViewModels;
-using System.Windows;
-using System.Windows.Controls;
-
-namespace PixiEditor.Views
-{
-    /// <summary>
-    ///     Interaction logic for MenuButton.xaml
-    /// </summary>
-    public partial class MenuButton : UserControl
-    {
-        public static readonly DependencyProperty MenuButtonTextProperty =
-            DependencyProperty.Register("Text", typeof(string), typeof(MenuButton),
-                new UIPropertyMetadata(string.Empty));
-
-        // Using a DependencyProperty as the backing store for Item.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty ItemProperty =
-            DependencyProperty.Register("Item", typeof(object), typeof(MenuButton), new PropertyMetadata(null));
-
-        private readonly MenuButtonViewModel dc = new MenuButtonViewModel();
-
-        public MenuButton()
-        {
-            InitializeComponent();
-            DataContext = dc;
-        }
-
-        public string Text
-        {
-            get => (string)GetValue(MenuButtonTextProperty);
-            set => SetValue(MenuButtonTextProperty, value);
-        }
-
-
-        public object Item
-        {
-            get => GetValue(ItemProperty);
-            set => SetValue(ItemProperty, value);
-        }
-
-        protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
-        {
-            dc.CloseListViewCommand.Execute(null);
-        }
-    }
-}

+ 0 - 16
PixiEditor/Views/UserControls/Rotatebox.xaml

@@ -1,16 +0,0 @@
-<UserControl x:Class="PixiEditor.Views.Rotatebox"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PixiEditor.Views"
-             mc:Ignorable="d" 
-             d:DesignHeight="100" d:DesignWidth="160" x:Name="uc">
-    <StackPanel Orientation="Vertical" RenderTransformOrigin="0.5, 0.5">
-    <Image Name="knob" Source="../Images/AnchorDot.png" RenderTransformOrigin="0.5,0.5" Width="20" Height="20"/>
-        <Border Width="120" Height="60" BorderThickness="0.3" BorderBrush="DeepSkyBlue" CornerRadius="1"/>
-        <StackPanel.RenderTransform>
-            <RotateTransform Angle="{Binding Path=Angle, ElementName=uc}"/>
-        </StackPanel.RenderTransform>
-    </StackPanel>
-</UserControl>

+ 0 - 71
PixiEditor/Views/UserControls/Rotatebox.xaml.cs

@@ -1,71 +0,0 @@
-using System;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-
-namespace PixiEditor.Views
-{
-    /// <summary>
-    /// Interaction logic for Rotatebox.xaml
-    /// </summary>
-    public partial class Rotatebox : UserControl
-    {
-        private double _height = 0, _width = 0;
-        private float _offset = 90;
-
-        public Rotatebox()
-        {
-            InitializeComponent();
-            MouseLeftButtonDown += OnMouseLeftButtonDown;
-            MouseUp += OnMouseUp;
-            MouseMove += OnMouseMove;
-        }
-
-        // Using a DependencyProperty backing store for Angle.
-        public static readonly DependencyProperty AngleProperty =
-            DependencyProperty.Register("Angle", typeof(double), typeof(Rotatebox), new UIPropertyMetadata(0.0));
-
-        public double Angle
-        {
-            get { return (double)GetValue(AngleProperty); }
-            set { SetValue(AngleProperty, value); }
-        }
-
-
-        private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
-        {
-            Mouse.Capture(this);
-            _width = ActualWidth;
-            _height = ActualHeight;
-        }
-
-        private void OnMouseUp(object sender, MouseButtonEventArgs e)
-        {
-            Mouse.Capture(null);
-        }
-
-        private void OnMouseMove(object sender, MouseEventArgs e)
-        {
-            if (Equals(Mouse.Captured, this))
-            {
-                // Get the current mouse position relative to the control
-                Point currentLocation = Mouse.GetPosition(this);
-
-                // We want to rotate around the center of the knob, not the top corner
-                Point knobCenter = new Point(_width / 2, _height / 2);
-
-                // Calculate an angle
-                double radians = Math.Atan((currentLocation.Y - knobCenter.Y) /
-                                           (currentLocation.X - knobCenter.X));
-                Angle = radians * 180 / Math.PI + _offset;
-
-                // Apply a 180 degree shift when X is negative so that we can rotate
-                // all of the way around
-                if (currentLocation.X - knobCenter.X < 0)
-                {
-                    Angle += 180;
-                }
-            }
-        }
-    }
-}

+ 0 - 1
PixiEditor/Views/UserControls/SizeInput.xaml

@@ -6,7 +6,6 @@
              xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
              xmlns:behaviors="clr-namespace:PixiEditor.Helpers.Behaviours"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
-             xmlns:validators="clr-namespace:PixiEditor.Helpers.Validators"
              mc:Ignorable="d" Foreground="White" Focusable="True"
              d:DesignHeight="30" d:DesignWidth="160" Name="uc">
 

+ 0 - 39
PixiEditorTests/ModelsTests/ImageManipulationTests/TransformTests.cs

@@ -1,39 +0,0 @@
-using PixiEditor.Models.ImageManipulation;
-using PixiEditor.Models.Position;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ImageManipulationTests
-{
-    public class TransformTests
-    {
-        [Theory]
-        [InlineData(0, 0, 1, 1, 1, 1)]
-        [InlineData(1, 1, 0, 0, -1, -1)]
-        [InlineData(5, 5, 4, 6, -1, 1)]
-        [InlineData(-15, -15, -16, -16, -1, -1)]
-        [InlineData(150, 150, 1150, 1150, 1000, 1000)]
-        public void TestGetTranslation(int x1, int y1, int x2, int y2, int expectedX, int expectedY)
-        {
-            Coordinates translation = Transform.GetTranslation(new Coordinates(x1, y1), new Coordinates(x2, y2));
-            Assert.Equal(new Coordinates(expectedX, expectedY), translation);
-        }
-
-        [Theory]
-        [InlineData(0, 0)]
-        [InlineData(1, 1)]
-        [InlineData(5, 2)]
-        [InlineData(50, 150)]
-        [InlineData(-5, -52)]
-        public void TestTranslate(int vectorX, int vectorY)
-        {
-            Coordinates[] points = { new Coordinates(0, 0), new Coordinates(5, 5), new Coordinates(15, 2) };
-            Coordinates[] translatedCords = Transform.Translate(points, new Coordinates(vectorX, vectorY));
-
-            for (int i = 0; i < points.Length; i++)
-            {
-                Assert.Equal(points[i].X + vectorX, translatedCords[i].X);
-                Assert.Equal(points[i].Y + vectorY, translatedCords[i].Y);
-            }
-        }
-    }
-}