diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs index 88a3a61571..78aa92f7aa 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs @@ -95,9 +95,9 @@ namespace BizHawk.Client.EmuHawk private void DrawColumnDrag(List visibleColumns) { - if (_columnDown?.Width != null && _columnDownMoved && _currentX.HasValue && _currentY.HasValue && IsHoveringOnColumnCell) + if (_columnDown?.Width > 0 && _columnDownMoved && _currentX.HasValue && _currentY.HasValue && IsHoveringOnColumnCell) { - int columnWidth = _columnDown.Width.Value; + int columnWidth = _columnDown.Width; int columnHeight = CellHeight; if (HorizontalOrientation) { @@ -124,8 +124,10 @@ namespace BizHawk.Client.EmuHawk private void DrawCellDrag(List visibleColumns) { - if (_draggingCell != null && _draggingCell.RowIndex.HasValue && _draggingCell.Column.Width.HasValue - && _currentX.HasValue && _currentY.HasValue) + if (_draggingCell?.RowIndex != null + && _draggingCell.Column.Width > 0 + && _currentX.HasValue + && _currentY.HasValue) { var text = ""; int offsetX = 0; @@ -141,9 +143,9 @@ namespace BizHawk.Client.EmuHawk int columnIndex = visibleColumns.IndexOf(_draggingCell.Column); columnHeight = GetHColHeight(columnIndex); } - int x1 = _currentX.Value - (_draggingCell.Column.Width.Value / 2); + int x1 = _currentX.Value - (_draggingCell.Column.Width / 2); int y1 = _currentY.Value - (columnHeight / 2); - int x2 = x1 + _draggingCell.Column.Width.Value; + int x2 = x1 + _draggingCell.Column.Width; int y2 = y1 + columnHeight; _renderer.SetBrush(bgColor); @@ -171,12 +173,12 @@ namespace BizHawk.Client.EmuHawk if (IsHoveringOnColumnCell && column == CurrentCell.Column) { _renderer.PrepDrawString(Font, SystemColors.HighlightText); - DrawString(column.Text, column.Width ?? 0, strX, strY); + DrawString(column.Text, column.Width, strX, strY); _renderer.PrepDrawString(Font, _foreColor); } else { - DrawString(column.Text, column.Width ?? 0, strX, strY); + DrawString(column.Text, column.Width, strX, strY); } y += columnHeight; @@ -195,12 +197,12 @@ namespace BizHawk.Client.EmuHawk if (IsHoveringOnColumnCell && column == CurrentCell.Column) { _renderer.PrepDrawString(Font, SystemColors.HighlightText); - DrawString(column.Text, column.Width ?? 0, x, y); + DrawString(column.Text, column.Width, x, y); _renderer.PrepDrawString(Font, _foreColor); } else { - DrawString(column.Text, column.Width ?? 0, x, y); + DrawString(column.Text, column.Width, x, y); } } } @@ -316,7 +318,7 @@ namespace BizHawk.Client.EmuHawk rePrep = true; } - DrawString(text, col.Width ?? 0, point.X + strOffsetX, point.Y + strOffsetY); + DrawString(text, col.Width, point.X + strOffsetX, point.Y + strOffsetY); if (rePrep) { @@ -387,7 +389,7 @@ namespace BizHawk.Client.EmuHawk } else { - _renderer.FillRectangle(new Rectangle(column.Left.Value + 1 - _hBar.Value, 1, column.Width.Value - 1, ColumnHeight - 1)); + _renderer.FillRectangle(new Rectangle(column.Left.Value + 1 - _hBar.Value, 1, column.Width - 1, ColumnHeight - 1)); } } @@ -575,7 +577,7 @@ namespace BizHawk.Client.EmuHawk } x = cell.Column.Left.Value - _hBar.Value + 1; - w = cell.Column.Width.Value - 1; + w = cell.Column.Width - 1; h = CellHeight - 1; } diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 794bc474b0..1a15eebc10 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -981,7 +981,7 @@ namespace BizHawk.Client.EmuHawk { if (_currentX != _previousX) { - _columnResizing.Width += _currentX - _previousX; + _columnResizing.Width += _currentX.Value - _previousX; if (_columnResizing.Width <= 0) { _columnResizing.Width = 1; @@ -1597,7 +1597,7 @@ namespace BizHawk.Client.EmuHawk RecalculateScrollBars(); if (_columns.VisibleColumns.Any()) { - ColumnWidth = _columns.VisibleColumns.Max(c => c.Width.Value) + CellWidthPadding * 4; + ColumnWidth = _columns.VisibleColumns.Max(c => c.Width) + CellWidthPadding * 4; } } diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs index b9d358a8cf..0f1f321fa6 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs @@ -3,7 +3,7 @@ public class RollColumn { public string Group { get; set; } - public int? Width { get; set; } + public int Width { get; set; } public int? Left { get; set; } public int? Right { get; set; } public string Name { get; set; } diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumns.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumns.cs index 96ee91ea59..af4228aed6 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumns.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumns.cs @@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk foreach (var col in VisibleColumns) { col.Left = pos; - pos += col.Width ?? 0; + pos += col.Width; col.Right = pos; }