Update FrmMain.cs
Haven't got the knack of getting the edited source straight out of my visual studio IDE, so I'm just copying and pasting bits here. So I'm not really sure if it still compiles w/o errors.
This commit is contained in:
@@ -59,6 +59,13 @@ namespace ROMVault2
|
|||||||
_scaleFactorY *= factor.Height;
|
_scaleFactorY *= factor.Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns either white or black, depending of quick luminance of Color "a"
|
||||||
|
// probably should be pre-computed into a table, corresponding to _displayColor
|
||||||
|
private Color contrasty(Color a)
|
||||||
|
{
|
||||||
|
return (a.R << 1) + a.B + a.G + (a.G << 2) < 1024 ? Color.White : Color.Black;
|
||||||
|
}
|
||||||
|
|
||||||
public FrmMain()
|
public FrmMain()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -745,6 +752,7 @@ namespace ROMVault2
|
|||||||
RvDir tRvDir = (RvDir)GameGrid.Rows[e.RowIndex].Tag;
|
RvDir tRvDir = (RvDir)GameGrid.Rows[e.RowIndex].Tag;
|
||||||
ReportStatus tDirStat = tRvDir.DirStatus;
|
ReportStatus tDirStat = tRvDir.DirStatus;
|
||||||
Color bgCol = Color.FromArgb(255, 255, 255);
|
Color bgCol = Color.FromArgb(255, 255, 255);
|
||||||
|
Color fgCol = contrasty(bgCol);
|
||||||
|
|
||||||
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
||||||
return;
|
return;
|
||||||
@@ -754,13 +762,16 @@ namespace ROMVault2
|
|||||||
if (tDirStat.Get(t1) <= 0) continue;
|
if (tDirStat.Get(t1) <= 0) continue;
|
||||||
|
|
||||||
bgCol = _displayColor[(int)t1];
|
bgCol = _displayColor[(int)t1];
|
||||||
|
fgCol = contrasty(bgCol);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameGrid.Columns[e.ColumnIndex].Name == "Type")
|
if (GameGrid.Columns[e.ColumnIndex].Name == "Type")
|
||||||
{
|
{
|
||||||
|
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
e.CellStyle.SelectionBackColor = bgCol;
|
e.CellStyle.SelectionBackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = fgCol;
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height);
|
Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height);
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
Graphics g = Graphics.FromImage(bmp);
|
||||||
@@ -799,7 +810,8 @@ namespace ROMVault2
|
|||||||
else if (GameGrid.Columns[e.ColumnIndex].Name == "CGame")
|
else if (GameGrid.Columns[e.ColumnIndex].Name == "CGame")
|
||||||
{
|
{
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = contrasty(bgCol);
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(tRvDir.FileName))
|
if (String.IsNullOrEmpty(tRvDir.FileName))
|
||||||
e.Value = tRvDir.Name;
|
e.Value = tRvDir.Name;
|
||||||
else
|
else
|
||||||
@@ -808,7 +820,8 @@ namespace ROMVault2
|
|||||||
else if (GameGrid.Columns[e.ColumnIndex].Name == "CDescription")
|
else if (GameGrid.Columns[e.ColumnIndex].Name == "CDescription")
|
||||||
{
|
{
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = contrasty(bgCol);
|
||||||
|
|
||||||
if (tRvDir.Game != null)
|
if (tRvDir.Game != null)
|
||||||
e.Value = tRvDir.Game.GetData(RvGame.GameData.Description);
|
e.Value = tRvDir.Game.GetData(RvGame.GameData.Description);
|
||||||
}
|
}
|
||||||
@@ -1302,8 +1315,13 @@ namespace ROMVault2
|
|||||||
RomGrid.Rows[row].Tag = tRomTable;
|
RomGrid.Rows[row].Tag = tRomTable;
|
||||||
|
|
||||||
for (int i = 0; i < RomGrid.Rows[row].Cells.Count; i++)
|
for (int i = 0; i < RomGrid.Rows[row].Cells.Count; i++)
|
||||||
RomGrid.Rows[row].Cells[i].Style.BackColor = _displayColor[(int)tRomTable.RepStatus];
|
{
|
||||||
|
Color bc;
|
||||||
|
DataGridViewCellStyle cs = RomGrid.Rows[row].Cells[i].Style;
|
||||||
|
cs.BackColor = (bc = _displayColor[(int)tRomTable.RepStatus]);
|
||||||
|
cs.ForeColor = contrasty(bc);
|
||||||
|
}
|
||||||
|
|
||||||
string fname = pathAdd + tRomTable.Name;
|
string fname = pathAdd + tRomTable.Name;
|
||||||
if (!string.IsNullOrEmpty(tRomTable.FileName))
|
if (!string.IsNullOrEmpty(tRomTable.FileName))
|
||||||
fname += " (Found: " + tRomTable.FileName + ")";
|
fname += " (Found: " + tRomTable.FileName + ")";
|
||||||
|
|||||||
Reference in New Issue
Block a user