InputRoll - more shenanigans

This commit is contained in:
adelikat 2015-09-05 15:09:55 -04:00
parent 747c0fddda
commit e9d7c7c88c
2 changed files with 17 additions and 16 deletions

View File

@ -399,7 +399,7 @@ namespace BizHawk.Client.EmuHawk
private void DrawBg(PaintEventArgs e, List<RollColumn> visibleColumns) private void DrawBg(PaintEventArgs e, List<RollColumn> visibleColumns)
{ {
if (UseCustomBackground && QueryItemBkColor != null) if (UseCustomBackground && QueryItemBkColor != null)
DoBackGroundCallback(e); DoBackGroundCallback(e, visibleColumns);
if (GridLines) if (GridLines)
{ {
@ -444,11 +444,11 @@ namespace BizHawk.Client.EmuHawk
if (SelectedItems.Any()) if (SelectedItems.Any())
{ {
DoSelectionBG(e); DoSelectionBG(e, visibleColumns);
} }
} }
private void DoSelectionBG(PaintEventArgs e) private void DoSelectionBG(PaintEventArgs e, List<RollColumn> visibleColumns)
{ {
// SuuperW: This allows user to see other colors in selected frames. // SuuperW: This allows user to see other colors in selected frames.
Color rowColor = Color.White; Color rowColor = Color.White;
@ -486,24 +486,22 @@ namespace BizHawk.Client.EmuHawk
cellColor = Color.FromArgb(cellColor.R - (int)((cellColor.R - SystemColors.Highlight.R) * alpha), cellColor = Color.FromArgb(cellColor.R - (int)((cellColor.R - SystemColors.Highlight.R) * alpha),
cellColor.G - (int)((cellColor.G - SystemColors.Highlight.G) * alpha), cellColor.G - (int)((cellColor.G - SystemColors.Highlight.G) * alpha),
cellColor.B - (int)((cellColor.B - SystemColors.Highlight.B) * alpha)); cellColor.B - (int)((cellColor.B - SystemColors.Highlight.B) * alpha));
DrawCellBG(cellColor, relativeCell); DrawCellBG(cellColor, relativeCell, visibleColumns);
} }
} }
/// <summary> /// <summary>
/// Given a cell with rowindex inbetween 0 and VisibleRows, it draws the background color specified. Do not call with absolute rowindices. /// Given a cell with rowindex inbetween 0 and VisibleRows, it draws the background color specified. Do not call with absolute rowindices.
/// </summary> /// </summary>
private void DrawCellBG(Color color, Cell cell) private void DrawCellBG(Color color, Cell cell, List<RollColumn> visibleColumns)
{ {
var columns = _columns.VisibleColumns.ToList();
int x, y, w, h; int x, y, w, h;
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
x = RowsToPixels(cell.RowIndex.Value) + 1; x = RowsToPixels(cell.RowIndex.Value) + 1;
w = CellWidth - 1; w = CellWidth - 1;
y = (CellHeight * columns.IndexOf(cell.Column)) + 1 - VBar.Value; // We can't draw without row and column, so assume they exist and fail catastrophically if they don't y = (CellHeight * visibleColumns.IndexOf(cell.Column)) + 1 - VBar.Value; // We can't draw without row and column, so assume they exist and fail catastrophically if they don't
h = CellHeight - 1; h = CellHeight - 1;
if (x < ColumnWidth) { return; } if (x < ColumnWidth) { return; }
} }
@ -532,9 +530,8 @@ namespace BizHawk.Client.EmuHawk
/// Calls QueryItemBkColor callback for all visible cells and fills in the background of those cells. /// Calls QueryItemBkColor callback for all visible cells and fills in the background of those cells.
/// </summary> /// </summary>
/// <param name="e"></param> /// <param name="e"></param>
private void DoBackGroundCallback(PaintEventArgs e) private void DoBackGroundCallback(PaintEventArgs e, List<RollColumn> visibleColumns)
{ {
List<RollColumn> columns = _columns.VisibleColumns.ToList();
int startIndex = FirstVisibleRow; int startIndex = FirstVisibleRow;
int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1; int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1;
int lastVisible = LastVisibleColumnIndex; int lastVisible = LastVisibleColumnIndex;
@ -554,7 +551,7 @@ namespace BizHawk.Client.EmuHawk
for (int j = FirstVisibleColumn; j <= lastVisible; j++) for (int j = FirstVisibleColumn; j <= lastVisible; j++)
{ {
Color itemColor = Color.White; Color itemColor = Color.White;
QueryItemBkColor(f + startIndex, columns[j], ref itemColor); QueryItemBkColor(f + startIndex, visibleColumns[j], ref itemColor);
if (itemColor == Color.White) if (itemColor == Color.White)
{ {
itemColor = rowColor; itemColor = rowColor;
@ -572,10 +569,10 @@ namespace BizHawk.Client.EmuHawk
{ {
var cell = new Cell var cell = new Cell
{ {
Column = columns[j], Column = visibleColumns[j],
RowIndex = i RowIndex = i
}; };
DrawCellBG(itemColor, cell); DrawCellBG(itemColor, cell, visibleColumns);
} }
} }
} }
@ -595,7 +592,7 @@ namespace BizHawk.Client.EmuHawk
for (int j = FirstVisibleColumn; j <= lastVisible; j++) // Horizontal for (int j = FirstVisibleColumn; j <= lastVisible; j++) // Horizontal
{ {
Color itemColor = Color.White; Color itemColor = Color.White;
QueryItemBkColor(f + startIndex, columns[j], ref itemColor); QueryItemBkColor(f + startIndex, visibleColumns[j], ref itemColor);
if (itemColor == Color.White) if (itemColor == Color.White)
{ {
itemColor = rowColor; itemColor = rowColor;
@ -612,10 +609,10 @@ namespace BizHawk.Client.EmuHawk
{ {
var cell = new Cell var cell = new Cell
{ {
Column = columns[j], Column = visibleColumns[j],
RowIndex = i RowIndex = i
}; };
DrawCellBG(itemColor, cell); DrawCellBG(itemColor, cell, visibleColumns);
} }
} }
} }

View File

@ -1847,9 +1847,13 @@ namespace BizHawk.Client.EmuHawk
} }
} }
else else
{
for (int i = 0; i <= VisibleRows; i++) for (int i = 0; i <= VisibleRows; i++)
{
lagFrames[i] = 0; lagFrames[i] = 0;
} }
}
}
private void SetLagFramesFirst() private void SetLagFramesFirst()
{ {
if (QueryFrameLag != null && LagFramesToHide != 0) if (QueryFrameLag != null && LagFramesToHide != 0)