InputRoll - remove a todo

This commit is contained in:
adelikat 2015-09-05 14:33:34 -04:00
parent b45f34dc3e
commit 747c0fddda
2 changed files with 21 additions and 18 deletions

View File

@ -59,9 +59,9 @@ namespace BizHawk.Client.EmuHawk
int x2 = x1 + _columnDown.Width.Value; int x2 = x1 + _columnDown.Width.Value;
int y2 = y1 + CellHeight; int y2 = y1 + CellHeight;
Gdi.SetSolidPen(this.BackColor); Gdi.SetSolidPen(_backColor);
Gdi.DrawRectangle(x1, y1, x2, y2); Gdi.DrawRectangle(x1, y1, x2, y2);
Gdi.PrepDrawString(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.DrawString(_columnDown.Text, new Point(x1 + CellWidthPadding, y1 + CellHeightPadding)); Gdi.DrawString(_columnDown.Text, new Point(x1 + CellWidthPadding, y1 + CellHeightPadding));
} }
} }
@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
QueryItemText(DraggingCell.RowIndex.Value, DraggingCell.Column, out text, ref offsetX, ref offsetY); QueryItemText(DraggingCell.RowIndex.Value, DraggingCell.Column, out text, ref offsetX, ref offsetY);
} }
Color bgColor = this.BackColor; Color bgColor = _backColor;
if (QueryItemBkColor != null) if (QueryItemBkColor != null)
{ {
QueryItemBkColor(DraggingCell.RowIndex.Value, DraggingCell.Column, ref bgColor); QueryItemBkColor(DraggingCell.RowIndex.Value, DraggingCell.Column, ref bgColor);
@ -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(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.DrawString(text, new Point(x1 + CellWidthPadding + offsetX, y1 + CellHeightPadding + offsetY)); Gdi.DrawString(text, new Point(x1 + CellWidthPadding + offsetX, y1 + CellHeightPadding + offsetY));
} }
} }
@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
{ {
int start = -VBar.Value; int start = -VBar.Value;
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor); Gdi.PrepDrawString(RotatedFont, _foreColor);
foreach (var column in visibleColumns) foreach (var column in visibleColumns)
{ {
@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
{ {
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText); Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.DrawString(column.Text, point); Gdi.DrawString(column.Text, point);
Gdi.PrepDrawString(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _foreColor);
} }
else else
{ {
@ -126,8 +126,8 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
//zeromus test //zeromus test
//Gdi.PrepDrawString(NormalFont, this.ForeColor); //Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor); Gdi.PrepDrawString(RotatedFont, _foreColor);
foreach (var column in visibleColumns) foreach (var column in visibleColumns)
{ {
@ -137,11 +137,11 @@ namespace BizHawk.Client.EmuHawk
{ {
//zeromus test //zeromus test
//Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText); //Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.PrepDrawString(this.RotatedFont, SystemColors.HighlightText); Gdi.PrepDrawString(RotatedFont, SystemColors.HighlightText);
Gdi.DrawString(column.Text, point); Gdi.DrawString(column.Text, point);
//zeromus test //zeromus test
//Gdi.PrepDrawString(NormalFont, this.ForeColor); //Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.PrepDrawString(this.RotatedFont, this.ForeColor); Gdi.PrepDrawString(RotatedFont, _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(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _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];
@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk
if (rePrep) if (rePrep)
{ {
Gdi.PrepDrawString(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _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(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _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
{ {
@ -267,7 +267,7 @@ namespace BizHawk.Client.EmuHawk
if (rePrep) if (rePrep)
{ {
Gdi.PrepDrawString(NormalFont, this.ForeColor); Gdi.PrepDrawString(NormalFont, _foreColor);
} }
} }
} }

View File

@ -1,6 +1,4 @@
//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;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
@ -48,6 +46,8 @@ namespace BizHawk.Client.EmuHawk
private IntPtr RotatedFont; private IntPtr RotatedFont;
private readonly Font NormalFont; private readonly Font NormalFont;
private Color _foreColor;
private Color _backColor;
public InputRoll() public InputRoll()
{ {
@ -111,6 +111,9 @@ namespace BizHawk.Client.EmuHawk
_hoverTimer.Interval = 750; _hoverTimer.Interval = 750;
_hoverTimer.Tick += HoverTimerEventProcessor; _hoverTimer.Tick += HoverTimerEventProcessor;
_hoverTimer.Stop(); _hoverTimer.Stop();
_foreColor = ForeColor;
_backColor = BackColor;
} }
private void HoverTimerEventProcessor(object sender, EventArgs e) private void HoverTimerEventProcessor(object sender, EventArgs e)