From 85a4c3a6519e083b12d56fd0b5e6e3f72f7919e7 Mon Sep 17 00:00:00 2001
From: ZZYZX <zzyzx@virtual>
Date: Mon, 19 Sep 2022 10:13:27 +0300
Subject: [PATCH] Fixed: Map options form window would become squished if the
 starting game configuration is invalid

---
 Source/Core/Windows/ConfigForm.cs         | 6 ++----
 Source/Core/Windows/MapOptionsForm.cs     | 3 +--
 Source/Core/Windows/OpenMapOptionsForm.cs | 8 ++++----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/Source/Core/Windows/ConfigForm.cs b/Source/Core/Windows/ConfigForm.cs
index 0701b517c..114ebbed3 100755
--- a/Source/Core/Windows/ConfigForm.cs
+++ b/Source/Core/Windows/ConfigForm.cs
@@ -56,7 +56,8 @@ namespace CodeImp.DoomBuilder.Windows
 			
 			// Initialize
 			InitializeComponent();
-			CodeImp.DoomBuilder.General.ApplyMonoListViewFix(listtextures);
+			this.initialformheight = Height;
+			General.ApplyMonoListViewFix(listtextures);
 
 			#if NO_WIN32
 			// Linux doesn't require .exe or .bat file extensions
@@ -110,9 +111,6 @@ namespace CodeImp.DoomBuilder.Windows
 
 			//mxd. Trigger change to update the right panel...
 			listconfigs_MouseUp(this, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0));
-
-			//
-			initialformheight = Height;
 		}
 		
 		// This shows a specific page
diff --git a/Source/Core/Windows/MapOptionsForm.cs b/Source/Core/Windows/MapOptionsForm.cs
index 3277d0356..2d1deca33 100755
--- a/Source/Core/Windows/MapOptionsForm.cs
+++ b/Source/Core/Windows/MapOptionsForm.cs
@@ -51,6 +51,7 @@ namespace CodeImp.DoomBuilder.Windows
 
 			// Initialize
 			InitializeComponent();
+			this.initialformheight = Height;
 
 			// Keep settings
 			this.options = options;
@@ -128,8 +129,6 @@ namespace CodeImp.DoomBuilder.Windows
 			datalocations.EditResourceLocationList(options.Resources);
 
 			//reloadresourceprecmd.Text = options.ReloadResourcePreCommand;
-
-			this.initialformheight = Height;
 		}
 
 		private GameConfiguration GetGameConfiguration()
diff --git a/Source/Core/Windows/OpenMapOptionsForm.cs b/Source/Core/Windows/OpenMapOptionsForm.cs
index 3aa65c375..e4b9a4629 100755
--- a/Source/Core/Windows/OpenMapOptionsForm.cs
+++ b/Source/Core/Windows/OpenMapOptionsForm.cs
@@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.Windows
 		private string selectedmapname;
 		private static readonly Regex episodemapregex = new Regex("^E[1-9]M[1-9]$");
 		private static readonly Regex noepisodemapregex = new Regex("^MAP[0-9][0-9]$");
-		private readonly int initialformsize;
+		private readonly int initialformheight;
 
 		// Properties
 		//public string FilePathName { get { return filepathname; } }
@@ -52,13 +52,13 @@ namespace CodeImp.DoomBuilder.Windows
 		{
 			// Initialize
 			InitializeComponent();
+			this.initialformheight = Height;
 			General.ApplyMonoListViewFix(mapslist);
 			this.Text = "Open Map from " + Path.GetFileName(filepathname);
 			this.filepathname = filepathname;
 			datalocations.StartPath = filepathname; //mxd
 			datalocations.IsMapControl = true;
 			this.options = null;
-			this.initialformsize = Height;
 		}
 
 		// Constructor
@@ -66,13 +66,13 @@ namespace CodeImp.DoomBuilder.Windows
 		{
 			// Initialize
 			InitializeComponent();
+			this.initialformheight = Height;
 			General.ApplyMonoListViewFix(mapslist);
 			this.Text = "Open Map from " + Path.GetFileName(filepathname);
 			this.filepathname = filepathname;
 			this.options = options;
 			datalocations.StartPath = filepathname; //mxd
 			datalocations.IsMapControl = true;
-			this.initialformsize = Height;
 		}
 
 		private GameConfiguration GetGameConfiguration()
@@ -643,7 +643,7 @@ namespace CodeImp.DoomBuilder.Windows
 
         private void datalocations_OnWarningsChanged(int size)
         {
-			Height = initialformsize + size;
+			Height = initialformheight + size;
 			Refresh();
 		}
     }
-- 
GitLab