示例#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);
                }
            }
        }
示例#2
0
 private void Add(IGameObject Object, string type, bool NoUndo, ref Command command)
 {
     if (!NoUndo)
     {
         command = new ObjectAddCommand(
             "Created Object '" + type + "'",
             Object,
             this);
     }
     GameObjects.Add(Object);
     try {
         if (ObjectAdded != null)
         {
             ObjectAdded(this, Object);
         }
     } catch (Exception e) {
         ErrorDialog.Exception(e);
     }
 }