Ejemplo n.º 1
0
        private void CommandPaste()
        {
            if (CommandCanPaste())
            {
                ObjectSelectionClipboard clip = ObjectSelectionClipboard.CopyFromClipboard(Layer.Level.Project);
                if (clip == null)
                {
                    return;
                }

                ObjectSelectTool tool = _currentTool as ObjectSelectTool;
                if (tool == null)
                {
                    SetCurrentTool(NewSelectTool());
                }

                _selectionManager.ClearSelection();

                CenterObjectsInViewport(clip.Objects);

                Command command = new ObjectAddCommand(Layer, clip.Objects, _selectionManager);
                LayerContext.History.Execute(command);

                foreach (ObjectInstance inst in clip.Objects)
                {
                    //Layer.AddObject(inst);
                    _selectionManager.AddObjectToSelection(inst);
                }
            }
        }
Ejemplo n.º 2
0
        private void CommandCopy()
        {
            if (CommandCanCopy())
            {
                ObjectSelectionClipboard clip = new ObjectSelectionClipboard(_selectionManager.SelectedObjects);
                clip.CopyToClipboard();

                CommandManager.Invalidate(CommandKey.Paste);
            }
        }
Ejemplo n.º 3
0
        public static ObjectSelectionClipboard CopyFromClipboard(Project project)
        {
            ObjectSelectionClipboard clip = Clipboard.GetData(typeof(ObjectSelectionClipboard).FullName) as ObjectSelectionClipboard;

            if (clip == null)
            {
                return(null);
            }

            foreach (ObjectInstance inst in clip.Objects)
            {
                inst.PostDeserialize(project);
            }

            return(clip);
        }