Esempio n. 1
0
        private void DrawMark(DrawingContext dc, TextMark mark)
        {
            double y = _track.GetPositionFromLine(mark.line) - _track.LineHeight / 2;

            Rect rect = new Rect(1, y, 1, 1);

            rect.Inflate(1.0, 1.0);

            Brush brush = Brushes.Transparent;

            switch (mark.type)
            {
            case TextMark.MarkType.Bookmark:
                brush = BookmarkMarkBrush;
                break;

            case TextMark.MarkType.Breakpoint:
                brush = BreakpointMarkBrush;
                break;

            case TextMark.MarkType.Tracepoint:
                brush = TracepointMarkBrush;
                break;
            }

            DrawRectangle(dc, brush, rect);
        }
Esempio n. 2
0
        public static TextMark Create(IMappingTagSpan <IVsVisibleTextMarkerTag> tag)
        {
            uint flags;
            int  hr = tag.Tag.StreamMarker.GetVisualStyle(out flags);

            if (ErrorHandler.Succeeded(hr) &&
                ((flags & (uint)MARKERVISUAL.MV_GLYPH) != 0) &&
                ((flags & ((uint)MARKERVISUAL.MV_COLOR_ALWAYS | (uint)MARKERVISUAL.MV_COLOR_LINE_IF_NO_MARGIN)) != 0))
            {
                COLORINDEX[] foreground = new COLORINDEX[1];
                COLORINDEX[] background = new COLORINDEX[1];
                hr = tag.Tag.MarkerType.GetDefaultColors(foreground, background);
                if (ErrorHandler.Succeeded(hr))
                {
                    ITextBuffer   buffer = tag.Span.BufferGraph.TopBuffer;
                    SnapshotPoint?pos    = tag.Span.Start.GetPoint(buffer, PositionAffinity.Successor);
                    if (pos.HasValue)
                    {
                        var text_mark = new TextMark();
                        text_mark.line  = buffer.CurrentSnapshot.GetLineNumberFromPosition(pos.Value.Position);
                        text_mark.brush = ColorExtractor.GetBrushFromIndex(background[0]);
                        return(text_mark);
                    }
                }
            }

            return(null);
        }
Esempio n. 3
0
        private void DrawMark(DrawingContext dc, TextMark mark)
        {
            double y = _track.GetPositionFromLine(mark.line) - _track.LineHeight / 2;

            Rect rect = new Rect(1, y, 1, 1);

            rect.Inflate(1.0, 1.0);

            DrawRectangle(dc, mark.brush, rect);
        }
Esempio n. 4
0
        public void UpdateMarks()
        {
            Marks.Clear();

            var snapshot = _view.VisualSnapshot;
            var span     = new SnapshotSpan(snapshot, 0, snapshot.Length);

            foreach (var tag in _aggregator.GetTags(span))
            {
                var mark = TextMark.Create(tag);
                if (mark != null)
                {
                    Marks.Add(mark);
                }
            }

            MarksChanged?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 5
0
        private void DrawMark(DrawingContext dc, TextMark mark)
        {
            double y = _track.GetPositionFromLine(mark.line) - _track.LineHeight / 2;

            Rect rect = new Rect(1, y, 1, 1);
            rect.Inflate(1.0, 1.0);

            DrawRectangle(dc, mark.brush, rect);
        }
Esempio n. 6
0
        public static TextMark Create(IMappingTagSpan<IVsVisibleTextMarkerTag> tag)
        {
            uint flags;
            int hr = tag.Tag.StreamMarker.GetVisualStyle(out flags);
            if (ErrorHandler.Succeeded(hr) &&
                    ((flags & (uint)MARKERVISUAL.MV_GLYPH) != 0) &&
                    ((flags & ((uint)MARKERVISUAL.MV_COLOR_ALWAYS | (uint)MARKERVISUAL.MV_COLOR_LINE_IF_NO_MARGIN)) != 0))
            {
                COLORINDEX[] foreground = new COLORINDEX[1];
                COLORINDEX[] background = new COLORINDEX[1];
                hr = tag.Tag.MarkerType.GetDefaultColors(foreground, background);
                if (ErrorHandler.Succeeded(hr))
                {
                    ITextBuffer buffer = tag.Span.BufferGraph.TopBuffer;
                    SnapshotPoint? pos = tag.Span.Start.GetPoint(buffer, PositionAffinity.Successor);
                    if (pos.HasValue)
                    {
                        var text_mark = new TextMark();
                        text_mark.line = buffer.CurrentSnapshot.GetLineNumberFromPosition(pos.Value.Position);
                        text_mark.brush = ColorExtractor.GetBrushFromIndex(background[0]);
                        return text_mark;
                    }
                }
            }

            return null;
        }