Example #1
0
        private void setSizeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CurrentSelectWindows.Count == 0)
            {
                return;
            }

            using (UISetWindowSize dlg = new UISetWindowSize())
            {
                Vector2 wndOldSize = CurrentSelectWindows[0].AbsoluteSize;
                dlg.WindowWidth  = wndOldSize.x;
                dlg.WindowHeight = wndOldSize.y;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Vector2 wndNewSize = new Vector2(dlg.WindowWidth, dlg.WindowHeight);
                    foreach (var item in CurrentSelectWindows)
                    {
                        CommandSetWindowSize command = new CommandSetWindowSize(item, wndNewSize);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                    RefreshUndoRedoStat();
                }
            }
        }
Example #2
0
        internal void InjectEditorMouseMove(MouseEventArgs e)
        {
            if (CurrentMode == UIEditorMode.Preview)
            {
                return;
            }

            Vector2 deltaPos = this.guiRenderControl.DeltaMouseMove;

            if (e.Button == MouseButtons.Left)
            {
                foreach (var item in CurrentSelectWindows)
                {
                    if (GUISystem.Instance.Modifiers == Keys.Alt)
                    {
                        CommandSetWindowSize command = new CommandSetWindowSize(item, item.AbsoluteSize + deltaPos);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                    else if (GUISystem.Instance.Modifiers == Keys.Shift)
                    {
                        CommandSetWindowPosition command = new CommandSetWindowPosition(item, item.AbsolutePosition + deltaPos);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                }
                RefreshUndoRedoStat();
            }
        }
Example #3
0
        internal void InjectKeyDown(KeyEventArgs e)
        {
            Vector2 deltaMove = Vector2.Zero;

            if (e.KeyCode == Keys.Left)
            {
                deltaMove.x = -1;
            }
            if (e.KeyCode == Keys.Right)
            {
                deltaMove.x = 1;
            }
            if (e.KeyCode == Keys.Up)
            {
                deltaMove.y = -1;
            }
            if (e.KeyCode == Keys.Down)
            {
                deltaMove.y = 1;
            }

            if (deltaMove != Vector2.Zero)
            {
                foreach (var item in CurrentSelectWindows)
                {
                    if (GUISystem.Instance.Modifiers == Keys.Alt)
                    {
                        CommandSetWindowSize command = new CommandSetWindowSize(item, item.AbsoluteSize + deltaMove);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                    else
                    {
                        CommandSetWindowPosition command = new CommandSetWindowPosition(item, item.AbsolutePosition + deltaMove);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                }
                RefreshUndoRedoStat();
            }
        }