From 424f5ab964d1c977a977f2f55697ad7a0ca4801b Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 10 Feb 2015 17:37:08 +0000 Subject: [PATCH] Set texture viewer status bar to fixed width font. Partly experimental * Since the addition of the normalised UV co-ords the status bar will flicker in width horrendously when scanning over a texture and it's impossible to track where you are. Even worse, if the text is wide enough (or the window narrow enough) you'll end up with the status bar flickering between one and two lines - which is awful. * For now I've added some padding for numbers and set a fixed width font so the only varying element is the actual texel value, which is unavoidable in the general case. The text is probably wider overall so I'll need to see what feedback I get. --- renderdocui/Windows/TextureViewer.Designer.cs | 2 ++ renderdocui/Windows/TextureViewer.cs | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/renderdocui/Windows/TextureViewer.Designer.cs b/renderdocui/Windows/TextureViewer.Designer.cs index 480e9168b..2ea7435e6 100644 --- a/renderdocui/Windows/TextureViewer.Designer.cs +++ b/renderdocui/Windows/TextureViewer.Designer.cs @@ -329,6 +329,7 @@ // // statusLabel // + this.statusLabel.Font = new System.Drawing.Font("Consolas", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.statusLabel.Name = "statusLabel"; this.statusLabel.Size = new System.Drawing.Size(63, 13); this.statusLabel.Text = "Status Text"; @@ -914,6 +915,7 @@ // // texStatusDim // + this.texStatusDim.Font = new System.Drawing.Font("Consolas", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.texStatusDim.Name = "texStatusDim"; this.texStatusDim.Size = new System.Drawing.Size(71, 13); this.texStatusDim.Text = "texStatusDim"; diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index c89942868..872337e07 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -1435,16 +1435,18 @@ namespace renderdocui.Windows int y = m_CurHoverPixel.Y >> (int)m_TexDisplay.mip; if (m_Core.APIProps.pipelineType == APIPipelineStateType.OpenGL) - y = (int)(tex.height-1) - y; + y = (int)(tex.height - 1) - y; if (m_TexDisplay.FlipY) - y = (int)(tex.height-1) - y; + y = (int)(tex.height - 1) - y; + + y = Math.Max(0, y); int x = m_CurHoverPixel.X >> (int)m_TexDisplay.mip; float invWidth = tex.width > 0 ? 1.0f / tex.width : 0.0f; float invHeight = tex.height > 0 ? 1.0f /tex.height : 0.0f; - string hoverCoords = String.Format("{0}, {1}, ({2}, {3})", - x, y, Formatter.Format(x * invWidth), Formatter.Format(y * invHeight)); + string hoverCoords = String.Format("{0,4}, {1,4} ({2:0.0000}, {3:0.0000})", + x, y, (x * invWidth), (y * invHeight)); string statusText = "Hover - " + hoverCoords; @@ -1453,12 +1455,16 @@ namespace renderdocui.Windows if (m_CurPixelValue != null) { + x = m_PickedPoint.X >> (int)m_TexDisplay.mip; y = m_PickedPoint.Y >> (int)m_TexDisplay.mip; + if (m_Core.APIProps.pipelineType == APIPipelineStateType.OpenGL) + y = (int)(tex.height - 1) - y; if (m_TexDisplay.FlipY) - y = (int)tex.height - y; + y = (int)(tex.height - 1) - y; - statusText += " - Right click - " + - (m_PickedPoint.X >> (int)m_TexDisplay.mip) + "," + y + ": "; + y = Math.Max(0, y); + + statusText += " - Right click - " + String.Format("{0,4}, {1,4}: ", x, y); PixelValue val = m_CurPixelValue;