Browse Source

Optimization, do not update variables if parent tree in Local Variables Pad is collapsed.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1411 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
cdb3bab310
  1. 42
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/TreeListViewDebuggerItem.cs

42
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/TreeListViewDebuggerItem.cs

@ -40,6 +40,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
} }
} }
bool IsVisible {
get {
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
if (!parent.IsExpanded) {
return false;
}
}
return true;
}
}
public TreeListViewDebuggerItem(Variable variable) public TreeListViewDebuggerItem(Variable variable)
{ {
this.variable = variable; this.variable = variable;
@ -54,20 +65,37 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
SubItems.Add(""); SubItems.Add("");
SubItems.Add(""); SubItems.Add("");
Update(); Update(this, null);
} }
bool waitingForParentToExpand = false;
void Update(object sender, DebuggerEventArgs e) void Update(object sender, DebuggerEventArgs e)
{ {
if (this.TreeListView is DebuggerTreeListView) { if (waitingForParentToExpand) return;
if (this.Parent != null && !IsVisible) {
// Delay the update until the parent is expanded
TreeListViewItemHanlder update = null;
update = delegate {
waitingForParentToExpand = false;
Update(this, null);
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
parent.AfterExpand -= update;
}
};
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
parent.AfterExpand += update;
}
waitingForParentToExpand = true;
return;
}
if (this.TreeListView != null) {
((DebuggerTreeListView)this.TreeListView).DelayRefresh(); ((DebuggerTreeListView)this.TreeListView).DelayRefresh();
Highlight = (Variable.Value.AsString != SubItems[1].Text);
} }
Highlight = (Variable.Value.AsString != SubItems[1].Text);
Update();
}
public void Update()
{
this.SubItems[0].Text = Variable.Name; this.SubItems[0].Text = Variable.Name;
this.SubItems[1].Text = Variable.Value.AsString; this.SubItems[1].Text = Variable.Value.AsString;
this.SubItems[2].Text = Variable.Value.Type; this.SubItems[2].Text = Variable.Value.Type;

Loading…
Cancel
Save