From 26739a7f2dcd57f5dcb317507f1f03071ec411bd Mon Sep 17 00:00:00 2001 From: codeimp Date: Tue, 28 Apr 2009 07:51:23 +0000 Subject: [PATCH] Displaying "no errors found" when nothing is found in Map Analysis mode --- .../Plugins/BuilderModes/BuilderModes.csproj | 3 +- .../ErrorChecks/ResultNoErrors.cs | 72 +++++++++++++++++++ .../BuilderModes/Interface/ErrorCheckForm.cs | 8 +++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 Source/Plugins/BuilderModes/ErrorChecks/ResultNoErrors.cs diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index b326c551..256ee870 100644 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -228,6 +228,7 @@ + @@ -273,4 +274,4 @@ - \ No newline at end of file + diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultNoErrors.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultNoErrors.cs new file mode 100644 index 00000000..ce325283 --- /dev/null +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultNoErrors.cs @@ -0,0 +1,72 @@ + +#region ================== Copyright (c) 2007 Pascal vd Heiden + +/* + * Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com + * This program is released under GNU General Public License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#endregion + +#region ================== Namespaces + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Reflection; +using CodeImp.DoomBuilder.Windows; +using CodeImp.DoomBuilder.IO; +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; +using CodeImp.DoomBuilder.Geometry; +using CodeImp.DoomBuilder.Editing; +using CodeImp.DoomBuilder.Actions; +using CodeImp.DoomBuilder.Types; +using CodeImp.DoomBuilder.Config; + +#endregion + +namespace CodeImp.DoomBuilder.BuilderModes +{ + public class ResultNoErrors : ErrorResult + { + #region ================== Variables + + #endregion + + #region ================== Properties + + public override int Buttons { get { return 0; } } + + #endregion + + #region ================== Constructor / Destructor + + // Constructor + public ResultNoErrors() + { + } + + #endregion + + #region ================== Methods + + // This must return the string that is displayed in the listbox + public override string ToString() + { + return "No errors were found."; + } + + #endregion + } +} diff --git a/Source/Plugins/BuilderModes/Interface/ErrorCheckForm.cs b/Source/Plugins/BuilderModes/Interface/ErrorCheckForm.cs index 982ab948..872b6d6f 100644 --- a/Source/Plugins/BuilderModes/Interface/ErrorCheckForm.cs +++ b/Source/Plugins/BuilderModes/Interface/ErrorCheckForm.cs @@ -174,6 +174,13 @@ namespace CodeImp.DoomBuilder.BuilderModes running = false; blockmap.Dispose(); blockmap = null; + + // When no results found, show "no results" and disable the list + if(results.Items.Count == 0) + { + results.Items.Add(new ResultNoErrors()); + results.Enabled = false; + } } } @@ -196,6 +203,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.Size = new Size(this.Width, this.Height - this.ClientSize.Height + resultspanel.Top + resultspanel.Height); progress.Value = 0; results.Items.Clear(); + results.Enabled = true; ClearSelectedResult(); resultspanel.Visible = true; buttoncheck.Text = "Abort Analysis";