Ditto for trace logger

This commit is contained in:
adelikat 2014-01-30 03:34:58 +00:00
parent ab4f9534fe
commit d44e6c6342
6 changed files with 63 additions and 40 deletions

View File

@ -269,14 +269,9 @@ namespace BizHawk.Client.Common
public Color HexHighlightFreezeColor = Color.Violet;
// Trace Logger Settings
public ToolDialogSettings TraceLoggerSettings = new ToolDialogSettings();
public bool TraceLoggerAutoLoad = false;
public bool TraceLoggerSaveWindowPosition = true;
public bool TraceLoggerOnTop = false;
public int TraceLoggerMaxLines = 100000;
public int TraceLoggerWndx = -1;
public int TraceLoggerWndy = -1;
public int TraceLoggerWidth = -1;
public int TraceLoggerHeight = -1;
// Video dumping settings
public string VideoWriter = "";

View File

@ -13,7 +13,7 @@
public int? Height { get; set; }
public bool SaveWindowPosition { get; set; }
public bool AlwaysOnTop { get; set; }
public bool TopMost { get; set; }
public bool FloatingWindow { get; set; }
public bool UseWindowPosition

View File

@ -58,7 +58,7 @@ namespace BizHawk.Client.EmuHawk
Header.Font = new Font("Courier New", 8);
AddressesLabel.Font = new Font("Courier New", 8);
AddressLabel.Font = new Font("Courier New", 8);
TopMost = Global.Config.HexEditorSettings.AlwaysOnTop;
TopMost = Global.Config.HexEditorSettings.TopMost;
}
private int? HighlightedAddress
@ -1445,7 +1445,7 @@ namespace BizHawk.Client.EmuHawk
{
AutoloadMenuItem.Checked = Global.Config.AutoLoadHexEditor;
SaveWindowsPositionMenuItem.Checked = Global.Config.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.HexEditorSettings.AlwaysOnTop;
AlwaysOnTopMenuItem.Checked = Global.Config.HexEditorSettings.TopMost;
}
private void SetColorsMenuItem_Click(object sender, EventArgs e)
@ -1480,8 +1480,8 @@ namespace BizHawk.Client.EmuHawk
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.HexEditorSettings.AlwaysOnTop ^= true;
TopMost = Global.Config.HexEditorSettings.AlwaysOnTop;
Global.Config.HexEditorSettings.TopMost ^= true;
TopMost = Global.Config.HexEditorSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
@ -1495,7 +1495,7 @@ namespace BizHawk.Client.EmuHawk
Size = new Size(_defaultWidth, _defaultHeight);
SetUpScrollBar();
Global.Config.HexEditorSettings.AlwaysOnTop = false;
Global.Config.HexEditorSettings.TopMost = false;
Global.Config.HexEditorSettings.SaveWindowPosition = true;
Global.Config.AutoLoadHexEditor = false;
}

View File

@ -46,6 +46,7 @@
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.BrowseBox = new System.Windows.Forms.Button();
this.FileBox = new System.Windows.Forms.TextBox();
@ -53,7 +54,7 @@
this.ToWindowRadio = new System.Windows.Forms.RadioButton();
this.ClearButton = new System.Windows.Forms.Button();
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TracerBox.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -77,6 +78,7 @@
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.BlazingFast = false;
this.TraceView.CheckBoxes = true;
this.TraceView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Script});
@ -183,7 +185,8 @@
this.toolStripSeparator2,
this.AutoloadMenuItem,
this.SaveWindowPositionMenuItem,
this.AlwaysOnTopMenuItem});
this.AlwaysOnTopMenuItem,
this.FloatingWindowMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Text = "&Options";
@ -215,6 +218,13 @@
this.SaveWindowPositionMenuItem.Text = "&Save Window Position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// AlwaysOnTopMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
this.AlwaysOnTopMenuItem.Text = "&Always on Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
@ -302,12 +312,12 @@
this.LoggingEnabled.UseVisualStyleBackColor = true;
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
//
// AlwaysOnTopMenuItem
// FloatingWindowMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
this.AlwaysOnTopMenuItem.Text = "&Always on Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
this.FloatingWindowMenuItem.Text = "&Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// TraceLogger
//
@ -362,5 +372,6 @@
private System.Windows.Forms.ToolStripMenuItem CopyMenuItem;
private System.Windows.Forms.ToolStripMenuItem SelectAllMenuItem;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
}
}

View File

@ -25,7 +25,7 @@ namespace BizHawk.Client.EmuHawk
TraceView.QueryItemText += TraceView_QueryItemText;
TraceView.VirtualMode = true;
TopMost = Global.Config.TraceLoggerOnTop;
TopMost = Global.Config.TraceLoggerSettings.TopMost;
Closing += (o, e) => SaveConfigSettings();
}
@ -42,20 +42,20 @@ namespace BizHawk.Client.EmuHawk
private void SaveConfigSettings()
{
Global.CoreComm.Tracer.Enabled = false;
Global.Config.TraceLoggerWndx = Location.X;
Global.Config.TraceLoggerWndy = Location.Y;
Global.Config.TraceLoggerSettings.Wndx = Location.X;
Global.Config.TraceLoggerSettings.Wndy = Location.Y;
}
private void TraceView_QueryItemText(int index, int column, out string text)
{
text = index < _instructions.Count ? _instructions[index] : String.Empty;
text = index < _instructions.Count ? _instructions[index] : string.Empty;
}
private void TraceLogger_Load(object sender, EventArgs e)
{
if (Global.Config.TraceLoggerSaveWindowPosition && Global.Config.TraceLoggerWndx >= 0 && Global.Config.TraceLoggerWndy >= 0)
if (Global.Config.TraceLoggerSettings.UseWindowPosition)
{
Location = new Point(Global.Config.TraceLoggerWndx, Global.Config.TraceLoggerWndy);
Location = new Point(Global.Config.TraceLoggerSettings.Wndx.Value, Global.Config.TraceLoggerSettings.Wndy.Value);
}
ClearList();
@ -116,15 +116,14 @@ namespace BizHawk.Client.EmuHawk
private void LogToWindow()
{
var instructions = Global.CoreComm.Tracer.TakeContents().Split('\n');
if (!String.IsNullOrWhiteSpace(instructions[0]))
if (!string.IsNullOrWhiteSpace(instructions[0]))
{
_instructions.AddRange(instructions);
}
if (_instructions.Count >= Global.Config.TraceLoggerMaxLines)
{
var x = _instructions.Count - Global.Config.TraceLoggerMaxLines;
_instructions.RemoveRange(0, x);
_instructions.RemoveRange(0, _instructions.Count - Global.Config.TraceLoggerMaxLines);
}
TraceView.ItemCount = _instructions.Count;
@ -180,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + ".txt";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null);
}
else if (!String.IsNullOrWhiteSpace(_logFile.FullName))
else if (!string.IsNullOrWhiteSpace(_logFile.FullName))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = Path.GetDirectoryName(_logFile.FullName);
@ -215,6 +214,11 @@ namespace BizHawk.Client.EmuHawk
}
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.TraceLoggerSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
#region Events
#region Menu Items
@ -280,8 +284,9 @@ namespace BizHawk.Client.EmuHawk
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
AutoloadMenuItem.Checked = Global.Config.TraceLoggerAutoLoad;
SaveWindowPositionMenuItem.Checked = Global.Config.TraceLoggerSaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.TraceLoggerOnTop;
SaveWindowPositionMenuItem.Checked = Global.Config.TraceLoggerSettings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.TraceLoggerSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.TraceLoggerSettings.FloatingWindow;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
@ -291,13 +296,19 @@ namespace BizHawk.Client.EmuHawk
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TraceLoggerSaveWindowPosition ^= true;
Global.Config.TraceLoggerSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TraceLoggerOnTop ^= true;
TopMost = Global.Config.TraceLoggerOnTop;
Global.Config.TraceLoggerSettings.TopMost ^= true;
TopMost = Global.Config.TraceLoggerSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TraceLoggerSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
#endregion
@ -361,6 +372,12 @@ namespace BizHawk.Client.EmuHawk
SetTracerBoxTitle();
}
protected override void OnShown(EventArgs e)
{
RefreshFloatingWindowControl();
base.OnShown(e);
}
#endregion
#endregion

View File

@ -74,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
_settings = new RamSearchEngine.Settings();
_searches = new RamSearchEngine(_settings);
TopMost = Global.Config.RamSearchSettings.AlwaysOnTop;
TopMost = Global.Config.RamSearchSettings.TopMost;
}
private void HardSetDisplayTypeDropDown(Watch.DisplayType type)
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
Size = new Size(Global.Config.RamSearchSettings.Width.Value, Global.Config.RamSearchSettings.Height.Value);
}
TopMost = Global.Config.RamSearchSettings.AlwaysOnTop;
TopMost = Global.Config.RamSearchSettings.TopMost;
LoadColumnInfo();
}
@ -1192,7 +1192,7 @@ namespace BizHawk.Client.EmuHawk
ExcludeRamWatchMenuItem.Checked = Global.Config.RamSearchAlwaysExcludeRamWatch;
UseUndoHistoryMenuItem.Checked = _searches.UndoEnabled;
PreviewModeMenuItem.Checked = Global.Config.RamSearchPreviewMode;
AlwaysOnTopMenuItem.Checked = Global.Config.RamSearchSettings.AlwaysOnTop;
AlwaysOnTopMenuItem.Checked = Global.Config.RamSearchSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.RamSearchSettings.FloatingWindow;
AutoSearchMenuItem.Checked = _autoSearch;
}
@ -1233,8 +1233,8 @@ namespace BizHawk.Client.EmuHawk
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamSearchSettings.AlwaysOnTop ^= true;
TopMost = Global.Config.RamSearchSettings.AlwaysOnTop;
Global.Config.RamSearchSettings.TopMost ^= true;
TopMost = Global.Config.RamSearchSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
@ -1269,7 +1269,7 @@ namespace BizHawk.Client.EmuHawk
WatchListView.Columns[WatchList.CHANGES].Width = _defaultColumnWidths[WatchList.CHANGES];
Global.Config.RamSearchSettings.SaveWindowPosition = true;
Global.Config.RamSearchSettings.AlwaysOnTop = TopMost = false;
Global.Config.RamSearchSettings.TopMost = TopMost = false;
Global.Config.RamSearchSettings.FloatingWindow = false;
Global.Config.RamSearchColumnWidths = new Dictionary<string, int>