From 24b275e6d39f7c9d8fcd92459a66ec830fce4bd0 Mon Sep 17 00:00:00 2001 From: codeimp Date: Thu, 23 Jul 2009 14:52:39 +0000 Subject: [PATCH] @ this may be a useful function --- Source/Core/Editing/CopyPasteManager.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Source/Core/Editing/CopyPasteManager.cs b/Source/Core/Editing/CopyPasteManager.cs index 799c45bb..5270f8d8 100644 --- a/Source/Core/Editing/CopyPasteManager.cs +++ b/Source/Core/Editing/CopyPasteManager.cs @@ -136,6 +136,31 @@ namespace CodeImp.DoomBuilder.Editing return null; } + // This pastes a prefab. Returns false when paste was cancelled. + public void InsertPrefabStream(Stream stream, PasteOptions options) + { + // Cancel volatile mode + General.Editing.DisengageVolatileMode(); + + // Let the plugins know + if(General.Plugins.OnPasteBegin(options)) + { + // Ask the editing mode to prepare selection for pasting. + if(General.Editing.Mode.OnPasteBegin(options)) + { + Cursor oldcursor = Cursor.Current; + Cursor.Current = Cursors.WaitCursor; + + if(stream != null) + PastePrefab(stream, options); + + General.MainWindow.UpdateInterface(); + + Cursor.Current = oldcursor; + } + } + } + // This pastes a prefab. Returns false when paste was cancelled. internal void PastePrefab(Stream filedata, PasteOptions options) {