mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-01 22:33:37 +00:00
Debugger: Fixed issues with watch list and the "add to watch" shortcut
This commit is contained in:
parent
51cad0e870
commit
700a71446b
@ -13,7 +13,7 @@ namespace Mesen.GUI.Controls
|
||||
{
|
||||
private bool _preventCheck = false;
|
||||
private int _editItemIndex = -1;
|
||||
private string _originalText;
|
||||
private string _originalText = null;
|
||||
|
||||
public bool IsEditing
|
||||
{
|
||||
@ -41,6 +41,9 @@ namespace Mesen.GUI.Controls
|
||||
|
||||
protected override void OnBeforeLabelEdit(LabelEditEventArgs e)
|
||||
{
|
||||
if(_originalText == null) {
|
||||
_originalText = this.Items[e.Item].Text;
|
||||
}
|
||||
_editItemIndex = e.Item;
|
||||
base.OnBeforeLabelEdit(e);
|
||||
}
|
||||
@ -48,6 +51,7 @@ namespace Mesen.GUI.Controls
|
||||
protected override void OnAfterLabelEdit(LabelEditEventArgs e)
|
||||
{
|
||||
base.OnAfterLabelEdit(e);
|
||||
_originalText = null;
|
||||
_editItemIndex = -1;
|
||||
}
|
||||
|
||||
|
4
GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs
generated
4
GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs
generated
@ -59,6 +59,7 @@
|
||||
this.lstWatch.TabIndex = 6;
|
||||
this.lstWatch.UseCompatibleStateImageBehavior = false;
|
||||
this.lstWatch.View = System.Windows.Forms.View.Details;
|
||||
this.lstWatch.BeforeLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lstWatch_BeforeLabelEdit);
|
||||
this.lstWatch.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lstWatch_AfterLabelEdit);
|
||||
this.lstWatch.SelectedIndexChanged += new System.EventHandler(this.lstWatch_SelectedIndexChanged);
|
||||
this.lstWatch.Click += new System.EventHandler(this.lstWatch_Click);
|
||||
@ -89,9 +90,10 @@
|
||||
// mnuRemoveWatch
|
||||
//
|
||||
this.mnuRemoveWatch.Name = "mnuRemoveWatch";
|
||||
this.mnuRemoveWatch.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.mnuRemoveWatch.ShortcutKeyDisplayString = "Del";
|
||||
this.mnuRemoveWatch.Size = new System.Drawing.Size(183, 22);
|
||||
this.mnuRemoveWatch.Text = "Remove";
|
||||
this.mnuRemoveWatch.Click += new System.EventHandler(this.mnuRemoveWatch_Click);
|
||||
//
|
||||
// mnuHexDisplay
|
||||
//
|
||||
|
@ -106,11 +106,15 @@ namespace Mesen.GUI.Debugger
|
||||
|
||||
public void AddWatch(UInt32 address)
|
||||
{
|
||||
ListViewItem item = lstWatch.Items.Insert(lstWatch.Items.Count - 1, "$" + address.ToString("x"));
|
||||
ListViewItem item = lstWatch.Items.Insert(lstWatch.Items.Count - 1, "[$" + address.ToString("X") + "]");
|
||||
item.Tag = address;
|
||||
UpdateWatch();
|
||||
}
|
||||
|
||||
private void lstWatch_BeforeLabelEdit(object sender, LabelEditEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void lstWatch_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
||||
{
|
||||
this.BeginInvoke((MethodInvoker)(() => { this.UpdateWatch(e.Item); }));
|
||||
@ -139,5 +143,19 @@ namespace Mesen.GUI.Debugger
|
||||
lstWatch.SelectedItems[0].BeginEdit();
|
||||
}
|
||||
}
|
||||
|
||||
private void mnuRemoveWatch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(lstWatch.SelectedItems.Count >= 1) {
|
||||
var itemsToRemove = new List<ListViewItem>();
|
||||
foreach(ListViewItem item in lstWatch.SelectedItems) {
|
||||
itemsToRemove.Add(item);
|
||||
}
|
||||
foreach(ListViewItem item in itemsToRemove) {
|
||||
lstWatch.Items.Remove(item);
|
||||
}
|
||||
UpdateWatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user