differentiate between RollColumn vertical width and horizontal height
don't really like this code too much, but it works. And the RollColumn has no idea what orientation it has, so it can't do the logic itself. see #3708
This commit is contained in:
parent
1e397432af
commit
6b012ef433
|
@ -142,33 +142,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_renderer.PrepDrawString(Font, _foreColor);
|
||||
|
||||
int h = ColumnHeight;
|
||||
int yOffset = HorizontalOrientation ? -_vBar.Value : 0;
|
||||
|
||||
for (int j = 0; j < visibleColumns.Count; j++)
|
||||
{
|
||||
var column = visibleColumns[j];
|
||||
var w = column.Width;
|
||||
int x, y;
|
||||
int x, y, w, h;
|
||||
|
||||
if (HorizontalOrientation)
|
||||
{
|
||||
var columnHeight = column.Width;
|
||||
var textSize = _renderer.MeasureString(column.Text, Font);
|
||||
x = MaxColumnWidth - CellWidthPadding - (int)textSize.Width;
|
||||
y = yOffset + ((columnHeight - (int)textSize.Height) / 2);
|
||||
yOffset += columnHeight;
|
||||
y = column.Left + ((column.Width - (int)textSize.Height) / 2) - _vBar.Value;
|
||||
w = MaxColumnWidth;
|
||||
h = column.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 1 + column.Left + CellWidthPadding - _hBar.Value;
|
||||
y = CellHeightPadding;
|
||||
w = column.Width;
|
||||
h = ColumnHeight;
|
||||
}
|
||||
|
||||
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
|
||||
{
|
||||
_renderer.PrepDrawString(Font, SystemColors.HighlightText);
|
||||
DrawString(column.Text, new Rectangle(x, y, column.Width, h));
|
||||
DrawString(column.Text, new Rectangle(x, y, w, h));
|
||||
_renderer.PrepDrawString(Font, _foreColor);
|
||||
}
|
||||
else
|
||||
|
@ -301,20 +299,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_renderer.FillRectangle(new Rectangle(0, 0, MaxColumnWidth + 1, rect.Height));
|
||||
|
||||
int y = -_vBar.Value;
|
||||
for (int j = 0; j < visibleColumns.Count; j++)
|
||||
{
|
||||
int y = visibleColumns[j].Left - _vBar.Value;
|
||||
_renderer.Line(1, y, MaxColumnWidth, y);
|
||||
y += visibleColumns[j].Width;
|
||||
}
|
||||
|
||||
if (visibleColumns.Count is not 0)
|
||||
{
|
||||
_renderer.Line(1, y, MaxColumnWidth, y);
|
||||
_renderer.Line(1, TotalColWidth, MaxColumnWidth, TotalColWidth);
|
||||
}
|
||||
|
||||
_renderer.Line(0, 0, 0, y);
|
||||
_renderer.Line(MaxColumnWidth, 0, MaxColumnWidth, y);
|
||||
_renderer.Line(0, 0, 0, rect.Height);
|
||||
_renderer.Line(MaxColumnWidth, 0, MaxColumnWidth, rect.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1645,7 +1645,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
RecalculateScrollBars();
|
||||
if (_columns.VisibleColumns.Any())
|
||||
{
|
||||
MaxColumnWidth = _columns.VisibleColumns.Max(c => c.Width);
|
||||
MaxColumnWidth = _columns.VisibleColumns.Max(c => c.VerticalWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1966,7 +1966,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (_columns.VisibleColumns.Any())
|
||||
{
|
||||
MaxColumnWidth = _columns.VisibleColumns.Max(c => c.Width);
|
||||
MaxColumnWidth = _columns.VisibleColumns.Max(c => c.VerticalWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public class RollColumn
|
||||
{
|
||||
public int VerticalWidth { get; }
|
||||
public int HorizontalHeight { get; }
|
||||
public int Width { get; set; }
|
||||
public int Left { get; set; }
|
||||
public int Right { get; set; }
|
||||
|
@ -36,11 +38,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
public RollColumn(string name, int widthUnscaled, ColumnType type, string text)
|
||||
: this(name, widthUnscaled, widthUnscaled, type, text) { }
|
||||
|
||||
public RollColumn(string name, int verticalWidth, int horizontalHeight, ColumnType type, string text)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Type = type;
|
||||
Width = UIHelper.ScaleX(widthUnscaled);
|
||||
VerticalWidth = UIHelper.ScaleX(verticalWidth);
|
||||
HorizontalHeight = UIHelper.ScaleX(horizontalHeight);
|
||||
Width = VerticalWidth;
|
||||
}
|
||||
|
||||
public RollColumn(string name, int widthUnscaled, string text)
|
||||
|
|
|
@ -347,7 +347,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
TasView.AllColumns.Add(new(
|
||||
name: name,
|
||||
widthUnscaled: (maxLength * 6) + 14, // magic numbers reused in EditBranchTextPopUp() --feos // not since eb63fa5a9 (before 2.3.3) --yoshi
|
||||
verticalWidth: (Math.Max(maxLength, mnemonic.Length) * 6) + 14,
|
||||
horizontalHeight: (maxLength * 6) + 14,
|
||||
type: type,
|
||||
text: mnemonic)
|
||||
{
|
||||
|
@ -1233,7 +1234,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (axisSpec.HasValue)
|
||||
{
|
||||
string mnemonic = Bk2MnemonicLookup.LookupAxis(name, MovieSession.Movie.SystemID);
|
||||
yield return (name, mnemonic, Math.Max(mnemonic.Length, axisSpec.Value.MaxDigits));
|
||||
yield return (name, mnemonic, axisSpec.Value.MaxDigits);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1250,12 +1251,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
BranchesMarkersSplit.Orientation = Orientation.Vertical;
|
||||
BranchesMarkersSplit.SplitterDistance = 200;
|
||||
foreach (var rollColumn in TasView.AllColumns)
|
||||
{
|
||||
rollColumn.Width = rollColumn.HorizontalHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BranchesMarkersSplit.Orientation = Orientation.Horizontal;
|
||||
BranchesMarkersSplit.SplitterDistance = _defaultBranchMarkerSplitDistance;
|
||||
foreach (var rollColumn in TasView.AllColumns)
|
||||
{
|
||||
rollColumn.Width = rollColumn.VerticalWidth;
|
||||
}
|
||||
}
|
||||
|
||||
TasView.AllColumns.ColumnsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue