New Ram Watch - some low hanging fruit

This commit is contained in:
adelikat 2013-09-06 20:43:01 +00:00
parent 0815d20f93
commit 068665f85b
3 changed files with 66 additions and 20 deletions

View File

@ -150,32 +150,32 @@
// newToolStripButton
//
this.newToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.newToolStripButton.Enabled = false;
this.newToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripButton.Image")));
this.newToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.newToolStripButton.Name = "newToolStripButton";
this.newToolStripButton.Size = new System.Drawing.Size(23, 22);
this.newToolStripButton.Text = "&New";
this.newToolStripButton.Click += new System.EventHandler(this.newListToolStripMenuItem_Click);
//
// openToolStripButton
//
this.openToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.openToolStripButton.Enabled = false;
this.openToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripButton.Image")));
this.openToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.openToolStripButton.Name = "openToolStripButton";
this.openToolStripButton.Size = new System.Drawing.Size(23, 22);
this.openToolStripButton.Text = "&Open";
this.openToolStripButton.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// saveToolStripButton
//
this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveToolStripButton.Enabled = false;
this.saveToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripButton.Image")));
this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveToolStripButton.Name = "saveToolStripButton";
this.saveToolStripButton.Size = new System.Drawing.Size(23, 22);
this.saveToolStripButton.Text = "&Save";
this.saveToolStripButton.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// toolStripSeparator
//
@ -320,6 +320,7 @@
this.filesToolStripMenuItem.Name = "filesToolStripMenuItem";
this.filesToolStripMenuItem.Size = new System.Drawing.Size(42, 20);
this.filesToolStripMenuItem.Text = "&Files";
this.filesToolStripMenuItem.DropDownOpened += new System.EventHandler(this.filesToolStripMenuItem_DropDownOpened);
//
// newListToolStripMenuItem
//
@ -341,28 +342,28 @@
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Enabled = false;
this.saveToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.SaveAs;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Enabled = false;
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.saveAsToolStripMenuItem.Text = "Save &As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// appendFileToolStripMenuItem
//
this.appendFileToolStripMenuItem.Enabled = false;
this.appendFileToolStripMenuItem.Name = "appendFileToolStripMenuItem";
this.appendFileToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.appendFileToolStripMenuItem.Text = "A&ppend File...";
this.appendFileToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// recentToolStripMenuItem
//
@ -600,6 +601,7 @@
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);
//
// definePreviousValueAsToolStripMenuItem
//
@ -625,17 +627,17 @@
//
// displayWatchesOnScreenToolStripMenuItem
//
this.displayWatchesOnScreenToolStripMenuItem.Enabled = false;
this.displayWatchesOnScreenToolStripMenuItem.Name = "displayWatchesOnScreenToolStripMenuItem";
this.displayWatchesOnScreenToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.displayWatchesOnScreenToolStripMenuItem.Text = "Display Watches On Screen";
this.displayWatchesOnScreenToolStripMenuItem.Click += new System.EventHandler(this.displayWatchesOnScreenToolStripMenuItem_Click);
//
// saveWindowPositionToolStripMenuItem
//
this.saveWindowPositionToolStripMenuItem.Enabled = false;
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position";
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
//
// toolStripSeparator7
//

View File

@ -220,6 +220,12 @@ namespace BizHawk.MultiClient
#region Winform Events
/*************File***********************/
private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
saveToolStripMenuItem.Enabled = Watches.Changes;
}
private void NewRamWatch_Load(object sender, EventArgs e)
{
@ -232,6 +238,7 @@ namespace BizHawk.MultiClient
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
bool append = sender == appendFileToolStripMenuItem;
var file = WatchCommon.GetFileFromUser(Watches.CurrentFileName);
if (file != null)
{
@ -243,9 +250,9 @@ namespace BizHawk.MultiClient
if (result)
{
Watches.Load(file.FullName, details: true, append: false);
Watches.Load(file.FullName, true, append);
DisplayWatches();
MessageLabel.Text = Path.GetFileNameWithoutExtension(Watches.CurrentFileName);
MessageLabel.Text = Path.GetFileNameWithoutExtension(Watches.CurrentFileName) + (Watches.Changes ? " *" : String.Empty);
UpdateWatchCount();
Global.Config.RecentWatches.Add(Watches.CurrentFileName);
SetMemoryDomain(WatchCommon.GetDomainPos(Watches.Domain.ToString()));
@ -253,6 +260,16 @@ namespace BizHawk.MultiClient
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
Watches.Save();
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
Watches.SaveAs();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!AskSave())
@ -265,6 +282,32 @@ namespace BizHawk.MultiClient
}
}
/*************Options***********************/
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
displayWatchesOnScreenToolStripMenuItem.Checked = Global.Config.DisplayRamWatch;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition;
}
private void displayWatchesOnScreenToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisplayRamWatch ^= true;
if (!Global.Config.DisplayRamWatch)
{
Global.OSD.ClearGUIText();
}
else
{
UpdateValues();
}
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchSaveWindowPosition ^= true;
}
#endregion
}
}

View File

@ -1266,7 +1266,7 @@ namespace BizHawk.MultiClient
}
else
{
SaveFileAs();
SaveAs();
}
}
@ -1276,12 +1276,13 @@ namespace BizHawk.MultiClient
if (result)
{
if (!append)
if (append)
{
CurrentFileName = path;
Changes = true;
}
else
{
CurrentFileName = path;
Changes = false;
}
}
@ -1295,7 +1296,7 @@ namespace BizHawk.MultiClient
throw new NotImplementedException();
}
private void SaveFileAs()
public void SaveAs()
{
//TODO
throw new NotImplementedException();