public void OperationsPaste() { if (!ClipboardManager.CanPaste()) { return; } var content = ClipboardManager.GetPastedContent(_document); if (content == null) { return; } var list = content.ToList(); if (!list.Any()) { return; } list.SelectMany(x => x.FindAll()).ToList().ForEach(x => x.IsSelected = true); _document.Selection.SwitchToObjectSelection(); var name = "Pasted " + list.Count + " item" + (list.Count == 1 ? "" : "s"); var selected = _document.Selection.GetSelectedObjects().ToList(); _document.PerformAction(name, new ActionCollection( new Deselect(selected), // Deselect the current objects new Create(_document.Map.WorldSpawn.ID, list))); // Add and select the new objects }
public void OperationsPasteSpecial() { if (!ClipboardManager.CanPaste()) { return; } var content = ClipboardManager.GetPastedContent(_document); if (content == null) { return; } var list = content.ToList(); if (!list.Any()) { return; } var box = new Box(list.Select(x => x.BoundingBox)); using (var psd = new PasteSpecialDialog(box)) { if (psd.ShowDialog() == DialogResult.OK) { var name = "Paste special (" + psd.NumberOfCopies + (psd.NumberOfCopies == 1 ? " copy)" : " copies)"); var action = new PasteSpecial(list, psd.NumberOfCopies, psd.StartPoint, psd.Grouping, psd.AccumulativeOffset, psd.AccumulativeRotation, psd.MakeEntitiesUnique, psd.PrefixEntityNames, psd.EntityNamePrefix); _document.PerformAction(name, action); } } }