diff --git a/BizHawk.Client.EmuHawk/tools/CDL.cs b/BizHawk.Client.EmuHawk/tools/CDL.cs index fa9e45556e..47354229de 100644 --- a/BizHawk.Client.EmuHawk/tools/CDL.cs +++ b/BizHawk.Client.EmuHawk/tools/CDL.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Windows.Forms; using BizHawk.Emulation.Common; @@ -59,6 +60,24 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); tsbViewStyle.SelectedIndex = 0; + + lvCDL.AllColumns.Clear(); + lvCDL.AllColumns.AddRange(new [] + { + new InputRoll.RollColumn { Name = "CDLFile", Text = "CDL File @", Width = 107, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "Domain", Text = "Domain", Width = 126, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "Percent", Text = "%", Width = 58, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "Mapped", Text = "Mapped", Width = 64, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "Size", Text = "Size", Width = 112, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x01", Text = "0x01", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x02", Text = "0x02", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x04", Text = "0x04", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x08", Text = "0x08", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x10", Text = "0x10", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x20", Text = "0x20", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x40", Text = "0x40", Width = 56, Type = InputRoll.RollColumn.InputType.Text }, + new InputRoll.RollColumn { Name = "0x80", Text = "0x80", Width = 56, Type = InputRoll.RollColumn.InputType.Text } + }); } public void NewUpdate(ToolFormUpdateType type) { } @@ -98,23 +117,10 @@ namespace BizHawk.Client.EmuHawk if (_cdl == null) { - lvCDL.BeginUpdate(); - if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) - { - lvCDL.Items.Clear(); - } - else - { - // this is a winforms implementation problem for mono - // see https://github.com/mono/mono/issues/11070 - // until this is resolved in mono we should just skip this call - } - lvCDL.EndUpdate(); + lvCDL.DeselectAll(); return; } - lvCDL.BeginUpdate(); - listContents = new string[_cdl.Count][]; int idx = 0; @@ -183,8 +189,7 @@ namespace BizHawk.Client.EmuHawk } } - lvCDL.VirtualListSize = _cdl.Count; - lvCDL.EndUpdate(); + lvCDL.RowCount = _cdl.Count; } public bool AskSaveChanges() @@ -571,9 +576,10 @@ namespace BizHawk.Client.EmuHawk CodeDataLogger.SetCDL(null); } - private void lvCDL_QueryItemText(int item, int subItem, out string text) + private void lvCDL_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY) { - text = listContents[item][subItem]; + var subItem = lvCDL.AllColumns.IndexOf(column); + text = listContents[index][subItem]; } private void tsbExportText_Click(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/tools/CDL.designer.cs b/BizHawk.Client.EmuHawk/tools/CDL.designer.cs index a43f020105..5b24949487 100644 --- a/BizHawk.Client.EmuHawk/tools/CDL.designer.cs +++ b/BizHawk.Client.EmuHawk/tools/CDL.designer.cs @@ -52,20 +52,7 @@ this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.tsbExportText = new System.Windows.Forms.ToolStripButton(); - this.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView(); - this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colPct = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colMapped = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag01 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag02 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag04 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag08 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.lvCDL = new InputRoll(); this.miAutoResume = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); @@ -280,93 +267,18 @@ // // lvCDL // - this.lvCDL.BlazingFast = false; - this.lvCDL.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colAddress, - this.colDomain, - this.colPct, - this.colMapped, - this.colSize, - this.colFlag01, - this.colFlag02, - this.colFlag04, - this.colFlag08, - this.colFlag10, - this.colFlag20, - this.colFlag40, - this.colFlag80}); this.lvCDL.Dock = System.Windows.Forms.DockStyle.Fill; this.lvCDL.FullRowSelect = true; this.lvCDL.GridLines = true; - this.lvCDL.ItemCount = 0; + this.lvCDL.RowCount = 0; this.lvCDL.Location = new System.Drawing.Point(0, 49); this.lvCDL.Name = "lvCDL"; - this.lvCDL.SelectAllInProgress = false; - this.lvCDL.selectedItem = -1; this.lvCDL.Size = new System.Drawing.Size(992, 323); this.lvCDL.TabIndex = 9; - this.lvCDL.UseCompatibleStateImageBehavior = false; this.lvCDL.UseCustomBackground = true; - this.lvCDL.View = System.Windows.Forms.View.Details; - this.lvCDL.VirtualMode = true; - this.lvCDL.QueryItemText += new BizHawk.Client.EmuHawk.QueryItemTextHandler(this.lvCDL_QueryItemText); - // - // colAddress - // - this.colAddress.Text = "CDL File @"; - this.colAddress.Width = 107; - // - // colDomain - // - this.colDomain.Text = "Domain"; - this.colDomain.Width = 126; - // - // colPct - // - this.colPct.Text = "%"; - this.colPct.Width = 58; - // - // colMapped - // - this.colMapped.Text = "Mapped"; - this.colMapped.Width = 64; - // - // colSize - // - this.colSize.Text = "Size"; - this.colSize.Width = 102; - // - // colFlag01 - // - this.colFlag01.Text = "0x01"; - // - // colFlag02 - // - this.colFlag02.Text = "0x02"; - // - // colFlag04 - // - this.colFlag04.Text = "0x04"; - // - // colFlag08 - // - this.colFlag08.Text = "0x08"; - // - // colFlag10 - // - this.colFlag10.Text = "0x10"; - // - // colFlag20 - // - this.colFlag20.Text = "0x20"; - // - // colFlag40 - // - this.colFlag40.Text = "0x40"; - // - // colFlag80 - // - this.colFlag80.Text = "0x80"; + this.lvCDL.AllowColumnReorder = false; + this.lvCDL.AllowColumnResize = true; + this.lvCDL.QueryItemText += new InputRoll.QueryItemTextHandler(this.lvCDL_QueryItemText); // // miAutoResume // @@ -422,20 +334,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripButton tsbViewUpdate; private System.Windows.Forms.ToolStripComboBox tsbViewStyle; - private VirtualListView lvCDL; - private System.Windows.Forms.ColumnHeader colAddress; - private System.Windows.Forms.ColumnHeader colDomain; - private System.Windows.Forms.ColumnHeader colPct; - private System.Windows.Forms.ColumnHeader colMapped; - private System.Windows.Forms.ColumnHeader colSize; - private System.Windows.Forms.ColumnHeader colFlag01; - private System.Windows.Forms.ColumnHeader colFlag02; - private System.Windows.Forms.ColumnHeader colFlag04; - private System.Windows.Forms.ColumnHeader colFlag08; - private System.Windows.Forms.ColumnHeader colFlag10; - private System.Windows.Forms.ColumnHeader colFlag20; - private System.Windows.Forms.ColumnHeader colFlag40; - private System.Windows.Forms.ColumnHeader colFlag80; + private InputRoll lvCDL; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripButton tsbExportText; private System.Windows.Forms.ToolStripMenuItem miAutoStart;