Debugger: Preserve breakpoint list scroll position when disabling/enabling breakpoints
This commit is contained in:
parent
4b6d96834b
commit
5899427fa5
2 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,9 @@ namespace Mesen.GUI.Debugger.Controls
|
||||||
public void RefreshList()
|
public void RefreshList()
|
||||||
{
|
{
|
||||||
lstBreakpoints.ItemChecked -= new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
lstBreakpoints.ItemChecked -= new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
||||||
|
|
||||||
|
int topIndex = lstBreakpoints.TopItem != null ? lstBreakpoints.TopItem.Index : 0;
|
||||||
|
lstBreakpoints.BeginUpdate();
|
||||||
lstBreakpoints.Items.Clear();
|
lstBreakpoints.Items.Clear();
|
||||||
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
|
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
|
||||||
string address = "$" + breakpoint.Address.ToString("X");
|
string address = "$" + breakpoint.Address.ToString("X");
|
||||||
|
@ -50,6 +53,11 @@ namespace Mesen.GUI.Debugger.Controls
|
||||||
item.SubItems.Add(breakpoint.Condition);
|
item.SubItems.Add(breakpoint.Condition);
|
||||||
lstBreakpoints.Items.Add(item);
|
lstBreakpoints.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
lstBreakpoints.EndUpdate();
|
||||||
|
if(lstBreakpoints.Items.Count > 0) {
|
||||||
|
lstBreakpoints.TopItem = lstBreakpoints.Items[lstBreakpoints.Items.Count > topIndex ? topIndex : lstBreakpoints.Items.Count - 1];
|
||||||
|
}
|
||||||
|
|
||||||
lstBreakpoints.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
lstBreakpoints.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Mesen.GUI.Debugger.Controls
|
||||||
InteropEmu.DebugGetState(ref state);
|
InteropEmu.DebugGetState(ref state);
|
||||||
_programCounter = state.CPU.DebugPC;
|
_programCounter = state.CPU.DebugPC;
|
||||||
|
|
||||||
|
this.lstCallstack.BeginUpdate();
|
||||||
this.lstCallstack.Items.Clear();
|
this.lstCallstack.Items.Clear();
|
||||||
int subStartAddr = -1;
|
int subStartAddr = -1;
|
||||||
ListViewItem item;
|
ListViewItem item;
|
||||||
|
@ -60,6 +61,7 @@ namespace Mesen.GUI.Debugger.Controls
|
||||||
}
|
}
|
||||||
item = this.lstCallstack.Items.Insert(0, "$" + (subStartAddr >= 0 ? subStartAddr.ToString("X4") : "--------"));
|
item = this.lstCallstack.Items.Insert(0, "$" + (subStartAddr >= 0 ? subStartAddr.ToString("X4") : "--------"));
|
||||||
item.SubItems.Add("@ $" + _programCounter.ToString("X4"));
|
item.SubItems.Add("@ $" + _programCounter.ToString("X4"));
|
||||||
|
this.lstCallstack.EndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstCallstack_DoubleClick(object sender, EventArgs e)
|
private void lstCallstack_DoubleClick(object sender, EventArgs e)
|
||||||
|
|
Loading…
Add table
Reference in a new issue