Ram Watch - Add message label and add some useful messages

This commit is contained in:
andres.delikat 2011-01-21 18:03:38 +00:00
parent d263848a89
commit ffa43f795e
2 changed files with 41 additions and 13 deletions

View File

@ -70,6 +70,7 @@
this.MoveUpStripButton1 = new System.Windows.Forms.ToolStripButton(); this.MoveUpStripButton1 = new System.Windows.Forms.ToolStripButton();
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton(); this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
this.WatchCountLabel = new System.Windows.Forms.Label(); this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -221,7 +222,7 @@
// //
this.newWatchToolStripMenuItem.Name = "newWatchToolStripMenuItem"; this.newWatchToolStripMenuItem.Name = "newWatchToolStripMenuItem";
this.newWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); this.newWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.newWatchToolStripMenuItem.Size = new System.Drawing.Size(179, 22); this.newWatchToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.newWatchToolStripMenuItem.Text = "&New Watch"; this.newWatchToolStripMenuItem.Text = "&New Watch";
this.newWatchToolStripMenuItem.Click += new System.EventHandler(this.newWatchToolStripMenuItem_Click); this.newWatchToolStripMenuItem.Click += new System.EventHandler(this.newWatchToolStripMenuItem_Click);
// //
@ -229,7 +230,7 @@
// //
this.editWatchToolStripMenuItem.Name = "editWatchToolStripMenuItem"; this.editWatchToolStripMenuItem.Name = "editWatchToolStripMenuItem";
this.editWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); this.editWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.editWatchToolStripMenuItem.Size = new System.Drawing.Size(179, 22); this.editWatchToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.editWatchToolStripMenuItem.Text = "&Edit Watch"; this.editWatchToolStripMenuItem.Text = "&Edit Watch";
this.editWatchToolStripMenuItem.Click += new System.EventHandler(this.editWatchToolStripMenuItem_Click); this.editWatchToolStripMenuItem.Click += new System.EventHandler(this.editWatchToolStripMenuItem_Click);
// //
@ -237,7 +238,7 @@
// //
this.removeWatchToolStripMenuItem.Name = "removeWatchToolStripMenuItem"; this.removeWatchToolStripMenuItem.Name = "removeWatchToolStripMenuItem";
this.removeWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); this.removeWatchToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
this.removeWatchToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.removeWatchToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.removeWatchToolStripMenuItem.Text = "&Remove Watch"; this.removeWatchToolStripMenuItem.Text = "&Remove Watch";
this.removeWatchToolStripMenuItem.Click += new System.EventHandler(this.removeWatchToolStripMenuItem_Click); this.removeWatchToolStripMenuItem.Click += new System.EventHandler(this.removeWatchToolStripMenuItem_Click);
// //
@ -252,7 +253,7 @@
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(172, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(199, 6);
// //
// moveUpToolStripMenuItem // moveUpToolStripMenuItem
// //
@ -285,7 +286,7 @@
this.WatchListView.LabelEdit = true; this.WatchListView.LabelEdit = true;
this.WatchListView.Location = new System.Drawing.Point(25, 76); this.WatchListView.Location = new System.Drawing.Point(25, 76);
this.WatchListView.Name = "WatchListView"; this.WatchListView.Name = "WatchListView";
this.WatchListView.Size = new System.Drawing.Size(314, 324); this.WatchListView.Size = new System.Drawing.Size(314, 327);
this.WatchListView.TabIndex = 1; this.WatchListView.TabIndex = 1;
this.WatchListView.UseCompatibleStateImageBehavior = false; this.WatchListView.UseCompatibleStateImageBehavior = false;
this.WatchListView.View = System.Windows.Forms.View.Details; this.WatchListView.View = System.Windows.Forms.View.Details;
@ -436,11 +437,22 @@
this.WatchCountLabel.TabIndex = 4; this.WatchCountLabel.TabIndex = 4;
this.WatchCountLabel.Text = "0 watches"; this.WatchCountLabel.Text = "0 watches";
// //
// MessageLabel
//
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true;
this.MessageLabel.Location = new System.Drawing.Point(28, 408);
this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(187, 13);
this.MessageLabel.TabIndex = 5;
this.MessageLabel.Text = " ";
//
// RamWatch // RamWatch
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(364, 412); this.ClientSize = new System.Drawing.Size(364, 424);
this.Controls.Add(this.MessageLabel);
this.Controls.Add(this.WatchCountLabel); this.Controls.Add(this.WatchCountLabel);
this.Controls.Add(this.toolStrip1); this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.WatchListView); this.Controls.Add(this.WatchListView);
@ -505,5 +517,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripButton EditWatchToolStripButton1; private System.Windows.Forms.ToolStripButton EditWatchToolStripButton1;
private System.Windows.Forms.ToolStripButton DuplicateWatchToolStripButton; private System.Windows.Forms.ToolStripButton DuplicateWatchToolStripButton;
private System.Windows.Forms.Label MessageLabel;
} }
} }

View File

@ -20,6 +20,7 @@ namespace BizHawk.MultiClient
//Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked //Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked
//TODO: Call AskSave in main client X function //TODO: Call AskSave in main client X function
//Address can be changed, when that event is triggered, open the edit watch dialog //Address can be changed, when that event is triggered, open the edit watch dialog
//Append sets the currentWatach file to the new file rather than the old!
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight; int defaultHeight;
List<Watch> watchList = new List<Watch>(); List<Watch> watchList = new List<Watch>();
@ -107,6 +108,7 @@ namespace BizHawk.MultiClient
DisplayWatchList(); DisplayWatchList();
currentWatchFile = ""; currentWatchFile = "";
changes = false; changes = false;
MessageLabel.Text = "";
} }
} }
@ -202,6 +204,7 @@ namespace BizHawk.MultiClient
Global.Config.RecentWatches.Add(file.FullName); Global.Config.RecentWatches.Add(file.FullName);
changes = false; changes = false;
MessageLabel.Text = Path.GetFileName(file.FullName);
//Update the number of watches //Update the number of watches
WatchCountLabel.Text = count.ToString() + " watches"; WatchCountLabel.Text = count.ToString() + " watches";
} }
@ -232,6 +235,12 @@ namespace BizHawk.MultiClient
} }
} }
void Changes()
{
changes = true;
MessageLabel.Text = Path.GetFileName(currentWatchFile) + " *";
}
void EditWatch() void EditWatch()
{ {
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
@ -245,7 +254,7 @@ namespace BizHawk.MultiClient
if (r.userSelected == true) if (r.userSelected == true)
{ {
changes = true; Changes();
watchList[x] = r.watch; watchList[x] = r.watch;
DisplayWatchList(); DisplayWatchList();
} }
@ -253,7 +262,7 @@ namespace BizHawk.MultiClient
void RemoveWatch() void RemoveWatch()
{ {
changes = true; Changes();
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
foreach (int index in indexes) foreach (int index in indexes)
{ {
@ -273,7 +282,7 @@ namespace BizHawk.MultiClient
if (r.userSelected == true) if (r.userSelected == true)
{ {
changes = true; Changes();
watchList.Add(watchList[x]); watchList.Add(watchList[x]);
DisplayWatchList(); DisplayWatchList();
} }
@ -289,7 +298,10 @@ namespace BizHawk.MultiClient
temp = watchList[index]; temp = watchList[index];
watchList.Remove(watchList[index]); watchList.Remove(watchList[index]);
watchList.Insert(index - 1, temp); watchList.Insert(index - 1, temp);
changes = true; //Note: here it will get flagged many times redundantly potentially, but this avoids it being flag falsely when the user did not select an index
//Note: here it will get flagged many times redundantly potentially,
//but this avoids it being flag falsely when the user did not select an index
Changes();
} }
DisplayWatchList(); DisplayWatchList();
//TODO: Set highlighted items to be what the user had selected (in their new position) //TODO: Set highlighted items to be what the user had selected (in their new position)
@ -309,7 +321,10 @@ namespace BizHawk.MultiClient
watchList.Remove(watchList[index]); watchList.Remove(watchList[index]);
watchList.Insert(index + 1, temp); watchList.Insert(index + 1, temp);
} }
changes = true; //Note: here it will get flagged many times redundantly potnetially, but this avoids it being flag falsely when the user did not select an index
//Note: here it will get flagged many times redundantly potnetially,
//but this avoids it being flag falsely when the user did not select an index
Changes();
} }
DisplayWatchList(); DisplayWatchList();
//TODO: Set highlighted items to be what the user had selected (in their new position) //TODO: Set highlighted items to be what the user had selected (in their new position)
@ -392,7 +407,7 @@ namespace BizHawk.MultiClient
var file = GetSaveFileFromUser(); var file = GetSaveFileFromUser();
if (file != null) if (file != null)
SaveWatchFile(file.FullName); SaveWatchFile(file.FullName);
//TODO: inform the user (with using an annoying message box) MessageLabel.Text = Path.GetFileName(currentWatchFile) + " saved.";
} }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
@ -406,7 +421,7 @@ namespace BizHawk.MultiClient
if (file != null) if (file != null)
LoadWatchFile(file.FullName, true); LoadWatchFile(file.FullName, true);
DisplayWatchList(); DisplayWatchList();
changes = true; Changes();
} }
private void autoLoadToolStripMenuItem_Click(object sender, EventArgs e) private void autoLoadToolStripMenuItem_Click(object sender, EventArgs e)