InputRoll - turn some public properties into private variables

This commit is contained in:
adelikat 2019-11-26 15:37:17 -06:00
parent 24a0bdbbed
commit e1f2147e65
2 changed files with 23 additions and 28 deletions

View File

@ -348,7 +348,7 @@ namespace BizHawk.Client.EmuHawk
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
_renderer.FillRectangle(0, 0, ColumnWidth + 1, DrawHeight + 1); _renderer.FillRectangle(0, 0, ColumnWidth + 1, _drawHeight + 1);
int y = -_vBar.Value; int y = -_vBar.Value;
for (int j = 0; j < visibleColumns.Count; j++) for (int j = 0; j < visibleColumns.Count; j++)
@ -473,14 +473,14 @@ namespace BizHawk.Client.EmuHawk
for (int i = 1; i < VisibleRows + 1; i++) for (int i = 1; i < VisibleRows + 1; i++)
{ {
int x = RowsToPixels(i); int x = RowsToPixels(i);
_renderer.Line(x, 1, x, DrawHeight); _renderer.Line(x, 1, x, _drawHeight);
} }
// Rows // Rows
for (int i = 0; i < visibleColumns.Count + 1; i++) for (int i = 0; i < visibleColumns.Count + 1; i++)
{ {
int y = GetHColTop(i) - _vBar.Value; int y = GetHColTop(i) - _vBar.Value;
_renderer.Line(RowsToPixels(0) + 1, y, DrawWidth, y); _renderer.Line(RowsToPixels(0) + 1, y, _drawWidth, y);
} }
} }
else else
@ -593,7 +593,7 @@ namespace BizHawk.Client.EmuHawk
} }
// Don't draw if off screen. // Don't draw if off screen.
if (x > DrawWidth || y > DrawHeight) if (x > _drawWidth || y > _drawHeight)
{ {
return; return;
} }

View File

@ -46,6 +46,9 @@ namespace BizHawk.Client.EmuHawk
private int? _currentX; private int? _currentX;
private int? _currentY; private int? _currentY;
private int _drawHeight;
private int _drawWidth;
// Hiding lag frames (Mainly intended for < 60fps play.) // Hiding lag frames (Mainly intended for < 60fps play.)
[Browsable(false)] [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@ -583,14 +586,6 @@ namespace BizHawk.Client.EmuHawk
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPaintDown { get; private set; } public bool IsPaintDown { get; private set; }
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int DrawHeight { get; private set; }
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int DrawWidth { get; private set; }
/// <summary> /// <summary>
/// Gets or sets the width of data cells when in Horizontal orientation. /// Gets or sets the width of data cells when in Horizontal orientation.
/// </summary> /// </summary>
@ -712,7 +707,7 @@ namespace BizHawk.Client.EmuHawk
get get
{ {
int halfRow = 0; int halfRow = 0;
if ((DrawHeight - ColumnHeight - 3) % CellHeight < CellHeight / 2) if ((_drawHeight - ColumnHeight - 3) % CellHeight < CellHeight / 2)
{ {
halfRow = 1; halfRow = 1;
} }
@ -729,7 +724,7 @@ namespace BizHawk.Client.EmuHawk
set set
{ {
int halfRow = 0; int halfRow = 0;
if ((DrawHeight - ColumnHeight - 3) % CellHeight < CellHeight / 2) if ((_drawHeight - ColumnHeight - 3) % CellHeight < CellHeight / 2)
{ {
halfRow = 1; halfRow = 1;
} }
@ -790,10 +785,10 @@ namespace BizHawk.Client.EmuHawk
{ {
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
return (DrawWidth - ColumnWidth) / CellWidth; return (_drawWidth - ColumnWidth) / CellWidth;
} }
return (DrawHeight - ColumnHeight - 3) / CellHeight; // Minus three makes it work return (_drawHeight - ColumnHeight - 3) / CellHeight; // Minus three makes it work
} }
} }
@ -828,10 +823,10 @@ namespace BizHawk.Client.EmuHawk
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
int count = columnList.Count; int count = columnList.Count;
return Enumerable.Range(0, count).Select(i => count - 1 - i).First(i => GetHColTop(i) <= DrawWidth + _hBar.Value); return Enumerable.Range(0, count).Select(i => count - 1 - i).First(i => GetHColTop(i) <= _drawWidth + _hBar.Value);
} }
return columnList.FindLastIndex(c => c.Left <= DrawWidth + _hBar.Value); return columnList.FindLastIndex(c => c.Left <= _drawWidth + _hBar.Value);
} }
} }
@ -1605,13 +1600,13 @@ namespace BizHawk.Client.EmuHawk
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
NeedsVScrollbar = GetHColBottom(iLastColumn) > DrawHeight; NeedsVScrollbar = GetHColBottom(iLastColumn) > _drawHeight;
NeedsHScrollbar = RowCount > 1; NeedsHScrollbar = RowCount > 1;
} }
else else
{ {
NeedsVScrollbar = ColumnHeight + (RowCount * RowHeight) > Height; NeedsVScrollbar = ColumnHeight + (RowCount * RowHeight) > Height;
NeedsHScrollbar = TotalColWidth.HasValue && TotalColWidth.Value - DrawWidth + 1 > 0; NeedsHScrollbar = TotalColWidth.HasValue && TotalColWidth.Value - _drawWidth + 1 > 0;
} }
UpdateDrawSize(); UpdateDrawSize();
@ -1621,7 +1616,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_hBar.Maximum = Math.Max((VisibleRows - 1) * CellWidth, _hBar.Maximum); _hBar.Maximum = Math.Max((VisibleRows - 1) * CellWidth, _hBar.Maximum);
_hBar.LargeChange = (VisibleRows - 1) * CellWidth; _hBar.LargeChange = (VisibleRows - 1) * CellWidth;
_vBar.LargeChange = Math.Max(0, DrawHeight / 2); _vBar.LargeChange = Math.Max(0, _drawHeight / 2);
} }
else else
{ {
@ -1629,7 +1624,7 @@ namespace BizHawk.Client.EmuHawk
_vBar.LargeChange = (VisibleRows - 1) * CellHeight; _vBar.LargeChange = (VisibleRows - 1) * CellHeight;
// DrawWidth can be negative if the TAStudio window is small enough // DrawWidth can be negative if the TAStudio window is small enough
// Clamp LargeChange to 0 here to prevent exceptions // Clamp LargeChange to 0 here to prevent exceptions
_hBar.LargeChange = Math.Max(0, DrawWidth / 2); _hBar.LargeChange = Math.Max(0, _drawWidth / 2);
} }
} }
@ -1638,7 +1633,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
_vBar.Maximum = GetHColBottom(iLastColumn) - DrawHeight + _vBar.LargeChange; _vBar.Maximum = GetHColBottom(iLastColumn) - _drawHeight + _vBar.LargeChange;
if (_vBar.Maximum < 0) if (_vBar.Maximum < 0)
{ {
_vBar.Maximum = 0; _vBar.Maximum = 0;
@ -1672,7 +1667,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
_hBar.Maximum = TotalColWidth.Value - DrawWidth + _hBar.LargeChange; _hBar.Maximum = TotalColWidth.Value - _drawWidth + _hBar.LargeChange;
} }
_hBar.Location = new Point(0, Height - _hBar.Height); _hBar.Location = new Point(0, Height - _hBar.Height);
@ -1690,19 +1685,19 @@ namespace BizHawk.Client.EmuHawk
{ {
if (NeedsVScrollbar) if (NeedsVScrollbar)
{ {
DrawWidth = Width - _vBar.Width; _drawWidth = Width - _vBar.Width;
} }
else else
{ {
DrawWidth = Width; _drawWidth = Width;
} }
if (NeedsHScrollbar) if (NeedsHScrollbar)
{ {
DrawHeight = Height - _hBar.Height; _drawHeight = Height - _hBar.Height;
} }
else else
{ {
DrawHeight = Height; _drawHeight = Height;
} }
} }