From 885757c17db35d22510f329286d979118c3354cb Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 22 Aug 2014 00:39:56 +0000 Subject: [PATCH] Input Roll - vertical scrolling, still todo: horizontal, and horizontal orientation --- .../tools/TAStudio/InputRoll.cs | 41 +++++++++++++++---- .../TAStudio/TasStudioExperiment.Designer.cs | 24 +++++++++++ .../tools/TAStudio/TasStudioExperiment.cs | 1 + 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 0a0168db00..7609f5b724 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -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 SelectedItems = new List(); @@ -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) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.Designer.cs index 6c18d0cfc4..2b859d2363 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.cs index c63e7977ad..4704c977df 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TasStudioExperiment.cs @@ -26,6 +26,7 @@ namespace BizHawk.Client.EmuHawk Watches.UpdateValues(); InputView.Refresh(); + ScrollBarValueTable.Text = InputView.ScrollPos.ToString(); } public void FastUpdate()