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(); } }
private void CommandCopy() { if (CommandCanCopy()) { TileSelectionClipboard clip = new TileSelectionClipboard(_selection.Tiles); clip.CopyToClipboard(); CommandManager.Invalidate(CommandKey.Paste); } }
private void CommandCut() { if (CommandCanCut()) { TileSelectionClipboard clip = new TileSelectionClipboard(_selection.Tiles); clip.CopyToClipboard(); CompoundCommand command = new CompoundCommand(); if (!_selection.Floating) { command.AddCommand(new FloatTileSelectionCommand(Layer as MultiTileGridLayer, this)); } command.AddCommand(new DeleteTileSelectionCommand(this)); LayerContext.History.Execute(command); CommandManager.Invalidate(CommandKey.Paste); } }