Esempio n. 1
0
 void RefreshExistingMarkers()
 {
     foreach (var markerElement in markerElements)
     {
         var props = editorFormatMap.GetProperties(markerElement.Type);
         markerElement.BackgroundBrush = GetBackgroundBrush(props);
         markerElement.Pen             = GetPen(props);
         int zIndex = props[VSTC.MarkerFormatDefinition.ZOrderId] as int? ?? 0;
         if (markerElement.ZIndex != zIndex)
         {
             UpdateRange(new NormalizedHexBufferSpanCollection(wpfHexView.HexViewLines.FormattedSpan));
             return;
         }
     }
 }
Esempio n. 2
0
        void UpdateLineElementBrushes()
        {
            var props = editorFormatMap.GetProperties(isActive ? CTC.ThemeClassificationTypeNameKeys.HexCurrentLine : CTC.ThemeClassificationTypeNameKeys.HexCurrentLineNoFocus);

            currentLineHighlighterElement.ForegroundBrush = TE.ResourceDictionaryUtilities.GetForegroundBrush(props);
            currentLineHighlighterElement.BackgroundBrush = TE.ResourceDictionaryUtilities.GetBackgroundBrush(props);
        }
Esempio n. 3
0
        void RecreateColumnLines()
        {
            delayRecreateColumnLinesCalled = false;
            if (wpfHexView.IsClosed)
            {
                return;
            }

            RemoveAllLines();
            if (!enabled)
            {
                return;
            }
            Debug2.Assert(adornmentLayer is not null);

            if (wpfHexView.ViewportHeight == 0)
            {
                return;
            }

            var line   = wpfHexView.HexViewLines.FirstVisibleLine;
            var top    = wpfHexView.ViewportTop;
            var bottom = wpfHexView.ViewportBottom;

            foreach (var info in GetColumnPositions(line.BufferLine))
            {
                var lineKind = GetColumnLineKind(info.kind);
                if (lineKind == HexColumnLineKind.None)
                {
                    continue;
                }
                var  props    = editorFormatMap.GetProperties(classificationTypeNames[(int)info.kind]);
                var  pen      = GetPen(props, lineKind);
                var  bounds   = line.GetCharacterBounds(info.linePosition);
                var  x        = Math.Round(bounds.Left + bounds.Width / 2 - PEN_THICKNESS / 2) + 0.5;
                var  lineElem = new LineElement(info.kind, x, top, bottom, pen);
                bool added    = adornmentLayer.AddAdornment(VSTE.AdornmentPositioningBehavior.OwnerControlled, (HexBufferSpan?)null, null, lineElem, null);
                if (added)
                {
                    lineElements.Add(lineElem);
                }
            }

            latestBufferLines = wpfHexView.BufferLines;
        }
Esempio n. 4
0
        void UpdateBackground()
        {
            if (editorFormatMap == null)
            {
                return;
            }
            var props         = editorFormatMap.GetProperties(CTC.ThemeClassificationTypeNameKeys.HexGlyphMargin);
            var newBackground = TE.ResourceDictionaryUtilities.GetBackgroundBrush(props, Brushes.Transparent);

            if (!TWPF.BrushComparer.Equals(canvas.Background, newBackground))
            {
                canvas.Background = newBackground;
                // The images could depend on the background color, so recreate every icon
                if (childCanvases.Any(a => a.Children.Count > 0))
                {
                    canvas.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(RefreshEverything));
                }
            }
        }
        void RecreateRectangles()
        {
            delayRecreateRectanglesCalled = false;
            if (wpfHexView.IsClosed)
            {
                return;
            }

            RemoveAllRectangles();
            if (!enabled)
            {
                return;
            }
            Debug2.Assert(adornmentLayer is not null);

            if (wpfHexView.ViewportHeight == 0)
            {
                return;
            }

            var line   = wpfHexView.HexViewLines.FirstVisibleLine;
            var top    = wpfHexView.ViewportTop;
            var bottom = wpfHexView.ViewportBottom;

            foreach (var info in GetRectanglePositions(line))
            {
                var props   = editorFormatMap.GetProperties(GetClassificationTypeName(info.type));
                var bgBrush = GetBackgroundBrush(props);
                if (bgBrush is null || TWPF.BrushComparer.Equals(bgBrush, Brushes.Transparent))
                {
                    continue;
                }
                var  lineElem = new RectangleElement(info.type, info.rect, bgBrush, null);
                bool added    = adornmentLayer.AddAdornment(VSTE.AdornmentPositioningBehavior.OwnerControlled, (HexBufferSpan?)null, null, lineElem, null);
                if (added)
                {
                    rectangleElements.Add(lineElem);
                }
            }

            latestBufferLines = wpfHexView.BufferLines;
        }
Esempio n. 6
0
        Brush GetBackgroundBrush()
        {
            var props = editorFormatMap.GetProperties(IsActive ? CTC.ThemeClassificationTypeNameKeys.HexSelection : CTC.ThemeClassificationTypeNameKeys.HexInactiveSelectedText);

            return(TE.ResourceDictionaryUtilities.GetBackgroundBrush(props, IsActive ? SystemColors.HighlightBrush : SystemColors.GrayTextBrush));
        }