Browse Source

Limit repainting of Local Variables Pad to 40 ms.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2908 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
7e46aa6f9d
  1. 3
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  2. 23
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs
  3. 25
      src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.cs

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

@ -230,9 +230,12 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -230,9 +230,12 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
using(new PrintTimes("Local Variables refresh")) {
try {
localVarList.BeginUpdate();
Utils.DoEvents(debuggedProcess.DebuggeeState);
TreeViewNode.SetContentRecursive(this, localVarList.Root.Children, new StackFrameNode(debuggedProcess.SelectedStackFrame).ChildNodes);
} catch(AbortedBecauseDebuggeeResumedException) {
} finally {
localVarList.EndUpdate();
}
}
}

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

@ -12,6 +12,8 @@ using System.Windows.Forms; @@ -12,6 +12,8 @@ using System.Windows.Forms;
using Aga.Controls.Tree;
using Debugger.Util;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.Pads;
@ -51,6 +53,9 @@ namespace Debugger.AddIn.TreeModel @@ -51,6 +53,9 @@ namespace Debugger.AddIn.TreeModel
SetContentRecursive(content);
}
static TimeSpan workTime = TimeSpan.FromMilliseconds(40);
static DateTime nextRepaintTime = DateTime.MinValue;
public void SetContentRecursive(AbstractNode content)
{
this.textChanged =
@ -68,9 +73,20 @@ namespace Debugger.AddIn.TreeModel @@ -68,9 +73,20 @@ namespace Debugger.AddIn.TreeModel
this.Children.Clear();
this.Collapse();
}
this.Tree.Invalidate();
// Repaint and process user commands
// Process user commands
Utils.DoEvents(localVarPad.Process.DebuggeeState);
// Repaint
if (HighPrecisionTimer.Now > nextRepaintTime) {
using(new PrintTime("Repainting Local Variables Pad")) {
try {
this.Tree.EndUpdate(); // Enable painting
Utils.DoEvents(localVarPad.Process.DebuggeeState); // Paint
} finally {
this.Tree.BeginUpdate(); // Disable painting
nextRepaintTime = HighPrecisionTimer.Now + workTime;
}
}
}
}
public static void SetContentRecursive(LocalVarPad localVarPad, IList<TreeNodeAdv> childNodes, IEnumerable<AbstractNode> contentEnum)
@ -115,8 +131,11 @@ namespace Debugger.AddIn.TreeModel @@ -115,8 +131,11 @@ namespace Debugger.AddIn.TreeModel
base.OnExpanded();
expandedNodes[FullName] = true;
try {
this.Tree.BeginUpdate();
LoadChilds();
} catch (AbortedBecauseDebuggeeResumedException) {
} finally {
this.Tree.EndUpdate();
}
}

25
src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.cs

@ -29,7 +29,7 @@ namespace Aga.Controls.Tree @@ -29,7 +29,7 @@ namespace Aga.Controls.Tree
private Pen _linePen;
private Pen _markPen;
private bool _suspendUpdate;
private int _suspendUpdate = 0;
private bool _needFullUpdate;
private bool _fireSelectionEvent;
private NodePlusMinus _plusMinus;
@ -318,18 +318,23 @@ namespace Aga.Controls.Tree @@ -318,18 +318,23 @@ namespace Aga.Controls.Tree
public void BeginUpdate()
{
_suspendUpdate = true;
_suspendUpdate++;
SuspendSelectionEvent = true;
}
public void EndUpdate()
{
_suspendUpdate = false;
if (_needFullUpdate)
FullUpdate();
else
UpdateView();
SuspendSelectionEvent = false;
if (_suspendUpdate == 0) {
throw new Exception("Number of calls to BeginUpdate does not match number of calls to EndUpdate.");
}
_suspendUpdate--;
if (_suspendUpdate == 0) {
if (_needFullUpdate)
FullUpdate();
else
UpdateView();
SuspendSelectionEvent = false;
}
}
public void ExpandAll()
@ -620,7 +625,7 @@ namespace Aga.Controls.Tree @@ -620,7 +625,7 @@ namespace Aga.Controls.Tree
internal void UpdateView()
{
if (!_suspendUpdate)
if (_suspendUpdate == 0)
Invalidate(false);
}
@ -909,7 +914,7 @@ namespace Aga.Controls.Tree @@ -909,7 +914,7 @@ namespace Aga.Controls.Tree
internal void SmartFullUpdate()
{
if (_suspendUpdate)
if (_suspendUpdate > 0)
_needFullUpdate = true;
else
FullUpdate();

Loading…
Cancel
Save