mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
more code for copy/paste
This commit is contained in:
parent
43559224d2
commit
0437ddff57
3 changed files with 135 additions and 27 deletions
|
@ -85,6 +85,7 @@
|
|||
<Compile Include="Data\SimpleTextureImage.cs" />
|
||||
<Compile Include="Data\SpriteImage.cs" />
|
||||
<Compile Include="Data\TextureImage.cs" />
|
||||
<Compile Include="Editing\CopyPasteManager.cs" />
|
||||
<Compile Include="Editing\EditMode.cs" />
|
||||
<Compile Include="Editing\EditModeAttribute.cs" />
|
||||
<Compile Include="Editing\EditModeInfo.cs" />
|
||||
|
|
131
Source/Editing/CopyPasteManager.cs
Normal file
131
Source/Editing/CopyPasteManager.cs
Normal file
|
@ -0,0 +1,131 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using System.Diagnostics;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class CopyPasteManager
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
internal CopyPasteManager()
|
||||
{
|
||||
// Initialize
|
||||
|
||||
// Bind any methods
|
||||
General.Actions.BindMethods(this);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Unbind any methods
|
||||
General.Actions.UnbindMethods(this);
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Private Methods
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Public Methods
|
||||
|
||||
// This copies the current selection
|
||||
[BeginAction("copyselection")]
|
||||
public void CopySelection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This cuts the current selection
|
||||
[BeginAction("cutselection")]
|
||||
public void CutSelection()
|
||||
{
|
||||
// Copy selected geometry
|
||||
CopySelection();
|
||||
|
||||
// Get the delete action and check if it's bound
|
||||
Action deleteitem = General.Actions["builder_deleteitem"];
|
||||
if(deleteitem.BeginBound)
|
||||
{
|
||||
// Perform delete action
|
||||
deleteitem.Begin();
|
||||
deleteitem.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Action not bound
|
||||
General.Interface.DisplayWarning("Cannot remove that in this mode.");
|
||||
}
|
||||
}
|
||||
|
||||
// This pastes what is on the clipboard and marks the new geometry
|
||||
[BeginAction("pasteselection")]
|
||||
public void PasteSelection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -82,6 +82,7 @@ namespace CodeImp.DoomBuilder
|
|||
private WAD tempwad;
|
||||
private GridSetup grid;
|
||||
private UndoManager undoredo;
|
||||
private CopyPasteManager copypaste;
|
||||
private Launcher launcher;
|
||||
private ThingsFilter thingsfilter;
|
||||
|
||||
|
@ -132,6 +133,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Basic objects
|
||||
grid = new GridSetup();
|
||||
undoredo = new UndoManager();
|
||||
copypaste = new CopyPasteManager();
|
||||
launcher = new Launcher(this);
|
||||
thingsfilter = new NullThingsFilter();
|
||||
}
|
||||
|
@ -151,6 +153,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Dispose
|
||||
if(grid != null) grid.Dispose();
|
||||
if(launcher != null) launcher.Dispose();
|
||||
if(copypaste != null) copypaste.Dispose();
|
||||
if(undoredo != null) undoredo.Dispose();
|
||||
General.WriteLogLine("Unloading data resources...");
|
||||
if(data != null) data.Dispose();
|
||||
|
@ -929,33 +932,6 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Copy / Paste
|
||||
|
||||
// This copies the current selection
|
||||
[Action("copyselection")]
|
||||
public void CopySelection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This cuts the current selection
|
||||
[Action("cutselection")]
|
||||
public void CutSelection()
|
||||
{
|
||||
CopySelection();
|
||||
General.Actions["deleteitem"].Begin();
|
||||
General.Actions["deleteitem"].End();
|
||||
}
|
||||
|
||||
// This pastes what is on the clipboard and makes it the current selection
|
||||
[Action("pasteselection")]
|
||||
public bool PasteSelection()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This changes thing filter
|
||||
|
|
Loading…
Reference in a new issue