Work on InputRoll horizontal mode a bit.
This commit is contained in:
parent
9471f7ca03
commit
90724bb777
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
@ -167,48 +167,75 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (HorizontalOrientation)
|
||||
{
|
||||
int startRow = FirstVisibleRow;
|
||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||
|
||||
_renderer.PrepDrawString(_font, _foreColor);
|
||||
for (int i = 0, f = 0; f < range; i++, f++)
|
||||
{
|
||||
f += _lagFrames[i];
|
||||
int lastVisible = LastVisibleColumnIndex;
|
||||
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||
|
||||
_renderer.PrepDrawString(_font, _foreColor);
|
||||
int lastVisible = LastVisibleColumnIndex;
|
||||
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;
|
||||
int x;
|
||||
int y;
|
||||
int bitmapOffsetX = 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)
|
||||
{
|
||||
x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
|
||||
y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
|
||||
int x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
|
||||
int y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
|
||||
_renderer.DrawBitmap(image, new Point(x, y));
|
||||
}
|
||||
|
||||
string text;
|
||||
int strOffsetX = 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
|
||||
x = RowsToPixels(i) + ((CellWidth - (text.Length * _charSize.Width)) / 2);
|
||||
y = (j * CellHeight) + CellHeightPadding - _vBar.Value;
|
||||
var point = new Point(x + strOffsetX, y + strOffsetY);
|
||||
|
||||
if (visibleColumns[j].Name == "FrameColumn") // TODO: don't do this hack
|
||||
int baseX = RowsToPixels(i) + (col.Rotatable ? CellWidth : 0);
|
||||
int baseY = j * CellHeight - _vBar.Value;
|
||||
int textWidth = text.Length * _charSize.Width;
|
||||
if (col.Rotatable)
|
||||
{
|
||||
// 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);
|
||||
DrawString(text, ColumnWidth, new Point(point.X + _charSize.Height + CellWidthPadding, point.Y + CellHeightPadding));
|
||||
DrawString(text, null /* TODO */, point);
|
||||
_renderer.PrepDrawString(_font, _foreColor, rotate: false);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1166,7 +1166,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// 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())
|
||||
{
|
||||
|
@ -1235,7 +1235,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class RollColumn
|
||||
{
|
||||
|
@ -15,5 +17,15 @@
|
|||
/// Column will be drawn with an emphasized look, if true
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,7 +319,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (columnName == FrameColumnName)
|
||||
{
|
||||
offsetX = 7;
|
||||
if (!TasView.HorizontalOrientation)
|
||||
{
|
||||
offsetX = 7;
|
||||
}
|
||||
text = index.ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0');
|
||||
}
|
||||
else
|
||||
|
|
|
@ -395,7 +395,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
TasView.AllColumns.Clear();
|
||||
AddColumn(CursorColumnName, "", 18);
|
||||
AddColumn(FrameColumnName, "Frame#", 68);
|
||||
AddColumn(
|
||||
new RollColumn
|
||||
{
|
||||
Name = FrameColumnName,
|
||||
Text = "Frame#",
|
||||
Width = 68,
|
||||
Type = ColumnType.Text,
|
||||
Rotatable = true
|
||||
});
|
||||
|
||||
var columnNames = GenerateColumnNames();
|
||||
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)
|
||||
{
|
||||
if (TasView.AllColumns[columnName] == null)
|
||||
{
|
||||
var column = new RollColumn
|
||||
AddColumn(
|
||||
new RollColumn
|
||||
{
|
||||
Name = columnName,
|
||||
Text = columnText,
|
||||
Width = columnWidth,
|
||||
Type = columnType
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void AddColumn(RollColumn column)
|
||||
{
|
||||
if (TasView.AllColumns[column.Name] == null)
|
||||
TasView.AllColumns.Add(column);
|
||||
}
|
||||
}
|
||||
|
||||
private void EngageTastudio()
|
||||
|
|
Loading…
Reference in New Issue