From 5fd79cd7a220a9af2a5af7182576d791906db415 Mon Sep 17 00:00:00 2001 From: MaxED Date: Thu, 24 Mar 2016 09:25:54 +0000 Subject: [PATCH] Fixed, "Check Polyobjects" error check: an error is no longer added when "Mirror Polyobject Number" of "Polyobj_Startline" is 0. Fixed, "Find and Replace" mode: "Find and Replace" window no longer closes when no results are found and Replace mode is enabled. Changed, "Find and Replace" mode: renamed some search modes for better grouping. --- Source/Core/Editing/EditMode.cs | 2 +- .../ClassicModes/FindReplaceMode.cs | 4 ++- .../ErrorChecks/CheckPolyobjects.cs | 5 ++-- .../FindReplace/FindSectorCeilingFlat.cs | 2 +- .../FindReplace/FindSectorCeilingHeight.cs | 2 +- .../FindReplace/FindSectorFloorFlat.cs | 2 +- .../FindReplace/FindSectorFloorHeight.cs | 2 +- .../FindReplace/FindSidedefLowerTexture.cs | 2 +- .../FindReplace/FindSidedefMiddleTexture.cs | 2 +- .../FindReplace/FindSidedefUpperTexture.cs | 2 +- .../Interface/FindReplaceForm.Designer.cs | 1 + .../BuilderModes/Interface/FindReplaceForm.cs | 27 ++++++++++--------- 12 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Source/Core/Editing/EditMode.cs b/Source/Core/Editing/EditMode.cs index 4920e23c..fb5aeede 100644 --- a/Source/Core/Editing/EditMode.cs +++ b/Source/Core/Editing/EditMode.cs @@ -45,7 +45,7 @@ namespace CodeImp.DoomBuilder.Editing #region ================== Variables // Attributes - private EditModeAttribute attributes; + protected EditModeAttribute attributes; //mxd. private -> protected // Disposing protected bool isdisposed; diff --git a/Source/Plugins/BuilderModes/ClassicModes/FindReplaceMode.cs b/Source/Plugins/BuilderModes/ClassicModes/FindReplaceMode.cs index ff839df8..5c790fb7 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/FindReplaceMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/FindReplaceMode.cs @@ -46,6 +46,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + internal bool Volatile { get { return attributes.Volatile; } set { attributes.Volatile = value; } } //mxd + #endregion #region ================== Constructor / Disposer @@ -89,7 +91,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Show toolbox window - BuilderPlug.Me.FindReplaceForm.Show((Form)General.Interface); + BuilderPlug.Me.FindReplaceForm.Show((Form)General.Interface, this); } // Disenagaging diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckPolyobjects.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckPolyobjects.cs index b2d0a153..42b6e743 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckPolyobjects.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckPolyobjects.cs @@ -10,7 +10,7 @@ using System.Threading; namespace CodeImp.DoomBuilder.BuilderModes { - [ErrorChecker("Check Polyobjects", true, 100)] + [ErrorChecker("Check polyobjects", true, 100)] public class CheckPolyobjects : ErrorChecker { #region ================== Constants @@ -124,7 +124,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Check if Mirror Polyobject Number exists foreach(Linedef linedef in linesbytype.Value) { - if(!startspots.ContainsKey(linedef.Args[1])) + // The value of 0 can mean either "No mirror polyobj" or "Polyobj 0" here... + if(linedef.Args[1] > 0 && !startspots.ContainsKey(linedef.Args[1])) SubmitResult(new ResultInvalidPolyobjectLines(new List { linedef }, "\"" + Polyobj_StartLine + "\" action have non-existing Mirror Polyobject Number assigned (" + linedef.Args[1] + "). It won't function correctly ingame.")); } } diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs index dc2e5ca4..c15e64dd 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs @@ -10,7 +10,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes { - [FindReplace("Sector Ceiling Flat", BrowseButton = true)] + [FindReplace("Sector Flat (Ceiling)", BrowseButton = true)] internal class FindSectorCeilingFlat : FindSectorFlat { #region ================== Methods diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs index ceecc742..d5a62aa2 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs @@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes.FindReplace { - [FindReplace("Sector Ceiling Height", BrowseButton = false)] + [FindReplace("Sector Height (Ceiling)", BrowseButton = false)] internal class FindSectorCeilingHeight : BaseFindSector { #region ================== Methods diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs index 07817d04..5de5af82 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs @@ -10,7 +10,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes { - [FindReplace("Sector Floor Flat", BrowseButton = true)] + [FindReplace("Sector Flat (Floor)", BrowseButton = true)] internal class FindSectorFloorFlat : FindSectorFlat { #region ================== Methods diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs index d0e297fe..2dddacb9 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs @@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes.FindReplace { - [FindReplace("Sector Floor Height", BrowseButton = false)] + [FindReplace("Sector Height (Floor)", BrowseButton = false)] internal class FindSectorFloorHeight : BaseFindSector { #region ================== Methods diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSidedefLowerTexture.cs b/Source/Plugins/BuilderModes/FindReplace/FindSidedefLowerTexture.cs index eed8ea31..5cbe8377 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSidedefLowerTexture.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSidedefLowerTexture.cs @@ -11,7 +11,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes { - [FindReplace("Sidedef Lower Texture", BrowseButton = true)] + [FindReplace("Sidedef Texture (Lower)", BrowseButton = true)] internal class FindSidedefLowerTexture : BaseFindSidedef { #region ================== Properties diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSidedefMiddleTexture.cs b/Source/Plugins/BuilderModes/FindReplace/FindSidedefMiddleTexture.cs index 25386746..9bb4318e 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSidedefMiddleTexture.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSidedefMiddleTexture.cs @@ -11,7 +11,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes { - [FindReplace("Sidedef Middle Texture", BrowseButton = true)] + [FindReplace("Sidedef Texture (Middle)", BrowseButton = true)] internal class FindSidedefMiddleTexture : BaseFindSidedef { #region ================== Properties diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSidedefUpperTexture.cs b/Source/Plugins/BuilderModes/FindReplace/FindSidedefUpperTexture.cs index 48d91761..24913ab3 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSidedefUpperTexture.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSidedefUpperTexture.cs @@ -11,7 +11,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.BuilderModes { - [FindReplace("Sidedef Upper Texture", BrowseButton = true)] + [FindReplace("Sidedef Texture (Upper)", BrowseButton = true)] internal class FindSidedefUpperTexture : BaseFindSidedef { #region ================== Properties diff --git a/Source/Plugins/BuilderModes/Interface/FindReplaceForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/FindReplaceForm.Designer.cs index 258f6870..7bfb6f57 100644 --- a/Source/Plugins/BuilderModes/Interface/FindReplaceForm.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/FindReplaceForm.Designer.cs @@ -72,6 +72,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.searchtypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.searchtypes.FormattingEnabled = true; this.searchtypes.Location = new System.Drawing.Point(109, 12); + this.searchtypes.MaxDropDownItems = 40; this.searchtypes.Name = "searchtypes"; this.searchtypes.Size = new System.Drawing.Size(156, 21); this.searchtypes.Sorted = true; diff --git a/Source/Plugins/BuilderModes/Interface/FindReplaceForm.cs b/Source/Plugins/BuilderModes/Interface/FindReplaceForm.cs index bd9e2300..008b1be9 100644 --- a/Source/Plugins/BuilderModes/Interface/FindReplaceForm.cs +++ b/Source/Plugins/BuilderModes/Interface/FindReplaceForm.cs @@ -36,12 +36,13 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Variables + private FindReplaceMode mode; //mxd private FindReplaceType newfinder; private FindReplaceType finder; private List findtypeslist; - bool controlpressed; - bool shiftpressed; - bool suppressevents; + private bool controlpressed; + private bool shiftpressed; + private bool suppressevents; #endregion @@ -169,7 +170,11 @@ namespace CodeImp.DoomBuilder.BuilderModes // Withdraw the undo step if nothing was replaced if(resultslist.Items.Count < 1) + { + mode.Volatile = false; //mxd. Otherwice UndoManager.PerformUndo will cancel the mode... General.Map.UndoRedo.WithdrawUndo(); + mode.Volatile = true; //mxd + } } else { @@ -345,14 +350,13 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Methods // This shows the window - public void Show(Form owner) + public void Show(Form owner, FindReplaceMode mode) { - // First time showing? - //if((this.Location.X == 0) && (this.Location.Y == 0)) - { - // Position at left-top of owner - this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90); - } + //mxd + this.mode = mode; + + // Position at left-top of owner + this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90); // Re-fill the search types list searchtypes.Items.Clear(); @@ -373,8 +377,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Select first if none was selected - if(searchtypes.SelectedIndex < 0) - searchtypes.SelectedIndex = 0; + if(searchtypes.SelectedIndex < 0) searchtypes.SelectedIndex = 0; // Close results part resultspanel.Visible = false;