Ejemplo n.º 1
0
        private void setPositionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CurrentSelectWindows.Count == 0)
            {
                return;
            }

            using (UISetWindowPosition dlg = new UISetWindowPosition())
            {
                Vector2 wndOldPos = GUISystem.Instance.ScreenToClient(CurrentSelectWindows[0].AbsolutePosition);
                dlg.LeftPosition = wndOldPos.x;
                dlg.TopPosition  = wndOldPos.y;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Vector2 wndNewPos = GUISystem.Instance.ClientToScreen(new Vector2(dlg.LeftPosition, dlg.TopPosition));
                    foreach (var item in CurrentSelectWindows)
                    {
                        CommandSetWindowPosition command = new CommandSetWindowPosition(item, wndNewPos);
                        command.Execute();
                        UndoRedoCommands.UndoCommands.Push(command);
                    }
                    RefreshUndoRedoStat();
                }
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 3
0
        private void pasteToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            WindowCollection wnds = PasteWindows(GUISystem.Instance.GetTargetWindow(this.guiRenderControl.LastMouseDownPosition));

            if (wnds == null)
            {
                return;
            }

            foreach (var item in wnds)
            {
                CommandSetWindowPosition command = new CommandSetWindowPosition(item, this.guiRenderControl.LastMouseDownPosition);
                command.Execute();
                UndoRedoCommands.UndoCommands.Push(command);
            }
            RefreshUndoRedoStat();
        }
Ejemplo n.º 4
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();
            }
        }