diff --git a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj index 967cd4788b..8c8d10176a 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj +++ b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj @@ -183,14 +183,12 @@ - - @@ -248,15 +246,7 @@ - - - - - - - - diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs index 7893dfd990..ffbfefaf63 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs @@ -31,7 +31,7 @@ namespace Debugger.AddIn.Visualizers public static ReadOnlyCollection GetAllDescriptors() { if (allDescriptors == null) { - allDescriptors = new List(CreateAllDescriptors()).AsReadOnly(); + allDescriptors = CreateAllDescriptors().ToList().AsReadOnly(); } return allDescriptors; } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/BoxDotFormatter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/BoxDotFormatter.cs deleted file mode 100644 index f37562f41b..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/BoxDotFormatter.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Text; -using System.Windows; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// that treats node as a atomic "box". Edges go from box to box. - /// - public class BoxDotFormatter : DotFormatter - { - public BoxDotFormatter(PositionedGraph posGraph) : base(posGraph) - { - } - - protected override void appendPosNode(PositionedGraphNode node, StringBuilder builder) - { - string nodeName = genId.GetNextId().ToString(); - nodeNames[node] = nodeName; - - Rect neatoInput = transform.NodeToNeatoInput(node); - - string dotFormatNode = - string.Format(this.neatoDoubleFormatter, - "{0} [pos=\"{1},{2}!\" width=\"{3}\" height=\"{4}\"];", - nodeName, neatoInput.Location.X, neatoInput.Location.Y, neatoInput.Width, neatoInput.Height); - builder.AppendLine(dotFormatNode); - } - - protected override void appendPosEdge(PositionedEdge edge, StringBuilder builder) - { - string sourceNodeName = nodeNames[edge.Source.ContainingNode]; - string targetNodeName = nodeNames[edge.Target]; - - builder.AppendLine(string.Format("{0} -> {1}", sourceNodeName, targetNodeName)); - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/DotFormatter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/DotFormatter.cs deleted file mode 100644 index 7c22473b17..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/DotFormatter.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using System.Linq; -using System.Windows; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// Converts - /// Gets Graphviz's dot format string for wrapped positioned graph. - /// - public string OutputGraphInDotFormat() - { - StringBuilder dotStringBuilder = new StringBuilder(getGraphHeader()); - - foreach (PositionedGraphNode posNode in this.posGraph.Nodes) - { - appendPosNode(posNode, dotStringBuilder); - } - foreach (PositionedEdge posEdge in this.posGraph.Edges) - { - appendPosEdge(posEdge, dotStringBuilder); - } - - dotStringBuilder.AppendLine(getGraphFooter()); - return dotStringBuilder.ToString(); - } - - private bool validateSplinePoints(PositionedEdge edge) - { - // must have correct number of points: one start point and 3 points per bezier segment - return ((edge.SplinePoints.Count - 1) % 3) == 0; - } - - /// - /// Parses edge positions (from Graphviz's plain format) and sets these positions to underlying positioned graph. - /// - /// Graph with positions in Graphviz's plain format - /// with edge positions filled. - public PositionedGraph ParseEdgePositions(string dotGraphString) - { - using (StringReader reader = new System.IO.StringReader(dotGraphString)) - { - skipAfterPattern(reader, "node " + nodeNames[posGraph.Nodes.First()] + " "); - Point neatoFirstNodePos = readPoint(reader); - PositionedGraphNode firstNode = posGraph.Nodes.First(); - Point firstNodePosOur = transform.AsNeato(firstNode.Center); - // determine how Neato shifted the nodes - transform.NeatoShiftX = neatoFirstNodePos.X - firstNodePosOur.X; - transform.NeatoShiftY = neatoFirstNodePos.Y - firstNodePosOur.Y; - - // assume that edges on output are in the same order as posGraph.Edges (!) - foreach (PositionedEdge posEdge in posGraph.Edges) - { - skipAfterPattern(reader, "edge "); - - readWord(reader); // source node name - readWord(reader); // target node name - - int splinePointCount = readInt(reader); - for (int i = 0; i < splinePointCount; i++) - { - Point edgePoint = readPoint(reader); - edgePoint = transform.FromNeatoOutput(edgePoint); - posEdge.SplinePoints.Add(edgePoint); - } - - bool edgeOk = validateSplinePoints(posEdge); - if (!edgeOk) - throw new DebuggerVisualizerException("Parsed edge invalid"); - } - } - // return original graph with filled edge positions - return this.posGraph; - } - - private Point readPoint(TextReader reader) - { - double x = readDouble(reader); - double y = readDouble(reader); - - return new Point(x, y); - } - - private double readDouble(TextReader reader) - { - return double.Parse(readWord(reader), this.neatoDoubleFormatter.DoubleCulture); - } - - private int readInt(TextReader reader) - { - return int.Parse(readWord(reader)); - } - - private string readWord(TextReader reader) - { - StringBuilder word = new StringBuilder(); - int ch = ' '; - while ((ch = reader.Read()) != ' ') - { - if (ch == -1 || ch == '\n' || ch == '\t') - break; - - word.Append((char)ch); - } - return word.ToString(); - } - - private bool skipAfterPattern(StringReader reader, string pattern) - { - int ch = -1; - int pIndex = 0; - int pTarget = pattern.Length; - while ((ch = reader.Read()) != -1) - { - if (ch == pattern[pIndex]) - { - pIndex++; - if (pIndex == pTarget) - return true; - } - else - { - pIndex = 0; - } - } - return false; - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/IdGenerator.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/IdGenerator.cs deleted file mode 100644 index 77eb424c28..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/IdGenerator.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// Generates sequential ids, usefull for node and edge ids. - /// - public class IdGenerator - { - int currentId = 0; - - public IdGenerator() - { - } - - public int GetNextId() - { - return currentId++; - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoDoubleFormatter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoDoubleFormatter.cs deleted file mode 100644 index 01a7064ce2..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoDoubleFormatter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Globalization; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// When used as IFormatProvider in string.Format, formats doubles to be suitable for Neato. - /// - public class NeatoDoubleFormatter : IFormatProvider, ICustomFormatter - { - private CultureInfo doubleCulture = CultureInfo.GetCultureInfo("en-US"); - /// - /// CultureInfo used for formatting and parsing doubles (en-US). - /// - public CultureInfo DoubleCulture - { - get { return this.doubleCulture; } - } - - public object GetFormat(Type formatType) - { - if (formatType == typeof(ICustomFormatter)) - return this; - else - return null; - } - - public string Format(string format, object arg, IFormatProvider formatProvider) - { - return string.Format(doubleCulture, "{0:0.000}", arg); - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoEdgeRouter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoEdgeRouter.cs deleted file mode 100644 index 7482282a08..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoEdgeRouter.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using System.Linq; -using System.Windows; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// Given with positions of nodes, calculates positions of edges. - /// - public class NeatoEdgeRouter - { - public NeatoEdgeRouter() - { - } - - /// - /// Given with node positions, calculates edge positions. - /// - /// , the nodes must have positions filled. - /// with preserved node positions and calculated edge positions. - public PositionedGraph CalculateEdges(PositionedGraph graphWithNodesPositioned) - { - DotFormatter dotFormatter = new BoxDotFormatter(graphWithNodesPositioned); - - // convert PosGraph to .dot string - string dotGraphString = dotFormatter.OutputGraphInDotFormat(); - - // pass to neato.exe and wait for output - string dotGraphStringWithPositions = NeatoProcess.Start().CalculatePositions(dotGraphString); - - // parse edge positions from neato's plain output format - PositionedGraph result = dotFormatter.ParseEdgePositions(dotGraphStringWithPositions); - - return result; - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoPositionTransform.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoPositionTransform.cs deleted file mode 100644 index 2bf6fd1efd..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoPositionTransform.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// Transforms positions to and from Neato. - /// - public class NeatoPositionTransform - { - private Rect graphBoundingRect; - - // So that Neato works with smaller numbers. Always > 1 - double ourInputScale = 40; - // Neato itself scales input by this constant. Always > 1, 1 for plain output, 72 for .dot output - double neatoOutputScale = 1; - - public NeatoPositionTransform(Rect graphBoundingRectangle) - { - graphBoundingRect = graphBoundingRectangle; - } - - /// - /// X shift, in Neato coords. - /// - public double NeatoShiftX { get; set; } - /// - /// Y shift, in Neato coords. - /// - public double NeatoShiftY { get; set; } - - public Point ToNeatoInput(Point ourPoint) - { - // invert Y axis, as Neato expects this - return new Point(ourPoint.X / ourInputScale, (graphBoundingRect.Bottom - ourPoint.Y) / ourInputScale); - } - - public System.Windows.Point FromNeatoOutput(Point neatoPoint) - { - // Neato multiplies coords by 72 and adds arbitrary shift (which has to be parsed) - double ourX = (neatoPoint.X - NeatoShiftX) / neatoOutputScale * ourInputScale; - double ourYInverted = (neatoPoint.Y - NeatoShiftY) / neatoOutputScale * ourInputScale; - // invert back - our Y axis grows down - return new Point(ourX, graphBoundingRect.Bottom - ourYInverted); - } - - /// - /// Transform points as Neato would transform it if Neato used no shift - /// - /// - /// - public System.Windows.Point AsNeato(Point ourPoint) - { - - return new Point(ourPoint.X * neatoOutputScale / ourInputScale, (graphBoundingRect.Bottom - ourPoint.Y) * neatoOutputScale / ourInputScale); - } - - public Rect NodeToNeatoInput(PositionedGraphNode node) - { - // don't transform size - return new Rect(ToNeatoInput(node.Center), - new Size(node.Width / ourInputScale, node.Height / ourInputScale)); - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoProcess.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoProcess.cs deleted file mode 100644 index d1d750b570..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/NeatoProcess.cs +++ /dev/null @@ -1,104 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.IO; -using System.Text; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// Encapsulates Neato.exe. - /// - public class NeatoProcess - { - private System.Diagnostics.Process neatoProcess; - - /// - /// Starts neato.exe - /// - public static NeatoProcess Start() - { - System.Diagnostics.Process neatoProcess = new System.Diagnostics.Process(); - neatoProcess.StartInfo.FileName = getNeatoExePath(); - neatoProcess.StartInfo.RedirectStandardInput = true; - neatoProcess.StartInfo.RedirectStandardError = true; - neatoProcess.StartInfo.RedirectStandardOutput = true; - neatoProcess.StartInfo.UseShellExecute = false; - neatoProcess.StartInfo.CreateNoWindow = true; - // tell neato to use splines instead of straigt lines - // output type = Graphviz's plain format - neatoProcess.StartInfo.Arguments = " -Gsplines=true -Tplain"; - //p.EnableRaisingEvents = true; - neatoProcess.Exited += delegate { - neatoProcess.Dispose(); - }; - /*p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { - }; - p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { - };*/ - - neatoProcess.Start(); - - return new NeatoProcess(neatoProcess); - } - - /// Creates new NeatoProcess. - /// Underlying neato.exe process - private NeatoProcess(System.Diagnostics.Process neatoProcess) - { - this.neatoProcess = neatoProcess; - } - - /// Gets directory where Debugger.AddIn.dll resides - private static string getCurrentAssemblyPath() - { - return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); - } - - private static string getNeatoExePath() - { - return Path.Combine(getCurrentAssemblyPath(), "neato.exe"); - } - - /// - /// Passes given graph to neato and reads output. - /// - /// Graph in Graphviz dot format. - /// Same graph in Graphviz plain format with position information added. - public string CalculatePositions(string dotGraph) - { - // write the input to neato.exe to a file for testing purposes - /*using (var writer = new StreamWriter(Path.Combine(getCurrentAssemblyPath(), "logIn.gv"))) - { - writer.Write(dotGraph); - }*/ - - neatoProcess.StandardInput.Write(dotGraph); - neatoProcess.StandardInput.Flush(); - neatoProcess.StandardInput.Close(); - - StringBuilder output = new StringBuilder(); - while(true) - { - string line = neatoProcess.StandardOutput.ReadLine(); - if (line == null) - { - // happens if neato.exe is killed - throw new DebuggerVisualizerException("Problem getting layout information from neato.exe"); - } - if (line == "stop") - { - break; - } - output.AppendLine(line); - } - - return output.ToString(); - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/RecordDotFormatter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/RecordDotFormatter.cs deleted file mode 100644 index 0398743608..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/RecordDotFormatter.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows; - -namespace Debugger.AddIn.Visualizers.Graph.Layout -{ - /// - /// that treats nodes as records of properties. - /// Edges start at property, end at node. - /// - public class RecordDotFormatter : DotFormatter - { - private Dictionary propertyIds = new Dictionary(); - - public RecordDotFormatter(PositionedGraph posGraph) : base(posGraph) - { - } - - protected override string getGraphHeader() - { - return "digraph G { rankdir=LR; node [shape = record];"; - } - - protected override void appendPosNode(PositionedGraphNode node, StringBuilder builder) - { - string nodeName = genId.GetNextId().ToString(); - nodeNames[node] = nodeName; - - Rect neatoInput = transform.NodeToNeatoInput(node); - - StringBuilder recordLabel = new StringBuilder(); - bool first = true; - foreach (var prop in node.Properties) - { - string propertyId = "f" + genId.GetNextId().ToString(); - propertyIds[prop] = propertyId; - if (!first) - { - recordLabel.Append("|"); - } - recordLabel.Append(string.Format("<{0}> l", propertyId)); - first = false; - } - - string dotFormatNode = - string.Format(this.neatoDoubleFormatter, - "{0} [pos=\"{1},{2}!\" width=\"{3}\" height=\"{4}\" label=\"{5}\"];", - nodeName, - neatoInput.Location.X, neatoInput.Location.Y, neatoInput.Width, neatoInput.Height, - recordLabel.ToString()); - builder.AppendLine(dotFormatNode); - } - - protected override void appendPosEdge(PositionedEdge edge, StringBuilder builder) - { - string sourceNodeName = nodeNames[edge.Source.ContainingNode]; - string sourcePropertyName = propertyIds[edge.Source]; - string targetNodeName = nodeNames[edge.Target]; - - builder.AppendLine(string.Format("{0}:{1} -> {2}", sourceNodeName, sourcePropertyName, targetNodeName)); - } - } -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/NodeControlCache.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/NodeControlCache.cs index 0734d71ed0..9e4ccffa5b 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/NodeControlCache.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/NodeControlCache.cs @@ -13,7 +13,7 @@ using System.Linq; namespace Debugger.AddIn.Visualizers.Graph { /// - /// Description of NodeControlCache. + /// Store to reuse s so that they don't have to be created for every drawing. /// public class NodeControlCache { diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs index 26bcc7d56d..14b05bb309 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs @@ -64,7 +64,7 @@ namespace Debugger.AddIn.Visualizers.Graph this.IsAtomic = debuggerVal.Type.IsAtomic(); this.IsNull = debuggerVal.IsNull; - // null and complex properties evaluate to empty string + // null and complex properties will show empty string this.Value = debuggerVal.IsNull || (!this.IsAtomic) ? string.Empty : debuggerVal.InvokeToString(); this.evaluateCalled = true; } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs index c27bbf2709..3bb8dcb65c 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs @@ -109,7 +109,7 @@ namespace Debugger.AddIn.Visualizers.Graph this.graphDrawer.ClearCanvas(); return; } - if (debuggerService.IsProcessRunning) // TODO "Process not paused" exception still occurs + if (debuggerService.IsProcessRunning) // "Process not paused" exception still occurs { showErrorMessage("Cannot inspect when the process is running."); return; diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/TreeModel/NestedNodeType.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/TreeModel/NestedNodeType.cs deleted file mode 100644 index 1b40ea5eca..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/TreeModel/NestedNodeType.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; - -namespace Debugger.AddIn.Visualizers.Graph -{ - /// - /// Description of NestedNodeType. - /// - /*public enum NestedNodeType - { - ThisNode, - BaseClassNode, - NonPublicInstanceMembersNode, - StaticMembersNode, - NonPublicStaticMembersNode - }*/ -} diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/ValueProviders/EnumerableValuesProvider.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/ValueProviders/EnumerableValuesProvider.cs index a9ba69de0a..74dfae8fba 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/ValueProviders/EnumerableValuesProvider.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/ValueProviders/EnumerableValuesProvider.cs @@ -21,7 +21,7 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer /// /// Provides s for debugee objects implementing IEnumerable. /// - public class EnumerableValuesProvider : GridValuesProvider + /*public class EnumerableValuesProvider : GridValuesProvider { public EnumerableValuesProvider(Expression targetObject, DebugType iEnumerableType, DebugType itemType) :base(targetObject, iEnumerableType, itemType) @@ -50,5 +50,5 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer yield return ObjectValue.Create(currentValue, index++, this.memberFromNameMap); } } - } + }*/ } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/PresentationBindings/ScrollUtils.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/PresentationBindings/ScrollUtils.cs deleted file mode 100644 index 4a3f8cdfbd..0000000000 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/PresentationBindings/ScrollUtils.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace Debugger.AddIn.Visualizers -{ -} diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs index a9906ae182..e256860267 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Windows.Threading; +using ICSharpCode.AvalonEdit.AddIn.Options; using ICSharpCode.Core; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Dom; @@ -26,6 +27,9 @@ namespace ICSharpCode.AvalonEdit.AddIn /// DispatcherTimer delayTimer; const int delayMilliseconds = 800; + /// + /// Delays the Resolve check so that it does not get called too often when user holds an arrow. + /// DispatcherTimer delayMoveTimer; const int delayMoveMilliseconds = 100; @@ -50,11 +54,18 @@ namespace ICSharpCode.AvalonEdit.AddIn this.delayMoveTimer.Tick += TimerMoveTick; this.editorView.TextArea.Caret.PositionChanged += CaretPositionChanged; } + + public void ClearHighlight() + { + this.highlightRenderer.ClearHighlight(); + } void TimerTick(object sender, EventArgs e) { + if (!CodeEditorOptions.Instance.HighlightSymbol) + return; + this.delayTimer.Stop(); - LoggingService.Info("tick"); // almost the same as DebuggerService.HandleToolTipRequest var referencesToBeHighlighted = GetReferencesInCurrentFile(this.lastResolveResult); this.highlightRenderer.SetHighlight(referencesToBeHighlighted); @@ -62,7 +73,9 @@ namespace ICSharpCode.AvalonEdit.AddIn void TimerMoveTick(object sender, EventArgs e) { - LoggingService.Debug("move"); + if (!CodeEditorOptions.Instance.HighlightSymbol) + return; + this.delayMoveTimer.Stop(); this.delayTimer.Stop(); var resolveResult = GetExpressionUnderCaret(); @@ -120,6 +133,13 @@ namespace ICSharpCode.AvalonEdit.AddIn /// bool SameResolveResult(ResolveResult resolveResult, ResolveResult resolveResult2) { + /*if (resolveResult == null && resolveResult2 == null) + return true; + if (resolveResult == null && resolveResult2 != null) + return false; + if (resolveResult != null && resolveResult2 == null) + return false;*/ + // TODO determine if 2 ResolveResults refer to the same symbol return false; } } diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs index 671f4ee23a..e02b91f5cd 100755 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs @@ -72,6 +72,8 @@ namespace ICSharpCode.AvalonEdit.AddIn HighlightBrackets(null, e); else if (e.PropertyName == "EnableFolding") UpdateParseInformation(); + else if (e.PropertyName == "HighlightSymbol") + this.caretReferencesRenderer.ClearHighlight(); } #region CaretPositionChanged - Bracket Highlighting diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs index d96485e379..c046ac1b94 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs @@ -135,6 +135,19 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options } } + bool highlightSymbol = true; + + [DefaultValue(true)] + public bool HighlightSymbol { + get { return highlightSymbol; } + set { + if (highlightSymbol != value) { + highlightSymbol = value; + OnPropertyChanged("HighlightSymbol"); + } + } + } + bool useSmartIndentation = true; [DefaultValue(true)] diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml index 556b22ccec..29c7198180 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml @@ -21,6 +21,9 @@ +