Merge anotak's optimizations - stage 1

This commit is contained in:
ZZYZX 2017-02-08 14:18:01 +02:00
parent 34d1af9446
commit 09b8c27dab
19 changed files with 918 additions and 808 deletions

View file

@ -220,14 +220,21 @@ namespace CodeImp.DoomBuilder.Actions
// Go for all methods on obj // Go for all methods on obj
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
foreach(MethodInfo m in methods) //foreach(MethodInfo m in methods)
int methodsCount = methods.Length;
for (int i = 0; i < methodsCount; i++)
{ {
MethodInfo m = methods[i];
// Check if the method has this attribute // Check if the method has this attribute
ActionAttribute[] attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(BeginActionAttribute), true); ActionAttribute[] attrs = (ActionAttribute[])methods[i].GetCustomAttributes(typeof(BeginActionAttribute), true);
int attrsCount = attrs.Length;
// Go for all attributes // Go for all attributes
foreach(ActionAttribute a in attrs) //foreach(ActionAttribute a in attrs)
for (int j = 0; j < attrsCount; j++)
{ {
ActionAttribute a = attrs[j];
// Create a delegate for this method // Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m); ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -243,10 +250,13 @@ namespace CodeImp.DoomBuilder.Actions
// Check if the method has this attribute // Check if the method has this attribute
attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true); attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true);
attrsCount = attrs.Length;
// Go for all attributes // Go for all attributes
foreach(ActionAttribute a in attrs) //foreach (ActionAttribute a in attrs)
for (int j = 0; j < attrsCount; j++)
{ {
ActionAttribute a = attrs[j];
// Create a delegate for this method // Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m); ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -312,14 +322,20 @@ namespace CodeImp.DoomBuilder.Actions
// Go for all methods on obj // Go for all methods on obj
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
foreach(MethodInfo m in methods) //foreach (MethodInfo m in methods)
int methodsCount = methods.Length;
for(int i = 0; i < methodsCount; i++)
{ {
MethodInfo m = methods[i];
// Check if the method has this attribute // Check if the method has this attribute
ActionAttribute[] attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(BeginActionAttribute), true); ActionAttribute[] attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(BeginActionAttribute), true);
// Go for all attributes // Go for all attributes
foreach(ActionAttribute a in attrs) //foreach (ActionAttribute a in attrs)
int attrsCount = attrs.Length;
for(int j = 0; j < attrsCount; j++)
{ {
ActionAttribute a = attrs[j];
// Create a delegate for this method // Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m); ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -334,8 +350,11 @@ namespace CodeImp.DoomBuilder.Actions
attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true); attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true);
// Go for all attributes // Go for all attributes
foreach(ActionAttribute a in attrs) //foreach (ActionAttribute a in attrs)
attrsCount = attrs.Length;
for (int j = 0; j < attrsCount; j++)
{ {
ActionAttribute a = attrs[j];
// Create a delegate for this method // Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m); ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);

View file

@ -53,11 +53,21 @@ namespace CodeImp.DoomBuilder.Controls
{ {
InitializeComponent(); InitializeComponent();
Reset();
}
#endregion
#region ================== Setup
public void Reset()
{
// Only when running (this.DesignMode won't do when not this, but one of parent controls is in design mode) // Only when running (this.DesignMode won't do when not this, but one of parent controls is in design mode)
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime) if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{ {
//mxd. Setup script numbers //mxd. Setup script numbers
scriptnumbers.Location = new Point(arg0.Location.X, arg0.Location.Y + 2); scriptnumbers.Location = new Point(arg0.Location.X, arg0.Location.Y + 2);
scriptnumbers.Items.Clear();
foreach (ScriptItem si in General.Map.NumberedScripts.Values) foreach (ScriptItem si in General.Map.NumberedScripts.Values)
scriptnumbers.Items.Add(new ColoredComboBoxItem(si, si.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText)); scriptnumbers.Items.Add(new ColoredComboBoxItem(si, si.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
scriptnumbers.DropDownWidth = Tools.GetDropDownWidth(scriptnumbers); scriptnumbers.DropDownWidth = Tools.GetDropDownWidth(scriptnumbers);
@ -65,6 +75,7 @@ namespace CodeImp.DoomBuilder.Controls
//mxd. Setup script names //mxd. Setup script names
if (General.Map.UDMF) if (General.Map.UDMF)
{ {
scriptnames.Items.Clear();
scriptnames.Location = scriptnumbers.Location; scriptnames.Location = scriptnumbers.Location;
foreach (ScriptItem nsi in General.Map.NamedScripts.Values) foreach (ScriptItem nsi in General.Map.NamedScripts.Values)
scriptnames.Items.Add(new ColoredComboBoxItem(nsi, nsi.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText)); scriptnames.Items.Add(new ColoredComboBoxItem(nsi, nsi.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
@ -78,10 +89,6 @@ namespace CodeImp.DoomBuilder.Controls
} }
} }
#endregion
#region ================== Setup
public void SetValue(Linedef l, bool first) public void SetValue(Linedef l, bool first)
{ {
SetValue(l.Fields, l.Args, first); SetValue(l.Fields, l.Args, first);

View file

@ -585,7 +585,7 @@ namespace CodeImp.DoomBuilder.Controls
// Show the whole thing // Show the whole thing
this.Show(); this.Show();
this.Update(); //this.Update(); // ano - don't think this is needed, and is slow
} }
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required) private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)

View file

@ -369,7 +369,7 @@ namespace CodeImp.DoomBuilder.Controls
// Show the whole thing // Show the whole thing
this.Show(); this.Show();
this.Update(); //this.Update(); // ano - don't think this is needed, and is slow
} }
//mxd //mxd

View file

@ -41,12 +41,7 @@ namespace CodeImp.DoomBuilder.Controls
public TagsSelector() public TagsSelector()
{ {
InitializeComponent(); InitializeComponent();
Reset();
tagspermapelement = new List<List<int>>();
usedtags = new List<int>();
rangemodes = new List<int>();
offsetmodes = new List<int>();
infos = new List<TagInfo>();
} }
#endregion #endregion
@ -154,7 +149,6 @@ namespace CodeImp.DoomBuilder.Controls
else else
infos.Add(new TagInfo(tag, string.Empty)); infos.Add(new TagInfo(tag, string.Empty));
} }
foreach(TagInfo info in infos) tagpicker.Items.Add(info); foreach(TagInfo info in infos) tagpicker.Items.Add(info);
tagpicker.DropDownWidth = DoomBuilder.Geometry.Tools.GetDropDownWidth(tagpicker); tagpicker.DropDownWidth = DoomBuilder.Geometry.Tools.GetDropDownWidth(tagpicker);
} }
@ -219,6 +213,18 @@ namespace CodeImp.DoomBuilder.Controls
#endregion #endregion
#region ================== Methods #region ================== Methods
public void Reset()
{
tagspermapelement = new List<List<int>>();
usedtags = new List<int>();
rangemodes = new List<int>();
offsetmodes = new List<int>();
infos = new List<TagInfo>();
tagslist.Links.Clear();
infos.Clear();
tagpicker.Items.Clear();
usedtags.Clear();
}
// Creates a single tag collection to display. int.MinValue means "mixed tag" // Creates a single tag collection to display. int.MinValue means "mixed tag"
private List<int> GetDisplayTags() private List<int> GetDisplayTags()

View file

@ -240,7 +240,7 @@ namespace CodeImp.DoomBuilder.Controls
// Show the whole thing // Show the whole thing
this.Show(); this.Show();
this.Update(); //this.Update(); // ano - don't think this is needed, and is slow
} }
//mxd //mxd

View file

@ -58,7 +58,7 @@ namespace CodeImp.DoomBuilder.Controls
// Show the whole thing // Show the whole thing
this.Show(); this.Show();
this.Update(); //this.Update(); // ano - don't think this is needed, and is slow
} }
} }
} }

View file

@ -986,6 +986,7 @@ namespace CodeImp.DoomBuilder.Map
// Limit intersection offset to the line // Limit intersection offset to the line
if(bounded) if(u < lengthinv) u = lengthinv; else if(u > (1f - lengthinv)) u = 1f - lengthinv; if(bounded) if(u < lengthinv) u = lengthinv; else if(u > (1f - lengthinv)) u = 1f - lengthinv;
/*
// Calculate intersection point // Calculate intersection point
Vector2D i = v1 + u * (v2 - v1); Vector2D i = v1 + u * (v2 - v1);
@ -993,6 +994,12 @@ namespace CodeImp.DoomBuilder.Map
// which is the shortest distance to the line // which is the shortest distance to the line
float ldx = p.x - i.x; float ldx = p.x - i.x;
float ldy = p.y - i.y; float ldy = p.y - i.y;
*/
// ano - let's check to see if we can do the previous faster without using operator overloading and etc
// the answer: running it int.MaxValue / 64 times it tended to be around 100ms faster
float ldx = p.x - (v1.x + u * (v2.x - v1.x));
float ldy = p.y - (v1.y + u * (v2.y - v1.y));
return ldx * ldx + ldy * ldy; return ldx * ldx + ldy * ldy;
} }

View file

@ -2194,12 +2194,16 @@ namespace CodeImp.DoomBuilder.Map
//DebugConsole.Clear(); //DebugConsole.Clear();
//DebugConsole.WriteLine("CorrectSectorReferences for " + lines.Count + " lines"); //DebugConsole.WriteLine("CorrectSectorReferences for " + lines.Count + " lines");
// ano - set a bunch of foreaches to be for()s because they're faster
// Create a list of sidedefs to perform sector creation with // Create a list of sidedefs to perform sector creation with
List<LinedefSide> edges = new List<LinedefSide>(); List<LinedefSide> edges = new List<LinedefSide>();
if(existing_only) if(existing_only)
{ {
foreach(Linedef l in lines) int lineCount = lines.Count;
for(int i = 0; i < lineCount; i++)
{ {
Linedef l = lines[i];
// Add only existing sides as edges (or front side if line has none) // Add only existing sides as edges (or front side if line has none)
if(l.Front != null || l.Back == null) if(l.Front != null || l.Back == null)
edges.Add(new LinedefSide(l, true)); edges.Add(new LinedefSide(l, true));
@ -2209,8 +2213,10 @@ namespace CodeImp.DoomBuilder.Map
} }
else else
{ {
foreach(Linedef l in lines) int lineCount = lines.Count;
for (int i = 0; i < lineCount; i++)
{ {
Linedef l = lines[i];
// Add front side // Add front side
edges.Add(new LinedefSide(l, true)); edges.Add(new LinedefSide(l, true));
@ -2221,8 +2227,10 @@ namespace CodeImp.DoomBuilder.Map
} }
HashSet<Sidedef> sides_correct = new HashSet<Sidedef>(); HashSet<Sidedef> sides_correct = new HashSet<Sidedef>();
foreach(LinedefSide ls in edges) int edgeCount = edges.Count;
for (int i = 0; i < edgeCount; i++)
{ {
LinedefSide ls = edges[i];
if (ls.Front && ls.Line.Front != null) if (ls.Front && ls.Line.Front != null)
sides_correct.Add(ls.Line.Front); sides_correct.Add(ls.Line.Front);
else if(!ls.Front && ls.Line.Back != null) else if(!ls.Front && ls.Line.Back != null)
@ -2241,8 +2249,9 @@ namespace CodeImp.DoomBuilder.Map
SectorBuilder builder = new SectorBuilder(); SectorBuilder builder = new SectorBuilder();
List<Sector> sectors_reused = new List<Sector>(); List<Sector> sectors_reused = new List<Sector>();
foreach(LinedefSide ls in edges) for (int i = 0; i < edgeCount; i++)
{ {
LinedefSide ls = edges[i];
// Skip if edge is ignored // Skip if edge is ignored
//DebugConsole.WriteLine((ls.Ignore ? "Ignoring line " : "Processing line ") + ls.Line.Index); //DebugConsole.WriteLine((ls.Ignore ? "Ignoring line " : "Processing line ") + ls.Line.Index);
if (ls.Ignore) continue; if (ls.Ignore) continue;
@ -2263,8 +2272,9 @@ namespace CodeImp.DoomBuilder.Map
if(side_exists && sectorsides.Contains(edge.Front ? edge.Line.Front : edge.Line.Back)) if(side_exists && sectorsides.Contains(edge.Front ? edge.Line.Front : edge.Line.Back))
has_dragged_sides = true; //mxd has_dragged_sides = true; //mxd
foreach(LinedefSide ls2 in edges) for (int k = 0; k < edgeCount; k++)
{ {
LinedefSide ls2 = edges[k];
if (ls2.Line == edge.Line) if (ls2.Line == edge.Line)
{ {
line_is_ours = true; line_is_ours = true;
@ -2276,12 +2286,16 @@ namespace CodeImp.DoomBuilder.Map
} }
} }
if(line_is_ours) // ano - so this inner part was already commented out
// so i just put the /* */ around it
/*if(line_is_ours)
{ {
//if(edge.Line.Front == null && edge.Line.Back == null) //if(edge.Line.Front == null && edge.Line.Back == null)
//has_zero_sided_lines = true; //has_zero_sided_lines = true;
} }
else else*/
if(!line_is_ours)
{ {
has_existing_lines = true; has_existing_lines = true;
has_existing_sides |= side_exists; //mxd has_existing_sides |= side_exists; //mxd
@ -2331,8 +2345,9 @@ namespace CodeImp.DoomBuilder.Map
} }
// Remove any sides that weren't part of a sector // Remove any sides that weren't part of a sector
foreach(LinedefSide ls in edges) for (int i = 0; i < edgeCount; i++)
{ {
LinedefSide ls = edges[i];
if (ls.Ignore || ls.Line == null) continue; if (ls.Ignore || ls.Line == null) continue;
if(ls.Front) if(ls.Front)

View file

@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.3.0.2859")] [assembly: AssemblyVersion("2.3.0.2866")]
[assembly: NeutralResourcesLanguageAttribute("en")] [assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("5a5c6d0")] [assembly: AssemblyHash("34d1af9")]

View file

@ -94,6 +94,11 @@ namespace CodeImp.DoomBuilder.Rendering
// Disposing // Disposing
private bool isdisposed; private bool isdisposed;
// ano - static stuff to prevent often alloc/dealloc performance hits
private static StringFormat strFormat;
private static SolidBrush brush;
private static Pen pen;
#endregion #endregion
#region ================== Properties #region ================== Properties
@ -157,6 +162,8 @@ namespace CodeImp.DoomBuilder.Rendering
this.updateneeded = true; this.updateneeded = true;
this.textureupdateneeded = true; //mxd this.textureupdateneeded = true; //mxd
InitializeStatics();
// Register as resource // Register as resource
General.Map.Graphics.RegisterResource(this); General.Map.Graphics.RegisterResource(this);
@ -181,6 +188,8 @@ namespace CodeImp.DoomBuilder.Rendering
this.updateneeded = true; this.updateneeded = true;
this.textureupdateneeded = true; this.textureupdateneeded = true;
InitializeStatics();
// Register as resource // Register as resource
General.Map.Graphics.RegisterResource(this); General.Map.Graphics.RegisterResource(this);
@ -210,6 +219,27 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Methods #region ================== Methods
// ano - share resources instead of constantly alloc/dealloc
public void InitializeStatics()
{
if (strFormat == null)
{
strFormat = new StringFormat();
strFormat.FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.NoWrap;
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
}
if (brush == null)
{
// if we actually see magenta, know we made a mistake somewhere
brush = new SolidBrush(System.Drawing.Color.Magenta);
}
if (pen == null)
{
pen = new Pen(System.Drawing.Color.Magenta);
}
}
// This updates the text if needed // This updates the text if needed
public void Update(float translatex, float translatey, float scalex, float scaley) public void Update(float translatex, float translatey, float scalex, float scaley)
{ {
@ -354,12 +384,6 @@ namespace CodeImp.DoomBuilder.Rendering
g.CompositingQuality = CompositingQuality.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality;
// Draw text // Draw text
using(StringFormat sf = new StringFormat())
{
sf.FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.NoWrap;
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
// Draw text with BG // Draw text with BG
if(drawbg) if(drawbg)
{ {
@ -388,16 +412,19 @@ namespace CodeImp.DoomBuilder.Rendering
p.AddArc(pathrect.Left, pathrect.Bottom - radius, radius, radius, 90, 90); p.AddArc(pathrect.Left, pathrect.Bottom - radius, radius, radius, 90, 90);
// Fill'n'draw bg // Fill'n'draw bg
using(SolidBrush brush = new SolidBrush(color.ToColor())) brush.Color = color.ToColor();
g.FillPath(brush, p); g.FillPath(brush, p);
using(Pen pen = new Pen(backcolor.ToColor(), outlinewidth)) pen.Color = backcolor.ToColor();
g.DrawPath(pen, p); g.DrawPath(pen, p);
// Draw text // Draw text
textrect.Inflate(4, 2); textrect.Inflate(4, 2);
using(SolidBrush brush = new SolidBrush(backcolor.ToColor())) brush.Color = backcolor.ToColor();
g.DrawString(text, font, brush, textrect, sf);
g.DrawString(text, font, brush, textrect, strFormat);
} }
// Draw plain text // Draw plain text
else else
@ -408,13 +435,13 @@ namespace CodeImp.DoomBuilder.Rendering
RectangleF plaintextrect = textrect; RectangleF plaintextrect = textrect;
plaintextrect.Inflate(6, 4); plaintextrect.Inflate(6, 4);
using(SolidBrush brush = new SolidBrush(backcolor.ToColor())) brush.Color = backcolor.ToColor();
g.FillRectangle(brush, plainbgrect); g.FillRectangle(brush, plainbgrect);
using(SolidBrush brush = new SolidBrush(color.ToColor())) brush.Color = color.ToColor();
g.DrawString(text, font, brush, plaintextrect, sf); g.DrawString(text, font, brush, plaintextrect, strFormat);
}
} }
} }
return result; return result;

View file

@ -152,6 +152,8 @@ namespace CodeImp.DoomBuilder.Windows
{ {
preventchanges = true; preventchanges = true;
argscontrol.Reset();
undocreated = false;
// Keep this list // Keep this list
this.lines = lines; this.lines = lines;
if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")"; if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")";

View file

@ -245,10 +245,27 @@ namespace CodeImp.DoomBuilder.Windows
// This sets up the form to edit the given lines // This sets up the form to edit the given lines
public void Setup(ICollection<Linedef> lines) public void Setup(ICollection<Linedef> lines)
{ {
// Window setup
// ano - moved this here because we don't reinstantiate the thing every time anymore
if (General.Settings.StoreSelectedEditTab)
{
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
if ((selectfront || selectback) && (activetab == 1 || activetab == 2))
tabs.SelectTab(selectfront ? 1 : 2);
else
tabs.SelectTab(activetab);
}
preventchanges = true; preventchanges = true;
undocreated = false;
argscontrol.Reset();
tagsselector.Reset();
// Keep this list // Keep this list
this.lines = lines; this.lines = lines;
if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")"; if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")";
linedefprops = new List<LinedefProperties>(); linedefprops = new List<LinedefProperties>();

View file

@ -850,7 +850,7 @@ namespace CodeImp.DoomBuilder.Windows
// Refresh // Refresh
statusbar.Invalidate(); statusbar.Invalidate();
this.Update(); //this.Update(); // ano - this is unneeded afaict and slow
} }
// This changes status text to Ready // This changes status text to Ready
@ -2116,18 +2116,21 @@ namespace CodeImp.DoomBuilder.Windows
internal void CheckEditModeButton(string modeclassname) internal void CheckEditModeButton(string modeclassname)
{ {
// Go for all items // Go for all items
foreach(ToolStripItem i in editmodeitems) //foreach(ToolStripItem item in editmodeitems)
int itemCount = editmodeitems.Count;
for(int i = 0; i < itemCount; i++)
{ {
ToolStripItem item = editmodeitems[i];
// Check what type it is // Check what type it is
if(i is ToolStripMenuItem) if(item is ToolStripMenuItem)
{ {
// Check if mode type matches with given name // Check if mode type matches with given name
(i as ToolStripMenuItem).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname); (item as ToolStripMenuItem).Checked = ((item.Tag as EditModeInfo).Type.Name == modeclassname);
} }
else if(i is ToolStripButton) else if(item is ToolStripButton)
{ {
// Check if mode type matches with given name // Check if mode type matches with given name
(i as ToolStripButton).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname); (item as ToolStripButton).Checked = ((item.Tag as EditModeInfo).Type.Name == modeclassname);
} }
} }
} }
@ -2136,11 +2139,14 @@ namespace CodeImp.DoomBuilder.Windows
internal void RemoveEditModeButtons() internal void RemoveEditModeButtons()
{ {
// Go for all items // Go for all items
foreach(ToolStripItem i in editmodeitems) //foreach(ToolStripItem item in editmodeitems)
int itemCount = editmodeitems.Count;
for (int i = 0; i < itemCount; i++)
{ {
ToolStripItem item = editmodeitems[i];
// Remove it and restart // Remove it and restart
menumode.DropDownItems.Remove(i); menumode.DropDownItems.Remove(item);
i.Dispose(); item.Dispose();
} }
// Done // Done

View file

@ -90,7 +90,7 @@ namespace CodeImp.DoomBuilder.Windows
public void Setup(ICollection<Sector> sectors) public void Setup(ICollection<Sector> sectors)
{ {
preventchanges = true; //mxd preventchanges = true; //mxd
undocreated = false;
// Keep this list // Keep this list
this.sectors = sectors; this.sectors = sectors;
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")"; if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";

View file

@ -292,7 +292,7 @@ namespace CodeImp.DoomBuilder.Windows
public void Setup(ICollection<Sector> sectors) public void Setup(ICollection<Sector> sectors)
{ {
preventchanges = true; //mxd preventchanges = true; //mxd
undocreated = false;
// Keep this list // Keep this list
this.sectors = sectors; this.sectors = sectors;
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")"; if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";

View file

@ -141,6 +141,8 @@ namespace CodeImp.DoomBuilder.Windows
public void Setup(ICollection<Thing> things) public void Setup(ICollection<Thing> things)
{ {
preventchanges = true; preventchanges = true;
undocreated = false;
argscontrol.Reset();
// Keep this list // Keep this list
this.things = things; this.things = things;

View file

@ -164,6 +164,8 @@ namespace CodeImp.DoomBuilder.Windows
public void Setup(ICollection<Thing> things) public void Setup(ICollection<Thing> things)
{ {
preventchanges = true; preventchanges = true;
undocreated = false;
argscontrol.Reset();
// Keep this list // Keep this list
this.things = things; this.things = things;

View file

@ -29,5 +29,5 @@ using System.Resources;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.3.0.2859")] [assembly: AssemblyVersion("2.3.0.2866")]
[assembly: NeutralResourcesLanguageAttribute("en")] [assembly: NeutralResourcesLanguageAttribute("en")]