public override void DrawForeground(MonoTextEditor editor, Context cr, MarginDrawMetrics metrics) { double size = metrics.Margin.Width; double borderLineWidth = cr.LineWidth; double x = Math.Floor(metrics.Margin.XOffset - borderLineWidth / 2); double y = Math.Floor(metrics.Y + (metrics.Height - size) / 2); var icon = GetIcon(SmartTagSeverity); var deltaX = size / 2 - icon.Width / 2 + 0.5f; var deltaY = size / 2 - icon.Height / 2 + 0.5f; cr.DrawImage(editor, icon, Math.Round(x + deltaX), Math.Round(y + deltaY)); Height = (int)(Math.Round(deltaY) + icon.Height); if (editor.TextArea.QuickFixMargin.HoveredSmartTagMarker == this) { const int triangleWidth = 8; const int triangleHeight = 4; cr.SetSourceColor(SyntaxHighlightingService.GetColor(editor.EditorTheme, EditorThemeColors.LineNumbers)); cr.MoveTo(metrics.X + metrics.Width - triangleWidth, metrics.Y + metrics.Height - triangleHeight); cr.LineTo(metrics.X + metrics.Width, metrics.Y + metrics.Height - triangleHeight); cr.LineTo(metrics.X + metrics.Width - triangleWidth / 2, metrics.Y + metrics.Height); cr.LineTo(metrics.X + metrics.Width - triangleWidth, metrics.Y + metrics.Height - triangleHeight); cr.Fill(); } PopupPosition = new Xwt.Point(metrics.X, metrics.Y); }
public override void DrawForeground(MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { double size = metrics.Margin.Width; double borderLineWidth = cr.LineWidth; double x = Math.Floor(metrics.Margin.XOffset - borderLineWidth / 2); double y = Math.Floor(metrics.Y + (metrics.Height - size) / 2); var deltaX = size / 2 - DebugIcon.Width / 2 + 0.5f; var deltaY = size / 2 - DebugIcon.Height / 2 + 0.5f; if (drawInIconMarging) { cr.DrawImage(editor, DebugIcon, Math.Round(x + deltaX), Math.Round(y + deltaY)); } else { cr.DrawImage(editor, DebugIcon, metrics.X, Math.Round(y + deltaY)); var lineSegment = metrics.LineSegment; var extendingMarker = lineSegment != null ? (IExtendingTextLineMarker)editor.Document.GetMarkers(lineSegment).FirstOrDefault(l => l is IExtendingTextLineMarker) : null; bool isSpaceAbove = extendingMarker != null && extendingMarker.IsSpaceAbove; editor.TextArea.GutterMargin.DrawForeground(cr, (int)metrics.LineNumber, metrics.X, metrics.Y, metrics.Height, isSpaceAbove); } }
public override void DrawForeground(MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { var tx = Math.Round(metrics.X + (metrics.Width - cache.errorPixbuf.Width) / 2) - 1; var ty = Math.Floor(metrics.Y + (metrics.Height - cache.errorPixbuf.Height) / 2); cr.Save(); cr.Translate(tx, ty); cr.DrawImage(editor, errors.Any(e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 0, 0); cr.Restore(); }
public override void DrawForeground(TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { double size = metrics.Margin.Width; double borderLineWidth = cr.LineWidth; double x = Math.Floor(metrics.Margin.XOffset - borderLineWidth / 2); double y = Math.Floor(metrics.Y + (metrics.Height - size) / 2); DrawMarginIcon(cr, x, y, size); }
public override void DrawForeground(TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { isFailed = false; var test = NUnitService.Instance.SearchTestById(unitTest.UnitTestIdentifier); bool searchCases = false; Xwt.Drawing.Image icon = null; if (test != null) { icon = test.StatusIcon; var result = test.GetLastResult(); if (result == null) { searchCases = true; } else if (result.IsFailure) { failMessage = result.Message; isFailed = true; } } else { searchCases = true; } if (searchCases) { foreach (var caseId in unitTest.TestCases) { test = NUnitService.Instance.SearchTestById(unitTest.UnitTestIdentifier + caseId); if (test != null) { icon = test.StatusIcon; var result = test.GetLastResult(); if (result != null && result.IsFailure) { failMessage = result.Message; isFailed = true; break; } } } } if (icon != null) { if (icon.Width > metrics.Width || icon.Height > metrics.Height) { icon = icon.WithBoxSize(metrics.Width, metrics.Height); } cr.DrawImage(editor, icon, Math.Truncate(metrics.X + metrics.Width / 2 - icon.Width / 2), Math.Truncate(metrics.Y + metrics.Height / 2 - icon.Height / 2)); } }
public override void DrawForeground(MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { double size = metrics.Margin.Width; double borderLineWidth = cr.LineWidth; double x = Math.Floor(metrics.Margin.XOffset - borderLineWidth / 2); double y = Math.Floor(metrics.Y + (metrics.Height - size) / 2); var deltaX = size / 2 - DebugIcon.Width / 2 + 0.5f; var deltaY = size / 2 - DebugIcon.Height / 2 + 0.5f; cr.DrawImage(editor, DebugIcon, Math.Round(x + deltaX), Math.Round(y + deltaY)); }
public override bool DrawBackground(MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { if (metrics.Margin is FoldMarkerMargin || metrics.Margin is GutterMargin || metrics.Margin is ActionMargin) { return(DrawMarginBackground(editor, metrics.Margin, cr, metrics.Area, LineSegment, metrics.LineNumber, metrics.X, metrics.Y, metrics.Height)); } if (metrics.Margin is IconMargin) { DrawIconMarginBackground(editor, cr, metrics); return(true); } return(false); }
public override void DrawForeground(TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { cr.Save(); cr.Translate( metrics.X + 0.5 + (metrics.Width - 2 - cache.errorPixbuf.Width) / 2, metrics.Y + 0.5 + (metrics.Height - cache.errorPixbuf.Height) / 2 ); Gdk.CairoHelper.SetSourcePixbuf( cr, errors.Any(e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 0, 0); cr.Paint(); cr.Restore(); }
void DrawIconMarginBackground(MonoTextEditor ed, Cairo.Context cr, MarginDrawMetrics metrics) { cr.Rectangle(metrics.X, metrics.Y, metrics.Width, metrics.Height); cr.SetSourceColor(IconMarginColor.Color); cr.Fill(); cr.MoveTo(metrics.Right - 0.5, metrics.Y); cr.LineTo(metrics.Right - 0.5, metrics.Bottom); cr.SetSourceColor(IconMarginColor.BorderColor); cr.Stroke(); if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this) { cr.Rectangle(metrics.X, metrics.Y, metrics.Width, metrics.Height); cr.SetSourceRGBA(ed.ColorStyle.IndicatorMargin.Color.R, ed.ColorStyle.IndicatorMargin.Color.G, ed.ColorStyle.IndicatorMargin.Color.B, 0.5); cr.Fill(); } }
public override void DrawForeground(TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { cr.Arc(metrics.X + metrics.Width / 2 + 2, metrics.Y + metrics.Height / 2, 7 * editor.Options.Zoom, 0, Math.PI * 2); isFailed = false; var test = NUnitService.Instance.SearchTestById(unitTest.UnitTestIdentifier); bool searchCases = false; if (unitTest.IsIgnored) { cr.SetSourceRGB(0.9, 0.9, 0); } else { if (test != null) { var result = test.GetLastResult(); if (result == null) { cr.SetSourceRGB(0.5, 0.5, 0.5); searchCases = true; } else if (result.IsNotRun) { cr.SetSourceRGBA(0.9, 0.9, 0, test.IsHistoricResult ? 0.5 : 1.0); } else if (result.IsSuccess) { cr.SetSourceRGBA(0, 1, 0, test.IsHistoricResult ? 0.2 : 1.0); } else if (result.IsFailure) { cr.SetSourceRGBA(1, 0, 0, test.IsHistoricResult ? 0.2 : 1.0); failMessage = result.Message; isFailed = true; } else if (result.IsInconclusive) { cr.SetSourceRGBA(0, 1, 1, test.IsHistoricResult ? 0.2 : 1.0); } } else { cr.SetSourceRGB(0.5, 0.5, 0.5); searchCases = true; } if (searchCases) { foreach (var caseId in unitTest.TestCases) { test = NUnitService.Instance.SearchTestById(unitTest.UnitTestIdentifier + caseId); if (test != null) { var result = test.GetLastResult(); if (result == null || result.IsNotRun || test.IsHistoricResult) { } else if (result.IsNotRun) { cr.SetSourceRGB(0.9, 0.9, 0); } else if (result.IsSuccess) { cr.SetSourceRGB(0, 1, 0); } else if (result.IsFailure) { cr.SetSourceRGB(1, 0, 0); failMessage = result.Message; isFailed = true; break; } else if (result.IsInconclusive) { cr.SetSourceRGB(0, 1, 1); } } } } } cr.FillPreserve(); if (unitTest.IsIgnored) { cr.SetSourceRGB(0.4, 0.4, 0); cr.Stroke(); } else { if (test != null) { var result = test.GetLastResult(); if (result == null) { cr.SetSourceRGB(0.2, 0.2, 0.2); cr.Stroke(); } else if (result.IsNotRun && !test.IsHistoricResult) { cr.SetSourceRGB(0.4, 0.4, 0); cr.Stroke(); } else if (result.IsSuccess && !test.IsHistoricResult) { cr.SetSourceRGB(0, 0.5, 0); cr.Stroke(); } else if (result.IsFailure && !test.IsHistoricResult) { cr.SetSourceRGB(0.5, 0, 0); cr.Stroke(); } else if (result.IsInconclusive && !test.IsHistoricResult) { cr.SetSourceRGB(0, 0.7, 0.7); cr.Stroke(); } } } cr.NewPath(); }
public override void DrawForeground(Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { isFailed = false; bool searchCases = false; Xwt.Drawing.Image icon = host.GetStatusIcon(unitTest.UnitTestIdentifier); if (icon != null) { if (host.HasResult(unitTest.UnitTestIdentifier)) { searchCases = true; } else if (host.IsFailure(unitTest.UnitTestIdentifier)) { failMessage = host.GetMessage(unitTest.UnitTestIdentifier); isFailed = true; } } else { searchCases = true; } if (searchCases) { foreach (var caseId in unitTest.TestCases) { icon = host.GetStatusIcon(unitTest.UnitTestIdentifier, caseId); if (host.IsFailure(unitTest.UnitTestIdentifier, caseId)) { failMessage = host.GetMessage(unitTest.UnitTestIdentifier, caseId); isFailed = true; break; } } } if (icon != null) { if (icon.Width > metrics.Width || icon.Height > metrics.Height) { icon = icon.WithBoxSize(metrics.Width, metrics.Height); } cr.DrawImage(editor, icon, Math.Truncate(metrics.X + metrics.Width / 2 - icon.Width / 2), Math.Truncate(metrics.Y + metrics.Height / 2 - icon.Height / 2)); } }
public override void DrawForeground(Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics) { if (statusIcon == null) { UpdateStatusIcon(); } if (statusIcon != null) { if (statusIcon.Width > metrics.Width || statusIcon.Height > metrics.Height) { statusIcon = statusIcon.WithBoxSize(metrics.Width, metrics.Height); } cr.DrawImage(editor, statusIcon, Math.Truncate(metrics.X + metrics.Width / 2 - statusIcon.Width / 2), Math.Truncate(metrics.Y + metrics.Height / 2 - statusIcon.Height / 2)); } }