/// <summary> /// Figure out what area the parsed error text will consume. /// </summary> private Rectangle ComputeTextDimensions( int arrowHeight, SizeF expectedLabelSize, ArrowDescription whatToDraw, Font font, out int correctWidth) { TextView activeView = TextView.Active; correctWidth = (int)(activeView.MeasureString(whatToDraw.Correct, font).Width); int expectedWidth = (int)(activeView.MeasureString(whatToDraw.Expected, font).Width); int incorrectWidth = (int)(activeView.MeasureString(whatToDraw.Incorrect, font).Width); int textWidth = (int)(expectedLabelSize.Width) + Math.Max(expectedWidth, correctWidth + incorrectWidth); int textHeight = (int)(expectedLabelSize.Height * 2); int textOffset = (arrowHeight - textHeight) / (arrowHeight > textHeight ? 2 : 1); ElementFrameGeometry geometry = GetViewElementFrameInfo().ElementFrameGeometry.ToLocation(); System.Drawing.Point arrowStart = new System.Drawing.Point((int)geometry.StartPoint.X.Value, (int)geometry.StartPoint.Y.Value); Rectangle textRect = new Rectangle( arrowStart.X, arrowStart.Y + textOffset, textWidth, textHeight); return(textRect); }
private int ComputeArrowHeight(ArrowDescription whatToDraw) { TextView view = TextView.Active; System.Drawing.Point end = view.ToScreenPoint(view.GetPoint(whatToDraw.End.End)); System.Drawing.Point start = view.ToScreenPoint(view.GetPoint(whatToDraw.Start.Start)); return end.Y - start.Y; }
private int ComputeArrowHeight(ArrowDescription whatToDraw) { TextView view = TextView.Active; System.Drawing.Point end = view.ToScreenPoint(view.GetPoint(whatToDraw.End.End)); System.Drawing.Point start = view.ToScreenPoint(view.GetPoint(whatToDraw.Start.Start)); return(end.Y - start.Y); }
/// <summary> /// Parse the message from the failed test and paint it in a way that empahsizes the important points /// </summary> private static void PaintParsedMessageOverArrow(Platform.IDrawingSurface context, Platform.Rect baseDrawingRect, ArrowDescription whatToDraw)//, int arrowHeight) { TextView activeView = TextView.Active; using (Font consolas = new Font("Consolas", 9)) {// Paint the details SizeF expectedLabelSize = activeView.MeasureString(kExpectedLabel, consolas); double correctWidth; Platform.Rect textRect = ComputeTextDimensions(baseDrawingRect, expectedLabelSize, whatToDraw, consolas, out correctWidth); PaintMessageBackground(context, textRect); PaintMessageText(context, textRect, expectedLabelSize, whatToDraw, correctWidth); } }
/// <summary> /// Parse the message from the failed test and paint it in a way that empahsizes the important points /// </summary> private void PaintParsedMessageOverArrow(Platform.IDrawingSurface context, ArrowDescription whatToDraw, int arrowHeight) { TextView activeView = TextView.Active; using (Font consolas = new Font("Consolas", 9)) { // Paint the details SizeF expectedLabelSize = activeView.MeasureString(kExpectedLabel, consolas); int correctWidth; Rectangle textRect = ComputeTextDimensions(arrowHeight, expectedLabelSize, whatToDraw, consolas, out correctWidth); PaintMessageBackground(context, textRect); PaintMessageText(context, textRect, expectedLabelSize, whatToDraw, correctWidth); } }
bool IsVisibleInView(TextView view) { if (view is IGdiTextView) { return(true); } ArrowDescription arrow = this.Object as ArrowDescription; if (arrow == null) { return(false); } return(!arrow.Test.InCollapsedRange(view)); }
private void CreateErrorArrowAdornment(DecorateLanguageElementEventArgs args, DevExpress.CodeRush.StructuralParser.Attribute attribute, Method target, TestMethod test) { if (test.Status == TestStatus.Failure && DrawArrowToAssert) { ArrowDescription visibleArrow = new ArrowDescription( attribute, target, test.TestResults[0], new MessageLimiter(ShortenLongStrings, MaxContextLength, ConvertEscapeCharacters)); args.AddAdornment( new FailedTestInspectorDocumentAdornment( new DocPoint(attribute.StartLine, attribute.StartOffset), new DocPoint(visibleArrow.End.Start.Line, visibleArrow.End.Start.Offset), this, visibleArrow)); } }
private void CreateErrorArrowAdornment(DecorateLanguageElementEventArgs args, DevExpress.CodeRush.StructuralParser.Attribute attribute, Method target, TestMethod test) { if (test.Status == TestStatus.Failure && DrawArrowToAssert) { ArrowDescription visibleArrow = new ArrowDescription( attribute, target, test.TestResults[0], new MessageLimiter(ShortenLongStrings, MaxContextLength, ConvertEscapeCharacters)); args.AddAdornment( new FailedTestInspectorDocumentAdornment( new DocPoint(attribute.StartLine, attribute.StartOffset), new DocPoint(visibleArrow.End.Start.Line, visibleArrow.End.Start.Offset), this, visibleArrow)); } }
/// <summary> /// Figure out what area the parsed error text will consume. /// </summary> private static Platform.Rect ComputeTextDimensions( Platform.Rect baseDrawingRect, SizeF expectedLabelSize, ArrowDescription whatToDraw, Font font, out double correctWidth) { TextView activeView = TextView.Active; correctWidth = activeView.MeasureString(whatToDraw.Correct, font).Width; double expectedWidth = activeView.MeasureString(whatToDraw.Expected, font).Width; double incorrectWidth = activeView.MeasureString(whatToDraw.Incorrect, font).Width; double textWidth = expectedLabelSize.Width + Math.Max(expectedWidth, correctWidth + incorrectWidth); double textHeight = expectedLabelSize.Height * 2; double textOffset = (baseDrawingRect.Height - textHeight) / (baseDrawingRect.Height > textHeight ? 2 : 1); Platform.Rect textRect = new Platform.Rect( baseDrawingRect.X, baseDrawingRect.Y + textOffset, textWidth, textHeight); return textRect; }
/// <summary> /// Figure out what area the parsed error text will consume. /// </summary> private static Platform.Rect ComputeTextDimensions( Platform.Rect baseDrawingRect, SizeF expectedLabelSize, ArrowDescription whatToDraw, Font font, out double correctWidth) { TextView activeView = TextView.Active; correctWidth = activeView.MeasureString(whatToDraw.Correct, font).Width; double expectedWidth = activeView.MeasureString(whatToDraw.Expected, font).Width; double incorrectWidth = activeView.MeasureString(whatToDraw.Incorrect, font).Width; double textWidth = expectedLabelSize.Width + Math.Max(expectedWidth, correctWidth + incorrectWidth); double textHeight = expectedLabelSize.Height * 2; double textOffset = (baseDrawingRect.Height - textHeight) / (baseDrawingRect.Height > textHeight ? 2 : 1); Platform.Rect textRect = new Platform.Rect( baseDrawingRect.X, baseDrawingRect.Y + textOffset, textWidth, textHeight); return(textRect); }
/// <summary> /// Figure out what area the parsed error text will consume. /// </summary> private Rectangle ComputeTextDimensions( int arrowHeight, SizeF expectedLabelSize, ArrowDescription whatToDraw, Font font, out int correctWidth) { TextView activeView = TextView.Active; correctWidth = (int)(activeView.MeasureString(whatToDraw.Correct, font).Width); int expectedWidth = (int)(activeView.MeasureString(whatToDraw.Expected, font).Width); int incorrectWidth = (int)(activeView.MeasureString(whatToDraw.Incorrect, font).Width); int textWidth = (int)(expectedLabelSize.Width) + Math.Max(expectedWidth, correctWidth + incorrectWidth); int textHeight = (int)(expectedLabelSize.Height * 2); int textOffset = (arrowHeight - textHeight) / (arrowHeight > textHeight ? 2 : 1); ElementFrameGeometry geometry = GetViewElementFrameInfo().ElementFrameGeometry.ToLocation(); System.Drawing.Point arrowStart = new System.Drawing.Point((int)geometry.StartPoint.X.Value, (int)geometry.StartPoint.Y.Value); Rectangle textRect = new Rectangle( arrowStart.X, arrowStart.Y + textOffset, textWidth, textHeight); return textRect; }
public FailedTestInspectorDocumentAdornment(DocPoint start, DocPoint end, CoreEventHub master, ArrowDescription arrow) : base(start, end, master, arrow) { }
public ErrorDetailsRangeArrow(SourceRange start, SourceRange end, ArrowDescription whatToDraw) : base (start, end) { this.whatToDraw = whatToDraw; }
public ErrorDetailsRangeArrowDocAdornment(SourceRange startRange, SourceRange endRange, Platform.Color color, ArrowDescription data) : base(startRange, endRange, color) { whatToDraw = data; localCopyColor = color; }
private static void PaintMessageText( Platform.IDrawingSurface context, Platform.Rect textRect, SizeF expectedLabelSize, ArrowDescription whatToDraw, double correctWidth) { const string kFontName = "Consolas"; const double kFontSize = 9; context.DrawString(kExpectedLabel, kFontName, kFontSize, Platform.Colors.DarkGray, new Platform.Point(textRect.X, textRect.Y)); context.DrawString(whatToDraw.Expected, kFontName, kFontSize, Platform.Colors.LightSalmon, new Platform.Point(textRect.X + expectedLabelSize.Width, textRect.Y)); context.DrawString(kActualLabel, kFontName, kFontSize, Platform.Colors.DarkGray, new Platform.Point(textRect.X, textRect.Y + expectedLabelSize.Height)); context.DrawString(whatToDraw.Correct, kFontName, kFontSize, Platform.Colors.LightSalmon, new Platform.Point(textRect.X + expectedLabelSize.Width, textRect.Y + expectedLabelSize.Height)); double incorrectStartX = textRect.X + expectedLabelSize.Width + correctWidth; context.DrawString(whatToDraw.Incorrect, kFontName, kFontSize, Platform.Colors.Red, new Platform.Point(incorrectStartX - 2, textRect.Y + expectedLabelSize.Height)); context.DrawLine(Platform.Colors.Red, new Platform.Point(incorrectStartX, textRect.Y + 2), new Platform.Point(incorrectStartX, textRect.Y + expectedLabelSize.Height + expectedLabelSize.Height - 2)); }
public ErrorDetailsForRangArrow(ArrowDescription whatToDraw) { this.whatToDraw = whatToDraw; }
private static void PaintMessageText( Platform.IDrawingSurface context, Platform.Rect textRect, SizeF expectedLabelSize, ArrowDescription whatToDraw, double correctWidth) { const string kFontName = "Consolas"; const double kFontSize = 9; context.DrawString(kExpectedLabel, kFontName, kFontSize, Platform.Colors.DarkGray, new Platform.Point(textRect.X, textRect.Y)); context.DrawString(whatToDraw.Expected, kFontName, kFontSize, Platform.Colors.LightSalmon, new Platform.Point(textRect.X + expectedLabelSize.Width, textRect.Y)); context.DrawString(kActualLabel, kFontName, kFontSize, Platform.Colors.DarkGray, new Platform.Point(textRect.X, textRect.Y + expectedLabelSize.Height)); context.DrawString(whatToDraw.Correct, kFontName, kFontSize, Platform.Colors.LightSalmon, new Platform.Point(textRect.X + expectedLabelSize.Width, textRect.Y + expectedLabelSize.Height)); double incorrectStartX = textRect.X + expectedLabelSize.Width + correctWidth; context.DrawString(whatToDraw.Incorrect, kFontName, kFontSize, Platform.Colors.Red, new Platform.Point(incorrectStartX - 2, textRect.Y + expectedLabelSize.Height)); context.DrawLine(Platform.Colors.Red, new Platform.Point(incorrectStartX, textRect.Y + 2), new Platform.Point(incorrectStartX, textRect.Y + expectedLabelSize.Height + expectedLabelSize.Height - 2)); }
public ErrorDetailsForRangArrow(ArrowDescription whatToDraw) { this.whatToDraw = whatToDraw; }
public override void Render(IDrawingSurface context, ElementFrameGeometry geometry) { ErrorInformation = base.Object as ArrowDescription; context.DrawImage(PlatformImage.ConvertFrom(_Bitmap), geometry.Bounds, 0.5); }
public ErrorDetailsRangeArrow(SourceRange start, SourceRange end, ArrowDescription whatToDraw) : base(start, end) { this.whatToDraw = whatToDraw; }
public override void Render(IDrawingSurface context, ElementFrameGeometry geometry) { ErrorInformation = base.Object as ArrowDescription; context.DrawImage(PlatformImage.ConvertFrom(_Bitmap), geometry.Bounds, 0.5); }
public ErrorDetailsRangeArrowAdornment(IElementFrame binding, ArrowDescription whatToDraw) : base(binding) { this.whatToDraw = whatToDraw; }
public ErrorDetailsRangeArrowDocAdornment(SourceRange startRange, SourceRange endRange, Platform.Color color, ArrowDescription data) : base(startRange, endRange, color) { whatToDraw = data; localCopyColor = color; }
public ErrorDetailsRangeArrowAdornment(IElementFrame binding, ArrowDescription whatToDraw) : base(binding) { this.whatToDraw = whatToDraw; }