Work on InputRoll horizontal mode a bit.
This commit is contained in:
parent
9471f7ca03
commit
90724bb777
|
@ -170,45 +170,72 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||||
|
|
||||||
_renderer.PrepDrawString(_font, _foreColor);
|
_renderer.PrepDrawString(_font, _foreColor);
|
||||||
for (int i = 0, f = 0; f < range; i++, f++)
|
|
||||||
{
|
|
||||||
f += _lagFrames[i];
|
|
||||||
int lastVisible = LastVisibleColumnIndex;
|
int lastVisible = LastVisibleColumnIndex;
|
||||||
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
||||||
{
|
{
|
||||||
|
RollColumn col = visibleColumns[j];
|
||||||
|
|
||||||
|
// Just a proof of concept to test auto-calculating the column height in horizontal
|
||||||
|
// mode. This would of course need to happen before any drawing because it's also
|
||||||
|
// needed for the column headers and background.
|
||||||
|
int debugColHeight = CellHeight;
|
||||||
|
if (col.Rotatable && col.RotatedHeight != null)
|
||||||
|
{
|
||||||
|
debugColHeight = Math.Max(debugColHeight, col.RotatedHeight.Value);
|
||||||
|
}
|
||||||
|
else if (col.Rotatable)
|
||||||
|
{
|
||||||
|
string text;
|
||||||
|
int strOffsetX = 0;
|
||||||
|
int strOffsetY = 0;
|
||||||
|
QueryItemText(startRow, col, out text, ref strOffsetX, ref strOffsetY);
|
||||||
|
int textWidth = _renderer.MeasureString(text, _font).Width;
|
||||||
|
debugColHeight = Math.Max(debugColHeight, strOffsetX + textWidth + (CellWidthPadding * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0, f = 0; f < range; i++, f++)
|
||||||
|
{
|
||||||
|
f += _lagFrames[i];
|
||||||
|
|
||||||
Bitmap image = null;
|
Bitmap image = null;
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int bitmapOffsetX = 0;
|
int bitmapOffsetX = 0;
|
||||||
int bitmapOffsetY = 0;
|
int bitmapOffsetY = 0;
|
||||||
|
|
||||||
QueryItemIcon?.Invoke(f + startRow, visibleColumns[j], ref image, ref bitmapOffsetX, ref bitmapOffsetY);
|
QueryItemIcon?.Invoke(f + startRow, col, ref image, ref bitmapOffsetX, ref bitmapOffsetY);
|
||||||
|
|
||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
|
int x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
|
||||||
y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
|
int y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
|
||||||
_renderer.DrawBitmap(image, new Point(x, y));
|
_renderer.DrawBitmap(image, new Point(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
string text;
|
string text;
|
||||||
int strOffsetX = 0;
|
int strOffsetX = 0;
|
||||||
int strOffsetY = 0;
|
int strOffsetY = 0;
|
||||||
QueryItemText(f + startRow, visibleColumns[j], out text, ref strOffsetX, ref strOffsetY);
|
QueryItemText(f + startRow, col, out text, ref strOffsetX, ref strOffsetY);
|
||||||
|
|
||||||
// Center Text
|
int baseX = RowsToPixels(i) + (col.Rotatable ? CellWidth : 0);
|
||||||
x = RowsToPixels(i) + ((CellWidth - (text.Length * _charSize.Width)) / 2);
|
int baseY = j * CellHeight - _vBar.Value;
|
||||||
y = (j * CellHeight) + CellHeightPadding - _vBar.Value;
|
int textWidth = text.Length * _charSize.Width;
|
||||||
var point = new Point(x + strOffsetX, y + strOffsetY);
|
if (col.Rotatable)
|
||||||
|
|
||||||
if (visibleColumns[j].Name == "FrameColumn") // TODO: don't do this hack
|
|
||||||
{
|
{
|
||||||
|
// Center Text
|
||||||
|
int textX = Math.Max(((CellHeight - textWidth) / 2), CellWidthPadding) + strOffsetX;
|
||||||
|
int textY = CellWidthPadding + strOffsetY;
|
||||||
|
var point = new Point(baseX - textY, baseY + textX);
|
||||||
|
|
||||||
_renderer.PrepDrawString(_font, _foreColor, rotate: true);
|
_renderer.PrepDrawString(_font, _foreColor, rotate: true);
|
||||||
DrawString(text, ColumnWidth, new Point(point.X + _charSize.Height + CellWidthPadding, point.Y + CellHeightPadding));
|
DrawString(text, null /* TODO */, point);
|
||||||
_renderer.PrepDrawString(_font, _foreColor, rotate: false);
|
_renderer.PrepDrawString(_font, _foreColor, rotate: false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Center Text
|
||||||
|
int textX = Math.Max(((CellWidth - textWidth) / 2), CellWidthPadding) + strOffsetX;
|
||||||
|
int textY = CellHeightPadding + strOffsetY;
|
||||||
|
var point = new Point(baseX + textX, baseY + textY);
|
||||||
|
|
||||||
DrawString(text, ColumnWidth, point);
|
DrawString(text, ColumnWidth, point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
// do marker drag here
|
// do marker drag here
|
||||||
}
|
}
|
||||||
else if (ModifierKeys == Keys.Shift && (CurrentCell.Column.Name == "FrameColumn" || CurrentCell.Column.Type == ColumnType.Text))
|
else if (ModifierKeys == Keys.Shift && CurrentCell.Column.Type == ColumnType.Text)
|
||||||
{
|
{
|
||||||
if (_selectedItems.Any())
|
if (_selectedItems.Any())
|
||||||
{
|
{
|
||||||
|
@ -1235,7 +1235,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
SelectCell(CurrentCell);
|
SelectCell(CurrentCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ModifierKeys == Keys.Control && (CurrentCell.Column.Name == "FrameColumn" || CurrentCell.Column.Type == ColumnType.Text))
|
else if (ModifierKeys == Keys.Control && CurrentCell.Column.Type == ColumnType.Text)
|
||||||
{
|
{
|
||||||
SelectCell(CurrentCell, toggle: true);
|
SelectCell(CurrentCell, toggle: true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace BizHawk.Client.EmuHawk
|
using System;
|
||||||
|
|
||||||
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public class RollColumn
|
public class RollColumn
|
||||||
{
|
{
|
||||||
|
@ -15,5 +17,15 @@
|
||||||
/// Column will be drawn with an emphasized look, if true
|
/// Column will be drawn with an emphasized look, if true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Emphasis { get; set; }
|
public bool Emphasis { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Column header text will be drawn rotated, if true
|
||||||
|
/// </summary>
|
||||||
|
public bool Rotatable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If drawn rotated, specifies the desired height, or null to auto-size
|
||||||
|
/// </summary>
|
||||||
|
public int? RotatedHeight { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,8 +318,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (columnName == FrameColumnName)
|
else if (columnName == FrameColumnName)
|
||||||
|
{
|
||||||
|
if (!TasView.HorizontalOrientation)
|
||||||
{
|
{
|
||||||
offsetX = 7;
|
offsetX = 7;
|
||||||
|
}
|
||||||
text = index.ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0');
|
text = index.ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -395,7 +395,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
TasView.AllColumns.Clear();
|
TasView.AllColumns.Clear();
|
||||||
AddColumn(CursorColumnName, "", 18);
|
AddColumn(CursorColumnName, "", 18);
|
||||||
AddColumn(FrameColumnName, "Frame#", 68);
|
AddColumn(
|
||||||
|
new RollColumn
|
||||||
|
{
|
||||||
|
Name = FrameColumnName,
|
||||||
|
Text = "Frame#",
|
||||||
|
Width = 68,
|
||||||
|
Type = ColumnType.Text,
|
||||||
|
Rotatable = true
|
||||||
|
});
|
||||||
|
|
||||||
var columnNames = GenerateColumnNames();
|
var columnNames = GenerateColumnNames();
|
||||||
foreach (var kvp in columnNames)
|
foreach (var kvp in columnNames)
|
||||||
|
@ -480,18 +488,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void AddColumn(string columnName, string columnText, int columnWidth, ColumnType columnType = ColumnType.Boolean)
|
public void AddColumn(string columnName, string columnText, int columnWidth, ColumnType columnType = ColumnType.Boolean)
|
||||||
{
|
{
|
||||||
if (TasView.AllColumns[columnName] == null)
|
AddColumn(
|
||||||
{
|
new RollColumn
|
||||||
var column = new RollColumn
|
|
||||||
{
|
{
|
||||||
Name = columnName,
|
Name = columnName,
|
||||||
Text = columnText,
|
Text = columnText,
|
||||||
Width = columnWidth,
|
Width = columnWidth,
|
||||||
Type = columnType
|
Type = columnType
|
||||||
};
|
});
|
||||||
|
|
||||||
TasView.AllColumns.Add(column);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddColumn(RollColumn column)
|
||||||
|
{
|
||||||
|
if (TasView.AllColumns[column.Name] == null)
|
||||||
|
TasView.AllColumns.Add(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EngageTastudio()
|
private void EngageTastudio()
|
||||||
|
|
Loading…
Reference in New Issue