Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        private void CommandCopy()
        {
            if (CommandCanCopy())
            {
                TileSelectionClipboard clip = new TileSelectionClipboard(_selection.Tiles);
                clip.CopyToClipboard();

                CommandManager.Invalidate(CommandKey.Paste);
            }
        }
Esempio n. 3
0
        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);
            }
        }