Trace Logger - basic logging fixed

This commit is contained in:
adelikat 2012-09-30 03:49:53 +00:00
parent e865790086
commit 427864841d
2 changed files with 56 additions and 64 deletions

View File

@ -29,53 +29,25 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TraceLogger));
this.TraceView = new BizHawk.VirtualListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.TraceView = new BizHawk.VirtualListView();
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ClearButton = new System.Windows.Forms.Button();
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// TraceView
//
this.TraceView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TraceView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.TraceView.FullRowSelect = true;
this.TraceView.GridLines = true;
this.TraceView.HideSelection = false;
this.TraceView.ItemCount = 0;
this.TraceView.LabelEdit = true;
this.TraceView.Location = new System.Drawing.Point(9, 16);
this.TraceView.Name = "TraceView";
this.TraceView.selectedItem = -1;
this.TraceView.Size = new System.Drawing.Size(320, 386);
this.TraceView.TabIndex = 0;
this.TraceView.UseCompatibleStateImageBehavior = false;
this.TraceView.View = System.Windows.Forms.View.Details;
this.TraceView.VirtualMode = true;
//
// columnHeader1
//
this.columnHeader1.Text = "Instructions";
this.columnHeader1.Width = 275;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -84,11 +56,36 @@
this.groupBox1.Controls.Add(this.TraceView);
this.groupBox1.Location = new System.Drawing.Point(12, 27);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(337, 411);
this.groupBox1.Size = new System.Drawing.Size(337, 365);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Trace log";
//
// TraceView
//
this.TraceView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TraceView.CheckBoxes = true;
this.TraceView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Script});
this.TraceView.FullRowSelect = true;
this.TraceView.GridLines = true;
this.TraceView.HideSelection = false;
this.TraceView.ItemCount = 0;
this.TraceView.Location = new System.Drawing.Point(9, 19);
this.TraceView.Name = "TraceView";
this.TraceView.selectedItem = -1;
this.TraceView.Size = new System.Drawing.Size(320, 340);
this.TraceView.TabIndex = 4;
this.TraceView.UseCompatibleStateImageBehavior = false;
this.TraceView.View = System.Windows.Forms.View.Details;
//
// Script
//
this.Script.Text = "Instructions";
this.Script.Width = 316;
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -120,22 +117,38 @@
//
this.saveLogToolStripMenuItem.Enabled = false;
this.saveLogToolStripMenuItem.Name = "saveLogToolStripMenuItem";
this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
this.saveLogToolStripMenuItem.Text = "&Save Log";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoloadToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "&Options";
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
//
// autoloadToolStripMenuItem
//
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.autoloadToolStripMenuItem.Text = "&Autoload";
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -144,7 +157,7 @@
this.groupBox2.Controls.Add(this.LoggingEnabled);
this.groupBox2.Location = new System.Drawing.Point(356, 27);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(187, 411);
this.groupBox2.Size = new System.Drawing.Size(187, 365);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Control";
@ -171,27 +184,11 @@
this.LoggingEnabled.UseVisualStyleBackColor = true;
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoloadToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "&Options";
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
//
// autoloadToolStripMenuItem
//
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.autoloadToolStripMenuItem.Text = "&Autoload";
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
//
// TraceLogger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(555, 450);
this.ClientSize = new System.Drawing.Size(555, 404);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.menuStrip1);
@ -212,7 +209,6 @@
#endregion
private VirtualListView TraceView;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
@ -223,9 +219,9 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox LoggingEnabled;
private System.Windows.Forms.Button ClearButton;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
private VirtualListView TraceView;
public System.Windows.Forms.ColumnHeader Script;
}
}

View File

@ -16,15 +16,17 @@ namespace BizHawk.MultiClient
public TraceLogger()
{
InitializeComponent();
TraceView.QueryItemText += new QueryItemTextHandler(TraceView_QueryItemText);
TraceView.QueryItemBkColor += new QueryItemBkColorHandler(TraceView_QueryItemBkColor);
TraceView.VirtualMode = true;
Closing += (o, e) => SaveConfigSettings();
}
public void SaveConfigSettings()
{
//TODO
Global.CoreInputComm.Tracer.Enabled = false;
}
private void TraceView_QueryItemBkColor(int index, int column, ref Color color)
@ -34,11 +36,7 @@ namespace BizHawk.MultiClient
private void TraceView_QueryItemText(int index, int column, out string text)
{
int x = 0;
x++;
int y = 0;
text = Instructions[index];
y = x + text.Length;
}
private void TraceLogger_Load(object sender, EventArgs e)
@ -51,7 +49,6 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
DoInstructions();
TraceView.Refresh();
}
public void Restart()
@ -69,7 +66,6 @@ namespace BizHawk.MultiClient
private void ClearList()
{
Instructions.Clear();
TraceView.Clear();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)