add auto-start and auto-save to CDL; fix toolbar to be ToolStripEx, so it doesnt suck
This commit is contained in:
parent
53c7f4e5be
commit
0cc27a226b
|
@ -127,6 +127,7 @@ namespace BizHawk.Client.Common
|
||||||
public DateTime? Update_LastCheckTimeUTC = null;
|
public DateTime? Update_LastCheckTimeUTC = null;
|
||||||
public string Update_LatestVersion = "";
|
public string Update_LatestVersion = "";
|
||||||
public string Update_IgnoreVersion = "";
|
public string Update_IgnoreVersion = "";
|
||||||
|
public bool CDLAutoSave = true, CDLAutoStart = true;
|
||||||
|
|
||||||
//public bool TurboSeek = true; // When PauseOnFrame is set, this will decide whether the client goes into turbo mode or not
|
//public bool TurboSeek = true; // When PauseOnFrame is set, this will decide whether the client goes into turbo mode or not
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,20 @@
|
||||||
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.miAutoStart = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.miAutoSave = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
this.toolStrip1 = new ToolStripEx();
|
||||||
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
|
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
|
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
|
||||||
this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox();
|
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.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView();
|
||||||
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
|
@ -62,8 +66,6 @@
|
||||||
this.colFlag20 = ((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.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.tsbExportText = new System.Windows.Forms.ToolStripButton();
|
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -88,6 +90,8 @@
|
||||||
this.SaveAsMenuItem,
|
this.SaveAsMenuItem,
|
||||||
this.AppendMenuItem,
|
this.AppendMenuItem,
|
||||||
this.RecentSubMenu,
|
this.RecentSubMenu,
|
||||||
|
this.miAutoStart,
|
||||||
|
this.miAutoSave,
|
||||||
this.toolStripSeparator2,
|
this.toolStripSeparator2,
|
||||||
this.ClearMenuItem,
|
this.ClearMenuItem,
|
||||||
this.DisassembleMenuItem,
|
this.DisassembleMenuItem,
|
||||||
|
@ -157,6 +161,19 @@
|
||||||
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
|
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
|
||||||
this.noneToolStripMenuItem.Text = "None";
|
this.noneToolStripMenuItem.Text = "None";
|
||||||
//
|
//
|
||||||
|
// miAutoStart
|
||||||
|
//
|
||||||
|
this.miAutoStart.Name = "miAutoStart";
|
||||||
|
this.miAutoStart.Size = new System.Drawing.Size(193, 22);
|
||||||
|
this.miAutoStart.Text = "Auto-Start";
|
||||||
|
this.miAutoStart.Click += new System.EventHandler(this.miAutoStart_Click);
|
||||||
|
//
|
||||||
|
// miAutoSave
|
||||||
|
//
|
||||||
|
this.miAutoSave.Name = "miAutoSave";
|
||||||
|
this.miAutoSave.Size = new System.Drawing.Size(193, 22);
|
||||||
|
this.miAutoSave.Text = "Auto-Save";
|
||||||
|
//
|
||||||
// toolStripSeparator2
|
// toolStripSeparator2
|
||||||
//
|
//
|
||||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
|
@ -191,6 +208,7 @@
|
||||||
//
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
|
this.toolStrip1.ClickThrough = true;
|
||||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.tsbLoggingActive,
|
this.tsbLoggingActive,
|
||||||
this.toolStripSeparator3,
|
this.toolStripSeparator3,
|
||||||
|
@ -243,6 +261,20 @@
|
||||||
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
|
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
|
||||||
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
|
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
|
// toolStripSeparator4
|
||||||
|
//
|
||||||
|
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||||
|
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// tsbExportText
|
||||||
|
//
|
||||||
|
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
|
||||||
|
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.tsbExportText.Name = "tsbExportText";
|
||||||
|
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
|
||||||
|
this.tsbExportText.Text = "To Clipboard";
|
||||||
|
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
|
||||||
|
//
|
||||||
// lvCDL
|
// lvCDL
|
||||||
//
|
//
|
||||||
this.lvCDL.BlazingFast = false;
|
this.lvCDL.BlazingFast = false;
|
||||||
|
@ -333,20 +365,6 @@
|
||||||
//
|
//
|
||||||
this.colFlag80.Text = "0x80";
|
this.colFlag80.Text = "0x80";
|
||||||
//
|
//
|
||||||
// toolStripSeparator4
|
|
||||||
//
|
|
||||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
|
||||||
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
|
|
||||||
//
|
|
||||||
// tsbExportText
|
|
||||||
//
|
|
||||||
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
|
|
||||||
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
|
|
||||||
this.tsbExportText.Name = "tsbExportText";
|
|
||||||
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
|
|
||||||
this.tsbExportText.Text = "To Clipboard";
|
|
||||||
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
|
|
||||||
//
|
|
||||||
// CDL
|
// CDL
|
||||||
//
|
//
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
|
@ -390,7 +408,6 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem RecentSubMenu;
|
private System.Windows.Forms.ToolStripMenuItem RecentSubMenu;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
|
||||||
private System.Windows.Forms.ToolStripButton tsbLoggingActive;
|
private System.Windows.Forms.ToolStripButton tsbLoggingActive;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||||
private System.Windows.Forms.ToolStripButton tsbViewUpdate;
|
private System.Windows.Forms.ToolStripButton tsbViewUpdate;
|
||||||
|
@ -411,6 +428,9 @@
|
||||||
private System.Windows.Forms.ColumnHeader colFlag80;
|
private System.Windows.Forms.ColumnHeader colFlag80;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||||
private System.Windows.Forms.ToolStripButton tsbExportText;
|
private System.Windows.Forms.ToolStripButton tsbExportText;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem miAutoStart;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem miAutoSave;
|
||||||
|
private ToolStripEx toolStrip1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -182,6 +182,30 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool AskSaveChanges()
|
public bool AskSaveChanges()
|
||||||
{
|
{
|
||||||
|
//nothing to fear:
|
||||||
|
if (_cdl == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//try auto-saving if appropriate
|
||||||
|
if (Global.Config.CDLAutoSave)
|
||||||
|
{
|
||||||
|
//TODO - I dont like this system. It's hard to figure out how to use it. It should be done in multiple passes.
|
||||||
|
var result = MessageBox.Show("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
if (result == DialogResult.No)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(_currentFilename))
|
||||||
|
{
|
||||||
|
if (!RunSaveAs())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RunSave();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +233,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//ok, it's all good:
|
//ok, it's all good:
|
||||||
_cdl = newCDL;
|
_cdl = newCDL;
|
||||||
CodeDataLogger.SetCDL(null);
|
CodeDataLogger.SetCDL(null);
|
||||||
if (tsbLoggingActive.Checked)
|
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
|
||||||
CodeDataLogger.SetCDL(_cdl);
|
CodeDataLogger.SetCDL(_cdl);
|
||||||
|
|
||||||
SetCurrentFilename(path);
|
SetCurrentFilename(path);
|
||||||
|
@ -226,6 +250,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ClearMenuItem.Enabled =
|
ClearMenuItem.Enabled =
|
||||||
DisassembleMenuItem.Enabled =
|
DisassembleMenuItem.Enabled =
|
||||||
_cdl != null;
|
_cdl != null;
|
||||||
|
|
||||||
|
miAutoSave.Checked = Global.Config.CDLAutoSave;
|
||||||
|
miAutoStart.Checked = Global.Config.CDLAutoStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
|
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||||
|
@ -239,7 +266,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_cdl = new CodeDataLog();
|
_cdl = new CodeDataLog();
|
||||||
CodeDataLogger.NewCDL(_cdl);
|
CodeDataLogger.NewCDL(_cdl);
|
||||||
|
|
||||||
if (tsbLoggingActive.Checked)
|
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
|
||||||
CodeDataLogger.SetCDL(_cdl);
|
CodeDataLogger.SetCDL(_cdl);
|
||||||
else CodeDataLogger.SetCDL(null);
|
else CodeDataLogger.SetCDL(null);
|
||||||
|
|
||||||
|
@ -283,27 +310,36 @@ namespace BizHawk.Client.EmuHawk
|
||||||
LoadFile(file.FullName);
|
LoadFile(file.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveMenuItem_Click(object sender, EventArgs e)
|
void RunSave()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(_currentFilename))
|
_recent.Add(_currentFilename);
|
||||||
{
|
|
||||||
RunSaveAs();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
|
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
|
||||||
{
|
{
|
||||||
_cdl.Save(fs);
|
_cdl.Save(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunSaveAs()
|
private void SaveMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_cdl == null)
|
if (_cdl == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
|
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (string.IsNullOrWhiteSpace(_currentFilename))
|
||||||
|
{
|
||||||
|
RunSaveAs();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// returns false if the operation was canceled
|
||||||
|
/// </summary>
|
||||||
|
bool RunSaveAs()
|
||||||
{
|
{
|
||||||
var file = SaveFileDialog(
|
var file = SaveFileDialog(
|
||||||
_currentFilename,
|
_currentFilename,
|
||||||
|
@ -311,16 +347,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
"Code Data Logger Files",
|
"Code Data Logger Files",
|
||||||
"cdl");
|
"cdl");
|
||||||
|
|
||||||
if (file != null)
|
if (file == null)
|
||||||
{
|
return false;
|
||||||
using (var fs = new FileStream(file.FullName, FileMode.Create, FileAccess.Write))
|
|
||||||
{
|
|
||||||
_cdl.Save(fs);
|
|
||||||
_recent.Add(file.FullName);
|
|
||||||
SetCurrentFilename(file.FullName);
|
SetCurrentFilename(file.FullName);
|
||||||
}
|
RunSave();
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -401,6 +433,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!AskSaveChanges())
|
||||||
|
e.Cancel = true;
|
||||||
|
base.OnClosing(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnShown(EventArgs e)
|
||||||
|
{
|
||||||
|
if (Global.Config.CDLAutoStart)
|
||||||
|
NewFileLogic();
|
||||||
|
base.OnShown(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
protected override void OnClosed(EventArgs e)
|
||||||
{
|
{
|
||||||
//deactivate logger
|
//deactivate logger
|
||||||
|
@ -463,5 +509,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
Clipboard.SetText(sw.ToString());
|
Clipboard.SetText(sw.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void miAutoSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.CDLAutoSave ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void miAutoStart_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.CDLAutoStart ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,5 +173,4 @@
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
>>>>>>> refs/remotes/TASVideos/master
|
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue