Browse Source

Fixed modifiers for some shortcuts

Frytek 5 years ago
parent
commit
8f7514373e

+ 5 - 4
PixiEditor/ViewModels/ViewModelMain.cs

@@ -13,6 +13,7 @@ using PixiEditor.Models.Dialogs;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
+using PixiEditor.Views;
 
 
 namespace PixiEditor.ViewModels
 namespace PixiEditor.ViewModels
 {
 {
@@ -161,16 +162,16 @@ namespace PixiEditor.ViewModels
                 Shortcuts = new List<Shortcut> { 
                 Shortcuts = new List<Shortcut> { 
                     new Shortcut(Key.B, SelectToolCommand, ToolType.Pen),
                     new Shortcut(Key.B, SelectToolCommand, ToolType.Pen),
                     new Shortcut(Key.X, SwapColorsCommand),
                     new Shortcut(Key.X, SwapColorsCommand),
-                    new Shortcut(Key.O, OpenFileCommand, ModifierKeys.Control),
+                    new Shortcut(Key.O, OpenFileCommand, null, ModifierKeys.Control),
                     new Shortcut(Key.E, SelectToolCommand, ToolType.Earser),
                     new Shortcut(Key.E, SelectToolCommand, ToolType.Earser),
                     new Shortcut(Key.O, SelectToolCommand, ToolType.ColorPicker),
                     new Shortcut(Key.O, SelectToolCommand, ToolType.ColorPicker),
                     new Shortcut(Key.C, SelectToolCommand, ToolType.Rectangle),
                     new Shortcut(Key.C, SelectToolCommand, ToolType.Rectangle),
                     new Shortcut(Key.L, SelectToolCommand, ToolType.Line),
                     new Shortcut(Key.L, SelectToolCommand, ToolType.Line),
                     new Shortcut(Key.G, SelectToolCommand, ToolType.Bucket),
                     new Shortcut(Key.G, SelectToolCommand, ToolType.Bucket),
-                    new Shortcut(Key.Y, RedoCommand, ModifierKeys.Control),
+                    new Shortcut(Key.Y, RedoCommand, null, ModifierKeys.Control),
                     new Shortcut(Key.Z, UndoCommand),
                     new Shortcut(Key.Z, UndoCommand),
-                    new Shortcut(Key.S, UndoCommand, ModifierKeys.Control),
-                    new Shortcut(Key.N, GenerateDrawAreaCommand, ModifierKeys.Control),
+                    new Shortcut(Key.S, UndoCommand, null, ModifierKeys.Control),
+                    new Shortcut(Key.N, GenerateDrawAreaCommand, null, ModifierKeys.Control),
                 }
                 }
             };
             };
             UndoManager.SetMainRoot(this);
             UndoManager.SetMainRoot(this);

+ 1 - 3
PixiEditor/Views/EditableTextBlock.xaml

@@ -2,9 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              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:i="http://schemas.microsoft.com/expression/2010/interactivity"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
              mc:Ignorable="d" 
              mc:Ignorable="d" 
              d:DesignHeight="60" d:DesignWidth="100">
              d:DesignHeight="60" d:DesignWidth="100">

+ 16 - 3
PixiEditor/Views/EditableTextBlock.xaml.cs

@@ -37,20 +37,33 @@ namespace PixiEditor.Views
         public static readonly DependencyProperty TextBlockVisibilityProperty =
         public static readonly DependencyProperty TextBlockVisibilityProperty =
             DependencyProperty.Register("TextBlockVisibility", typeof(Visibility), typeof(EditableTextBlock), new PropertyMetadata(Visibility.Visible));
             DependencyProperty.Register("TextBlockVisibility", typeof(Visibility), typeof(EditableTextBlock), new PropertyMetadata(Visibility.Visible));
 
 
-
-
+      
 
 
         // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
         // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TextProperty =
         public static readonly DependencyProperty TextProperty =
             DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock), new PropertyMetadata(default(string)));
             DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock), new PropertyMetadata(default(string)));
 
 
+
+
+        public RelayCommand EnableEditingCommand
+        {
+            get { return (RelayCommand)GetValue(EnableEditingCommandProperty); }
+            set { SetValue(EnableEditingCommandProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for EnableEditingCommand.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty EnableEditingCommandProperty =
+            DependencyProperty.Register("EnableEditingCommand", typeof(RelayCommand), typeof(EditableTextBlock), new PropertyMetadata(null));
+
+
+
         public string Text
         public string Text
         {
         {
             get { return (string)GetValue(TextProperty); }
             get { return (string)GetValue(TextProperty); }
             set { SetValue(TextProperty, value); }
             set { SetValue(TextProperty, value); }
         }
         }
 
 
-        private void EnableEditing()
+        public void EnableEditing()
         {
         {
             ShortcutController.BlockShortcutExecution = true;
             ShortcutController.BlockShortcutExecution = true;
             TextBlockVisibility = Visibility.Hidden;
             TextBlockVisibility = Visibility.Hidden;