public bool OnHotkey(Keys keyData)
        {
            if (!keyData.HasFlag(Keys.Control))
            {
                return(false);
            }

            var key = keyData & ~Keys.Control;

            switch (key)
            {
            case Keys.N:
                ClearAllPixelsButton.PerformClick();
                return(true);

            case Keys.I:
                InverseButton.PerformClick();
                return(true);

            case Keys.R:
                ResizeButton.PerformClick();
                return(true);

            case Keys.C:
                CopyButton.PerformClick();
                return(true);

            case Keys.V:
                PasteButton.PerformClick();
                return(true);

            case Keys.A:
                ImageListBox.BeginUpdate();
                ImageListBox.SelectedIndices.Clear();
                ImageListBox.SelectedIndices.AddRange(Enumerable.Range(0, ImageListBox.Items.Count));
                ImageListBox.EndUpdate();
                return(true);

            case Keys.Up:
                ShiftUpButton.PerformClick();
                return(true);

            case Keys.Down:
                ShiftDownButton.PerformClick();
                return(true);

            case Keys.Left:
                ShiftLeftButton.PerformClick();
                return(true);

            case Keys.Right:
                ShiftRightButton.PerformClick();
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        public void CreateUi()
        {
            var copyButton = new CopyButton();

            copyButton.SetCommand(Execute(new CopyCommand(_activeEditor, this)));
            var cutButton = new CutButton();

            cutButton.SetCommand(Execute(new CutCommand(_activeEditor, this)));
            var pasteButton = new PasteButton();

            pasteButton.SetCommand(Execute(new PasteCommand(_activeEditor, this)));
            var undoButton = new UndoButton();

            undoButton.SetCommand(Execute(new UndoCommand(_activeEditor, this)));
        }
Beispiel #3
0
 private void RegisterCommands()
 {
     // bind the default commands to the buttons
     zoomInButton.SetCommand(Commands.IncreaseZoom, graphControl);
     zoomOutButton.SetCommand(Commands.DecreaseZoom, graphControl);
     zoom100Button.SetCommand(Commands.Zoom, 1, graphControl);
     fitContentButton.SetCommand(Commands.FitContent, graphControl);
     undoButton.SetCommand(Commands.Undo, graphControl);
     redoButton.SetCommand(Commands.Redo, graphControl);
     GroupSelectionButton.SetCommand(Commands.GroupSelection, graphControl);
     UngroupSelectionButton.SetCommand(Commands.UngroupSelection, graphControl);
     CutButton.SetCommand(Commands.Cut, graphControl);
     copyButton.SetCommand(Commands.Copy, graphControl);
     PasteButton.SetCommand(Commands.Paste, graphControl);
     openButton.SetCommand(Commands.Open, graphControl);
     SaveButton.SetCommand(Commands.SaveAs, graphControl);
     DeleteButton.SetCommand(Commands.Delete, graphControl);
 }
Beispiel #4
0
 private void MapStyleEditorForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Alt && e.KeyCode == Keys.C)
     {
         CopyTypeButton.PerformClick();
         return;
     }
     else if (e.Alt && e.KeyCode == Keys.T)
     {
         CopyTileButton.PerformClick();
         return;
     }
     else if (e.Alt && e.KeyCode == Keys.V)
     {
         PasteButton.PerformClick();
         return;
     }
 }