|
@@ -109,63 +109,61 @@ namespace PixiEditor.ViewModels
|
|
|
ViewportSubViewModel = new ViewportViewModel(this);
|
|
|
ColorsSubViewModel = new ColorsViewModel(this);
|
|
|
DocumentSubViewModel = new DocumentViewModel(this);
|
|
|
- MiscSubViewModel = new MiscViewModel(this);
|
|
|
DiscordViewModel = new DiscordViewModel(this, "764168193685979138");
|
|
|
#if DEBUG
|
|
|
DebugSubViewModel = new DebugViewModel(this);
|
|
|
#endif
|
|
|
|
|
|
- ShortcutController = new ShortcutController
|
|
|
- {
|
|
|
- Shortcuts = new List<Shortcut>
|
|
|
- {
|
|
|
- // Tools
|
|
|
- CreateToolShortcut<PenTool>(Key.B),
|
|
|
- CreateToolShortcut<EraserTool>(Key.E),
|
|
|
- CreateToolShortcut<ColorPickerTool>(Key.O),
|
|
|
- CreateToolShortcut<RectangleTool>(Key.R),
|
|
|
- CreateToolShortcut<CircleTool>(Key.C),
|
|
|
- CreateToolShortcut<LineTool>(Key.L),
|
|
|
- CreateToolShortcut<FloodFill>(Key.G),
|
|
|
- CreateToolShortcut<BrightnessTool>(Key.U),
|
|
|
- CreateToolShortcut<MoveTool>(Key.V),
|
|
|
- CreateToolShortcut<SelectTool>(Key.M),
|
|
|
- CreateToolShortcut<ZoomTool>(Key.Z),
|
|
|
- CreateToolShortcut<MoveViewportTool>(Key.H),
|
|
|
- new Shortcut(Key.OemPlus, ViewportSubViewModel.ZoomCommand, 115),
|
|
|
- new Shortcut(Key.OemMinus, ViewportSubViewModel.ZoomCommand, 85),
|
|
|
- new Shortcut(Key.OemOpenBrackets, ToolsSubViewModel.ChangeToolSizeCommand, -1),
|
|
|
- new Shortcut(Key.OemCloseBrackets, ToolsSubViewModel.ChangeToolSizeCommand, 1),
|
|
|
-
|
|
|
- // Editor
|
|
|
- new Shortcut(Key.X, ColorsSubViewModel.SwapColorsCommand),
|
|
|
- new Shortcut(Key.Y, UndoSubViewModel.RedoCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.Z, UndoSubViewModel.UndoCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.D, SelectionSubViewModel.DeselectCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.A, SelectionSubViewModel.SelectAllCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.C, ClipboardSubViewModel.CopyCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.V, ClipboardSubViewModel.PasteCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.J, ClipboardSubViewModel.DuplicateCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.X, ClipboardSubViewModel.CutCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.Delete, DocumentSubViewModel.DeletePixelsCommand),
|
|
|
- new Shortcut(Key.I, DocumentSubViewModel.OpenResizePopupCommand, modifier: ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
- new Shortcut(Key.C, DocumentSubViewModel.OpenResizePopupCommand, "canvas", ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
- new Shortcut(Key.F11, SystemCommands.MaximizeWindowCommand),
|
|
|
-
|
|
|
- // File
|
|
|
- new Shortcut(Key.O, FileSubViewModel.OpenFileCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.S, FileSubViewModel.ExportFileCommand, modifier: ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt),
|
|
|
- new Shortcut(Key.S, FileSubViewModel.SaveDocumentCommand, modifier: ModifierKeys.Control),
|
|
|
- new Shortcut(Key.S, FileSubViewModel.SaveDocumentCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
- new Shortcut(Key.N, FileSubViewModel.OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
|
|
|
-
|
|
|
- // Layers
|
|
|
- new Shortcut(Key.F2, LayersSubViewModel.RenameLayerCommand, BitmapManager.ActiveDocument?.ActiveLayerGuid),
|
|
|
-
|
|
|
- // View
|
|
|
- new Shortcut(Key.OemTilde, ViewportSubViewModel.ToggleGridLinesCommand, modifier: ModifierKeys.Control),
|
|
|
- }
|
|
|
- };
|
|
|
+ ShortcutController = new ShortcutController(
|
|
|
+ new ShortcutGroup(
|
|
|
+ "Tools",
|
|
|
+ CreateToolShortcut<PenTool>(Key.B, "Select Pen Tool"),
|
|
|
+ CreateToolShortcut<EraserTool>(Key.E, "Select Eraser Tool"),
|
|
|
+ CreateToolShortcut<ColorPickerTool>(Key.O, "Select Color Picker Tool"),
|
|
|
+ CreateToolShortcut<RectangleTool>(Key.R, "Select Rectangle Tool"),
|
|
|
+ CreateToolShortcut<CircleTool>(Key.C, "Select Circle Tool"),
|
|
|
+ CreateToolShortcut<LineTool>(Key.L, "Select Line Tool"),
|
|
|
+ CreateToolShortcut<FloodFill>(Key.G, "Select Flood Fill Tool"),
|
|
|
+ CreateToolShortcut<BrightnessTool>(Key.U, "Select Brightness Tool"),
|
|
|
+ CreateToolShortcut<MoveTool>(Key.V, "Select Move Tool"),
|
|
|
+ CreateToolShortcut<SelectTool>(Key.M, "Select Select Tool"),
|
|
|
+ CreateToolShortcut<ZoomTool>(Key.Z, "Select Zoom Tool"),
|
|
|
+ CreateToolShortcut<MoveViewportTool>(Key.H, "Select Viewport Move Tool"),
|
|
|
+ new Shortcut(Key.OemPlus, ViewportSubViewModel.ZoomCommand, "Zoom in", 115),
|
|
|
+ new Shortcut(Key.OemMinus, ViewportSubViewModel.ZoomCommand, "Zoom out", 85),
|
|
|
+ new Shortcut(Key.OemOpenBrackets, ToolsSubViewModel.ChangeToolSizeCommand, "Decrease Tool Size", -1),
|
|
|
+ new Shortcut(Key.OemCloseBrackets, ToolsSubViewModel.ChangeToolSizeCommand, "Increase Tool Size", 1)),
|
|
|
+ new ShortcutGroup(
|
|
|
+ "Editor",
|
|
|
+ new Shortcut(Key.X, ColorsSubViewModel.SwapColorsCommand, "Swap primary and secondary color"),
|
|
|
+ new Shortcut(Key.Y, UndoSubViewModel.RedoCommand, "Redo", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.Z, UndoSubViewModel.UndoCommand, "Undo", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.D, SelectionSubViewModel.DeselectCommand, "Deselect all command", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.A, SelectionSubViewModel.SelectAllCommand, "Select all command", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.C, ClipboardSubViewModel.CopyCommand, "Copy", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.V, ClipboardSubViewModel.PasteCommand, "Paste", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.J, ClipboardSubViewModel.DuplicateCommand, "Duplicate", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.X, ClipboardSubViewModel.CutCommand, "Cut", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.Delete, DocumentSubViewModel.DeletePixelsCommand, "Delete selected pixels"),
|
|
|
+ new Shortcut(Key.I, DocumentSubViewModel.OpenResizePopupCommand, "Resize document", modifier: ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
+ new Shortcut(Key.C, DocumentSubViewModel.OpenResizePopupCommand, "Resize canvas", "canvas", ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
+ new Shortcut(Key.F11, SystemCommands.MaximizeWindowCommand, "Maximize")),
|
|
|
+ new ShortcutGroup(
|
|
|
+ "File",
|
|
|
+ new Shortcut(Key.O, FileSubViewModel.OpenFileCommand, "Open a Document", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.S, FileSubViewModel.ExportFileCommand, "Export as image", modifier: ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt),
|
|
|
+ new Shortcut(Key.S, FileSubViewModel.SaveDocumentCommand, "Save Document", modifier: ModifierKeys.Control),
|
|
|
+ new Shortcut(Key.S, FileSubViewModel.SaveDocumentCommand, "Save Docuemnt As New", "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
|
|
|
+ new Shortcut(Key.N, FileSubViewModel.OpenNewFilePopupCommand, "Create new Document", modifier: ModifierKeys.Control)),
|
|
|
+ new ShortcutGroup(
|
|
|
+ "Layers",
|
|
|
+ new Shortcut(Key.F2, LayersSubViewModel.RenameLayerCommand, "Rename active layer", BitmapManager.ActiveDocument?.ActiveLayerGuid)),
|
|
|
+ new ShortcutGroup(
|
|
|
+ "View",
|
|
|
+ new Shortcut(Key.OemTilde, ViewportSubViewModel.ToggleGridLinesCommand, "Toggle gridlines", modifier: ModifierKeys.Control)));
|
|
|
+
|
|
|
+ MiscSubViewModel = new MiscViewModel(this);
|
|
|
+
|
|
|
BitmapManager.PrimaryColor = ColorsSubViewModel.PrimaryColor;
|
|
|
}
|
|
|
|
|
@@ -193,6 +191,12 @@ namespace PixiEditor.ViewModels
|
|
|
return new Shortcut(key, ToolsSubViewModel.SelectToolCommand, typeof(T), modifier);
|
|
|
}
|
|
|
|
|
|
+ private Shortcut CreateToolShortcut<T>(Key key, string description, ModifierKeys modifier = ModifierKeys.None)
|
|
|
+ where T : Tool
|
|
|
+ {
|
|
|
+ return new Shortcut(key, ToolsSubViewModel.SelectToolCommand, description, typeof(T), modifier);
|
|
|
+ }
|
|
|
+
|
|
|
public void CloseWindow(object property)
|
|
|
{
|
|
|
if (!(property is CancelEventArgs))
|