Beispiel #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (!numericUpDownZoom.Focused)
            {
                int nHChange = 0;
                int nVChange = 0;
                // NOTE: this method only detects keydown events
                switch (keyData)
                {
                case Keys.Control | Keys.Add:
                    numericUpDownZoom.Value = Math.Min(numericUpDownZoom.Maximum,
                                                       numericUpDownZoom.Value + numericUpDownZoom.Increment);
                    break;

                case Keys.Control | Keys.Subtract:
                    numericUpDownZoom.Value = Math.Max(numericUpDownZoom.Minimum,
                                                       numericUpDownZoom.Value - numericUpDownZoom.Increment);
                    break;

                // focus is taken by the MDICanvas, reset it after each change below & reset the translation lock
                case Keys.Shift | Keys.Up:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(-1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Shift | Keys.Down:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Up:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(-1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Down:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.ShiftKey | Keys.Shift:
                    if (TranslationLock.Unset == m_eTranslationLock)
                    {
                        m_eTranslationLock = TranslationLock.WaitingToSet;
                    }
                    break;

                case Keys.Up:
                    nVChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Down:
                    nVChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Left:
                    nHChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Right:
                    nHChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.M:
                    ChangeMouseMode(MouseMode.Move == m_eMouseMode
                            ? MouseMode.MoveResize
                            : MouseMode.Move);
                    break;

                case Keys.R:
                    ChangeMouseMode(MouseMode.Rotate == m_eMouseMode
                            ? MouseMode.MoveResize
                            : MouseMode.Rotate);
                    break;
                }
                ElementManager.Instance.ProcessSelectedElementsChange(nHChange, nVChange, 0, 0);
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }
Beispiel #2
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (!numericUpDownZoom.Focused)
            {
                int nHChange = 0;
                int nVChange = 0;
                // NOTE: this method only detects keydown events
                bool ignoreDisabledElements = false;
                switch (keyData)
                {
                case Keys.Control | Keys.Add:
                    ignoreDisabledElements  = true;
                    numericUpDownZoom.Value = Math.Min(numericUpDownZoom.Maximum,
                                                       numericUpDownZoom.Value + numericUpDownZoom.Increment);
                    break;

                case Keys.Control | Keys.Subtract:
                    ignoreDisabledElements  = true;
                    numericUpDownZoom.Value = Math.Max(numericUpDownZoom.Minimum,
                                                       numericUpDownZoom.Value - numericUpDownZoom.Increment);
                    break;

                // focus is taken by the MDICanvas, reset it after each change below & reset the translation lock
                case Keys.Shift | Keys.Up:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(-1);
                    TranslationLockState = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Shift | Keys.Down:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(1);
                    TranslationLockState = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Up:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(-1);
                    TranslationLockState = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Down:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(1);
                    TranslationLockState = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.ShiftKey | Keys.Shift:
                    if (TranslationLock.Unset == TranslationLockState)
                    {
                        TranslationLockState = TranslationLock.WaitingToSet;
                    }
                    break;

                case Keys.Up:
                    nVChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Down:
                    nVChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Left:
                    nHChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Right:
                    nHChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.M:
                    ignoreDisabledElements = true;
                    ChangeMouseMode(MouseMode.Move == m_eMouseMode
                            ? MouseMode.MoveResize
                            : MouseMode.Move);
                    break;

                case Keys.R:
                    ignoreDisabledElements = true;
                    ChangeMouseMode(MouseMode.Rotate == m_eMouseMode
                            ? MouseMode.MoveResize
                            : MouseMode.Rotate);
                    break;
                }

                if (!ignoreDisabledElements)
                {
                    if (CheckAllSelectedElementsEnabled(false))
                    {
                        ElementManager.Instance.ProcessSelectedElementsChange(nHChange, nVChange, 0, 0);
                    }
                    else
                    {
                        Logger.AddLogLine("You cannot adjust disabled elements!");
                    }
                }
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }
Beispiel #3
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (!numericUpDownZoom.Focused)
            {
                int nHChange = 0;
                int nVChange = 0;
                // NOTE: this method only detects keydown events
                switch (keyData)
                {
                case Keys.Control | Keys.Add:
                    numericUpDownZoom.Value = Math.Min(numericUpDownZoom.Maximum,
                                                       numericUpDownZoom.Value + numericUpDownZoom.Increment);
                    break;

                case Keys.Control | Keys.Subtract:
                    numericUpDownZoom.Value = Math.Max(numericUpDownZoom.Minimum,
                                                       numericUpDownZoom.Value - numericUpDownZoom.Increment);
                    break;

                // focus is taken by the MDICanvas, reset it after each change below & reset the translation lock
                case Keys.Shift | Keys.Up:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(-1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Shift | Keys.Down:
                    LayoutManager.Instance.FireElementOrderAdjustRequest(1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Up:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(-1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Control | Keys.Down:
                    LayoutManager.Instance.FireElementSelectAdjustRequest(1);
                    m_eTranslationLock = TranslationLock.Unset;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.ShiftKey | Keys.Shift:
                    if (TranslationLock.Unset == m_eTranslationLock)
                    {
                        m_eTranslationLock = TranslationLock.WaitingToSet;
                    }
                    break;

                case Keys.Up:
                    nVChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Down:
                    nVChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Left:
                    nHChange = -1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.Right:
                    nHChange = 1;
                    m_zCardCanvas.Focus();
                    break;

                case Keys.M:
                    m_eMouseMode = MouseMode.Move == m_eMouseMode
                            ? MouseMode.MoveResize
                            : MouseMode.Move;
                    UpdateText();
                    // get the position of the mouse to trigger a standard mouse move (updates the cursor/mode)
                    var pLocation = panelCardCanvas.PointToClient(Cursor.Position);
                    cardCanvas_MouseMove(null, new MouseEventArgs(MouseButtons.None, 0, pLocation.X, pLocation.Y, 0));
                    break;
                }
                ElementManager.Instance.ProcessSelectedElementsChange(nHChange, nVChange, 0, 0);
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }