Ram watch - a few cleanups, and change spaces to tabs

This commit is contained in:
adelikat 2019-09-28 09:11:41 -05:00
parent 5531c8731c
commit 19645e54bc
1 changed files with 96 additions and 96 deletions

View File

@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
private int _defaultWidth; private int _defaultWidth;
private int _defaultHeight; private int _defaultHeight;
private string _sortedColumn = ""; private string _sortedColumn;
private bool _sortReverse; private bool _sortReverse;
private bool _paused; private bool _paused;
@ -94,13 +94,13 @@ namespace BizHawk.Client.EmuHawk
get { return SelectedItems.Where(x => !x.IsSeparator); } get { return SelectedItems.Where(x => !x.IsSeparator); }
} }
private IEnumerable<Watch> SelectedSeparators private IEnumerable<Watch> SelectedSeparators
{ {
get get
{ {
return SelectedItems.Where(x => x.IsSeparator); return SelectedItems.Where(x => x.IsSeparator);
} }
} }
public IEnumerable<Watch> Watches public IEnumerable<Watch> Watches
{ {
@ -403,7 +403,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (sw.Domain != SelectedWatches.First().Domain) 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(); UpdateValues();
} }
else if (SelectedSeparators.Any() && !duplicate) else if (SelectedSeparators.Any() && !duplicate)
{ {
var inputPrompt = new InputPrompt var inputPrompt = new InputPrompt
{ {
Text = "Edit Separator", Text = "Edit Separator",
StartLocation = this.ChildPointToScreen(WatchListView), StartLocation = this.ChildPointToScreen(WatchListView),
Message = "Separator Text:", Message = "Separator Text:",
TextInputType = InputPrompt.InputType.Text TextInputType = InputPrompt.InputType.Text
}; };
var result = inputPrompt.ShowHawkDialog(); var result = inputPrompt.ShowHawkDialog();
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
Changes(); Changes();
for (int i = 0; i < SelectedSeparators.Count(); i++) for (int i = 0; i < SelectedSeparators.Count(); i++)
{ {
var sep = SelectedSeparators.ToList()[i]; var sep = SelectedSeparators.ToList()[i];
sep.Notes = inputPrompt.PromptText; sep.Notes = inputPrompt.PromptText;
_watches[indexes[i]] = sep; _watches[indexes[i]] = sep;
} }
} }
UpdateValues(); UpdateValues();
} }
} }
private string ComputeDisplayType(Watch w) private string ComputeDisplayType(Watch w)
@ -667,15 +667,15 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (_watches[index].IsSeparator) if (_watches[index].IsSeparator)
{ {
if (WatchListView.Columns[column].Name == WatchList.ADDRESS) if (WatchListView.Columns[column].Name == WatchList.ADDRESS)
{ {
text = _watches[index].Notes; text = _watches[index].Notes;
} }
return; return;
} }
var columnName = WatchListView.Columns[column].Name; var columnName = WatchListView.Columns[column].Name;
@ -778,8 +778,8 @@ namespace BizHawk.Client.EmuHawk
RemoveWatchMenuItem.Enabled = RemoveWatchMenuItem.Enabled =
MoveUpMenuItem.Enabled = MoveUpMenuItem.Enabled =
MoveDownMenuItem.Enabled = MoveDownMenuItem.Enabled =
MoveTopMenuItem.Enabled = MoveTopMenuItem.Enabled =
MoveBottomMenuItem.Enabled = MoveBottomMenuItem.Enabled =
SelectedIndices.Any(); SelectedIndices.Any();
PokeAddressMenuItem.Enabled = PokeAddressMenuItem.Enabled =
@ -960,67 +960,67 @@ namespace BizHawk.Client.EmuHawk
WatchListView.ItemCount = _watches.Count; WatchListView.ItemCount = _watches.Count;
} }
private void MoveTopMenuItem_Click(object sender, EventArgs e) private void MoveTopMenuItem_Click(object sender, EventArgs e)
{ {
var indexes = SelectedIndices.ToList(); var indexes = SelectedIndices.ToList();
if (!indexes.Any()) if (!indexes.Any())
{ {
return; return;
} }
for (int i = 0; i < indexes.Count; i++) for (int i = 0; i < indexes.Count; i++)
{ {
var watch = _watches[indexes[i]]; var watch = _watches[indexes[i]];
_watches.RemoveAt(indexes[i]); _watches.RemoveAt(indexes[i]);
_watches.Insert(i, watch); _watches.Insert(i, watch);
indexes[i] = i; indexes[i] = i;
} }
Changes(); Changes();
WatchListView.SelectedIndices.Clear(); WatchListView.SelectedIndices.Clear();
foreach (var t in indexes) foreach (var t in indexes)
{ {
WatchListView.SelectItem(t, true); WatchListView.SelectItem(t, true);
} }
WatchListView.ItemCount = _watches.Count; WatchListView.ItemCount = _watches.Count;
} }
private void MoveBottomMenuItem_Click(object sender, EventArgs e) private void MoveBottomMenuItem_Click(object sender, EventArgs e)
{ {
var indices = SelectedIndices.ToList(); var indices = SelectedIndices.ToList();
if (indices.Count == 0) // || indices.Last() == _watches.Count - 1) if (indices.Count == 0) // || indices.Last() == _watches.Count - 1)
{ {
return; return;
} }
for (var i = 0; i < indices.Count; i++) for (var i = 0; i < indices.Count; i++)
{ {
var watch = _watches[indices[i] - i]; var watch = _watches[indices[i] - i];
_watches.RemoveAt(indices[i] - i); _watches.RemoveAt(indices[i] - i);
_watches.Insert(_watches.Count, watch); _watches.Insert(_watches.Count, watch);
//_watches.Add(watch); //_watches.Add(watch);
//indices[i] = (_watches.Count - 1 - indices.Count) + i; //indices[i] = (_watches.Count - 1 - indices.Count) + i;
} }
var newInd = new List<int>(); var newInd = new List<int>();
for (int i = 0, x = _watches.Count - indices.Count; i < indices.Count; i++, x++) for (int i = 0, x = _watches.Count - indices.Count; i < indices.Count; i++, x++)
{ {
newInd.Add(x); newInd.Add(x);
} }
WatchListView.SelectedIndices.Clear(); WatchListView.SelectedIndices.Clear();
foreach (var t in newInd) foreach (var t in newInd)
{ {
WatchListView.SelectItem(t, true); WatchListView.SelectItem(t, true);
} }
Changes();
WatchListView.ItemCount = _watches.Count;
}
private void SelectAllMenuItem_Click(object sender, EventArgs e) Changes();
WatchListView.ItemCount = _watches.Count;
}
private void SelectAllMenuItem_Click(object sender, EventArgs e)
{ {
WatchListView.SelectAll(); WatchListView.SelectAll();
} }
@ -1173,8 +1173,8 @@ namespace BizHawk.Client.EmuHawk
InsertSeperatorContextMenuItem.Visible = InsertSeperatorContextMenuItem.Visible =
MoveUpContextMenuItem.Visible = MoveUpContextMenuItem.Visible =
MoveDownContextMenuItem.Visible = MoveDownContextMenuItem.Visible =
MoveTopContextMenuItem.Visible = MoveTopContextMenuItem.Visible =
MoveBottomContextMenuItem.Visible = MoveBottomContextMenuItem.Visible =
indexes.Count > 0; indexes.Count > 0;
ReadBreakpointContextMenuItem.Visible = ReadBreakpointContextMenuItem.Visible =
@ -1340,5 +1340,5 @@ namespace BizHawk.Client.EmuHawk
{ {
base.GenericDragEnter(sender, e); base.GenericDragEnter(sender, e);
} }
} }
} }