mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Tweak cell header merging in buffer viewer to merge all columns
* There's some kind of flickering/lag that goes on when you horizontally scroll but it's minor and I can't figure out how to fix it for now.
This commit is contained in:
+3
@@ -652,6 +652,7 @@
|
||||
this.vsInBufferView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.bufferView_ColumnHeaderMouseClick);
|
||||
this.vsInBufferView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bufferView_Scroll);
|
||||
this.vsInBufferView.SelectionChanged += new System.EventHandler(this.bufferView_SelectionChanged);
|
||||
this.vsInBufferView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.bufferView_CellPaint);
|
||||
this.vsInBufferView.Paint += new System.Windows.Forms.PaintEventHandler(this.bufferView_Paint);
|
||||
this.vsInBufferView.Enter += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
this.vsInBufferView.Leave += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
@@ -699,6 +700,7 @@
|
||||
this.vsOutBufferView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.bufferView_ColumnHeaderMouseClick);
|
||||
this.vsOutBufferView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bufferView_Scroll);
|
||||
this.vsOutBufferView.SelectionChanged += new System.EventHandler(this.bufferView_SelectionChanged);
|
||||
this.vsOutBufferView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.bufferView_CellPaint);
|
||||
this.vsOutBufferView.Paint += new System.Windows.Forms.PaintEventHandler(this.bufferView_Paint);
|
||||
this.vsOutBufferView.Enter += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
this.vsOutBufferView.Leave += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
@@ -992,6 +994,7 @@
|
||||
this.gsOutBufferView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.bufferView_ColumnHeaderMouseClick);
|
||||
this.gsOutBufferView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bufferView_Scroll);
|
||||
this.gsOutBufferView.SelectionChanged += new System.EventHandler(this.bufferView_SelectionChanged);
|
||||
this.gsOutBufferView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.bufferView_CellPaint);
|
||||
this.gsOutBufferView.Paint += new System.Windows.Forms.PaintEventHandler(this.bufferView_Paint);
|
||||
this.gsOutBufferView.Enter += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
this.gsOutBufferView.Leave += new System.EventHandler(this.bufferView_EnterLeave);
|
||||
|
||||
@@ -1190,28 +1190,6 @@ namespace renderdocui.Windows
|
||||
|
||||
#region Setting Column Headers
|
||||
|
||||
private void UI_MergeColumns(DataGridView grid, int col, uint num, Graphics g)
|
||||
{
|
||||
for(int i=0; i < num; i++)
|
||||
{
|
||||
if (col + i >= grid.Columns.Count) break;
|
||||
|
||||
DataGridViewCell hc = grid.Columns[col + i].HeaderCell;
|
||||
Rectangle hcRct = grid.GetCellDisplayRectangle(hc.ColumnIndex, -1, true);
|
||||
|
||||
Rectangle left = new Rectangle(hcRct.Left, hcRct.Top + 2, 1, hcRct.Height - 4);
|
||||
Rectangle right = new Rectangle(hcRct.Left+hcRct.Width-1, hcRct.Top + 2, 1, hcRct.Height - 4);
|
||||
|
||||
using (var brush = new SolidBrush(grid.Columns[col + i].HeaderCell.Style.BackColor))
|
||||
{
|
||||
if (i != 0)
|
||||
g.FillRectangle(brush, left);
|
||||
if (i != num - 1)
|
||||
g.FillRectangle(brush, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UI_UpdateMeshColumns(MeshDataStage type, FormatElement[] el)
|
||||
{
|
||||
bool active = (type == m_MeshDisplay.type);
|
||||
@@ -2228,14 +2206,70 @@ namespace renderdocui.Windows
|
||||
|
||||
if (input == null) return;
|
||||
|
||||
uint i = 1;
|
||||
foreach (var el in input.BufferFormats)
|
||||
var grid = (DataGridView)sender;
|
||||
|
||||
int i = MeshView ? 2 : 1;
|
||||
|
||||
using (Graphics g = grid.CreateGraphics())
|
||||
{
|
||||
UI_MergeColumns((DataGridView)sender, (int)i, el.format.compCount, e.Graphics);
|
||||
i += el.format.compCount;
|
||||
foreach (var el in input.BufferFormats)
|
||||
{
|
||||
int baseCol = i;
|
||||
|
||||
i += (int)el.format.compCount;
|
||||
|
||||
Rectangle stringBounds = Rectangle.Empty;
|
||||
for (int f = baseCol; f < i; f++)
|
||||
{
|
||||
Rectangle r = grid.GetCellDisplayRectangle(f, -1, true);
|
||||
|
||||
if (r.Width > 0)
|
||||
{
|
||||
r.Width -= grid.Columns[f].DividerWidth;
|
||||
|
||||
if (stringBounds.Width == 0)
|
||||
stringBounds = r;
|
||||
else
|
||||
stringBounds = Rectangle.Union(stringBounds, r);
|
||||
}
|
||||
}
|
||||
|
||||
stringBounds.X += 1;
|
||||
stringBounds.Y += 2;
|
||||
stringBounds.Width -= 2;
|
||||
stringBounds.Height -= 3;
|
||||
|
||||
var sf = new StringFormat(StringFormat.GenericDefault);
|
||||
|
||||
sf.Trimming = StringTrimming.EllipsisCharacter;
|
||||
sf.FormatFlags |= StringFormatFlags.NoWrap;
|
||||
|
||||
using (Brush b = new SolidBrush(grid.ColumnHeadersDefaultCellStyle.BackColor))
|
||||
g.FillRectangle(b, stringBounds);
|
||||
using (Brush b = new SolidBrush(ForeColor))
|
||||
g.DrawString(el.name, grid.Font, b, stringBounds, sf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bufferView_CellPaint(object sender, DataGridViewCellPaintingEventArgs e)
|
||||
{
|
||||
// only paint the cell headers
|
||||
if (e.RowIndex != -1) return;
|
||||
|
||||
Input input = GetUIState(sender).m_Input;
|
||||
|
||||
if (input == null) return;
|
||||
|
||||
// display the initial columns as normal
|
||||
if (e.ColumnIndex < (MeshView ? 2 : 1))
|
||||
return;
|
||||
|
||||
// for others, just paint the border
|
||||
e.Paint(e.CellBounds, DataGridViewPaintParts.Border);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void render_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (m_Output == null || m_Core.Renderer == null)
|
||||
|
||||
Reference in New Issue
Block a user