From 1b1546ae6a29ea4a81c75bc2c44aa0b8d7f635ab Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Mon, 23 Mar 2015 22:39:31 +0000
Subject: [PATCH] Fixed(?), Texture Browser: possibly fixed Texture Browser not
 showing up / locking edit forms when current map has a ton of textures (like
 2000 or more) in a single texture group. Changed, cosmetic, Sector Info
 panel, Visual mode: info about currently highlighted surface is now shown
 using different color. Changed, cosmetic, Linedef Info panel, Visual mode,
 non-UDMF: texture offset labels for currently highlighted sidedef are now
 shown using different color. Changed, cosmetic, Vertex Info panel, UDMF:
 floor and ceiling offset labels are now grayed out when they have default
 values.

---
 Source/Core/Controls/LinedefInfoPanel.cs      |  6 +++
 .../Core/Controls/SectorInfoPanel.Designer.cs | 40 +++++++++----------
 Source/Core/Controls/SectorInfoPanel.cs       | 14 ++++++-
 Source/Core/Controls/SectorInfoPanel.resx     |  6 ---
 .../Core/Controls/VertexInfoPanel.Designer.cs | 40 +++++++++----------
 Source/Core/Controls/VertexInfoPanel.cs       | 36 +++++------------
 Source/Core/Windows/IMainForm.cs              |  1 +
 Source/Core/Windows/MainForm.cs               | 24 ++++++++++-
 Source/Core/Windows/TextureBrowserForm.cs     |  3 ++
 .../VisualModes/BaseVisualMode.cs             |  3 +-
 10 files changed, 98 insertions(+), 75 deletions(-)

diff --git a/Source/Core/Controls/LinedefInfoPanel.cs b/Source/Core/Controls/LinedefInfoPanel.cs
index fb5bd3b9..fbffd542 100644
--- a/Source/Core/Controls/LinedefInfoPanel.cs
+++ b/Source/Core/Controls/LinedefInfoPanel.cs
@@ -244,6 +244,9 @@ namespace CodeImp.DoomBuilder.Controls
 						frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
 						frontoffsetlabel.Enabled = true;
 						frontoffset.Enabled = true;
+
+						frontoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
+						frontoffsetlabel.ForeColor = frontoffset.ForeColor;
 					}
 					else
 					{
@@ -359,6 +362,9 @@ namespace CodeImp.DoomBuilder.Controls
 						backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
 						backoffsetlabel.Enabled = true;
 						backoffset.Enabled = true;
+
+						backoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
+						backoffsetlabel.ForeColor = backoffset.ForeColor;
 					}
 					else
 					{
diff --git a/Source/Core/Controls/SectorInfoPanel.Designer.cs b/Source/Core/Controls/SectorInfoPanel.Designer.cs
index 30bd0e60..dd5f7421 100644
--- a/Source/Core/Controls/SectorInfoPanel.Designer.cs
+++ b/Source/Core/Controls/SectorInfoPanel.Designer.cs
@@ -30,8 +30,8 @@ namespace CodeImp.DoomBuilder.Controls
 		{
 			System.Windows.Forms.Label label13;
 			System.Windows.Forms.Label label5;
-			System.Windows.Forms.Label label3;
-			System.Windows.Forms.Label label2;
+			this.labelfloor = new System.Windows.Forms.Label();
+			this.labelceiling = new System.Windows.Forms.Label();
 			this.labelTag = new System.Windows.Forms.Label();
 			this.labelEffect = new System.Windows.Forms.Label();
 			this.ceilingLightLabel = new System.Windows.Forms.Label();
@@ -74,8 +74,6 @@ namespace CodeImp.DoomBuilder.Controls
 			this.flags = new System.Windows.Forms.ListView();
 			label13 = new System.Windows.Forms.Label();
 			label5 = new System.Windows.Forms.Label();
-			label3 = new System.Windows.Forms.Label();
-			label2 = new System.Windows.Forms.Label();
 			this.sectorinfo.SuspendLayout();
 			this.ceilingpanel.SuspendLayout();
 			this.ceilingtex.SuspendLayout();
@@ -103,23 +101,23 @@ namespace CodeImp.DoomBuilder.Controls
 			label5.Text = "Height:";
 			label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
 			// 
-			// label3
+			// labelfloor
 			// 
-			label3.Location = new System.Drawing.Point(8, 49);
-			label3.Name = "label3";
-			label3.Size = new System.Drawing.Size(44, 14);
-			label3.TabIndex = 3;
-			label3.Text = "Floor:";
-			label3.TextAlign = System.Drawing.ContentAlignment.TopRight;
+			this.labelfloor.Location = new System.Drawing.Point(8, 49);
+			this.labelfloor.Name = "labelfloor";
+			this.labelfloor.Size = new System.Drawing.Size(44, 14);
+			this.labelfloor.TabIndex = 3;
+			this.labelfloor.Text = "Floor:";
+			this.labelfloor.TextAlign = System.Drawing.ContentAlignment.TopRight;
 			// 
-			// label2
+			// labelceiling
 			// 
-			label2.Location = new System.Drawing.Point(8, 34);
-			label2.Name = "label2";
-			label2.Size = new System.Drawing.Size(44, 14);
-			label2.TabIndex = 2;
-			label2.Text = "Ceiling:";
-			label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
+			this.labelceiling.Location = new System.Drawing.Point(8, 34);
+			this.labelceiling.Name = "labelceiling";
+			this.labelceiling.Size = new System.Drawing.Size(44, 14);
+			this.labelceiling.TabIndex = 2;
+			this.labelceiling.Text = "Ceiling:";
+			this.labelceiling.TextAlign = System.Drawing.ContentAlignment.TopRight;
 			// 
 			// labelTag
 			// 
@@ -225,8 +223,8 @@ namespace CodeImp.DoomBuilder.Controls
 			this.sectorinfo.Controls.Add(this.floor);
 			this.sectorinfo.Controls.Add(this.ceiling);
 			this.sectorinfo.Controls.Add(this.labelTag);
-			this.sectorinfo.Controls.Add(label3);
-			this.sectorinfo.Controls.Add(label2);
+			this.sectorinfo.Controls.Add(this.labelfloor);
+			this.sectorinfo.Controls.Add(this.labelceiling);
 			this.sectorinfo.Controls.Add(this.effect);
 			this.sectorinfo.Controls.Add(this.labelEffect);
 			this.sectorinfo.Location = new System.Drawing.Point(0, 0);
@@ -605,5 +603,7 @@ namespace CodeImp.DoomBuilder.Controls
 		private System.Windows.Forms.ListView flags;
 		private System.Windows.Forms.Label labelTag;
 		private System.Windows.Forms.Label labelEffect;
+		private System.Windows.Forms.Label labelfloor;
+		private System.Windows.Forms.Label labelceiling;
 	}
 }
diff --git a/Source/Core/Controls/SectorInfoPanel.cs b/Source/Core/Controls/SectorInfoPanel.cs
index 3622557c..30a8b5b6 100644
--- a/Source/Core/Controls/SectorInfoPanel.cs
+++ b/Source/Core/Controls/SectorInfoPanel.cs
@@ -53,7 +53,7 @@ namespace CodeImp.DoomBuilder.Controls
 		}
 
 		// This shows the info
-		public void ShowInfo(Sector s)
+		public void ShowInfo(Sector s, bool highlightceiling, bool highlightfloor)
 		{
 			int sheight = s.CeilHeight - s.FloorHeight;
 
@@ -321,6 +321,18 @@ namespace CodeImp.DoomBuilder.Controls
 			UpdateTexturePanel(ceilingpanel, ceilingname, ceilinfolabels, ceilingtex, ceilingOffsetLabel.Location.X - 1, showExtededCeilingInfo);
 			UpdateTexturePanel(floorpanel, floorname, floorinfolabels, floortex, floorOffsetLabel.Location.X - 1, showExtededFloorInfo);
 
+			//mxd. Highlight ceiling or floor?
+			Color floorhighlightcolor = (highlightfloor ? SystemColors.HotTrack : SystemColors.WindowText);
+			Color ceilinghighlightcolor = (highlightceiling ? SystemColors.HotTrack : SystemColors.WindowText);
+			
+			floorpanel.ForeColor = floorhighlightcolor;
+			floor.ForeColor = floorhighlightcolor;
+			labelfloor.ForeColor = floorhighlightcolor;
+
+			ceilingpanel.ForeColor = ceilinghighlightcolor;
+			ceiling.ForeColor = ceilinghighlightcolor;
+			labelceiling.ForeColor = ceilinghighlightcolor;
+
 			// Show the whole thing
 			this.Show();
 			this.Update();
diff --git a/Source/Core/Controls/SectorInfoPanel.resx b/Source/Core/Controls/SectorInfoPanel.resx
index 9ef70c1a..adcbc94b 100644
--- a/Source/Core/Controls/SectorInfoPanel.resx
+++ b/Source/Core/Controls/SectorInfoPanel.resx
@@ -123,10 +123,4 @@
   <metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>False</value>
   </metadata>
-  <metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>False</value>
-  </metadata>
-  <metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>False</value>
-  </metadata>
 </root>
\ No newline at end of file
diff --git a/Source/Core/Controls/VertexInfoPanel.Designer.cs b/Source/Core/Controls/VertexInfoPanel.Designer.cs
index 162bc408..84f3a294 100644
--- a/Source/Core/Controls/VertexInfoPanel.Designer.cs
+++ b/Source/Core/Controls/VertexInfoPanel.Designer.cs
@@ -32,9 +32,9 @@ namespace CodeImp.DoomBuilder.Controls
 			this.vertexinfo = new System.Windows.Forms.GroupBox();
 			this.panelOffsets = new System.Windows.Forms.Panel();
 			this.zfloor = new System.Windows.Forms.Label();
-			this.labelCeilingOffset = new System.Windows.Forms.Label();
+			this.labelzceiling = new System.Windows.Forms.Label();
 			this.zceiling = new System.Windows.Forms.Label();
-			this.labelFloorOffset = new System.Windows.Forms.Label();
+			this.labelzfloor = new System.Windows.Forms.Label();
 			this.position = new System.Windows.Forms.Label();
 			label1 = new System.Windows.Forms.Label();
 			this.vertexinfo.SuspendLayout();
@@ -65,9 +65,9 @@ namespace CodeImp.DoomBuilder.Controls
 			// panelOffsets
 			// 
 			this.panelOffsets.Controls.Add(this.zfloor);
-			this.panelOffsets.Controls.Add(this.labelCeilingOffset);
+			this.panelOffsets.Controls.Add(this.labelzceiling);
 			this.panelOffsets.Controls.Add(this.zceiling);
-			this.panelOffsets.Controls.Add(this.labelFloorOffset);
+			this.panelOffsets.Controls.Add(this.labelzfloor);
 			this.panelOffsets.Location = new System.Drawing.Point(6, 49);
 			this.panelOffsets.Name = "panelOffsets";
 			this.panelOffsets.Size = new System.Drawing.Size(151, 46);
@@ -82,14 +82,14 @@ namespace CodeImp.DoomBuilder.Controls
 			this.zfloor.TabIndex = 7;
 			this.zfloor.Text = "-512";
 			// 
-			// labelCeilingOffset
+			// labelzceiling
 			// 
-			this.labelCeilingOffset.AutoSize = true;
-			this.labelCeilingOffset.Location = new System.Drawing.Point(5, 3);
-			this.labelCeilingOffset.Name = "labelCeilingOffset";
-			this.labelCeilingOffset.Size = new System.Drawing.Size(70, 13);
-			this.labelCeilingOffset.TabIndex = 4;
-			this.labelCeilingOffset.Text = "Ceiling offset:";
+			this.labelzceiling.AutoSize = true;
+			this.labelzceiling.Location = new System.Drawing.Point(5, 3);
+			this.labelzceiling.Name = "labelzceiling";
+			this.labelzceiling.Size = new System.Drawing.Size(70, 13);
+			this.labelzceiling.TabIndex = 4;
+			this.labelzceiling.Text = "Ceiling offset:";
 			// 
 			// zceiling
 			// 
@@ -100,14 +100,14 @@ namespace CodeImp.DoomBuilder.Controls
 			this.zceiling.TabIndex = 6;
 			this.zceiling.Text = "-512";
 			// 
-			// labelFloorOffset
+			// labelzfloor
 			// 
-			this.labelFloorOffset.AutoSize = true;
-			this.labelFloorOffset.Location = new System.Drawing.Point(12, 26);
-			this.labelFloorOffset.Name = "labelFloorOffset";
-			this.labelFloorOffset.Size = new System.Drawing.Size(62, 13);
-			this.labelFloorOffset.TabIndex = 5;
-			this.labelFloorOffset.Text = "Floor offset:";
+			this.labelzfloor.AutoSize = true;
+			this.labelzfloor.Location = new System.Drawing.Point(12, 26);
+			this.labelzfloor.Name = "labelzfloor";
+			this.labelzfloor.Size = new System.Drawing.Size(62, 13);
+			this.labelzfloor.TabIndex = 5;
+			this.labelzfloor.Text = "Floor offset:";
 			// 
 			// position
 			// 
@@ -142,8 +142,8 @@ namespace CodeImp.DoomBuilder.Controls
 		private System.Windows.Forms.Label zfloor;
 		private System.Windows.Forms.Label zceiling;
 		private System.Windows.Forms.Panel panelOffsets;
-		private System.Windows.Forms.Label labelCeilingOffset;
-		private System.Windows.Forms.Label labelFloorOffset;
+		private System.Windows.Forms.Label labelzceiling;
+		private System.Windows.Forms.Label labelzfloor;
 
 	}
 }
diff --git a/Source/Core/Controls/VertexInfoPanel.cs b/Source/Core/Controls/VertexInfoPanel.cs
index 50049968..32419f01 100644
--- a/Source/Core/Controls/VertexInfoPanel.cs
+++ b/Source/Core/Controls/VertexInfoPanel.cs
@@ -41,35 +41,21 @@ namespace CodeImp.DoomBuilder.Controls
 			position.Text = v.Position.x.ToString(CultureInfo.InvariantCulture) + ", " + v.Position.y.ToString(CultureInfo.InvariantCulture);
 			
 			//mxd. Height offsets
-			if(General.Map.UDMF) 
+			if(General.Map.UDMF)
 			{
-				if(!float.IsNaN(v.ZCeiling)) 
-				{
-					zceiling.Text = v.ZCeiling.ToString(CultureInfo.InvariantCulture);
-					zceiling.Enabled = true;
-					labelCeilingOffset.Enabled = true;
-				} 
-				else 
-				{
-					zceiling.Text = "--";
-				}
+				bool haveoffset = !float.IsNaN(v.ZCeiling);
+				zceiling.Text = (haveoffset ? v.ZCeiling.ToString(CultureInfo.InvariantCulture) : "--");
+				zceiling.Enabled = haveoffset;
+				labelzceiling.Enabled = haveoffset;
 
-				if(!float.IsNaN(v.ZFloor)) 
-				{
-					zfloor.Text = v.ZFloor.ToString(CultureInfo.InvariantCulture);
-					zfloor.Enabled = true;
-					labelFloorOffset.Enabled = true;
-				} 
-				else 
-				{
-					zfloor.Text = "--";
-				}
-
-				panelOffsets.Visible = true;
-			} else {
-				panelOffsets.Visible = false;
+				haveoffset = !float.IsNaN(v.ZFloor);
+				zfloor.Text = (haveoffset ? v.ZFloor.ToString(CultureInfo.InvariantCulture) : "--");
+				zfloor.Enabled = haveoffset;
+				labelzfloor.Enabled = haveoffset;
 			}
 
+			panelOffsets.Visible = General.Map.UDMF;
+
 			// Show the whole thing
 			this.Show();
 			this.Update();
diff --git a/Source/Core/Windows/IMainForm.cs b/Source/Core/Windows/IMainForm.cs
index 0d38c6a2..68dcb212 100644
--- a/Source/Core/Windows/IMainForm.cs
+++ b/Source/Core/Windows/IMainForm.cs
@@ -58,6 +58,7 @@ namespace CodeImp.DoomBuilder.Windows
 		void ShowLinedefInfo(Linedef l);
 		void ShowLinedefInfo(Linedef l, Sidedef highlightside); //mxd
 		void ShowSectorInfo(Sector s);
+		void ShowSectorInfo(Sector s, bool highlightceiling, bool highlightfloor); //mxd
 		void ShowThingInfo(Thing t);
 		void ShowVertexInfo(Vertex v);
 		void HideInfo();
diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs
index 040d8ef9..d518eecf 100644
--- a/Source/Core/Windows/MainForm.cs
+++ b/Source/Core/Windows/MainForm.cs
@@ -3366,8 +3366,14 @@ namespace CodeImp.DoomBuilder.Windows
 			General.Plugins.OnHighlightVertex(v);
 		}
 
-		// Show sector info
+		//mxd. Show sector info
 		public void ShowSectorInfo(Sector s) 
+		{
+			ShowSectorInfo(s, false, false);
+		}
+
+		// Show sector info
+		public void ShowSectorInfo(Sector s, bool highlightceiling, bool highlightfloor) 
 		{
 			if (s.IsDisposed) 
 			{
@@ -3384,7 +3390,7 @@ namespace CodeImp.DoomBuilder.Windows
 			if (linedefinfo.Visible) linedefinfo.Hide();
 			if (vertexinfo.Visible) vertexinfo.Hide();
 			if (thinginfo.Visible) thinginfo.Hide();
-			if(IsInfoPanelExpanded) sectorinfo.ShowInfo(s);
+			if(IsInfoPanelExpanded) sectorinfo.ShowInfo(s, highlightceiling, highlightfloor); //mxd
 
 			// Show info on collapsed label
 			if(General.Map.Config.SectorEffects.ContainsKey(s.Effect))
@@ -3479,7 +3485,9 @@ namespace CodeImp.DoomBuilder.Windows
 		{
 			// Show sector edit dialog
 			VertexEditForm f = new VertexEditForm();
+			DisableProcessing(); //mxd
 			f.Setup(vertices, allowPositionChange);
+			EnableProcessing(); //mxd
 			f.OnValuesChanged += EditForm_OnValuesChanged;
 			editformopen = true; //mxd
 			DialogResult result = f.ShowDialog(this);
@@ -3498,7 +3506,9 @@ namespace CodeImp.DoomBuilder.Windows
 			if(General.Map.UDMF) //mxd
 			{
 				LinedefEditFormUDMF f = new LinedefEditFormUDMF();
+				DisableProcessing(); //mxd
 				f.Setup(lines);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
@@ -3508,7 +3518,9 @@ namespace CodeImp.DoomBuilder.Windows
 			else
 			{
 				LinedefEditForm f = new LinedefEditForm();
+				DisableProcessing(); //mxd
 				f.Setup(lines);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
@@ -3528,7 +3540,9 @@ namespace CodeImp.DoomBuilder.Windows
 			if(General.Map.UDMF) //mxd
 			{ 
 				SectorEditFormUDMF f = new SectorEditFormUDMF();
+				DisableProcessing(); //mxd
 				f.Setup(sectors);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
@@ -3538,7 +3552,9 @@ namespace CodeImp.DoomBuilder.Windows
 			else
 			{
 				SectorEditForm f = new SectorEditForm();
+				DisableProcessing(); //mxd
 				f.Setup(sectors);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
@@ -3558,7 +3574,9 @@ namespace CodeImp.DoomBuilder.Windows
 			if(General.Map.UDMF) 
 			{
 				ThingEditFormUDMF f = new ThingEditFormUDMF();
+				DisableProcessing(); //mxd
 				f.Setup(things);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
@@ -3568,7 +3586,9 @@ namespace CodeImp.DoomBuilder.Windows
 			else 
 			{
 				ThingEditForm f = new ThingEditForm();
+				DisableProcessing(); //mxd
 				f.Setup(things);
+				EnableProcessing(); //mxd
 				f.OnValuesChanged += EditForm_OnValuesChanged;
 				editformopen = true; //mxd
 				result = f.ShowDialog(this);
diff --git a/Source/Core/Windows/TextureBrowserForm.cs b/Source/Core/Windows/TextureBrowserForm.cs
index 01e42be8..0ded874c 100644
--- a/Source/Core/Windows/TextureBrowserForm.cs
+++ b/Source/Core/Windows/TextureBrowserForm.cs
@@ -49,6 +49,8 @@ namespace CodeImp.DoomBuilder.Windows
 		public TextureBrowserForm(string selecttexture, bool browseflats)
 		{
 			Cursor.Current = Cursors.WaitCursor;
+			General.Interface.DisableProcessing(); //mxd
+
 			TreeNode item; //mxd
 			long longname = Lump.MakeLongName(selecttexture ?? "");
 			longname = (browseflats ? General.Map.Data.GetFullLongFlatName(longname) : General.Map.Data.GetFullLongTextureName(longname)); //mxd
@@ -397,6 +399,7 @@ namespace CodeImp.DoomBuilder.Windows
 		private void TextureBrowserForm_Activated(object sender, EventArgs e)
 		{
 			Cursor.Current = Cursors.Default;
+			General.Interface.EnableProcessing(); //mxd
 		}
 
 		// Loading
diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs
index 7e81f8a1..f99af497 100644
--- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs
+++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs
@@ -465,7 +465,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
 					else if(pickedgeo is BaseVisualGeometrySector)
 					{
 						BaseVisualGeometrySector pickedsector = (pickedgeo as BaseVisualGeometrySector);
-						General.Interface.ShowSectorInfo(pickedsector.Level.sector);
+						bool isceiling = (pickedsector is VisualCeiling); //mxd
+						General.Interface.ShowSectorInfo(pickedsector.Level.sector, isceiling, !isceiling);
 					}
 					else
 					{