Input Roll - vertical scrolling, still todo: horizontal, and horizontal orientation

This commit is contained in:
adelikat 2014-08-22 00:39:56 +00:00
parent 9bcb5f835a
commit 885757c17d
3 changed files with 59 additions and 7 deletions

View File

@ -11,6 +11,30 @@ namespace BizHawk.Client.EmuHawk
{
public class InputRoll : Control
{
// TODO: temporary hack for debugging and testing, sould be removed before being "shipped"
public int ScrollPos
{
get
{
if (HorizontalOrientation)
{
if (NeedsHScrollbar)
{
return HBar.Value;
}
return 0;
}
if (NeedsVScrollbar)
{
return VBar.Value;
}
return 0;
}
}
private readonly GDIRenderer Gdi;
private readonly RollColumns Columns = new RollColumns();
private readonly List<Cell> SelectedItems = new List<Cell>();
@ -372,21 +396,25 @@ namespace BizHawk.Client.EmuHawk
}
else
{
var visibleRows = (Height / CellHeight);
if (visibleRows >= ItemCount)
int startIndex = VBar.Value;
int endIndex = startIndex + (Height / CellHeight);
if (endIndex >= ItemCount)
{
visibleRows = ItemCount;
endIndex = ItemCount;
}
int range = endIndex - startIndex;
Gdi.PrepDrawString(this.Font, this.ForeColor);
for (int i = 1; i < visibleRows; i++)
for (int i = 0; i < range; i++)
{
int x = 1;
for (int j = 0; j < Columns.Count; j++)
{
string text;
var point = new Point(x + CellPadding, i * CellHeight);
QueryItemText(i, j, out text);
var point = new Point(x + CellPadding, (i + 1) * CellHeight); // +1 accounts for the column header
QueryItemText(i + startIndex, j, out text);
Gdi.DrawString(text, point);
x += CalcWidth(Columns[j]);
}
@ -771,7 +799,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void SelectCell(Cell cell)
{
if (!MultiSelect)

View File

@ -35,6 +35,8 @@
this.CurrentCellLabel = new System.Windows.Forms.Label();
this.InputView = new BizHawk.Client.EmuHawk.InputRoll();
this.OutputLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.ScrollBarValueTable = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -112,11 +114,31 @@
this.OutputLabel.TabIndex = 4;
this.OutputLabel.Text = "label2";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 28);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(76, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Scroll Position:";
//
// ScrollBarValueTable
//
this.ScrollBarValueTable.AutoSize = true;
this.ScrollBarValueTable.Location = new System.Drawing.Point(94, 28);
this.ScrollBarValueTable.Name = "ScrollBarValueTable";
this.ScrollBarValueTable.Size = new System.Drawing.Size(76, 13);
this.ScrollBarValueTable.TabIndex = 6;
this.ScrollBarValueTable.Text = "Scroll Position:";
//
// TasStudioExperiment
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 418);
this.Controls.Add(this.ScrollBarValueTable);
this.Controls.Add(this.label2);
this.Controls.Add(this.OutputLabel);
this.Controls.Add(this.CurrentCellLabel);
this.Controls.Add(this.label1);
@ -142,5 +164,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label CurrentCellLabel;
private System.Windows.Forms.Label OutputLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label ScrollBarValueTable;
}
}

View File

@ -26,6 +26,7 @@ namespace BizHawk.Client.EmuHawk
Watches.UpdateValues();
InputView.Refresh();
ScrollBarValueTable.Text = InputView.ScrollPos.ToString();
}
public void FastUpdate()