Debugger: Fixed delete key not working in watch edit mode

This commit is contained in:
Sour 2020-02-22 21:22:47 -05:00
parent 483ffe1143
commit 58c18adc10
2 changed files with 13 additions and 2 deletions

View file

@ -322,6 +322,9 @@ namespace Mesen.GUI.Config
if(parentForm is BaseForm) {
ProcessCmdKeyHandler onProcessCmdKeyHandler = (Keys keyData, ref bool processed) => {
if(!processed && item.Enabled && parent.ContainsFocus && keyData == keys) {
if(parent is IShortcutParent && ((IShortcutParent)parent).SuppressShortcut) {
return;
}
item.PerformClick();
processed = true;
}
@ -389,4 +392,9 @@ namespace Mesen.GUI.Config
this.Name = name;
}
}
public interface IShortcutParent
{
bool SuppressShortcut { get; }
}
}

View file

@ -16,7 +16,7 @@ using Mesen.GUI.Debugger.Labels;
namespace Mesen.GUI.Debugger
{
public partial class ctrlWatch : BaseControl
public partial class ctrlWatch : BaseControl, IShortcutParent
{
private Color _updatedColor = Color.Red;
private Color _normalColor = SystemColors.ControlText;
@ -54,6 +54,9 @@ namespace Mesen.GUI.Debugger
}
}
//Suppress watch shortcuts while in edit mode
bool IShortcutParent.SuppressShortcut { get { return _isEditing; } }
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
@ -178,7 +181,6 @@ namespace Mesen.GUI.Debugger
private void lstWatch_SelectedIndexChanged(object sender, EventArgs e)
{
mnuRemoveWatch.Enabled = lstWatch.SelectedItems.Count >= 1;
UpdateActions();
}
@ -188,6 +190,7 @@ namespace Mesen.GUI.Debugger
mnuDecimalDisplay.Checked = ConfigManager.Config.Debug.Debugger.WatchFormat == WatchFormatStyle.Signed;
mnuBinaryDisplay.Checked = ConfigManager.Config.Debug.Debugger.WatchFormat == WatchFormatStyle.Binary;
mnuRowDisplayFormat.Enabled = lstWatch.SelectedItems.Count > 0;
mnuRemoveWatch.Enabled = lstWatch.SelectedItems.Count >= 1;
mnuEditInMemoryViewer.Enabled = false;
mnuViewInDisassembly.Enabled = false;