Ram Watch - convert message label into a Status bar with a error icon with similar functionality as ram search
This commit is contained in:
parent
e5b3138d15
commit
81a841057c
|
@ -139,14 +139,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void OutOfRangeCheck()
|
private void OutOfRangeCheck()
|
||||||
{
|
{
|
||||||
if (_searches.OutOfRangeAddress.Any())
|
ErrorIconButton.Visible = _searches.OutOfRangeAddress.Any();
|
||||||
{
|
|
||||||
ErrorIconButton.Visible = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorIconButton.Visible = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListView_QueryItemBkColor(int index, int column, ref Color color)
|
private void ListView_QueryItemBkColor(int index, int column, ref Color color)
|
||||||
|
@ -1476,11 +1469,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ErrorIconButton_Click(object sender, EventArgs e)
|
private void ErrorIconButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var _outOfRangeAddresses = _searches.OutOfRangeAddress.ToList();
|
var outOfRangeAddresses = _searches.OutOfRangeAddress.ToList();
|
||||||
|
|
||||||
SetRemovedMessage(_outOfRangeAddresses.Count);
|
SetRemovedMessage(outOfRangeAddresses.Count);
|
||||||
|
|
||||||
_searches.RemoveRange(_outOfRangeAddresses);
|
_searches.RemoveRange(outOfRangeAddresses);
|
||||||
|
|
||||||
WatchListView.ItemCount = _searches.Count;
|
WatchListView.ItemCount = _searches.Count;
|
||||||
SetTotal();
|
SetTotal();
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RamWatch));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RamWatch));
|
||||||
this.WatchCountLabel = new System.Windows.Forms.Label();
|
this.WatchCountLabel = new System.Windows.Forms.Label();
|
||||||
this.MessageLabel = new System.Windows.Forms.Label();
|
|
||||||
this.MemDomainLabel = new System.Windows.Forms.Label();
|
this.MemDomainLabel = new System.Windows.Forms.Label();
|
||||||
this.ListViewContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.ListViewContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.EditContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.EditContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -50,6 +49,8 @@
|
||||||
this.ShowChangeCountsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ShowChangeCountsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ShowDiffContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ShowDiffContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ShowDomainContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ShowDomainContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||||
|
this.MessageLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.toolStrip1 = new ToolStripEx();
|
this.toolStrip1 = new ToolStripEx();
|
||||||
this.newToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.newToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
|
@ -117,7 +118,9 @@
|
||||||
this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
|
this.ErrorIconButton = new System.Windows.Forms.ToolStripButton();
|
||||||
this.ListViewContextMenu.SuspendLayout();
|
this.ListViewContextMenu.SuspendLayout();
|
||||||
|
this.statusStrip1.SuspendLayout();
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -131,16 +134,6 @@
|
||||||
this.WatchCountLabel.TabIndex = 5;
|
this.WatchCountLabel.TabIndex = 5;
|
||||||
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(18, 362);
|
|
||||||
this.MessageLabel.Name = "MessageLabel";
|
|
||||||
this.MessageLabel.Size = new System.Drawing.Size(187, 13);
|
|
||||||
this.MessageLabel.TabIndex = 6;
|
|
||||||
this.MessageLabel.Text = " ";
|
|
||||||
//
|
|
||||||
// MemDomainLabel
|
// MemDomainLabel
|
||||||
//
|
//
|
||||||
this.MemDomainLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.MemDomainLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
@ -299,6 +292,23 @@
|
||||||
this.ShowDomainContextMenuItem.Text = "Show Domain";
|
this.ShowDomainContextMenuItem.Text = "Show Domain";
|
||||||
this.ShowDomainContextMenuItem.Click += new System.EventHandler(this.ShowDomainMenuItem_Click);
|
this.ShowDomainContextMenuItem.Click += new System.EventHandler(this.ShowDomainMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.ErrorIconButton,
|
||||||
|
this.MessageLabel});
|
||||||
|
this.statusStrip1.Location = new System.Drawing.Point(0, 356);
|
||||||
|
this.statusStrip1.Name = "statusStrip1";
|
||||||
|
this.statusStrip1.Size = new System.Drawing.Size(359, 22);
|
||||||
|
this.statusStrip1.TabIndex = 8;
|
||||||
|
this.statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// MessageLabel
|
||||||
|
//
|
||||||
|
this.MessageLabel.Name = "MessageLabel";
|
||||||
|
this.MessageLabel.Size = new System.Drawing.Size(31, 17);
|
||||||
|
this.MessageLabel.Text = " ";
|
||||||
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
this.toolStrip1.ClickThrough = true;
|
this.toolStrip1.ClickThrough = true;
|
||||||
|
@ -868,6 +878,7 @@
|
||||||
this.WatchListView.ItemCount = 0;
|
this.WatchListView.ItemCount = 0;
|
||||||
this.WatchListView.Location = new System.Drawing.Point(16, 76);
|
this.WatchListView.Location = new System.Drawing.Point(16, 76);
|
||||||
this.WatchListView.Name = "WatchListView";
|
this.WatchListView.Name = "WatchListView";
|
||||||
|
this.WatchListView.SelectAllInProgress = false;
|
||||||
this.WatchListView.selectedItem = -1;
|
this.WatchListView.selectedItem = -1;
|
||||||
this.WatchListView.Size = new System.Drawing.Size(327, 281);
|
this.WatchListView.Size = new System.Drawing.Size(327, 281);
|
||||||
this.WatchListView.TabIndex = 2;
|
this.WatchListView.TabIndex = 2;
|
||||||
|
@ -925,13 +936,24 @@
|
||||||
this.NotesColumn.Text = "Notes";
|
this.NotesColumn.Text = "Notes";
|
||||||
this.NotesColumn.Width = 128;
|
this.NotesColumn.Width = 128;
|
||||||
//
|
//
|
||||||
|
// ErrorIconButton
|
||||||
|
//
|
||||||
|
this.ErrorIconButton.BackColor = System.Drawing.Color.NavajoWhite;
|
||||||
|
this.ErrorIconButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.ErrorIconButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ExclamationRed;
|
||||||
|
this.ErrorIconButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.ErrorIconButton.Name = "ErrorIconButton";
|
||||||
|
this.ErrorIconButton.Size = new System.Drawing.Size(23, 20);
|
||||||
|
this.ErrorIconButton.Text = "Warning! Out of Range Addresses in list, click to remove them";
|
||||||
|
this.ErrorIconButton.Click += new System.EventHandler(this.ErrorIconButton_Click);
|
||||||
|
//
|
||||||
// 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(359, 378);
|
this.ClientSize = new System.Drawing.Size(359, 378);
|
||||||
|
this.Controls.Add(this.statusStrip1);
|
||||||
this.Controls.Add(this.MemDomainLabel);
|
this.Controls.Add(this.MemDomainLabel);
|
||||||
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.menuStrip1);
|
this.Controls.Add(this.menuStrip1);
|
||||||
|
@ -946,6 +968,8 @@
|
||||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragEnter);
|
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragEnter);
|
||||||
this.Enter += new System.EventHandler(this.NewRamWatch_Enter);
|
this.Enter += new System.EventHandler(this.NewRamWatch_Enter);
|
||||||
this.ListViewContextMenu.ResumeLayout(false);
|
this.ListViewContextMenu.ResumeLayout(false);
|
||||||
|
this.statusStrip1.ResumeLayout(false);
|
||||||
|
this.statusStrip1.PerformLayout();
|
||||||
this.toolStrip1.ResumeLayout(false);
|
this.toolStrip1.ResumeLayout(false);
|
||||||
this.toolStrip1.PerformLayout();
|
this.toolStrip1.PerformLayout();
|
||||||
this.menuStrip1.ResumeLayout(false);
|
this.menuStrip1.ResumeLayout(false);
|
||||||
|
@ -1020,8 +1044,7 @@
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||||
private System.Windows.Forms.ToolStripButton MoveUpStripButton1;
|
private System.Windows.Forms.ToolStripButton MoveUpStripButton1;
|
||||||
private System.Windows.Forms.ToolStripButton MoveDownStripButton1;
|
private System.Windows.Forms.ToolStripButton MoveDownStripButton1;
|
||||||
private System.Windows.Forms.Label WatchCountLabel;
|
private System.Windows.Forms.Label WatchCountLabel;
|
||||||
private System.Windows.Forms.Label MessageLabel;
|
|
||||||
private System.Windows.Forms.Label MemDomainLabel;
|
private System.Windows.Forms.Label MemDomainLabel;
|
||||||
private System.Windows.Forms.ToolStripSeparator Separator2;
|
private System.Windows.Forms.ToolStripSeparator Separator2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem OriginalMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem OriginalMenuItem;
|
||||||
|
@ -1044,5 +1067,8 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem ShowDomainContextMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ShowDomainContextMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||||
|
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripStatusLabel MessageLabel;
|
||||||
|
private System.Windows.Forms.ToolStripButton ErrorIconButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -150,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Global.Config.RecentWatches.Add(path);
|
Global.Config.RecentWatches.Add(path);
|
||||||
WatchListView.ItemCount = _watches.ItemCount;
|
WatchListView.ItemCount = _watches.ItemCount;
|
||||||
UpdateWatchCount();
|
UpdateWatchCount();
|
||||||
UpdateMessageLabel();
|
UpdateStatusBar();
|
||||||
_watches.Changes = false;
|
_watches.Changes = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,10 +170,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_watches.Load(file.FullName, append);
|
_watches.Load(file.FullName, append);
|
||||||
WatchListView.ItemCount = _watches.ItemCount;
|
WatchListView.ItemCount = _watches.ItemCount;
|
||||||
UpdateMessageLabel();
|
|
||||||
UpdateWatchCount();
|
UpdateWatchCount();
|
||||||
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
|
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
|
||||||
SetMemoryDomain(_watches.Domain.ToString());
|
SetMemoryDomain(_watches.Domain.ToString());
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
||||||
{
|
{
|
||||||
_watches.Reload();
|
_watches.Reload();
|
||||||
UpdateMessageLabel();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void Changes()
|
private void Changes()
|
||||||
{
|
{
|
||||||
_watches.Changes = true;
|
_watches.Changes = true;
|
||||||
UpdateMessageLabel();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ColumnPositions()
|
private void ColumnPositions()
|
||||||
|
@ -405,7 +405,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_watches.Clear();
|
_watches.Clear();
|
||||||
WatchListView.ItemCount = _watches.ItemCount;
|
WatchListView.ItemCount = _watches.ItemCount;
|
||||||
UpdateWatchCount();
|
UpdateWatchCount();
|
||||||
UpdateMessageLabel();
|
UpdateStatusBar();
|
||||||
_sortReverse = false;
|
_sortReverse = false;
|
||||||
_sortedColumn = string.Empty;
|
_sortedColumn = string.Empty;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var result = _watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(_watches.CurrentFileName));
|
var result = _watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(_watches.CurrentFileName));
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
UpdateMessageLabel(saved: true);
|
UpdateStatusBar(saved: true);
|
||||||
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
|
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MemDomainLabel.Text = Global.Emulator.SystemId + " " + _watches.Domain.Name;
|
MemDomainLabel.Text = Global.Emulator.SystemId + " " + _watches.Domain.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMessageLabel(bool saved = false)
|
private void UpdateStatusBar(bool saved = false)
|
||||||
{
|
{
|
||||||
var message = string.Empty;
|
var message = string.Empty;
|
||||||
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
||||||
|
@ -517,10 +517,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_watches.Any(watch => (watch.Address ?? 0) >= watch.Domain.Size))
|
var test1 = _watches.Any(watch => (watch.Address ?? 0) >= watch.Domain.Size);
|
||||||
{
|
|
||||||
message += " WARNING! Out of range addresses";
|
ErrorIconButton.Visible = _watches.Any(watch => (watch.Address ?? 0) >= watch.Domain.Size);
|
||||||
}
|
|
||||||
|
|
||||||
MessageLabel.Text = message;
|
MessageLabel.Text = message;
|
||||||
}
|
}
|
||||||
|
@ -628,7 +627,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (_watches.Save())
|
if (_watches.Save())
|
||||||
{
|
{
|
||||||
UpdateMessageLabel(saved: true);
|
UpdateStatusBar(saved: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -988,7 +987,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void NewRamWatch_Load(object sender, EventArgs e)
|
private void NewRamWatch_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
LoadConfigSettings();
|
LoadConfigSettings();
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewRamWatch_Activated(object sender, EventArgs e)
|
private void NewRamWatch_Activated(object sender, EventArgs e)
|
||||||
|
@ -1122,6 +1123,23 @@ namespace BizHawk.Client.EmuHawk
|
||||||
base.OnShown(e);
|
base.OnShown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ErrorIconButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var items = _watches
|
||||||
|
.Where(watch => (watch.Address ?? 0) >= watch.Domain.Size)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
_watches.Remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
WatchListView.ItemCount = _watches.ItemCount;
|
||||||
|
UpdateValues();
|
||||||
|
UpdateWatchCount();
|
||||||
|
UpdateStatusBar();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -120,6 +120,9 @@
|
||||||
<metadata name="ListViewContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="ListViewContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>336, 17</value>
|
<value>336, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>506, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>231, 17</value>
|
<value>231, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
Loading…
Reference in New Issue