From ac56fb088321b84a2902aeb5dea4a5a61379788b Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 7 Dec 2013 23:20:44 +0000 Subject: [PATCH] Start a TasListView object that inherits VirtualListView, make TAStudio use it, have it have properties for which Column and Row is currently being pointed to by the mouse. Row isn't calculated yet, but column is --- .../BizHawk.Client.EmuHawk.csproj | 3 ++ .../CustomControls/TasListView.cs | 49 +++++++++++++++++++ .../tools/TAStudio/TAStudio.Designer.cs | 4 +- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/CustomControls/TasListView.cs diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 0948ea5056..af407ce773 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -326,6 +326,9 @@ Component + + Component + Component diff --git a/BizHawk.Client.EmuHawk/CustomControls/TasListView.cs b/BizHawk.Client.EmuHawk/CustomControls/TasListView.cs new file mode 100644 index 0000000000..f9cc9c5a28 --- /dev/null +++ b/BizHawk.Client.EmuHawk/CustomControls/TasListView.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.Client.EmuHawk +{ + public class TasListView : VirtualListView + { + public string PointedColumnName = String.Empty; + public int? PointedRowIndex = null; + + private void CalculatePointedCell(int x, int y) + { + string columnName = String.Empty; + + var accumulator = 0; + foreach (ColumnHeader column in Columns) + { + accumulator += column.Width; + if (accumulator < x) + { + continue; + } + else + { + PointedColumnName = column.Name; + break; + } + } + + // TODO: Get row + } + + protected override void OnMouseLeave(EventArgs e) + { + PointedColumnName = String.Empty; + PointedRowIndex = null; + base.OnMouseLeave(e); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + CalculatePointedCell(e.X, e.Y); + base.OnMouseMove(e); + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index b4b78c1c00..5729b363db 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk this.EnableTooltipsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.TASView = new BizHawk.Client.EmuHawk.VirtualListView(); + this.TASView = new BizHawk.Client.EmuHawk.TasListView(); this.Frame = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Log = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.MarkerLabel = new System.Windows.Forms.Label(); @@ -752,7 +752,7 @@ namespace BizHawk.Client.EmuHawk private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ConfigSubMenu; - private VirtualListView TASView; + private TasListView TASView; private System.Windows.Forms.ColumnHeader Log; private System.Windows.Forms.ToolStripMenuItem RecentSubMenu; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;