InputRoll - code cleanup - make NormalFont readonly and remove redundant use of this.NormalFont
This commit is contained in:
parent
76db52966e
commit
b45f34dc3e
|
@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
Gdi.SetSolidPen(this.BackColor);
|
Gdi.SetSolidPen(this.BackColor);
|
||||||
Gdi.DrawRectangle(x1, y1, x2, y2);
|
Gdi.DrawRectangle(x1, y1, x2, y2);
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
Gdi.DrawString(_columnDown.Text, new Point(x1 + CellWidthPadding, y1 + CellHeightPadding));
|
Gdi.DrawString(_columnDown.Text, new Point(x1 + CellWidthPadding, y1 + CellHeightPadding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
Gdi.SetBrush(bgColor);
|
Gdi.SetBrush(bgColor);
|
||||||
Gdi.FillRectangle(x1, y1, x2 - x1, y2 - y1);
|
Gdi.FillRectangle(x1, y1, x2 - x1, y2 - y1);
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
Gdi.DrawString(text, new Point(x1 + CellWidthPadding + offsetX, y1 + CellHeightPadding + offsetY));
|
Gdi.DrawString(text, new Point(x1 + CellWidthPadding + offsetX, y1 + CellHeightPadding + offsetY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,9 +111,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
|
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
|
||||||
{
|
{
|
||||||
Gdi.PrepDrawString(this.NormalFont, SystemColors.HighlightText);
|
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
|
||||||
Gdi.DrawString(column.Text, point);
|
Gdi.DrawString(column.Text, point);
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//zeromus test
|
//zeromus test
|
||||||
//Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
//Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor);
|
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor);
|
||||||
|
|
||||||
foreach (var column in visibleColumns)
|
foreach (var column in visibleColumns)
|
||||||
|
@ -136,11 +136,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
|
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
|
||||||
{
|
{
|
||||||
//zeromus test
|
//zeromus test
|
||||||
//Gdi.PrepDrawString(this.NormalFont, SystemColors.HighlightText);
|
//Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
|
||||||
Gdi.PrepDrawString(this.RotatedFont, SystemColors.HighlightText);
|
Gdi.PrepDrawString(this.RotatedFont, SystemColors.HighlightText);
|
||||||
Gdi.DrawString(column.Text, point);
|
Gdi.DrawString(column.Text, point);
|
||||||
//zeromus test
|
//zeromus test
|
||||||
//Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
//Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor);
|
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int startRow = FirstVisibleRow;
|
int startRow = FirstVisibleRow;
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||||
|
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
for (int i = 0, f = 0; f < range; i++, f++)
|
for (int i = 0, f = 0; f < range; i++, f++)
|
||||||
{
|
{
|
||||||
f += lagFrames[i];
|
f += lagFrames[i];
|
||||||
|
@ -199,7 +199,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var rePrep = false;
|
var rePrep = false;
|
||||||
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
|
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
|
||||||
{
|
{
|
||||||
Gdi.PrepDrawString(this.NormalFont, SystemColors.HighlightText);
|
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
|
||||||
rePrep = true;
|
rePrep = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (rePrep)
|
if (rePrep)
|
||||||
{
|
{
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int startRow = FirstVisibleRow;
|
int startRow = FirstVisibleRow;
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||||
|
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
int xPadding = CellWidthPadding + 1 - HBar.Value;
|
int xPadding = CellWidthPadding + 1 - HBar.Value;
|
||||||
for (int i = 0, f = 0; f < range; i++, f++) // Vertical
|
for (int i = 0, f = 0; f < range; i++, f++) // Vertical
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
bool rePrep = false;
|
bool rePrep = false;
|
||||||
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = f + startRow }))
|
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = f + startRow }))
|
||||||
{
|
{
|
||||||
Gdi.PrepDrawString(this.NormalFont, SystemColors.HighlightText);
|
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
|
||||||
rePrep = true;
|
rePrep = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (rePrep)
|
if (rePrep)
|
||||||
{
|
{
|
||||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
Gdi.PrepDrawString(NormalFont, this.ForeColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//TODO - do not constantly reference this.ForeColor and this.NormalFont. it should be a waste of time. Cache them (and be sure to respond to system messages when the user settings change)
|
//TODO - do not constantly reference this.ForeColor, it should be a waste of time. Cache them (and be sure to respond to system messages when the user settings change)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public bool denoteMarkersWithBGColor { get; set; }
|
public bool denoteMarkersWithBGColor { get; set; }
|
||||||
|
|
||||||
private IntPtr RotatedFont;
|
private IntPtr RotatedFont;
|
||||||
private Font NormalFont;
|
private readonly Font NormalFont;
|
||||||
|
|
||||||
public InputRoll()
|
public InputRoll()
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
using (var g = CreateGraphics())
|
using (var g = CreateGraphics())
|
||||||
using (var LCK = Gdi.LockGraphics(g))
|
using (var LCK = Gdi.LockGraphics(g))
|
||||||
{
|
{
|
||||||
_charSize = Gdi.MeasureString("A", this.NormalFont); // TODO make this a property so changing it updates other values.
|
_charSize = Gdi.MeasureString("A", NormalFont); // TODO make this a property so changing it updates other values.
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCellSize();
|
UpdateCellSize();
|
||||||
|
@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
Gdi.Dispose();
|
Gdi.Dispose();
|
||||||
|
|
||||||
this.NormalFont.Dispose();
|
NormalFont.Dispose();
|
||||||
GDIRenderer.DestroyHFont(RotatedFont);
|
GDIRenderer.DestroyHFont(RotatedFont);
|
||||||
|
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
|
Loading…
Reference in New Issue