Forráskód Böngészése

Updated logo size and icon, fixed drag viewport and even shapes

flabbet 5 éve
szülő
commit
4f4d9e6e58

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018 flabbet
+Copyright (c) 2018-2020 flabbet
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

BIN
PixiEditor/Images/PixiEditorLogo.png


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

@@ -155,7 +155,7 @@ namespace PixiEditor.Models.Controllers
 
         private bool IsDraggingViewport()
         {
-            return Keyboard.IsKeyDown(Key.LeftShift);
+            return Keyboard.IsKeyDown(Key.LeftShift) && !(SelectedTool is ShapeTool);
         }
 
         private void MouseController_StartedRecordingChanges(object sender, EventArgs e)

+ 29 - 11
PixiEditor/ViewModels/ViewModelMain.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Windows;
@@ -49,7 +50,7 @@ namespace PixiEditor.ViewModels
         public RelayCommand MouseMoveCommand { get; set; } //Command that is used to draw
         public RelayCommand MouseDownCommand { get; set; }
         public RelayCommand KeyDownCommand { get; set; }
-        public RelayCommand SaveFileCommand { get; set; } //Command that is used to save file
+        public RelayCommand ExportFileCommand { get; set; } //Command that is used to save file
         public RelayCommand UndoCommand { get; set; }
         public RelayCommand RedoCommand { get; set; }
         public RelayCommand MouseUpCommand { get; set; }
@@ -76,6 +77,7 @@ namespace PixiEditor.ViewModels
         public RelayCommand OnStartupCommand { get; set; }
         public RelayCommand CloseWindowCommand { get; set; }
         public RelayCommand CenterContentCommand { get; set; }
+        public RelayCommand OpenHyperlinkCommand { get; set; }
 
         private double _mouseXonCanvas;
 
@@ -187,7 +189,7 @@ namespace PixiEditor.ViewModels
             OpenNewFilePopupCommand = new RelayCommand(OpenNewFilePopup);
             MouseMoveCommand = new RelayCommand(MouseMove);
             MouseDownCommand = new RelayCommand(MouseDown);
-            SaveFileCommand = new RelayCommand(SaveFile, CanSave);
+            ExportFileCommand = new RelayCommand(ExportFile, CanSave);
             UndoCommand = new RelayCommand(Undo, CanUndo);
             RedoCommand = new RelayCommand(Redo, CanRedo);
             MouseUpCommand = new RelayCommand(MouseUp);
@@ -215,6 +217,7 @@ namespace PixiEditor.ViewModels
             OnStartupCommand = new RelayCommand(OnStartup);
             CloseWindowCommand = new RelayCommand(CloseWindow);
             CenterContentCommand = new RelayCommand(CenterContent, DocumentIsNotNull);
+            OpenHyperlinkCommand = new RelayCommand(OpenHyperlink);
             ToolSet = new ObservableCollection<Tool>
             {
                 new MoveTool(), new PenTool(), new SelectTool(), new FloodFill(), new LineTool(),
@@ -224,9 +227,8 @@ namespace PixiEditor.ViewModels
             {
                 Shortcuts = new List<Shortcut>
                 {
+                    //Tools
                     new Shortcut(Key.B, SelectToolCommand, ToolType.Pen),
-                    new Shortcut(Key.X, SwapColorsCommand),
-                    new Shortcut(Key.O, OpenFileCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.E, SelectToolCommand, ToolType.Earser),
                     new Shortcut(Key.O, SelectToolCommand, ToolType.ColorPicker),
                     new Shortcut(Key.R, SelectToolCommand, ToolType.Rectangle),
@@ -236,13 +238,10 @@ namespace PixiEditor.ViewModels
                     new Shortcut(Key.U, SelectToolCommand, ToolType.Brightness),
                     new Shortcut(Key.V, SelectToolCommand, ToolType.Move),
                     new Shortcut(Key.M, SelectToolCommand, ToolType.Select),
+                    //Editor
+                    new Shortcut(Key.X, SwapColorsCommand),
                     new Shortcut(Key.Y, RedoCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.Z, UndoCommand),
-                    new Shortcut(Key.S, SaveFileCommand,
-                        modifier: ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt),
-                    new Shortcut(Key.S, SaveDocumentCommand, modifier: ModifierKeys.Control),
-                    new Shortcut(Key.S, SaveDocumentCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
-                    new Shortcut(Key.N, OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.D, DeselectCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.A, SelectAllCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.C, CopyCommand, modifier: ModifierKeys.Control),
@@ -251,7 +250,14 @@ namespace PixiEditor.ViewModels
                     new Shortcut(Key.X, CutCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.Delete, DeletePixelsCommand),
                     new Shortcut(Key.I, OpenResizePopupCommand, modifier: ModifierKeys.Control | ModifierKeys.Shift),
-                    new Shortcut(Key.C, OpenResizePopupCommand, "canvas", ModifierKeys.Control | ModifierKeys.Shift)
+                    new Shortcut(Key.C, OpenResizePopupCommand, "canvas", ModifierKeys.Control | ModifierKeys.Shift),
+                    //File
+                    new Shortcut(Key.O, OpenFileCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.S, ExportFileCommand,
+                        modifier: ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt),
+                    new Shortcut(Key.S, SaveDocumentCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.S, SaveDocumentCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
+                    new Shortcut(Key.N, OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
                 }
             };
             UndoManager.SetMainRoot(this);
@@ -261,6 +267,18 @@ namespace PixiEditor.ViewModels
             Current = this;
         }
 
+        private void OpenHyperlink(object parameter)
+        {
+            if (parameter == null) return;
+            string url = (string) parameter;
+            var processInfo = new ProcessStartInfo()
+            {
+                FileName = url,
+                UseShellExecute = true
+            };
+            Process.Start(processInfo);
+        }
+
         private void CenterContent(object property)
         {
             BitmapManager.ActiveDocument.CenterContent();
@@ -714,7 +732,7 @@ namespace PixiEditor.ViewModels
         ///     Generates export dialog or saves directly if save data is known.
         /// </summary>
         /// <param name="parameter"></param>
-        private void SaveFile(object parameter)
+        private void ExportFile(object parameter)
         {
             WriteableBitmap bitmap = BitmapManager.GetCombinedLayersBitmap();
             Exporter.Export(bitmap, new Size(bitmap.PixelWidth, bitmap.PixelHeight));

+ 14 - 1
PixiEditor/Views/MainWindow.xaml

@@ -76,7 +76,7 @@
                     <MenuItem Header="_Save" InputGestureText="Ctrl+S" Command="{Binding SaveDocumentCommand}" />
                     <MenuItem Header="_Save As..." InputGestureText="Ctrl+Shift+S"
                               Command="{Binding SaveDocumentCommand}" CommandParameter="AsNew" />
-                    <MenuItem Header="_Export" InputGestureText="Ctrl+Shift+Alt+S" Command="{Binding SaveFileCommand}" />
+                    <MenuItem Header="_Export" InputGestureText="Ctrl+Shift+Alt+S" Command="{Binding ExportFileCommand}" />
                 </MenuItem>
                 <MenuItem Header="_Edit">
                     <MenuItem Header="_Undo" InputGestureText="Ctrl+Z" Command="{Binding UndoCommand}" />
@@ -103,6 +103,19 @@
                     <Separator/>
                     <MenuItem Header="Center Content" Command="{Binding CenterContentCommand}" />
                 </MenuItem>
+                <MenuItem Header="_Help">
+                    <MenuItem Header="Documentation" Command="{Binding OpenHyperlinkCommand}"
+                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki"/>
+                    <MenuItem Header="Repository" Command="{Binding OpenHyperlinkCommand}"
+                              CommandParameter="https://github.com/flabbet/PixiEditor"/>
+                    <MenuItem Header="Shortcuts" Command="{Binding OpenHyperlinkCommand}"
+                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki/Shortcuts"/>
+                    <Separator/>
+                    <MenuItem Header="License" Command="{Binding OpenHyperlinkCommand}"
+                              CommandParameter="https://github.com/flabbet/PixiEditor/blob/master/LICENSE"/>
+                    <MenuItem Header="Third Party Licenses" Command="{Binding OpenHyperlinkCommand}"
+                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki/Third-party-licenses"/>
+                </MenuItem>
             </Menu>
             <StackPanel DockPanel.Dock="Right" VerticalAlignment="Top" Orientation="Horizontal"
                         HorizontalAlignment="Right" WindowChrome.IsHitTestVisibleInChrome="True">

BIN
icon.ico