Ejemplo n.º 1
0
 private void saveLevelButton_Click(object sender, EventArgs e)
 {
     levelEditorControl1.UndoManager.Clean();
     Level.Save();
 }
Ejemplo n.º 2
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            Console.Out.WriteLine(keyData);
            if (keyData == (Keys.Control | Keys.X))
            {
                cut();
                return(true);
            }
            if (keyData == (Keys.Control | Keys.C))
            {
                copy();
                return(true);
            }
            if (keyData == (Keys.Control | Keys.V))
            {
                paste();
                return(true);
            }
            if (keyData == (Keys.Control | Keys.S))
            {
                Level.Save();
                return(true);
            }
            if (keyData == (Keys.Control | Keys.Z))
            {
                UndoManager.onUndoLast(null, null);
                return(true);
            }
            if (keyData == (Keys.Control | Keys.Y))
            {
                UndoManager.onRedoLast(null, null);
                return(true);
            }
            if (keyData == (Keys.Control | Keys.A))
            {
                mode.SelectAll();
                return(true);
            }
            if (keyData == (Keys.Delete))
            {
                delete();
                return(true);
            }
            if (keyData == (Keys.PageDown))
            {
                mode.lower();
                return(true);
            }
            if (keyData == (Keys.PageUp))
            {
                mode.raise();
                return(true);
            }
            int xDelta = 0, yDelta = 0;

            if (keyData == Keys.Up)
            {
                yDelta -= 1;
            }
            if (keyData == Keys.Down)
            {
                yDelta += 1;
            }
            if (keyData == Keys.Left)
            {
                xDelta -= 1;
            }
            if (keyData == Keys.Right)
            {
                xDelta += 1;
            }
            if (xDelta != 0 || yDelta != 0)
            {
                mode.MoveObjects(xDelta, yDelta);
                return(true);
            }

            int newTab = -1;

            if (keyData == Keys.C)
            {
                newTab = 0;
            }
            if (keyData == Keys.O)
            {
                newTab = 1;
            }
            if (keyData == Keys.S)
            {
                newTab = 2;
            }
            if (keyData == Keys.E)
            {
                newTab = 3;
            }
            if (keyData == Keys.V)
            {
                newTab = 4;
            }
            if (keyData == Keys.Z)
            {
                newTab = 5;
            }
            if (keyData == Keys.P)
            {
                newTab = 6;
            }
            if (keyData == Keys.G)
            {
                newTab = 7;
            }

            if (newTab != -1)
            {
                editor.oem.tabs.SelectedTab = newTab;
                this.Focus(); //For some reason setting a new tab gives it focus
                return(true);
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }