-Better fix of lag log clearing.

-Current branch is now highlighted in BranchView
This commit is contained in:
Suuper 2015-07-22 14:14:33 -05:00
parent 635ad9c01d
commit 6f105f6ee8
4 changed files with 36 additions and 25 deletions

View File

@ -174,5 +174,11 @@ namespace BizHawk.Client.Common
return log;
}
public void FromLagLog(TasLagLog log)
{
LagLog = log.LagLog;
WasLag = log.WasLag;
}
}
}

View File

@ -463,8 +463,8 @@ namespace BizHawk.Client.Common
_changes = true;
StateManager.ClearStateHistory();
StateManager.SetState(branch.Frame, branch.CoreData);
LagLog.Clear();
LagLog = branch.LagLog.Clone();
//LagLog.Clear(); LagLog and InputLog is the same reference as what's in the branch!
LagLog.FromLagLog(branch.LagLog);
}
}
}

View File

@ -31,10 +31,10 @@
this.components = new System.ComponentModel.Container();
this.BookmarksBranchesGroupBox = new System.Windows.Forms.GroupBox();
this.BranchesContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.AddContextMenu = new System.Windows.Forms.ToolStripMenuItem();
this.RemoveBranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.LoadBranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.AddContextMenu = new System.Windows.Forms.ToolStripMenuItem();
this.RemoveBranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.BranchView = new BizHawk.Client.EmuHawk.VirtualListView();
this.BranchNumberColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.FrameColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -64,9 +64,22 @@
this.AddContextMenu,
this.RemoveBranchContextMenuItem});
this.BranchesContextMenu.Name = "BranchesContextMenu";
this.BranchesContextMenu.Size = new System.Drawing.Size(153, 98);
this.BranchesContextMenu.Size = new System.Drawing.Size(118, 76);
this.BranchesContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.BranchesContextMenu_Opening);
//
// LoadBranchContextMenuItem
//
this.LoadBranchContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Debugger;
this.LoadBranchContextMenuItem.Name = "LoadBranchContextMenuItem";
this.LoadBranchContextMenuItem.Size = new System.Drawing.Size(117, 22);
this.LoadBranchContextMenuItem.Text = "Load";
this.LoadBranchContextMenuItem.Click += new System.EventHandler(this.LoadBranchContextMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(114, 6);
//
// AddContextMenu
//
this.AddContextMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.add;
@ -83,19 +96,6 @@
this.RemoveBranchContextMenuItem.Text = "Remove";
this.RemoveBranchContextMenuItem.Click += new System.EventHandler(this.RemoveBranchContextMenuItem_Click);
//
// LoadBranchContextMenuItem
//
this.LoadBranchContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Debugger;
this.LoadBranchContextMenuItem.Name = "LoadBranchContextMenuItem";
this.LoadBranchContextMenuItem.Size = new System.Drawing.Size(152, 22);
this.LoadBranchContextMenuItem.Text = "Load";
this.LoadBranchContextMenuItem.Click += new System.EventHandler(this.LoadBranchContextMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(114, 6);
//
// BranchView
//
this.BranchView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

View File

@ -43,6 +43,8 @@ namespace BizHawk.Client.EmuHawk
}
}
private int CurrentBranch = -1;
private void QueryItemText(int index, int column, out string text)
{
text = string.Empty;
@ -70,7 +72,8 @@ namespace BizHawk.Client.EmuHawk
private void QueryItemBkColor(int index, int column, ref Color color)
{
if (index == CurrentBranch)
color = SystemColors.HotTrack;
}
private void AddContextMenu_Click(object sender, EventArgs e)
@ -92,23 +95,25 @@ namespace BizHawk.Client.EmuHawk
private void BranchView_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (SelectedBranch != null)
{
LoadBranch(SelectedBranch);
}
LoadSelectedBranch();
}
private void LoadBranchContextMenuItem_Click(object sender, EventArgs e)
{
LoadSelectedBranch();
}
private void LoadSelectedBranch()
{
if (SelectedBranch != null)
{
CurrentBranch = BranchView.selectedItem;
BranchView.Refresh();
LoadBranch(SelectedBranch);
}
}
private void BranchesContextMenu_Opening(object sender, CancelEventArgs e)
{
RemoveBranchContextMenuItem.Enabled =
RemoveBranchContextMenuItem.Enabled =
LoadBranchContextMenuItem.Enabled =
SelectedBranch != null;
}