private void CommandPaste() { if (CommandCanPaste()) { TileSelectionClipboard clip = TileSelectionClipboard.CopyFromClipboard(); TileSelection selection = clip.GetAsTileSelection(Layer.Level.Project, Layer.TileWidth, Layer.TileHeight); if (selection == null) { return; } if (_selection != null) { CompoundCommand command = new CompoundCommand(); if (_selection.Floating) { command.AddCommand(new DefloatTileSelectionCommand(Layer as MultiTileGridLayer, this)); } command.AddCommand(new DeleteTileSelectionCommand(this)); LayerContext.History.Execute(command); } Command pasteCommand = new PasteFloatingSelectionCommand(this, selection, GetCenterTileOffset()); LayerContext.History.Execute(pasteCommand); if (!(_currentTool is TileSelectTool)) { CommandManager.Perform(CommandKey.TileToolSelect); } _selection.Activate(); } }