예제 #1
0
        private void cardCanvas_MouseDown(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left == e.Button)
            {
                ProjectLayoutElement zElement = ElementManager.Instance.GetSelectedElement();
                if (null != zElement)
                {
                    CardMakerInstance.CanvasUserAction = true;

                    m_pointOriginalMouseDown = e.Location;
                    if (TranslationLock.WaitingToSet != m_eTranslationLock)
                    {
                        m_eTranslationLock = TranslationLock.Unset;
                    }

                    int nX = e.X;
                    int nY = e.Y;

                    if ((nX >= (int)(zElement.x * m_fZoom - SELECTION_BUFFER) &&
                         nX <= (int)(zElement.x * m_fZoom + zElement.width * m_fZoom + SELECTION_BUFFER)) &&
                        (nY >= (int)(zElement.y * m_fZoom - SELECTION_BUFFER) &&
                         nY <= (int)(zElement.y * m_fZoom + zElement.height * m_fZoom + SELECTION_BUFFER)) ||
                        m_eMouseMode == MouseMode.Rotate)
                    {
                        // Setup the start position and allow movement
                        var nXUnzoomed = (int)((float)nX * m_fZoomRatio);
                        var nYUnzoomed = (int)((float)nY * m_fZoomRatio);
                        // store the offset in "normal" size
                        m_bElementSelected = true;
                        m_zSelectedElement = zElement;

                        m_listSelectedElements = ElementManager.Instance.SelectedElements;
                        if (null != m_listSelectedElements)
                        {
                            m_listSelectedOriginalPosition = new List <Point>();
                            m_listSelectedOriginalRotation = new List <float>();
                            foreach (var zSelectedElement in m_listSelectedElements)
                            {
                                m_listSelectedOriginalPosition.Add(new Point(
                                                                       nXUnzoomed - zSelectedElement.x,
                                                                       nYUnzoomed - zSelectedElement.y));
                                m_listSelectedOriginalRotation.Add(zSelectedElement.rotation);
                            }
                            // setup the undo dictionary (covers all types of changes allowed with canvas mouse movement)
                            m_dictionarySelectedUndo = ElementManager.Instance.GetUndoRedoPoints();
                        }
                    }
                }
            }
        }
예제 #2
0
 private void numericUpDownZoom_ValueChanged(object sender, EventArgs e)
 {
     if (LayoutManager.Instance.ActiveDeck == null)
     {
         return;
     }
     m_fZoom            = (float)numericUpDownZoom.Value;
     m_fZoomRatio       = 1.0f / m_fZoom;
     m_eTranslationLock = TranslationLock.Unset;
     m_zCardCanvas.CardRenderer.ZoomLevel = m_fZoom;
     LayoutManager.Instance.ActiveDeck.ResetDeckCache();
     m_zCardCanvas.UpdateSize();
     m_zCardCanvas.Invalidate();
 }
예제 #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
                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));
        }
예제 #4
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));
        }
예제 #5
0
        private void cardCanvas_MouseMoveGeneralMode(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left == e.Button)
            {
                if (m_bElementSelected)
                {
                    int nX = e.X;
                    int nY = e.Y;
                    var bElementBoundsChanged = false;
                    if (Cursor == Cursors.SizeAll)
                    {
                        if (TranslationLock.WaitingToSet == m_eTranslationLock)
                        {
                            // setup the lock (if outside the dead zone)
                            int nXDiff = Math.Abs(nX - m_pointOriginalMouseDown.X);
                            int nYDiff = Math.Abs(nY - m_pointOriginalMouseDown.Y);
                            if (nXDiff > TRANSLATION_LOCK_DEAD_ZONE || nYDiff > TRANSLATION_LOCK_DEAD_ZONE)
                            {
                                m_eTranslationLock = nXDiff > nYDiff
                                    ? TranslationLock.Horizontal
                                    : TranslationLock.Vertical;
                            }
                        }

                        switch (m_eTranslationLock)
                        {
                        case TranslationLock.Horizontal:
                            nY = m_pointOriginalMouseDown.Y;
                            break;

                        case TranslationLock.Vertical:
                            nX = m_pointOriginalMouseDown.X;
                            break;
                        }

                        var nXUnzoomed = (int)((float)nX * m_fZoomRatio);
                        var nYUnzoomed = (int)((float)nY * m_fZoomRatio);

                        if (null != m_listSelectedElements)
                        {
                            int idx = 0;
                            foreach (var selectedElement in m_listSelectedElements)
                            {
                                selectedElement.x = nXUnzoomed - m_listSelectedOriginalPosition[idx].X;
                                selectedElement.y = nYUnzoomed - m_listSelectedOriginalPosition[idx].Y;
                                idx++;
                            }
                        }

                        bElementBoundsChanged = true;
                    }
                    else if (Cursor == Cursors.SizeNS)
                    {
                        switch (m_eResizeDirection)
                        {
                        case ResizeDirection.Up:
                            bElementBoundsChanged |= ResizeUp(nY);
                            break;

                        case ResizeDirection.Down:
                            bElementBoundsChanged |= ResizeDown(nY);
                            break;
                        }
                    }
                    else if (Cursor == Cursors.SizeWE)
                    {
                        switch (m_eResizeDirection)
                        {
                        case ResizeDirection.Left:
                            bElementBoundsChanged |= ResizeLeft(nX);
                            break;

                        case ResizeDirection.Right:
                            bElementBoundsChanged |= ResizeRight(nX);
                            break;
                        }
                    }
                    else if (Cursor == Cursors.SizeNESW)
                    {
                        switch (m_eResizeDirection)
                        {
                        case ResizeDirection.UpRight:
                            bElementBoundsChanged |= ResizeUp(nY);
                            bElementBoundsChanged |= ResizeRight(nX);
                            break;

                        case ResizeDirection.DownLeft:
                            bElementBoundsChanged |= ResizeDown(nY);
                            bElementBoundsChanged |= ResizeLeft(nX);
                            break;
                        }
                    }
                    else if (Cursor == Cursors.SizeNWSE)
                    {
                        switch (m_eResizeDirection)
                        {
                        case ResizeDirection.UpLeft:
                            bElementBoundsChanged |= ResizeUp(nY);
                            bElementBoundsChanged |= ResizeLeft(nX);
                            break;

                        case ResizeDirection.DownRight:
                            bElementBoundsChanged |= ResizeDown(nY);
                            bElementBoundsChanged |= ResizeRight(nX);
                            break;
                        }
                    }

                    if (bElementBoundsChanged)
                    {
                        ElementManager.Instance.FireElementBoundsUpdateEvent();
                    }
                }
            }
            if (MouseButtons.None == e.Button)
            {
                var zElement = ElementManager.Instance.GetSelectedElement();
                if (null != zElement)
                {
                    m_eResizeDirection = ResizeDirection.None;

                    var nX = e.X;
                    var nY = e.Y;

                    var nEdgeRight  = (int)(zElement.x * m_fZoom + zElement.width * m_fZoom + SELECTION_BUFFER);
                    var nEdgeLeft   = (int)(zElement.x * m_fZoom - SELECTION_BUFFER);
                    var nEdgeTop    = (int)(zElement.y * m_fZoom - SELECTION_BUFFER);
                    var nEdgeBottom = (int)(zElement.y * m_fZoom + zElement.height * m_fZoom + SELECTION_BUFFER);

                    // first verify the cursor is within the SELECTION_BUFFER sized area
                    if ((nX >= (nEdgeLeft)) && (nX <= (nEdgeRight)) &&
                        (nY >= (nEdgeTop)) && (nY <= (nEdgeBottom)))
                    {
                        if (SELECTION_BUFFER_SPACE >= (nX - nEdgeLeft))
                        {
                            m_eResizeDirection |= ResizeDirection.Left;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nEdgeRight - nX))
                        {
                            m_eResizeDirection |= ResizeDirection.Right;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nY - nEdgeTop))
                        {
                            m_eResizeDirection |= ResizeDirection.Up;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nEdgeBottom - nY))
                        {
                            m_eResizeDirection |= ResizeDirection.Down;
                        }

                        if (MouseMode.Move == m_eMouseMode)
                        {
                            m_eResizeDirection = ResizeDirection.None;
                        }

                        switch (m_eResizeDirection)
                        {
                        case ResizeDirection.Down:
                        case ResizeDirection.Up:
                            Cursor = Cursors.SizeNS;
                            break;

                        case ResizeDirection.Left:
                        case ResizeDirection.Right:
                            Cursor = Cursors.SizeWE;
                            break;

                        case ResizeDirection.UpLeft:
                        case ResizeDirection.DownRight:
                            Cursor = Cursors.SizeNWSE;
                            break;

                        case ResizeDirection.UpRight:
                        case ResizeDirection.DownLeft:
                            Cursor = Cursors.SizeNESW;
                            break;

                        case ResizeDirection.None:
                            // if no edge was found to be selected it's a move
                            Cursor             = Cursors.SizeAll;
                            m_eResizeDirection = ResizeDirection.Move;
                            break;
                        }
                    }
                    else
                    {
                        Cursor = Cursors.Default;
                    }
                }
            }
        }
예제 #6
0
 private void numericUpDownZoom_ValueChanged(object sender, EventArgs e)
 {
     m_fZoom = (float)numericUpDownZoom.Value;
     m_fZoomRatio = 1.0f / m_fZoom;
     m_eTranslationLock = TranslationLock.Unset;
     m_zCardCanvas.CardRenderer.ZoomLevel = m_fZoom;
     LayoutManager.Instance.ActiveDeck.ResetDeckCache();
     m_zCardCanvas.UpdateSize();
     m_zCardCanvas.Invalidate();
 }
예제 #7
0
        private void cardCanvas_MouseMove(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left == e.Button)
            {
                if (m_bElementSelected)
                {
                    int nX = e.X;
                    int nY = e.Y;
                    var bElementBoundsChanged = false;
                    if (Cursor == Cursors.SizeAll)
                    {
                        if (TranslationLock.WaitingToSet == m_eTranslationLock)
                        {
                            // setup the lock (if outside the dead zone)
                            int nXDiff = Math.Abs(nX - m_pointOriginalMouseDown.X);
                            int nYDiff = Math.Abs(nY - m_pointOriginalMouseDown.Y);
                            if (nXDiff > TRANSLATION_LOCK_DEAD_ZONE || nYDiff > TRANSLATION_LOCK_DEAD_ZONE)
                            {
                                m_eTranslationLock = nXDiff > nYDiff
                                    ? TranslationLock.Horizontal
                                    : TranslationLock.Vertical;
                            }
                        }

                        switch (m_eTranslationLock)
                        {
                            case TranslationLock.Horizontal:
                                nY = m_pointOriginalMouseDown.Y;
                                break;
                            case TranslationLock.Vertical:
                                nX = m_pointOriginalMouseDown.X;
                                break;
                        }

                        var nXUnzoomed = (int) ((float) nX*m_fZoomRatio);
                        var nYUnzoomed = (int) ((float) nY*m_fZoomRatio);

                        if (null != m_listSelectedElements)
                        {
                            int idx = 0;
                            foreach (var selectedElement in m_listSelectedElements)
                            {
                                selectedElement.x = nXUnzoomed - m_listSelectedOffsets[idx].X;
                                selectedElement.y = nYUnzoomed - m_listSelectedOffsets[idx].Y;
                                idx++;
                            }
                        }

                        bElementBoundsChanged = true;
                    }
                    else if (Cursor == Cursors.SizeNS)
                    {
                        switch (m_eResizeDirection)
                        {
                            case ResizeDirection.Up:
                                bElementBoundsChanged |= ResizeUp(nY);
                                break;
                            case ResizeDirection.Down:
                                bElementBoundsChanged |= ResizeDown(nY);
                                break;
                        }
                    }
                    else if (Cursor == Cursors.SizeWE)
                    {
                        switch (m_eResizeDirection)
                        {
                            case ResizeDirection.Left:
                                bElementBoundsChanged |= ResizeLeft(nX);
                                break;
                            case ResizeDirection.Right:
                                bElementBoundsChanged |= ResizeRight(nX);
                                break;
                        }
                    }
                    else if (Cursor == Cursors.SizeNESW)
                    {
                        switch (m_eResizeDirection)
                        {
                            case ResizeDirection.UpRight:
                                bElementBoundsChanged |= ResizeUp(nY);
                                bElementBoundsChanged |= ResizeRight(nX);
                                break;
                            case ResizeDirection.DownLeft:
                                bElementBoundsChanged |= ResizeDown(nY);
                                bElementBoundsChanged |= ResizeLeft(nX);
                                break;
                        }
                    }
                    else if (Cursor == Cursors.SizeNWSE)
                    {
                        switch (m_eResizeDirection)
                        {
                            case ResizeDirection.UpLeft:
                                bElementBoundsChanged |= ResizeUp(nY);
                                bElementBoundsChanged |= ResizeLeft(nX);
                                break;
                            case ResizeDirection.DownRight:
                                bElementBoundsChanged |= ResizeDown(nY);
                                bElementBoundsChanged |= ResizeRight(nX);
                                break;
                        }
                    }

                    if (bElementBoundsChanged)
                    {
                        ElementManager.Instance.FireElementBoundsUpdateEvent();
                    }

                }
            }
            if (MouseButtons.None == e.Button)
            {
                var zElement = ElementManager.Instance.GetSelectedElement();
                if (null != zElement)
                {
                    m_eResizeDirection = ResizeDirection.None;

                    var nX = e.X;
                    var nY = e.Y;

                    var nEdgeRight = (int) (zElement.x*m_fZoom + zElement.width*m_fZoom + SELECTION_BUFFER);
                    var nEdgeLeft = (int) (zElement.x*m_fZoom - SELECTION_BUFFER);
                    var nEdgeTop = (int) (zElement.y*m_fZoom - SELECTION_BUFFER);
                    var nEdgeBottom = (int) (zElement.y*m_fZoom + zElement.height*m_fZoom + SELECTION_BUFFER);

                    // first verify the cursor is within the SELECTION_BUFFER sized area
                    if ((nX >= (nEdgeLeft)) && (nX <= (nEdgeRight)) &&
                        (nY >= (nEdgeTop)) && (nY <= (nEdgeBottom)))
                    {

                        if (SELECTION_BUFFER_SPACE >= (nX - nEdgeLeft))
                        {
                            m_eResizeDirection |= ResizeDirection.Left;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nEdgeRight - nX))
                        {
                            m_eResizeDirection |= ResizeDirection.Right;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nY - nEdgeTop))
                        {
                            m_eResizeDirection |= ResizeDirection.Up;
                        }

                        if (SELECTION_BUFFER_SPACE >= (nEdgeBottom - nY))
                        {
                            m_eResizeDirection |= ResizeDirection.Down;
                        }

                        if (MouseMode.Move == m_eMouseMode)
                            m_eResizeDirection = ResizeDirection.None;

                        switch (m_eResizeDirection)
                        {
                            case ResizeDirection.Down:
                            case ResizeDirection.Up:
                                Cursor = Cursors.SizeNS;
                                break;
                            case ResizeDirection.Left:
                            case ResizeDirection.Right:
                                Cursor = Cursors.SizeWE;
                                break;
                            case ResizeDirection.UpLeft:
                            case ResizeDirection.DownRight:
                                Cursor = Cursors.SizeNWSE;
                                break;
                            case ResizeDirection.UpRight:
                            case ResizeDirection.DownLeft:
                                Cursor = Cursors.SizeNESW;
                                break;
                            case ResizeDirection.None:
                                // if no edge was found to be selected it's a move
                                Cursor = Cursors.SizeAll;
                                m_eResizeDirection = ResizeDirection.Move;
                                break;

                        }
                    }
                    else
                    {
                        Cursor = Cursors.Default;
                    }
                }
            }
        }
예제 #8
0
        private void cardCanvas_MouseDown(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left == e.Button)
            {
                ProjectLayoutElement zElement = ElementManager.Instance.GetSelectedElement();
                if (null != zElement)
                {
                    CardMakerInstance.CanvasUserAction = true;

                    m_pointOriginalMouseDown = e.Location;
                    if (TranslationLock.WaitingToSet != m_eTranslationLock)
                    {
                        m_eTranslationLock = TranslationLock.Unset;
                    }

                    int nX = e.X;
                    int nY = e.Y;

                    if ((nX >= (int) (zElement.x*m_fZoom - SELECTION_BUFFER) &&
                         nX <= (int) (zElement.x*m_fZoom + zElement.width*m_fZoom + SELECTION_BUFFER)) &&
                        (nY >= (int) (zElement.y*m_fZoom - SELECTION_BUFFER) &&
                         nY <= (int) (zElement.y*m_fZoom + zElement.height*m_fZoom + SELECTION_BUFFER)))
                    {
                        // Setup the start position and allow movement
                        var nXUnzoomed = (int) ((float) nX*m_fZoomRatio);
                        var nYUnzoomed = (int) ((float) nY*m_fZoomRatio);
                        // store the offset in "normal" size
                        m_bElementSelected = true;
                        m_zSelectedElement = zElement;

                        m_listSelectedElements = ElementManager.Instance.SelectedElements;
                        if (null != m_listSelectedElements)
                        {
                            m_listSelectedOffsets = new List<Point>();
                            foreach (var zSelectedElement in m_listSelectedElements)
                            {
                                m_listSelectedOffsets.Add(new Point(
                                    nXUnzoomed - zSelectedElement.x,
                                    nYUnzoomed - zSelectedElement.y));
                            }
                            // setup the undo dictionary (covers all types of changes allowed with canvas mouse movement)
                            m_dictionarySelectedUndo = ElementManager.Instance.GetUndoRedoPoints();
                        }
                    }
                }
            }
        }
예제 #9
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);
        }
예제 #10
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));
        }