From e54969161990ee97730429f13315fdbfcfa0c5b4 Mon Sep 17 00:00:00 2001 From: codeimp Date: Mon, 12 Nov 2007 22:43:01 +0000 Subject: [PATCH] added undo/redo --- Resources/Icons/Redo.png | Bin 0 -> 436 bytes Resources/Icons/Undo.png | Bin 0 -> 396 bytes Source/Builder.csproj | 5 + Source/Editing/DragVerticesMode.cs | 10 +- Source/Editing/UndoGroup.cs | 39 + Source/Editing/UndoManager.cs | 241 ++++++ Source/Editing/UndoSnapshot.cs | 63 ++ Source/General/MapManager.cs | 19 +- Source/Interface/MainForm.Designer.cs | 987 +++++++++++++----------- Source/Interface/MainForm.cs | 18 + Source/Interface/MainForm.resx | 14 +- Source/Map/Linedef.cs | 24 +- Source/Map/MapOptions.cs | 2 +- Source/Map/MapSelection.cs | 2 +- Source/Map/MapSet.cs | 6 +- Source/Map/Sector.cs | 30 +- Source/Map/Sidedef.cs | 11 +- Source/Map/Thing.cs | 9 +- Source/Map/Vertex.cs | 2 +- Source/Properties/Resources.Designer.cs | 14 + Source/Properties/Resources.resx | 10 +- Source/Resources/Actions.cfg | 18 + Source/Resources/Redo.png | Bin 0 -> 436 bytes Source/Resources/Undo.png | Bin 0 -> 396 bytes 24 files changed, 1020 insertions(+), 504 deletions(-) create mode 100644 Resources/Icons/Redo.png create mode 100644 Resources/Icons/Undo.png create mode 100644 Source/Editing/UndoGroup.cs create mode 100644 Source/Editing/UndoManager.cs create mode 100644 Source/Editing/UndoSnapshot.cs create mode 100644 Source/Resources/Redo.png create mode 100644 Source/Resources/Undo.png diff --git a/Resources/Icons/Redo.png b/Resources/Icons/Redo.png new file mode 100644 index 0000000000000000000000000000000000000000..3e05a40dc349a9b4126457c4a3858fde3ed587f8 GIT binary patch literal 436 zcmV;l0ZaagP)pF33NqRbVF}#ZDnqB004<9jRpV!0Z~arK~#90rIWo%!%!H8a~s*b zgg_?ilFc776mc*JS{!NwhivVX=u#XE6htt(M2SNtLj#IPq!db5y#a|A(4OAG>-mzj zBqT^}hld2h`+V>DI1!o-gjHB6To8EgY=+EHGw5B+eVbD$2nS5{KN##_0{eM_D^AB_ zsFIWfuft>-cFY(XdI&`iu-zI!zhP(FWn~e0pEy2=uHqJVTb2Zm(WIw!7&g-ed4b5o7EMmVM$8*^%L0D3X1arb1oB+K7e>vfHch7R z+E%qdriw~C&hKE(LifOrzAb8TWQ~d~78MYh`2~{DoycxtDg38^LTC05G&>PE%Lr!w egYz%Jvit)7k2!?6pF33NqRbVF}#ZDnqB004<9jRpV!0VzpDK~#90t&=fsgD@0^xkhe* zDK4c7H!9rVy7L6KY`gAzTHaKSz qElUdXREN(R + + + @@ -281,6 +284,8 @@ + + diff --git a/Source/Editing/DragVerticesMode.cs b/Source/Editing/DragVerticesMode.cs index 0a573625..db34b42a 100644 --- a/Source/Editing/DragVerticesMode.cs +++ b/Source/Editing/DragVerticesMode.cs @@ -46,6 +46,9 @@ namespace CodeImp.DoomBuilder.Editing #region ================== Variables + // Undo ticket + private int undoticket; + // Mouse position on map where dragging started protected Vector2D dragstartmappos; @@ -70,6 +73,9 @@ namespace CodeImp.DoomBuilder.Editing this.dragitem = dragitem; this.dragstartmappos = dragstartmappos; + // Make undo + undoticket = General.Map.UndoRedo.CreateUndo("drag vertices", UndoGroup.None, 0, false); + // Make old positions list // We will use this as reference to move the vertices, or to move them back on cancel oldpositions = new List(General.Map.Selection.Vertices.Count); @@ -101,6 +107,9 @@ namespace CodeImp.DoomBuilder.Editing { int i = 0; + // Withdraw undo + General.Map.UndoRedo.WithdrawUndo(undoticket); + // Move geometry back to original position foreach(Vertex v in General.Map.Selection.Vertices) { @@ -138,7 +147,6 @@ namespace CodeImp.DoomBuilder.Editing // When not cancelled if(!cancelled) { - // TODO: Merge geometry diff --git a/Source/Editing/UndoGroup.cs b/Source/Editing/UndoGroup.cs new file mode 100644 index 00000000..57955f7e --- /dev/null +++ b/Source/Editing/UndoGroup.cs @@ -0,0 +1,39 @@ + +#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.Map; + +#endregion + +namespace CodeImp.DoomBuilder.Editing +{ + public enum UndoGroup : int + { + None = 0, + FloorTextureChange = 1, + CeilingTextureChange = 2 + } +} diff --git a/Source/Editing/UndoManager.cs b/Source/Editing/UndoManager.cs new file mode 100644 index 00000000..a5b3d94f --- /dev/null +++ b/Source/Editing/UndoManager.cs @@ -0,0 +1,241 @@ + +#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.Interface; +using CodeImp.DoomBuilder.IO; +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; +using System.Diagnostics; +using CodeImp.DoomBuilder.Controls; + +#endregion + +namespace CodeImp.DoomBuilder.Editing +{ + public class UndoManager : IDisposable + { + #region ================== Constants + + #endregion + + #region ================== Variables + + // Undo and redo stacks + private Stack undos; + private Stack redos; + + // Grouping + private UndoGroup lastgroup; + private int lastgrouptag; + + // Unique tickets + private int ticketid; + + // Disposing + private bool isdisposed = false; + + #endregion + + #region ================== Properties + + public UndoSnapshot NextUndo { get { if(undos.Count > 0) return undos.Peek(); else return null; } } + public UndoSnapshot NextRedo { get { if(redos.Count > 0) return redos.Peek(); else return null; } } + public bool IsDisposed { get { return isdisposed; } } + + #endregion + + #region ================== Constructor / Disposer + + // Constructor + public UndoManager() + { + // Initialize + ticketid = 1; + undos = new Stack(); + redos = new Stack(); + + // Bind any methods + ActionAttribute.BindMethods(this); + + // We have no destructor + GC.SuppressFinalize(this); + } + + // Diposer + public void Dispose() + { + // Not already disposed? + if(!isdisposed) + { + // Unbind any methods + ActionAttribute.UnbindMethods(this); + + // Clean up + ClearUndos(); + ClearRedos(); + + // Done + isdisposed = true; + } + } + + #endregion + + #region ================== Private Methods + + // This clears the redos + private void ClearRedos() + { + // Dispose all redos + foreach(UndoSnapshot u in redos) u.map.Dispose(); + redos.Clear(); + } + + // This clears the undos + private void ClearUndos() + { + // Dispose all undos + foreach(UndoSnapshot u in undos) u.map.Dispose(); + undos.Clear(); + } + + #endregion + + #region ================== Public Methods + + // This makes an undo and returns the unique ticket id + public int CreateUndo(string description, UndoGroup group, int grouptag, bool allow3dchange) + { + UndoSnapshot u; + + // Not the same as previous group? + if((group == UndoGroup.None) || + (group != lastgroup) || + (grouptag != lastgrouptag)) + { + // Next ticket id + if(++ticketid == int.MaxValue) ticketid = 1; + + // Make a snapshot + u = new UndoSnapshot(description, allow3dchange, General.Map.Map.Clone(), ticketid); + + // Put it on the stack + undos.Push(u); + + // Clear all redos + redos.Clear(); + + // Keep grouping info + lastgroup = group; + lastgrouptag = grouptag; + + // Update + General.MainWindow.UpdateInterface(); + + // Done + return ticketid; + } + else + { + return -1; + } + } + + // This removes a previously made undo + public void WithdrawUndo(int ticket) + { + // Anything to undo? + if(undos.Count > 0) + { + // Check if the ticket id matches + if(ticket == undos.Peek().ticketid) + { + // Remove the last made undo + undos.Pop(); + + // Update + General.MainWindow.UpdateInterface(); + } + } + } + + // This performs an undo + [Action("undo")] + public void PerformUndo() + { + UndoSnapshot u, r; + + // Anything to undo? + if(undos.Count > 0) + { + // Get undo snapshot + u = undos.Pop(); + + // Make a snapshot for redo + r = new UndoSnapshot(u, General.Map.Map.Clone()); + + // Put it on the stack + redos.Push(r); + + // Change map set + General.Map.ChangeMapSet(u.map); + + // Update + General.MainWindow.RedrawDisplay(); + General.MainWindow.UpdateInterface(); + } + } + + // This performs a redo + [Action("redo")] + public void PerformRedo() + { + UndoSnapshot u, r; + + // Anything to redo? + if(redos.Count > 0) + { + // Get redo snapshot + r = redos.Pop(); + + // Make a snapshot for undo + u = new UndoSnapshot(r, General.Map.Map.Clone()); + + // Put it on the stack + undos.Push(u); + + // Change map set + General.Map.ChangeMapSet(r.map); + + // Update + General.MainWindow.RedrawDisplay(); + General.MainWindow.UpdateInterface(); + } + } + + #endregion + } +} diff --git a/Source/Editing/UndoSnapshot.cs b/Source/Editing/UndoSnapshot.cs new file mode 100644 index 00000000..f9b2291d --- /dev/null +++ b/Source/Editing/UndoSnapshot.cs @@ -0,0 +1,63 @@ + +#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.Interface; +using CodeImp.DoomBuilder.IO; +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; +using System.Diagnostics; +using CodeImp.DoomBuilder.Controls; + +#endregion + +namespace CodeImp.DoomBuilder.Editing +{ + public class UndoSnapshot + { + public MapSet map; + public string description; + public bool allow3dchange; // True when allowed to change in 3D mode + public int ticketid; // For safe withdrawing + + // Constructor + public UndoSnapshot(string description, bool allow3dchange, MapSet map, int ticketid) + { + this.ticketid = ticketid; + this.description = description; + this.allow3dchange = allow3dchange; + this.map = map; + } + + // Constructor + public UndoSnapshot(UndoSnapshot info, MapSet map) + { + this.ticketid = info.ticketid; + this.description = info.description; + this.allow3dchange = info.allow3dchange; + this.map = map; + } + } +} diff --git a/Source/General/MapManager.cs b/Source/General/MapManager.cs index 470202c8..01bc522d 100644 --- a/Source/General/MapManager.cs +++ b/Source/General/MapManager.cs @@ -77,6 +77,7 @@ namespace CodeImp.DoomBuilder private WAD tempwad; private MapSelection selection; private GridSetup grid; + private UndoManager undoredo; // Disposing private bool isdisposed = false; @@ -100,7 +101,8 @@ namespace CodeImp.DoomBuilder public GameConfiguration Config { get { return config; } } public MapSelection Selection { get { return selection; } } public GridSetup Grid { get { return grid; } } - + public UndoManager UndoRedo { get { return undoredo; } } + #endregion #region ================== Constructor / Disposer @@ -114,6 +116,8 @@ namespace CodeImp.DoomBuilder // Basic objects grid = new GridSetup(); selection = new MapSelection(); + undoredo = new UndoManager(); + } // Diposer @@ -130,6 +134,7 @@ namespace CodeImp.DoomBuilder // Basic objects if(selection != null) selection.Dispose(); + if(undoredo != null) undoredo.Dispose(); // Dispose General.WriteLogLine("Unloading data resources..."); @@ -886,6 +891,18 @@ namespace CodeImp.DoomBuilder #region ================== Methods + // This sets a new mapset for editing + public void ChangeMapSet(MapSet newmap) + { + // Can't have a selection in an old map set + selection.ClearAll(); + + // Apply + map.Dispose(); + map = newmap; + map.Update(); + } + // This reloads resources [Action("reloadresources")] public void ReloadResources() diff --git a/Source/Interface/MainForm.Designer.cs b/Source/Interface/MainForm.Designer.cs index eacd937c..5e2ebb07 100644 --- a/Source/Interface/MainForm.Designer.cs +++ b/Source/Interface/MainForm.Designer.cs @@ -39,26 +39,20 @@ namespace CodeImp.DoomBuilder.Interface System.Windows.Forms.ToolStripSeparator toolStripSeparator3; System.Windows.Forms.ToolStripSeparator toolStripSeparator5; System.Windows.Forms.ToolStripSeparator toolStripSeparator7; + System.Windows.Forms.ToolStripSeparator toolStripMenuItem5; System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + System.Windows.Forms.ToolStripSeparator toolStripSeparator10; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.poscommalabel = new System.Windows.Forms.ToolStripStatusLabel(); this.menumain = new System.Windows.Forms.MenuStrip(); this.menufile = new System.Windows.Forms.ToolStripMenuItem(); - this.itemnewmap = new System.Windows.Forms.ToolStripMenuItem(); - this.itemopenmap = new System.Windows.Forms.ToolStripMenuItem(); this.itemclosemap = new System.Windows.Forms.ToolStripMenuItem(); - this.itemsavemap = new System.Windows.Forms.ToolStripMenuItem(); this.itemsavemapas = new System.Windows.Forms.ToolStripMenuItem(); this.itemsavemapinto = new System.Windows.Forms.ToolStripMenuItem(); this.itemnorecent = new System.Windows.Forms.ToolStripMenuItem(); this.itemexit = new System.Windows.Forms.ToolStripMenuItem(); this.menuedit = new System.Windows.Forms.ToolStripMenuItem(); - this.itemverticesmode = new System.Windows.Forms.ToolStripMenuItem(); - this.itemlinedefsmode = new System.Windows.Forms.ToolStripMenuItem(); - this.itemsectorsmode = new System.Windows.Forms.ToolStripMenuItem(); - this.itemthingsmode = new System.Windows.Forms.ToolStripMenuItem(); - this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem(); this.menutools = new System.Windows.Forms.ToolStripMenuItem(); this.itemreloadresources = new System.Windows.Forms.ToolStripMenuItem(); this.configurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -66,20 +60,21 @@ namespace CodeImp.DoomBuilder.Interface this.menuhelp = new System.Windows.Forms.ToolStripMenuItem(); this.itemhelpabout = new System.Windows.Forms.ToolStripMenuItem(); this.toolbar = new System.Windows.Forms.ToolStrip(); - this.buttonnewmap = new System.Windows.Forms.ToolStripButton(); - this.buttonopenmap = new System.Windows.Forms.ToolStripButton(); - this.buttonsavemap = new System.Windows.Forms.ToolStripButton(); - this.buttonmapoptions = new System.Windows.Forms.ToolStripButton(); - this.buttonverticesmode = new System.Windows.Forms.ToolStripButton(); - this.buttonlinedefsmode = new System.Windows.Forms.ToolStripButton(); - this.buttonsectorsmode = new System.Windows.Forms.ToolStripButton(); - this.buttonthingsmode = new System.Windows.Forms.ToolStripButton(); - this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton(); this.thingfilters = new System.Windows.Forms.ToolStripComboBox(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.statusbar = new System.Windows.Forms.StatusStrip(); - this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel(); this.gridlabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.zoomlabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.xposlabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.panelinfo = new System.Windows.Forms.Panel(); + this.vertexinfo = new CodeImp.DoomBuilder.Interface.VertexInfoPanel(); + this.thinginfo = new CodeImp.DoomBuilder.Interface.ThingInfoPanel(); + this.sectorinfo = new CodeImp.DoomBuilder.Interface.SectorInfoPanel(); + this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel(); + this.redrawtimer = new System.Windows.Forms.Timer(this.components); + this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl(); + this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel(); this.buttongrid = new System.Windows.Forms.ToolStripDropDownButton(); this.itemgrid1024 = new System.Windows.Forms.ToolStripMenuItem(); this.itemgrid512 = new System.Windows.Forms.ToolStripMenuItem(); @@ -91,7 +86,6 @@ namespace CodeImp.DoomBuilder.Interface this.itemgrid8 = new System.Windows.Forms.ToolStripMenuItem(); this.itemgrid4 = new System.Windows.Forms.ToolStripMenuItem(); this.itemgridcustom = new System.Windows.Forms.ToolStripMenuItem(); - this.zoomlabel = new System.Windows.Forms.ToolStripStatusLabel(); this.buttonzoom = new System.Windows.Forms.ToolStripDropDownButton(); this.itemzoom200 = new System.Windows.Forms.ToolStripMenuItem(); this.itemzoom100 = new System.Windows.Forms.ToolStripMenuItem(); @@ -100,15 +94,27 @@ namespace CodeImp.DoomBuilder.Interface this.itemzoom10 = new System.Windows.Forms.ToolStripMenuItem(); this.itemzoom5 = new System.Windows.Forms.ToolStripMenuItem(); this.itemzoomfittoscreen = new System.Windows.Forms.ToolStripMenuItem(); - this.xposlabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.panelinfo = new System.Windows.Forms.Panel(); - this.vertexinfo = new CodeImp.DoomBuilder.Interface.VertexInfoPanel(); - this.thinginfo = new CodeImp.DoomBuilder.Interface.ThingInfoPanel(); - this.sectorinfo = new CodeImp.DoomBuilder.Interface.SectorInfoPanel(); - this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel(); - this.redrawtimer = new System.Windows.Forms.Timer(this.components); - this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl(); + this.buttonnewmap = new System.Windows.Forms.ToolStripButton(); + this.buttonopenmap = new System.Windows.Forms.ToolStripButton(); + this.buttonsavemap = new System.Windows.Forms.ToolStripButton(); + this.buttonmapoptions = new System.Windows.Forms.ToolStripButton(); + this.buttonverticesmode = new System.Windows.Forms.ToolStripButton(); + this.buttonlinedefsmode = new System.Windows.Forms.ToolStripButton(); + this.buttonsectorsmode = new System.Windows.Forms.ToolStripButton(); + this.buttonthingsmode = new System.Windows.Forms.ToolStripButton(); + this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton(); + this.itemnewmap = new System.Windows.Forms.ToolStripMenuItem(); + this.itemopenmap = new System.Windows.Forms.ToolStripMenuItem(); + this.itemsavemap = new System.Windows.Forms.ToolStripMenuItem(); + this.itemundo = new System.Windows.Forms.ToolStripMenuItem(); + this.itemredo = new System.Windows.Forms.ToolStripMenuItem(); + this.itemverticesmode = new System.Windows.Forms.ToolStripMenuItem(); + this.itemlinedefsmode = new System.Windows.Forms.ToolStripMenuItem(); + this.itemsectorsmode = new System.Windows.Forms.ToolStripMenuItem(); + this.itemthingsmode = new System.Windows.Forms.ToolStripMenuItem(); + this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonundo = new System.Windows.Forms.ToolStripButton(); + this.buttonredo = new System.Windows.Forms.ToolStripButton(); toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); @@ -119,8 +125,10 @@ namespace CodeImp.DoomBuilder.Interface toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); + toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.menumain.SuspendLayout(); this.toolbar.SuspendLayout(); this.statusbar.SuspendLayout(); @@ -148,13 +156,6 @@ namespace CodeImp.DoomBuilder.Interface toolStripSeparator1.Name = "toolStripSeparator1"; toolStripSeparator1.Size = new System.Drawing.Size(6, 23); // - // poscommalabel - // - this.poscommalabel.Name = "poscommalabel"; - this.poscommalabel.Size = new System.Drawing.Size(11, 18); - this.poscommalabel.Text = ","; - this.poscommalabel.ToolTipText = "Current X, Y coordinates on map"; - // // toolStripSeparator4 // toolStripSeparator4.Name = "toolStripSeparator4"; @@ -189,15 +190,17 @@ namespace CodeImp.DoomBuilder.Interface toolStripSeparator7.Name = "toolStripSeparator7"; toolStripSeparator7.Size = new System.Drawing.Size(6, 25); // - // toolStripMenuItem4 + // toolStripMenuItem5 // - toolStripMenuItem4.Name = "toolStripMenuItem4"; - toolStripMenuItem4.Size = new System.Drawing.Size(161, 6); + toolStripMenuItem5.Name = "toolStripMenuItem5"; + toolStripMenuItem5.Size = new System.Drawing.Size(158, 6); // - // toolStripSeparator2 + // poscommalabel // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(164, 6); + this.poscommalabel.Name = "poscommalabel"; + this.poscommalabel.Size = new System.Drawing.Size(11, 18); + this.poscommalabel.Text = ","; + this.poscommalabel.ToolTipText = "Current X, Y coordinates on map"; // // menumain // @@ -229,25 +232,6 @@ namespace CodeImp.DoomBuilder.Interface this.menufile.Size = new System.Drawing.Size(35, 20); this.menufile.Text = "File"; // - // itemnewmap - // - this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.File; - this.itemnewmap.Name = "itemnewmap"; - this.itemnewmap.ShortcutKeyDisplayString = ""; - this.itemnewmap.Size = new System.Drawing.Size(201, 22); - this.itemnewmap.Tag = "newmap"; - this.itemnewmap.Text = "New Map"; - this.itemnewmap.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // itemopenmap - // - this.itemopenmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.OpenMap; - this.itemopenmap.Name = "itemopenmap"; - this.itemopenmap.Size = new System.Drawing.Size(201, 22); - this.itemopenmap.Tag = "openmap"; - this.itemopenmap.Text = "Open Map..."; - this.itemopenmap.Click += new System.EventHandler(this.InvokeTaggedAction); - // // itemclosemap // this.itemclosemap.Name = "itemclosemap"; @@ -256,15 +240,6 @@ namespace CodeImp.DoomBuilder.Interface this.itemclosemap.Text = "Close Map"; this.itemclosemap.Click += new System.EventHandler(this.InvokeTaggedAction); // - // itemsavemap - // - this.itemsavemap.Image = global::CodeImp.DoomBuilder.Properties.Resources.SaveMap; - this.itemsavemap.Name = "itemsavemap"; - this.itemsavemap.Size = new System.Drawing.Size(201, 22); - this.itemsavemap.Tag = "savemap"; - this.itemsavemap.Text = "Save Map"; - this.itemsavemap.Click += new System.EventHandler(this.InvokeTaggedAction); - // // itemsavemapas // this.itemsavemapas.Name = "itemsavemapas"; @@ -297,6 +272,9 @@ namespace CodeImp.DoomBuilder.Interface // menuedit // this.menuedit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.itemundo, + this.itemredo, + toolStripMenuItem5, this.itemverticesmode, this.itemlinedefsmode, this.itemsectorsmode, @@ -307,51 +285,6 @@ namespace CodeImp.DoomBuilder.Interface this.menuedit.Size = new System.Drawing.Size(37, 20); this.menuedit.Text = "Edit"; // - // itemverticesmode - // - this.itemverticesmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.VerticesMode; - this.itemverticesmode.Name = "itemverticesmode"; - this.itemverticesmode.Size = new System.Drawing.Size(161, 22); - this.itemverticesmode.Tag = "verticesmode"; - this.itemverticesmode.Text = "Vertices Mode"; - this.itemverticesmode.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // itemlinedefsmode - // - this.itemlinedefsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.LinesMode; - this.itemlinedefsmode.Name = "itemlinedefsmode"; - this.itemlinedefsmode.Size = new System.Drawing.Size(161, 22); - this.itemlinedefsmode.Tag = "linedefsmode"; - this.itemlinedefsmode.Text = "Linedefs Mode"; - this.itemlinedefsmode.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // itemsectorsmode - // - this.itemsectorsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.SectorsMode; - this.itemsectorsmode.Name = "itemsectorsmode"; - this.itemsectorsmode.Size = new System.Drawing.Size(161, 22); - this.itemsectorsmode.Tag = "sectorsmode"; - this.itemsectorsmode.Text = "Sectors Mode"; - this.itemsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // itemthingsmode - // - this.itemthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode; - this.itemthingsmode.Name = "itemthingsmode"; - this.itemthingsmode.Size = new System.Drawing.Size(161, 22); - this.itemthingsmode.Tag = "thingsmode"; - this.itemthingsmode.Text = "Things Mode"; - this.itemthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // itemmapoptions - // - this.itemmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties; - this.itemmapoptions.Name = "itemmapoptions"; - this.itemmapoptions.Size = new System.Drawing.Size(161, 22); - this.itemmapoptions.Tag = "mapoptions"; - this.itemmapoptions.Text = "Map Options...."; - this.itemmapoptions.Click += new System.EventHandler(this.InvokeTaggedAction); - // // menutools // this.menutools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -411,6 +344,9 @@ namespace CodeImp.DoomBuilder.Interface this.buttonsavemap, toolStripSeparator3, this.buttonmapoptions, + toolStripSeparator10, + this.buttonundo, + this.buttonredo, toolStripSeparator5, this.buttonverticesmode, this.buttonlinedefsmode, @@ -425,6 +361,362 @@ namespace CodeImp.DoomBuilder.Interface this.toolbar.Size = new System.Drawing.Size(839, 25); this.toolbar.TabIndex = 1; // + // thingfilters + // + this.thingfilters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.thingfilters.Enabled = false; + this.thingfilters.Items.AddRange(new object[] { + "(none)", + "(custom)", + "Easy skill items only", + "Medium skill items only", + "Hard skill items only"}); + this.thingfilters.Name = "thingfilters"; + this.thingfilters.Size = new System.Drawing.Size(130, 25); + this.thingfilters.ToolTipText = "Things Filter"; + // + // toolStripSeparator8 + // + this.toolStripSeparator8.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.toolStripSeparator8.Name = "toolStripSeparator8"; + this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25); + // + // statusbar + // + this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.statusbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.statuslabel, + this.gridlabel, + this.buttongrid, + toolStripSeparator1, + this.zoomlabel, + this.buttonzoom, + toolStripSeparator9, + this.xposlabel, + this.poscommalabel, + this.yposlabel}); + this.statusbar.Location = new System.Drawing.Point(0, 522); + this.statusbar.Name = "statusbar"; + this.statusbar.ShowItemToolTips = true; + this.statusbar.Size = new System.Drawing.Size(839, 23); + this.statusbar.TabIndex = 2; + // + // gridlabel + // + this.gridlabel.AutoSize = false; + this.gridlabel.AutoToolTip = true; + this.gridlabel.Name = "gridlabel"; + this.gridlabel.Size = new System.Drawing.Size(64, 18); + this.gridlabel.Text = "32 mp"; + this.gridlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.gridlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; + this.gridlabel.ToolTipText = "Grid size"; + // + // zoomlabel + // + this.zoomlabel.AutoSize = false; + this.zoomlabel.AutoToolTip = true; + this.zoomlabel.Name = "zoomlabel"; + this.zoomlabel.Size = new System.Drawing.Size(54, 18); + this.zoomlabel.Text = "50%"; + this.zoomlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.zoomlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; + this.zoomlabel.ToolTipText = "Zoom level"; + // + // xposlabel + // + this.xposlabel.AutoSize = false; + this.xposlabel.Name = "xposlabel"; + this.xposlabel.Size = new System.Drawing.Size(50, 18); + this.xposlabel.Text = "0"; + this.xposlabel.ToolTipText = "Current X, Y coordinates on map"; + // + // yposlabel + // + this.yposlabel.AutoSize = false; + this.yposlabel.Name = "yposlabel"; + this.yposlabel.Size = new System.Drawing.Size(50, 18); + this.yposlabel.Text = "0"; + this.yposlabel.ToolTipText = "Current X, Y coordinates on map"; + // + // panelinfo + // + this.panelinfo.Controls.Add(this.vertexinfo); + this.panelinfo.Controls.Add(this.thinginfo); + this.panelinfo.Controls.Add(this.sectorinfo); + this.panelinfo.Controls.Add(this.linedefinfo); + this.panelinfo.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panelinfo.Location = new System.Drawing.Point(0, 416); + this.panelinfo.Name = "panelinfo"; + this.panelinfo.Size = new System.Drawing.Size(839, 106); + this.panelinfo.TabIndex = 4; + // + // vertexinfo + // + this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vertexinfo.Location = new System.Drawing.Point(3, 3); + this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100); + this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100); + this.vertexinfo.Name = "vertexinfo"; + this.vertexinfo.Size = new System.Drawing.Size(180, 100); + this.vertexinfo.TabIndex = 1; + this.vertexinfo.Visible = false; + // + // thinginfo + // + this.thinginfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.thinginfo.Location = new System.Drawing.Point(3, 3); + this.thinginfo.MaximumSize = new System.Drawing.Size(10000, 100); + this.thinginfo.MinimumSize = new System.Drawing.Size(100, 100); + this.thinginfo.Name = "thinginfo"; + this.thinginfo.Size = new System.Drawing.Size(385, 100); + this.thinginfo.TabIndex = 3; + this.thinginfo.Visible = false; + // + // sectorinfo + // + this.sectorinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.sectorinfo.Location = new System.Drawing.Point(3, 3); + this.sectorinfo.MaximumSize = new System.Drawing.Size(10000, 100); + this.sectorinfo.MinimumSize = new System.Drawing.Size(100, 100); + this.sectorinfo.Name = "sectorinfo"; + this.sectorinfo.Size = new System.Drawing.Size(447, 100); + this.sectorinfo.TabIndex = 2; + this.sectorinfo.Visible = false; + // + // linedefinfo + // + this.linedefinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.linedefinfo.Location = new System.Drawing.Point(3, 3); + this.linedefinfo.MaximumSize = new System.Drawing.Size(10000, 100); + this.linedefinfo.MinimumSize = new System.Drawing.Size(100, 100); + this.linedefinfo.Name = "linedefinfo"; + this.linedefinfo.Size = new System.Drawing.Size(783, 100); + this.linedefinfo.TabIndex = 0; + this.linedefinfo.Visible = false; + // + // redrawtimer + // + this.redrawtimer.Interval = 1; + this.redrawtimer.Tick += new System.EventHandler(this.redrawtimer_Tick); + // + // display + // + this.display.BackColor = System.Drawing.SystemColors.AppWorkspace; + this.display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.display.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.display.CausesValidation = false; + this.display.Dock = System.Windows.Forms.DockStyle.Fill; + this.display.Location = new System.Drawing.Point(0, 49); + this.display.Name = "display"; + this.display.Size = new System.Drawing.Size(839, 367); + this.display.TabIndex = 5; + this.display.MouseLeave += new System.EventHandler(this.display_MouseLeave); + this.display.MouseDown += new System.Windows.Forms.MouseEventHandler(this.display_MouseDown); + this.display.MouseMove += new System.Windows.Forms.MouseEventHandler(this.display_MouseMove); + this.display.MouseClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseClick); + this.display.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseDoubleClick); + this.display.Resize += new System.EventHandler(this.display_Resize); + this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter); + this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint); + this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp); + // + // statuslabel + // + this.statuslabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Status2; + this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.statuslabel.Name = "statuslabel"; + this.statuslabel.Size = new System.Drawing.Size(201, 16); + this.statuslabel.Spring = true; + this.statuslabel.Text = "Initializing user interface..."; + this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // buttongrid + // + this.buttongrid.AutoToolTip = false; + this.buttongrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttongrid.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.itemgrid1024, + this.itemgrid512, + this.itemgrid256, + this.itemgrid128, + this.itemgrid64, + this.itemgrid32, + this.itemgrid16, + this.itemgrid8, + this.itemgrid4, + toolStripMenuItem4, + this.itemgridcustom}); + this.buttongrid.Image = global::CodeImp.DoomBuilder.Properties.Resources.Grid2; + this.buttongrid.ImageTransparentColor = System.Drawing.Color.Transparent; + this.buttongrid.Name = "buttongrid"; + this.buttongrid.Size = new System.Drawing.Size(29, 20); + this.buttongrid.Text = "Grid"; + // + // itemgrid1024 + // + this.itemgrid1024.Name = "itemgrid1024"; + this.itemgrid1024.Size = new System.Drawing.Size(164, 22); + this.itemgrid1024.Tag = "1024"; + this.itemgrid1024.Text = "1024 mp"; + this.itemgrid1024.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid512 + // + this.itemgrid512.Name = "itemgrid512"; + this.itemgrid512.Size = new System.Drawing.Size(164, 22); + this.itemgrid512.Tag = "512"; + this.itemgrid512.Text = "512 mp"; + this.itemgrid512.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid256 + // + this.itemgrid256.Name = "itemgrid256"; + this.itemgrid256.Size = new System.Drawing.Size(164, 22); + this.itemgrid256.Tag = "256"; + this.itemgrid256.Text = "256 mp"; + this.itemgrid256.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid128 + // + this.itemgrid128.Name = "itemgrid128"; + this.itemgrid128.Size = new System.Drawing.Size(164, 22); + this.itemgrid128.Tag = "128"; + this.itemgrid128.Text = "128 mp"; + this.itemgrid128.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid64 + // + this.itemgrid64.Name = "itemgrid64"; + this.itemgrid64.Size = new System.Drawing.Size(164, 22); + this.itemgrid64.Tag = "64"; + this.itemgrid64.Text = "64 mp"; + this.itemgrid64.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid32 + // + this.itemgrid32.Name = "itemgrid32"; + this.itemgrid32.Size = new System.Drawing.Size(164, 22); + this.itemgrid32.Tag = "32"; + this.itemgrid32.Text = "32 mp"; + this.itemgrid32.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid16 + // + this.itemgrid16.Name = "itemgrid16"; + this.itemgrid16.Size = new System.Drawing.Size(164, 22); + this.itemgrid16.Tag = "16"; + this.itemgrid16.Text = "16 mp"; + this.itemgrid16.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid8 + // + this.itemgrid8.Name = "itemgrid8"; + this.itemgrid8.Size = new System.Drawing.Size(164, 22); + this.itemgrid8.Tag = "8"; + this.itemgrid8.Text = "8 mp"; + this.itemgrid8.Click += new System.EventHandler(this.itemgridsize_Click); + // + // itemgrid4 + // + this.itemgrid4.Name = "itemgrid4"; + this.itemgrid4.Size = new System.Drawing.Size(164, 22); + this.itemgrid4.Tag = "4"; + this.itemgrid4.Text = "4 mp"; + this.itemgrid4.Click += new System.EventHandler(this.itemgridsize_Click); + // + // toolStripMenuItem4 + // + toolStripMenuItem4.Name = "toolStripMenuItem4"; + toolStripMenuItem4.Size = new System.Drawing.Size(161, 6); + // + // itemgridcustom + // + this.itemgridcustom.Name = "itemgridcustom"; + this.itemgridcustom.Size = new System.Drawing.Size(164, 22); + this.itemgridcustom.Text = "Customize..."; + this.itemgridcustom.Click += new System.EventHandler(this.itemgridcustom_Click); + // + // buttonzoom + // + this.buttonzoom.AutoToolTip = false; + this.buttonzoom.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonzoom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.itemzoom200, + this.itemzoom100, + this.itemzoom50, + this.itemzoom25, + this.itemzoom10, + this.itemzoom5, + toolStripSeparator2, + this.itemzoomfittoscreen}); + this.buttonzoom.Image = global::CodeImp.DoomBuilder.Properties.Resources.Zoom; + this.buttonzoom.ImageTransparentColor = System.Drawing.Color.Transparent; + this.buttonzoom.Name = "buttonzoom"; + this.buttonzoom.Size = new System.Drawing.Size(29, 20); + this.buttonzoom.Text = "Zoom"; + // + // itemzoom200 + // + this.itemzoom200.Name = "itemzoom200"; + this.itemzoom200.Size = new System.Drawing.Size(167, 22); + this.itemzoom200.Tag = "200"; + this.itemzoom200.Text = "200%"; + this.itemzoom200.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom100 + // + this.itemzoom100.Name = "itemzoom100"; + this.itemzoom100.Size = new System.Drawing.Size(167, 22); + this.itemzoom100.Tag = "100"; + this.itemzoom100.Text = "100%"; + this.itemzoom100.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom50 + // + this.itemzoom50.Name = "itemzoom50"; + this.itemzoom50.Size = new System.Drawing.Size(167, 22); + this.itemzoom50.Tag = "50"; + this.itemzoom50.Text = "50%"; + this.itemzoom50.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom25 + // + this.itemzoom25.Name = "itemzoom25"; + this.itemzoom25.Size = new System.Drawing.Size(167, 22); + this.itemzoom25.Tag = "25"; + this.itemzoom25.Text = "25%"; + this.itemzoom25.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom10 + // + this.itemzoom10.Name = "itemzoom10"; + this.itemzoom10.Size = new System.Drawing.Size(167, 22); + this.itemzoom10.Tag = "10"; + this.itemzoom10.Text = "10%"; + this.itemzoom10.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom5 + // + this.itemzoom5.Name = "itemzoom5"; + this.itemzoom5.Size = new System.Drawing.Size(167, 22); + this.itemzoom5.Tag = "5"; + this.itemzoom5.Text = "5%"; + this.itemzoom5.Click += new System.EventHandler(this.itemzoomto_Click); + // + // toolStripSeparator2 + // + toolStripSeparator2.Name = "toolStripSeparator2"; + toolStripSeparator2.Size = new System.Drawing.Size(164, 6); + // + // itemzoomfittoscreen + // + this.itemzoomfittoscreen.Name = "itemzoomfittoscreen"; + this.itemzoomfittoscreen.Size = new System.Drawing.Size(167, 22); + this.itemzoomfittoscreen.Text = "Fit to screen"; + this.itemzoomfittoscreen.Click += new System.EventHandler(this.itemzoomfittoscreen_Click); + // // buttonnewmap // this.buttonnewmap.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -523,351 +815,124 @@ namespace CodeImp.DoomBuilder.Interface this.buttonthingsfilter.Size = new System.Drawing.Size(23, 22); this.buttonthingsfilter.Text = "Configure Things Filters"; // - // thingfilters - // - this.thingfilters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.thingfilters.Enabled = false; - this.thingfilters.Items.AddRange(new object[] { - "(none)", - "(custom)", - "Easy skill items only", - "Medium skill items only", - "Hard skill items only"}); - this.thingfilters.Name = "thingfilters"; - this.thingfilters.Size = new System.Drawing.Size(130, 25); - this.thingfilters.ToolTipText = "Things Filter"; - // - // toolStripSeparator8 - // - this.toolStripSeparator8.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); - this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25); - // - // statusbar - // - this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.statusbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.statuslabel, - this.gridlabel, - this.buttongrid, - toolStripSeparator1, - this.zoomlabel, - this.buttonzoom, - toolStripSeparator9, - this.xposlabel, - this.poscommalabel, - this.yposlabel}); - this.statusbar.Location = new System.Drawing.Point(0, 522); - this.statusbar.Name = "statusbar"; - this.statusbar.ShowItemToolTips = true; - this.statusbar.Size = new System.Drawing.Size(839, 23); - this.statusbar.TabIndex = 2; - // - // statuslabel - // - this.statuslabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Status2; - this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.statuslabel.Name = "statuslabel"; - this.statuslabel.Size = new System.Drawing.Size(482, 18); - this.statuslabel.Spring = true; - this.statuslabel.Text = "Initializing user interface..."; - this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // gridlabel - // - this.gridlabel.AutoSize = false; - this.gridlabel.AutoToolTip = true; - this.gridlabel.Name = "gridlabel"; - this.gridlabel.Size = new System.Drawing.Size(64, 18); - this.gridlabel.Text = "32 mp"; - this.gridlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.gridlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; - this.gridlabel.ToolTipText = "Grid size"; - // - // buttongrid - // - this.buttongrid.AutoToolTip = false; - this.buttongrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttongrid.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.itemgrid1024, - this.itemgrid512, - this.itemgrid256, - this.itemgrid128, - this.itemgrid64, - this.itemgrid32, - this.itemgrid16, - this.itemgrid8, - this.itemgrid4, - toolStripMenuItem4, - this.itemgridcustom}); - this.buttongrid.Image = global::CodeImp.DoomBuilder.Properties.Resources.Grid2; - this.buttongrid.ImageTransparentColor = System.Drawing.Color.Transparent; - this.buttongrid.Name = "buttongrid"; - this.buttongrid.Size = new System.Drawing.Size(29, 21); - this.buttongrid.Text = "Grid"; - // - // itemgrid1024 - // - this.itemgrid1024.Name = "itemgrid1024"; - this.itemgrid1024.Size = new System.Drawing.Size(164, 22); - this.itemgrid1024.Tag = "1024"; - this.itemgrid1024.Text = "1024 mp"; - this.itemgrid1024.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid512 - // - this.itemgrid512.Name = "itemgrid512"; - this.itemgrid512.Size = new System.Drawing.Size(164, 22); - this.itemgrid512.Tag = "512"; - this.itemgrid512.Text = "512 mp"; - this.itemgrid512.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid256 - // - this.itemgrid256.Name = "itemgrid256"; - this.itemgrid256.Size = new System.Drawing.Size(164, 22); - this.itemgrid256.Tag = "256"; - this.itemgrid256.Text = "256 mp"; - this.itemgrid256.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid128 - // - this.itemgrid128.Name = "itemgrid128"; - this.itemgrid128.Size = new System.Drawing.Size(164, 22); - this.itemgrid128.Tag = "128"; - this.itemgrid128.Text = "128 mp"; - this.itemgrid128.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid64 - // - this.itemgrid64.Name = "itemgrid64"; - this.itemgrid64.Size = new System.Drawing.Size(164, 22); - this.itemgrid64.Tag = "64"; - this.itemgrid64.Text = "64 mp"; - this.itemgrid64.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid32 - // - this.itemgrid32.Name = "itemgrid32"; - this.itemgrid32.Size = new System.Drawing.Size(164, 22); - this.itemgrid32.Tag = "32"; - this.itemgrid32.Text = "32 mp"; - this.itemgrid32.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid16 - // - this.itemgrid16.Name = "itemgrid16"; - this.itemgrid16.Size = new System.Drawing.Size(164, 22); - this.itemgrid16.Tag = "16"; - this.itemgrid16.Text = "16 mp"; - this.itemgrid16.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid8 - // - this.itemgrid8.Name = "itemgrid8"; - this.itemgrid8.Size = new System.Drawing.Size(164, 22); - this.itemgrid8.Tag = "8"; - this.itemgrid8.Text = "8 mp"; - this.itemgrid8.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgrid4 - // - this.itemgrid4.Name = "itemgrid4"; - this.itemgrid4.Size = new System.Drawing.Size(164, 22); - this.itemgrid4.Tag = "4"; - this.itemgrid4.Text = "4 mp"; - this.itemgrid4.Click += new System.EventHandler(this.itemgridsize_Click); - // - // itemgridcustom - // - this.itemgridcustom.Name = "itemgridcustom"; - this.itemgridcustom.Size = new System.Drawing.Size(164, 22); - this.itemgridcustom.Text = "Customize..."; - this.itemgridcustom.Click += new System.EventHandler(this.itemgridcustom_Click); - // - // zoomlabel - // - this.zoomlabel.AutoSize = false; - this.zoomlabel.AutoToolTip = true; - this.zoomlabel.Name = "zoomlabel"; - this.zoomlabel.Size = new System.Drawing.Size(54, 18); - this.zoomlabel.Text = "50%"; - this.zoomlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.zoomlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; - this.zoomlabel.ToolTipText = "Zoom level"; - // - // buttonzoom - // - this.buttonzoom.AutoToolTip = false; - this.buttonzoom.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonzoom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.itemzoom200, - this.itemzoom100, - this.itemzoom50, - this.itemzoom25, - this.itemzoom10, - this.itemzoom5, - toolStripSeparator2, - this.itemzoomfittoscreen}); - this.buttonzoom.Image = global::CodeImp.DoomBuilder.Properties.Resources.Zoom; - this.buttonzoom.ImageTransparentColor = System.Drawing.Color.Transparent; - this.buttonzoom.Name = "buttonzoom"; - this.buttonzoom.Size = new System.Drawing.Size(29, 21); - this.buttonzoom.Text = "Zoom"; - // - // itemzoom200 - // - this.itemzoom200.Name = "itemzoom200"; - this.itemzoom200.Size = new System.Drawing.Size(167, 22); - this.itemzoom200.Tag = "200"; - this.itemzoom200.Text = "200%"; - this.itemzoom200.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoom100 - // - this.itemzoom100.Name = "itemzoom100"; - this.itemzoom100.Size = new System.Drawing.Size(167, 22); - this.itemzoom100.Tag = "100"; - this.itemzoom100.Text = "100%"; - this.itemzoom100.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoom50 - // - this.itemzoom50.Name = "itemzoom50"; - this.itemzoom50.Size = new System.Drawing.Size(167, 22); - this.itemzoom50.Tag = "50"; - this.itemzoom50.Text = "50%"; - this.itemzoom50.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoom25 - // - this.itemzoom25.Name = "itemzoom25"; - this.itemzoom25.Size = new System.Drawing.Size(167, 22); - this.itemzoom25.Tag = "25"; - this.itemzoom25.Text = "25%"; - this.itemzoom25.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoom10 - // - this.itemzoom10.Name = "itemzoom10"; - this.itemzoom10.Size = new System.Drawing.Size(167, 22); - this.itemzoom10.Tag = "10"; - this.itemzoom10.Text = "10%"; - this.itemzoom10.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoom5 - // - this.itemzoom5.Name = "itemzoom5"; - this.itemzoom5.Size = new System.Drawing.Size(167, 22); - this.itemzoom5.Tag = "5"; - this.itemzoom5.Text = "5%"; - this.itemzoom5.Click += new System.EventHandler(this.itemzoomto_Click); - // - // itemzoomfittoscreen - // - this.itemzoomfittoscreen.Name = "itemzoomfittoscreen"; - this.itemzoomfittoscreen.Size = new System.Drawing.Size(167, 22); - this.itemzoomfittoscreen.Text = "Fit to screen"; - this.itemzoomfittoscreen.Click += new System.EventHandler(this.itemzoomfittoscreen_Click); - // - // xposlabel - // - this.xposlabel.AutoSize = false; - this.xposlabel.Name = "xposlabel"; - this.xposlabel.Size = new System.Drawing.Size(50, 18); - this.xposlabel.Text = "0"; - this.xposlabel.ToolTipText = "Current X, Y coordinates on map"; - // - // yposlabel - // - this.yposlabel.AutoSize = false; - this.yposlabel.Name = "yposlabel"; - this.yposlabel.Size = new System.Drawing.Size(50, 18); - this.yposlabel.Text = "0"; - this.yposlabel.ToolTipText = "Current X, Y coordinates on map"; - // - // panelinfo - // - this.panelinfo.Controls.Add(this.vertexinfo); - this.panelinfo.Controls.Add(this.thinginfo); - this.panelinfo.Controls.Add(this.sectorinfo); - this.panelinfo.Controls.Add(this.linedefinfo); - this.panelinfo.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panelinfo.Location = new System.Drawing.Point(0, 416); - this.panelinfo.Name = "panelinfo"; - this.panelinfo.Size = new System.Drawing.Size(839, 106); - this.panelinfo.TabIndex = 4; - // - // vertexinfo - // - this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.vertexinfo.Location = new System.Drawing.Point(3, 3); - this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100); - this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100); - this.vertexinfo.Name = "vertexinfo"; - this.vertexinfo.Size = new System.Drawing.Size(180, 100); - this.vertexinfo.TabIndex = 1; - this.vertexinfo.Visible = false; - // - // thinginfo - // - this.thinginfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.thinginfo.Location = new System.Drawing.Point(3, 3); - this.thinginfo.MaximumSize = new System.Drawing.Size(10000, 100); - this.thinginfo.MinimumSize = new System.Drawing.Size(100, 100); - this.thinginfo.Name = "thinginfo"; - this.thinginfo.Size = new System.Drawing.Size(385, 100); - this.thinginfo.TabIndex = 3; - this.thinginfo.Visible = false; - // - // sectorinfo - // - this.sectorinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.sectorinfo.Location = new System.Drawing.Point(3, 3); - this.sectorinfo.MaximumSize = new System.Drawing.Size(10000, 100); - this.sectorinfo.MinimumSize = new System.Drawing.Size(100, 100); - this.sectorinfo.Name = "sectorinfo"; - this.sectorinfo.Size = new System.Drawing.Size(447, 100); - this.sectorinfo.TabIndex = 2; - this.sectorinfo.Visible = false; - // - // linedefinfo - // - this.linedefinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.linedefinfo.Location = new System.Drawing.Point(3, 3); - this.linedefinfo.MaximumSize = new System.Drawing.Size(10000, 100); - this.linedefinfo.MinimumSize = new System.Drawing.Size(100, 100); - this.linedefinfo.Name = "linedefinfo"; - this.linedefinfo.Size = new System.Drawing.Size(783, 100); - this.linedefinfo.TabIndex = 0; - this.linedefinfo.Visible = false; - // - // redrawtimer - // - this.redrawtimer.Interval = 1; - this.redrawtimer.Tick += new System.EventHandler(this.redrawtimer_Tick); - // - // display - // - this.display.BackColor = System.Drawing.SystemColors.AppWorkspace; - this.display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.display.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.display.CausesValidation = false; - this.display.Dock = System.Windows.Forms.DockStyle.Fill; - this.display.Location = new System.Drawing.Point(0, 49); - this.display.Name = "display"; - this.display.Size = new System.Drawing.Size(839, 367); - this.display.TabIndex = 5; - this.display.MouseLeave += new System.EventHandler(this.display_MouseLeave); - this.display.MouseDown += new System.Windows.Forms.MouseEventHandler(this.display_MouseDown); - this.display.MouseMove += new System.Windows.Forms.MouseEventHandler(this.display_MouseMove); - this.display.MouseClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseClick); - this.display.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseDoubleClick); - this.display.Resize += new System.EventHandler(this.display_Resize); - this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter); - this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint); - this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp); + // itemnewmap + // + this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.File; + this.itemnewmap.Name = "itemnewmap"; + this.itemnewmap.ShortcutKeyDisplayString = ""; + this.itemnewmap.Size = new System.Drawing.Size(201, 22); + this.itemnewmap.Tag = "newmap"; + this.itemnewmap.Text = "New Map"; + this.itemnewmap.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemopenmap + // + this.itemopenmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.OpenMap; + this.itemopenmap.Name = "itemopenmap"; + this.itemopenmap.Size = new System.Drawing.Size(201, 22); + this.itemopenmap.Tag = "openmap"; + this.itemopenmap.Text = "Open Map..."; + this.itemopenmap.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemsavemap + // + this.itemsavemap.Image = global::CodeImp.DoomBuilder.Properties.Resources.SaveMap; + this.itemsavemap.Name = "itemsavemap"; + this.itemsavemap.Size = new System.Drawing.Size(201, 22); + this.itemsavemap.Tag = "savemap"; + this.itemsavemap.Text = "Save Map"; + this.itemsavemap.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemundo + // + this.itemundo.Image = global::CodeImp.DoomBuilder.Properties.Resources.Undo; + this.itemundo.Name = "itemundo"; + this.itemundo.Size = new System.Drawing.Size(161, 22); + this.itemundo.Tag = "undo"; + this.itemundo.Text = "Undo"; + this.itemundo.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemredo + // + this.itemredo.Image = global::CodeImp.DoomBuilder.Properties.Resources.Redo; + this.itemredo.Name = "itemredo"; + this.itemredo.Size = new System.Drawing.Size(161, 22); + this.itemredo.Tag = "redo"; + this.itemredo.Text = "Redo"; + this.itemredo.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemverticesmode + // + this.itemverticesmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.VerticesMode; + this.itemverticesmode.Name = "itemverticesmode"; + this.itemverticesmode.Size = new System.Drawing.Size(161, 22); + this.itemverticesmode.Tag = "verticesmode"; + this.itemverticesmode.Text = "Vertices Mode"; + this.itemverticesmode.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemlinedefsmode + // + this.itemlinedefsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.LinesMode; + this.itemlinedefsmode.Name = "itemlinedefsmode"; + this.itemlinedefsmode.Size = new System.Drawing.Size(161, 22); + this.itemlinedefsmode.Tag = "linedefsmode"; + this.itemlinedefsmode.Text = "Linedefs Mode"; + this.itemlinedefsmode.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemsectorsmode + // + this.itemsectorsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.SectorsMode; + this.itemsectorsmode.Name = "itemsectorsmode"; + this.itemsectorsmode.Size = new System.Drawing.Size(161, 22); + this.itemsectorsmode.Tag = "sectorsmode"; + this.itemsectorsmode.Text = "Sectors Mode"; + this.itemsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemthingsmode + // + this.itemthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode; + this.itemthingsmode.Name = "itemthingsmode"; + this.itemthingsmode.Size = new System.Drawing.Size(161, 22); + this.itemthingsmode.Tag = "thingsmode"; + this.itemthingsmode.Text = "Things Mode"; + this.itemthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // itemmapoptions + // + this.itemmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties; + this.itemmapoptions.Name = "itemmapoptions"; + this.itemmapoptions.Size = new System.Drawing.Size(161, 22); + this.itemmapoptions.Tag = "mapoptions"; + this.itemmapoptions.Text = "Map Options...."; + this.itemmapoptions.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonundo + // + this.buttonundo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonundo.Image = global::CodeImp.DoomBuilder.Properties.Resources.Undo; + this.buttonundo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonundo.Name = "buttonundo"; + this.buttonundo.Size = new System.Drawing.Size(23, 22); + this.buttonundo.Tag = "undo"; + this.buttonundo.Text = "Undo"; + this.buttonundo.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // toolStripSeparator10 + // + toolStripSeparator10.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + toolStripSeparator10.Name = "toolStripSeparator10"; + toolStripSeparator10.Size = new System.Drawing.Size(6, 25); + // + // buttonredo + // + this.buttonredo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonredo.Image = global::CodeImp.DoomBuilder.Properties.Resources.Redo; + this.buttonredo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonredo.Name = "buttonredo"; + this.buttonredo.Size = new System.Drawing.Size(23, 22); + this.buttonredo.Tag = "redo"; + this.buttonredo.Text = "Redo"; + this.buttonredo.Click += new System.EventHandler(this.InvokeTaggedAction); // // MainForm // @@ -973,5 +1038,9 @@ namespace CodeImp.DoomBuilder.Interface private System.Windows.Forms.ToolStripMenuItem itemgridcustom; private System.Windows.Forms.ToolStripMenuItem itemgrid512; private System.Windows.Forms.ToolStripStatusLabel poscommalabel; + private System.Windows.Forms.ToolStripMenuItem itemundo; + private System.Windows.Forms.ToolStripMenuItem itemredo; + private System.Windows.Forms.ToolStripButton buttonundo; + private System.Windows.Forms.ToolStripButton buttonredo; } } \ No newline at end of file diff --git a/Source/Interface/MainForm.cs b/Source/Interface/MainForm.cs index db9c643c..1a996bc9 100644 --- a/Source/Interface/MainForm.cs +++ b/Source/Interface/MainForm.cs @@ -865,6 +865,20 @@ namespace CodeImp.DoomBuilder.Interface itemlinedefsmode.Enabled = (General.Map != null); itemsectorsmode.Enabled = (General.Map != null); itemthingsmode.Enabled = (General.Map != null); + itemundo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextUndo != null); + itemredo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextRedo != null); + + // Determine undo description + if(itemundo.Enabled) + itemundo.Text = "Undo " + General.Map.UndoRedo.NextUndo.description; + else + itemundo.Text = "Undo"; + + // Determine redo description + if(itemredo.Enabled) + itemredo.Text = "Redo " + General.Map.UndoRedo.NextRedo.description; + else + itemredo.Text = "Redo"; // Toolbar icons buttonmapoptions.Enabled = (General.Map != null); @@ -872,6 +886,10 @@ namespace CodeImp.DoomBuilder.Interface buttonlinedefsmode.Enabled = (General.Map != null); buttonsectorsmode.Enabled = (General.Map != null); buttonthingsmode.Enabled = (General.Map != null); + buttonundo.Enabled = itemundo.Enabled; + buttonredo.Enabled = itemredo.Enabled; + buttonundo.ToolTipText = itemundo.Text; + buttonredo.ToolTipText = itemredo.Text; } #endregion diff --git a/Source/Interface/MainForm.resx b/Source/Interface/MainForm.resx index e3fa0fa3..dd63b7fa 100644 --- a/Source/Interface/MainForm.resx +++ b/Source/Interface/MainForm.resx @@ -147,10 +147,7 @@ False - - False - - + False @@ -165,12 +162,21 @@ 121, 17 + + False + True 207, 17 + + False + + + False + True diff --git a/Source/Map/Linedef.cs b/Source/Map/Linedef.cs index 7b52216c..4ede3780 100644 --- a/Source/Map/Linedef.cs +++ b/Source/Map/Linedef.cs @@ -29,7 +29,7 @@ using SlimDX.Direct3D; namespace CodeImp.DoomBuilder.Map { - public class Linedef : IDisposable + public sealed class Linedef : IDisposable { #region ================== Constants @@ -155,6 +155,17 @@ namespace CodeImp.DoomBuilder.Map #region ================== Management + // This copies all properties to another line + public void CopyPropertiesTo(Linedef l) + { + // Copy properties + l.action = action; + l.args = (byte[])args.Clone(); + l.flags = flags; + l.tag = tag; + l.updateneeded = true; + } + // This attaches a sidedef on the front public void AttachFront(Sidedef s) { @@ -228,17 +239,6 @@ namespace CodeImp.DoomBuilder.Map { updateneeded = true; } - - // This copies all properties to another line - public void CopyPropertiesTo(Linedef l) - { - // Copy properties - l.action = action; - l.args = (byte[])args.Clone(); - l.flags = flags; - l.tag = tag; - l.updateneeded = true; - } #endregion diff --git a/Source/Map/MapOptions.cs b/Source/Map/MapOptions.cs index dd5d0f86..868d0e30 100644 --- a/Source/Map/MapOptions.cs +++ b/Source/Map/MapOptions.cs @@ -29,7 +29,7 @@ using CodeImp.DoomBuilder.Data; namespace CodeImp.DoomBuilder.Map { - public class MapOptions + public sealed class MapOptions { #region ================== Constants diff --git a/Source/Map/MapSelection.cs b/Source/Map/MapSelection.cs index fddba5a3..859a0493 100644 --- a/Source/Map/MapSelection.cs +++ b/Source/Map/MapSelection.cs @@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.Geometry; namespace CodeImp.DoomBuilder.Map { - public class MapSelection : IDisposable + public sealed class MapSelection : IDisposable { #region ================== Constants diff --git a/Source/Map/MapSet.cs b/Source/Map/MapSet.cs index 5f90d676..3bfa0ff4 100644 --- a/Source/Map/MapSet.cs +++ b/Source/Map/MapSet.cs @@ -31,7 +31,7 @@ using System.Drawing; namespace CodeImp.DoomBuilder.Map { - public class MapSet : IDisposable + public sealed class MapSet : IDisposable { #region ================== Variables @@ -128,6 +128,10 @@ namespace CodeImp.DoomBuilder.Map Dictionary linedeflink = new Dictionary(linedefs.Count); Dictionary sectorlink = new Dictionary(sectors.Count); + // TODO: Try making this faster by giving each element that + // requires a lookup (vertex/linedef/sector) a reference to + // its clone and remove those references after cloning. + // Create the map set MapSet newset = new MapSet(); diff --git a/Source/Map/Sector.cs b/Source/Map/Sector.cs index 7667f53a..6d729c8c 100644 --- a/Source/Map/Sector.cs +++ b/Source/Map/Sector.cs @@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.IO; namespace CodeImp.DoomBuilder.Map { - public class Sector : IDisposable + public sealed class Sector : IDisposable { #region ================== Constants @@ -128,6 +128,21 @@ namespace CodeImp.DoomBuilder.Map #region ================== Management + // This copies all properties to another sector + public void CopyPropertiesTo(Sector s) + { + // Copy properties + s.ceilheight = ceilheight; + s.ceiltexname = ceiltexname; + s.longceiltexname = longceiltexname; + s.floorheight = floorheight; + s.floortexname = floortexname; + s.longfloortexname = longfloortexname; + s.effect = effect; + s.tag = tag; + s.brightness = brightness; + } + // This attaches a sidedef and returns the listitem public LinkedListNode AttachSidedef(Sidedef sd) { return sidedefs.AddLast(sd); } @@ -155,19 +170,6 @@ namespace CodeImp.DoomBuilder.Map // This detaches a thing public void DetachThing(LinkedListNode l) { if(!isdisposed) things.Remove(l); } - // This copies all properties to another sector - public void CopyPropertiesTo(Sector s) - { - // Copy properties - s.ceilheight = ceilheight; - s.SetCeilTexture(ceiltexname); - s.floorheight = floorheight; - s.SetFloorTexture(floortexname); - s.effect = effect; - s.tag = tag; - s.brightness = brightness; - } - #endregion #region ================== Changes diff --git a/Source/Map/Sidedef.cs b/Source/Map/Sidedef.cs index bbb8a073..4e5249ff 100644 --- a/Source/Map/Sidedef.cs +++ b/Source/Map/Sidedef.cs @@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.IO; namespace CodeImp.DoomBuilder.Map { - public class Sidedef : IDisposable + public sealed class Sidedef : IDisposable { #region ================== Constants @@ -140,9 +140,12 @@ namespace CodeImp.DoomBuilder.Map // Copy properties s.offsetx = offsetx; s.offsety = offsety; - s.SetTextureHigh(texnamehigh); - s.SetTextureMid(texnamelow); - s.SetTextureLow(texnamemid); + s.texnamehigh = texnamehigh; + s.texnamemid = texnamemid; + s.texnamelow = texnamelow; + s.longtexnamehigh = longtexnamehigh; + s.longtexnamemid = longtexnamemid; + s.longtexnamelow = longtexnamelow; } #endregion diff --git a/Source/Map/Thing.cs b/Source/Map/Thing.cs index e8b3f1c1..df583896 100644 --- a/Source/Map/Thing.cs +++ b/Source/Map/Thing.cs @@ -30,7 +30,7 @@ using System.Drawing; namespace CodeImp.DoomBuilder.Map { - public class Thing : IDisposable + public sealed class Thing : IDisposable { #region ================== Constants @@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.Map // Configuration private float size; private PixelColor color; - private float iconoffset; + private float iconoffset; // Arrow or dot coordinate offset on the texture // Selections private int selected; @@ -143,10 +143,13 @@ namespace CodeImp.DoomBuilder.Map t.flags = flags; t.tag = tag; t.action = action; - t.args = EMPTY_ARGS; t.x = x; t.y = y; t.zoffset = zoffset; + t.args = EMPTY_ARGS; + t.size = size; + t.color = color; + t.iconoffset = iconoffset; args.CopyTo(t.args, 0); } diff --git a/Source/Map/Vertex.cs b/Source/Map/Vertex.cs index f3e0e1db..c70fa884 100644 --- a/Source/Map/Vertex.cs +++ b/Source/Map/Vertex.cs @@ -30,7 +30,7 @@ using System.Drawing; namespace CodeImp.DoomBuilder.Map { - public class Vertex : IDisposable + public sealed class Vertex : IDisposable { #region ================== Constants diff --git a/Source/Properties/Resources.Designer.cs b/Source/Properties/Resources.Designer.cs index 67bcccb2..d19ee4a6 100644 --- a/Source/Properties/Resources.Designer.cs +++ b/Source/Properties/Resources.Designer.cs @@ -123,6 +123,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap Redo { + get { + object obj = ResourceManager.GetObject("Redo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap SaveMap { get { object obj = ResourceManager.GetObject("SaveMap", resourceCulture); @@ -179,6 +186,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap Undo { + get { + object obj = ResourceManager.GetObject("Undo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap UnknownImage { get { object obj = ResourceManager.GetObject("UnknownImage", resourceCulture); diff --git a/Source/Properties/Resources.resx b/Source/Properties/Resources.resx index 5d23ab36..08cc4752 100644 --- a/Source/Properties/Resources.resx +++ b/Source/Properties/Resources.resx @@ -142,6 +142,9 @@ ..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -151,6 +154,9 @@ ..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -175,7 +181,7 @@ ..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/Source/Resources/Actions.cfg b/Source/Resources/Actions.cfg index 34108a20..3494b8cf 100644 --- a/Source/Resources/Actions.cfg +++ b/Source/Resources/Actions.cfg @@ -211,3 +211,21 @@ gridsetup allowmouse = false; allowscroll = false; } + +undo +{ + title = "Edit: Undo"; + description = "Restores the current map as it was before last action(s) performed."; + allowkeys = true; + allowmouse = false; + allowscroll = false; +} + +redo +{ + title = "Edit: Redo"; + description = "Repeates the action(s) performed before Undo was used."; + allowkeys = true; + allowmouse = false; + allowscroll = false; +} diff --git a/Source/Resources/Redo.png b/Source/Resources/Redo.png new file mode 100644 index 0000000000000000000000000000000000000000..3e05a40dc349a9b4126457c4a3858fde3ed587f8 GIT binary patch literal 436 zcmV;l0ZaagP)pF33NqRbVF}#ZDnqB004<9jRpV!0Z~arK~#90rIWo%!%!H8a~s*b zgg_?ilFc776mc*JS{!NwhivVX=u#XE6htt(M2SNtLj#IPq!db5y#a|A(4OAG>-mzj zBqT^}hld2h`+V>DI1!o-gjHB6To8EgY=+EHGw5B+eVbD$2nS5{KN##_0{eM_D^AB_ zsFIWfuft>-cFY(XdI&`iu-zI!zhP(FWn~e0pEy2=uHqJVTb2Zm(WIw!7&g-ed4b5o7EMmVM$8*^%L0D3X1arb1oB+K7e>vfHch7R z+E%qdriw~C&hKE(LifOrzAb8TWQ~d~78MYh`2~{DoycxtDg38^LTC05G&>PE%Lr!w egYz%Jvit)7k2!?6pF33NqRbVF}#ZDnqB004<9jRpV!0VzpDK~#90t&=fsgD@0^xkhe* zDK4c7H!9rVy7L6KY`gAzTHaKSz qElUdXREN(R