From c0d5437ff4980e6eaf63256af0005ed8c9065683 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 9 Jun 2012 21:57:00 +0000 Subject: [PATCH] Ram Watch - revert "fix" to watch count display, make watch list count update in appropriate places, don't count separators in watch count, fix cosmetically be showing "watch" instead of "watches" when there is 1 address --- BizHawk.MultiClient/tools/RamWatch.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index c737cea949..31bcadf41e 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -88,7 +88,8 @@ namespace BizHawk.MultiClient WatchListView.BlazingFast = true; WatchListView.Refresh(); WatchListView.BlazingFast = false; - WatchCountLabel.Text = watchList.Count.ToString() + " watches"; + + } public void AddWatch(Watch w) @@ -280,6 +281,7 @@ namespace BizHawk.MultiClient { watchList.Clear(); DisplayWatchList(); + UpdateWatchCount(); currentFile = ""; changes = false; MessageLabel.Text = ""; @@ -293,6 +295,20 @@ namespace BizHawk.MultiClient return WatchCommon.SaveWchFile(path, Domain.Name, watchList); } + private void UpdateWatchCount() + { + int count = 0; + foreach (Watch w in watchList) + { + if (!(w.type == atype.SEPARATOR)) + { + count++; + } + } + + WatchCountLabel.Text = count.ToString() + (count == 1 ? " watch" : " watches"); + } + public bool LoadWatchFile(string path, bool append) { string domain = ""; @@ -306,6 +322,7 @@ namespace BizHawk.MultiClient } changes = false; MessageLabel.Text = Path.GetFileNameWithoutExtension(path); + UpdateWatchCount(); Global.Config.RecentWatches.Add(path); SetMemoryDomain(WatchCommon.GetDomainPos(domain)); return true; @@ -339,6 +356,7 @@ namespace BizHawk.MultiClient watchList.Add(r.watch); Changes(); DisplayWatchList(); + UpdateWatchCount(); } } @@ -387,6 +405,7 @@ namespace BizHawk.MultiClient DisplayWatchList(); } UpdateValues(); + UpdateWatchCount(); } void DuplicateWatch() @@ -411,6 +430,7 @@ namespace BizHawk.MultiClient } } UpdateValues(); + UpdateWatchCount(); } void MoveUp()