Browse Source

Updating Local Variables Pad to work with the new TreeView

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2803 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
c6948d0f0f
  1. 10
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  2. 30
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs

10
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -118,16 +118,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
localVarList.VisibleChanged += delegate { if (localVarList.Visible) RefreshPad(); }; localVarList.VisibleChanged += delegate { if (localVarList.Visible) RefreshPad(); };
localVarList.SizeChanged += delegate { RefreshPad(); }; localVarList.SizeChanged += delegate { RefreshPad(); };
localVarList.Expanding += delegate(object sender, TreeViewAdvEventArgs e) {
if (e.Node is TreeViewNode) ((TreeViewNode)e.Node).OnExpanding();
};
localVarList.Expanded += delegate(object sender, TreeViewAdvEventArgs e) {
if (e.Node is TreeViewNode) ((TreeViewNode)e.Node).OnExpanded();
};
localVarList.Collapsed += delegate(object sender, TreeViewAdvEventArgs e) {
if (e.Node is TreeViewNode) ((TreeViewNode)e.Node).OnCollapsed();
};
NodeIcon iconControl = new ItemIcon(); NodeIcon iconControl = new ItemIcon();
iconControl.ParentColumn = nameColumn; iconControl.ParentColumn = nameColumn;
localVarList.NodeControls.Add(iconControl); localVarList.NodeControls.Add(iconControl);

30
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs

@ -47,17 +47,16 @@ namespace Debugger.AddIn.TreeModel
{ {
this.content = content; this.content = content;
this.IsLeaf = (content.ChildNodes == null); this.IsLeaf = (content.ChildNodes == null);
this.IsExpanded = (content.ChildNodes != null && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]);
if (this.IsExpanded) {
loadChildsWhenExpanding = false;
SetContentRecursive(this.Tree, this.Children, this.Content.ChildNodes);
} else {
loadChildsWhenExpanding = true; loadChildsWhenExpanding = true;
if (content.ChildNodes != null && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) {
this.Expand();
} else {
this.Collapse();
this.Children.Clear(); this.Children.Clear();
} }
} }
public static void SetContentRecursive(TreeViewAdv tree, Collection<TreeNodeAdv> childNodes, IEnumerable<AbstractNode> contentEnum) public static void SetContentRecursive(TreeViewAdv tree, IList<TreeNodeAdv> childNodes, IEnumerable<AbstractNode> contentEnum)
{ {
contentEnum = contentEnum ?? new AbstractNode[0]; contentEnum = contentEnum ?? new AbstractNode[0];
@ -72,7 +71,6 @@ namespace Debugger.AddIn.TreeModel
// Add // Add
childNodes.Add(new TreeViewNode(tree, content)); childNodes.Add(new TreeViewNode(tree, content));
} }
tree.FullUpdate();
DoEvents(); DoEvents();
index++; index++;
} }
@ -81,28 +79,32 @@ namespace Debugger.AddIn.TreeModel
while(childNodes.Count > count) { while(childNodes.Count > count) {
childNodes.RemoveAt(count); childNodes.RemoveAt(count);
} }
tree.FullUpdate();
DoEvents(); DoEvents();
} }
public void OnExpanding() protected override void OnExpanding()
{ {
base.OnExpanding();
if (loadChildsWhenExpanding) { if (loadChildsWhenExpanding) {
loadChildsWhenExpanding = false; loadChildsWhenExpanding = false;
SetContentRecursive(this.Tree, this.Children, this.Content.ChildNodes); SetContentRecursive(this.Tree, this.Children, this.Content.ChildNodes);
this.IsExpandedOnce = true;
this.Tree.UpdateSelection();
this.Tree.FullUpdate();
} }
} }
public void OnExpanded() protected override void OnExpanded()
{ {
base.OnExpanded();
expandedNodes[FullName] = true; expandedNodes[FullName] = true;
} }
public void OnCollapsed() protected override void OnCollapsing()
{
base.OnCollapsing();
}
protected override void OnCollapsed()
{ {
base.OnCollapsed();
expandedNodes[FullName] = false; expandedNodes[FullName] = false;
} }

Loading…
Cancel
Save