Hex Editor - draw header only as needed rather than every frame, 1-2 fps speedup

This commit is contained in:
adelikat 2012-06-13 02:18:34 +00:00
parent c22ba4da32
commit ac96d4cc4a
2 changed files with 19 additions and 8 deletions

View File

@ -77,6 +77,7 @@
this.MemoryViewerBox = new System.Windows.Forms.GroupBox();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.AddressesLabel = new System.Windows.Forms.Label();
this.Header = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.ViewerContextMenuStrip.SuspendLayout();
this.MemoryViewerBox.SuspendLayout();
@ -472,7 +473,7 @@
//
this.AddressesLabel.AutoSize = true;
this.AddressesLabel.ContextMenuStrip = this.ViewerContextMenuStrip;
this.AddressesLabel.Location = new System.Drawing.Point(6, 16);
this.AddressesLabel.Location = new System.Drawing.Point(6, 30);
this.AddressesLabel.Name = "AddressesLabel";
this.AddressesLabel.Size = new System.Drawing.Size(31, 13);
this.AddressesLabel.TabIndex = 0;
@ -481,11 +482,22 @@
this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave);
this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove);
//
// Header
//
this.Header.AutoSize = true;
this.Header.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Header.Location = new System.Drawing.Point(18, 44);
this.Header.Name = "Header";
this.Header.Size = new System.Drawing.Size(35, 13);
this.Header.TabIndex = 2;
this.Header.Text = "label1";
//
// HexEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 301);
this.Controls.Add(this.Header);
this.Controls.Add(this.MemoryViewerBox);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@ -558,5 +570,6 @@
private System.Windows.Forms.ToolStripMenuItem setColorsToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
private System.Windows.Forms.ToolStripMenuItem resetToDefaultToolStripMenuItem1;
private System.Windows.Forms.Label Header;
}
}

View File

@ -22,7 +22,6 @@ namespace BizHawk.MultiClient
int defaultHeight;
List<ToolStripMenuItem> domainMenuItems = new List<ToolStripMenuItem>();
int RowsVisible = 0;
string Header = "";
int NumDigits = 4;
string NumDigitsStr = "{0:X4} ";
string DigitFormatString = "{0:X2} ";
@ -62,7 +61,8 @@ namespace BizHawk.MultiClient
LoadConfigSettings();
SetHeader();
Closing += (o, e) => SaveConfigSettings();
AddressesLabel.Font = new Font("Courier New", 8); ;
Header.Font = new Font("Courier New", 8);
AddressesLabel.Font = new Font("Courier New", 8);
}
private void LoadConfigSettings()
@ -131,8 +131,6 @@ namespace BizHawk.MultiClient
StringBuilder rowStr = new StringBuilder("");
addrOffset = (NumDigits % 4) * 9;
rowStr.Append(Header + '\n');
for (int i = 0; i < RowsVisible; i++)
{
row = i + vScrollBar1.Value;
@ -434,13 +432,13 @@ namespace BizHawk.MultiClient
switch (DataSize)
{
case 1:
Header = " 0 1 2 3 4 5 6 7 8 9 A B C D E F";
Header.Text = " 0 1 2 3 4 5 6 7 8 9 A B C D E F";
break;
case 2:
Header = " 0 2 4 6 8 A C E";
Header.Text = " 0 2 4 6 8 A C E";
break;
case 4:
Header = " 0 4 8 C";
Header.Text = " 0 4 8 C";
break;
}
NumDigits = GetNumDigits(Domain.Size);