Exemple #1
0
        void Update(HexBufferSpan span, ref HashSet <HexViewLine> checkedLines)
        {
            Debug.Assert(span.Buffer == wpfHexViewHost.HexView.Buffer);
            var intersection = span.Intersection(wpfHexViewHost.HexView.HexViewLines.FormattedSpan);

            if (intersection == null)
            {
                return;
            }
            var point = intersection.Value.Start;

            while (point <= intersection.Value.End)
            {
                var line = wpfHexViewHost.HexView.WpfHexViewLines.GetWpfHexViewLineContainingBufferPosition(point);
                if (line == null)
                {
                    break;
                }
                if (checkedLines == null)
                {
                    checkedLines = new HashSet <HexViewLine>();
                }
                if (!checkedLines.Contains(line))
                {
                    checkedLines.Add(line);
                    Update(line);
                }
                if (line.IsLastDocumentLine())
                {
                    break;
                }
                point = line.BufferEnd;
            }
        }
Exemple #2
0
		void Update(HexBufferSpan span, ref HashSet<HexViewLine> checkedLines) {
			Debug.Assert(span.Buffer == wpfHexViewHost.HexView.Buffer);
			var intersection = span.Intersection(wpfHexViewHost.HexView.HexViewLines.FormattedSpan);
			if (intersection == null)
				return;
			var point = intersection.Value.Start;
			while (point <= intersection.Value.End) {
				var line = wpfHexViewHost.HexView.WpfHexViewLines.GetWpfHexViewLineContainingBufferPosition(point);
				if (line == null)
					break;
				if (checkedLines == null)
					checkedLines = new HashSet<HexViewLine>();
				if (!checkedLines.Contains(line)) {
					checkedLines.Add(line);
					Update(line);
				}
				if (line.IsLastDocumentLine())
					break;
				point = line.BufferEnd;
			}
		}
Exemple #3
0
		bool Intersects(HexBufferSpan fullSpan, HexViewLine line, Rect rect) {
			var span = fullSpan.Intersection(line.BufferSpan);
			if (span == null || span.Value.Length == 0)
				return false;
			var allBounds = line.GetNormalizedTextBounds(span.Value, HexSpanSelectionFlags.Selection);
			if (allBounds.Count == 0)
				return false;
			double left = double.MaxValue, right = double.MinValue, top = double.MaxValue, bottom = double.MinValue;
			foreach (var bounds in allBounds) {
				left = Math.Min(left, bounds.Left);
				right = Math.Max(right, bounds.Right);
				top = Math.Min(top, bounds.TextTop);
				bottom = Math.Max(bottom, bounds.TextBottom);
			}
			left -= wpfHexView.ViewportLeft;
			top -= wpfHexView.ViewportTop;
			right -= wpfHexView.ViewportLeft;
			bottom -= wpfHexView.ViewportTop;
			bool b = left <= right && top <= bottom;
			Debug.Assert(b);
			if (!b)
				return false;
			var r = new Rect(left, top, right - left, bottom - top);
			return r.IntersectsWith(rect);
		}