Example #1
0
        public override void Paste(XElement xe)
        {
            string id = xe.Element("SessionId").Value;

            if (id != sessionString)
            {
                textManager.ProcessPastedXML(xe);
            }
            int undoCount = UndoManager.UndoCount + 1;

            if (IsSelecting)
            {
                ActiveChild.RemoveSelection(true);
            }
            ActiveChild.Paste(xe.Element("payload").Elements().First());
            if (IsSelecting && undoCount < UndoManager.UndoCount)
            {
                UndoManager.ChangeUndoCountOfLastAction(1);
            }
            CalculateSize();
            AdjustCarets();
            DeSelect();
        }
Example #2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            CanvasControl canvas = ActiveChild.Canvas;

            if (e.KeyCode == Keys.Escape)
            {
                canvas.UnselectSelectedImages();
            }
            else if (e.KeyCode == Keys.Delete)
            {
                canvas.DeleteSelectedImages();
            }
            else if (e.Control && e.KeyCode == Keys.L)
            {
                if (UnLocked)
                {
                    Lock();
                }
                else
                {
                    Unlock();
                }
            }
            else if (e.Control && e.KeyCode == Keys.C)
            {
                ActiveChild.Copy();
            }
            else if (e.Control && e.KeyCode == Keys.V)
            {
                ActiveChild.Paste();
            }
            else if (e.Control && e.KeyCode == Keys.X)
            {
                ActiveChild.Cut();
            }
            else if (e.Control && e.KeyCode == Keys.Y)
            {
                //m_UndoRedoManager.Redo();
            }
            else if (e.Control && e.KeyCode == Keys.Z)
            {
                //m_UndoRedoManager.Undo();
            }
            else if (!canvas.m_SelectedImgList.IsEmpty())
            {
                foreach (var obj in canvas.m_SelectedImgList)
                {
                    if (e.KeyCode == Keys.Left)
                    {
                        obj.Move(-POINTS_TO_STEP, 0);
                    }
                    else if (e.KeyCode == Keys.Right)
                    {
                        obj.Move(POINTS_TO_STEP, 0);
                    }
                    else if (e.KeyCode == Keys.Up)
                    {
                        obj.Move(0, -POINTS_TO_STEP);
                    }
                    else if (e.KeyCode == Keys.Down)
                    {
                        obj.Move(0, POINTS_TO_STEP);
                    }

                    Invalidate(obj.Rect.InflateEx());
                }
            }

            base.OnKeyDown(e);
        }