From 19645e54bc473f90ea03e3a941f469c4d322d33e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 28 Sep 2019 09:11:41 -0500 Subject: [PATCH] Ram watch - a few cleanups, and change spaces to tabs --- .../tools/Watch/RamWatch.cs | 192 +++++++++--------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index 28e312da29..82cca1cfd5 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk private int _defaultWidth; private int _defaultHeight; - private string _sortedColumn = ""; + private string _sortedColumn; private bool _sortReverse; private bool _paused; @@ -94,13 +94,13 @@ namespace BizHawk.Client.EmuHawk get { return SelectedItems.Where(x => !x.IsSeparator); } } - private IEnumerable SelectedSeparators - { - get - { - return SelectedItems.Where(x => x.IsSeparator); - } - } + private IEnumerable SelectedSeparators + { + get + { + return SelectedItems.Where(x => x.IsSeparator); + } + } public IEnumerable Watches { @@ -403,7 +403,7 @@ namespace BizHawk.Client.EmuHawk { if (sw.Domain != SelectedWatches.First().Domain) { - throw new InvalidOperationException("Can't edit multiple watches on varying memorydomains"); + throw new InvalidOperationException("Can't edit multiple watches on varying memory domains"); } } @@ -436,32 +436,32 @@ namespace BizHawk.Client.EmuHawk UpdateValues(); } - else if (SelectedSeparators.Any() && !duplicate) - { - var inputPrompt = new InputPrompt - { - Text = "Edit Separator", - StartLocation = this.ChildPointToScreen(WatchListView), - Message = "Separator Text:", - TextInputType = InputPrompt.InputType.Text - }; + else if (SelectedSeparators.Any() && !duplicate) + { + var inputPrompt = new InputPrompt + { + Text = "Edit Separator", + StartLocation = this.ChildPointToScreen(WatchListView), + Message = "Separator Text:", + TextInputType = InputPrompt.InputType.Text + }; - var result = inputPrompt.ShowHawkDialog(); + var result = inputPrompt.ShowHawkDialog(); - if (result == DialogResult.OK) - { - Changes(); + if (result == DialogResult.OK) + { + Changes(); - for (int i = 0; i < SelectedSeparators.Count(); i++) - { - var sep = SelectedSeparators.ToList()[i]; - sep.Notes = inputPrompt.PromptText; - _watches[indexes[i]] = sep; - } - } + for (int i = 0; i < SelectedSeparators.Count(); i++) + { + var sep = SelectedSeparators.ToList()[i]; + sep.Notes = inputPrompt.PromptText; + _watches[indexes[i]] = sep; + } + } - UpdateValues(); - } + UpdateValues(); + } } private string ComputeDisplayType(Watch w) @@ -667,15 +667,15 @@ namespace BizHawk.Client.EmuHawk return; } - if (_watches[index].IsSeparator) - { - if (WatchListView.Columns[column].Name == WatchList.ADDRESS) - { - text = _watches[index].Notes; - } + if (_watches[index].IsSeparator) + { + if (WatchListView.Columns[column].Name == WatchList.ADDRESS) + { + text = _watches[index].Notes; + } - return; - } + return; + } var columnName = WatchListView.Columns[column].Name; @@ -778,8 +778,8 @@ namespace BizHawk.Client.EmuHawk RemoveWatchMenuItem.Enabled = MoveUpMenuItem.Enabled = MoveDownMenuItem.Enabled = - MoveTopMenuItem.Enabled = - MoveBottomMenuItem.Enabled = + MoveTopMenuItem.Enabled = + MoveBottomMenuItem.Enabled = SelectedIndices.Any(); PokeAddressMenuItem.Enabled = @@ -960,67 +960,67 @@ namespace BizHawk.Client.EmuHawk WatchListView.ItemCount = _watches.Count; } - private void MoveTopMenuItem_Click(object sender, EventArgs e) - { - var indexes = SelectedIndices.ToList(); - if (!indexes.Any()) - { - return; - } + private void MoveTopMenuItem_Click(object sender, EventArgs e) + { + var indexes = SelectedIndices.ToList(); + if (!indexes.Any()) + { + return; + } - for (int i = 0; i < indexes.Count; i++) - { - var watch = _watches[indexes[i]]; - _watches.RemoveAt(indexes[i]); - _watches.Insert(i, watch); - indexes[i] = i; - } + for (int i = 0; i < indexes.Count; i++) + { + var watch = _watches[indexes[i]]; + _watches.RemoveAt(indexes[i]); + _watches.Insert(i, watch); + indexes[i] = i; + } - Changes(); + Changes(); - WatchListView.SelectedIndices.Clear(); - foreach (var t in indexes) - { - WatchListView.SelectItem(t, true); - } + WatchListView.SelectedIndices.Clear(); + foreach (var t in indexes) + { + WatchListView.SelectItem(t, true); + } - WatchListView.ItemCount = _watches.Count; - } + WatchListView.ItemCount = _watches.Count; + } - private void MoveBottomMenuItem_Click(object sender, EventArgs e) - { - var indices = SelectedIndices.ToList(); - if (indices.Count == 0) // || indices.Last() == _watches.Count - 1) - { - return; - } + private void MoveBottomMenuItem_Click(object sender, EventArgs e) + { + var indices = SelectedIndices.ToList(); + if (indices.Count == 0) // || indices.Last() == _watches.Count - 1) + { + return; + } - for (var i = 0; i < indices.Count; i++) - { - var watch = _watches[indices[i] - i]; - _watches.RemoveAt(indices[i] - i); - _watches.Insert(_watches.Count, watch); - //_watches.Add(watch); - //indices[i] = (_watches.Count - 1 - indices.Count) + i; - } + for (var i = 0; i < indices.Count; i++) + { + var watch = _watches[indices[i] - i]; + _watches.RemoveAt(indices[i] - i); + _watches.Insert(_watches.Count, watch); + //_watches.Add(watch); + //indices[i] = (_watches.Count - 1 - indices.Count) + i; + } - var newInd = new List(); - for (int i = 0, x = _watches.Count - indices.Count; i < indices.Count; i++, x++) - { - newInd.Add(x); - } + var newInd = new List(); + for (int i = 0, x = _watches.Count - indices.Count; i < indices.Count; i++, x++) + { + newInd.Add(x); + } - WatchListView.SelectedIndices.Clear(); - foreach (var t in newInd) - { - WatchListView.SelectItem(t, true); - } - - Changes(); - WatchListView.ItemCount = _watches.Count; - } + WatchListView.SelectedIndices.Clear(); + foreach (var t in newInd) + { + WatchListView.SelectItem(t, true); + } - private void SelectAllMenuItem_Click(object sender, EventArgs e) + Changes(); + WatchListView.ItemCount = _watches.Count; + } + + private void SelectAllMenuItem_Click(object sender, EventArgs e) { WatchListView.SelectAll(); } @@ -1173,8 +1173,8 @@ namespace BizHawk.Client.EmuHawk InsertSeperatorContextMenuItem.Visible = MoveUpContextMenuItem.Visible = MoveDownContextMenuItem.Visible = - MoveTopContextMenuItem.Visible = - MoveBottomContextMenuItem.Visible = + MoveTopContextMenuItem.Visible = + MoveBottomContextMenuItem.Visible = indexes.Count > 0; ReadBreakpointContextMenuItem.Visible = @@ -1340,5 +1340,5 @@ namespace BizHawk.Client.EmuHawk { base.GenericDragEnter(sender, e); } - } + } }