Esempio n. 1
0
        // Do a range-painting operation (actual painting, or measuring, which involve much of the same work
        // except for the innermost step) for a given range selection.
        private void DoRangePaintingOp(RangeSelection range, IVwGraphics vg, PaintTransform ptrans,
                                       RangePaintingOp op)
        {
            int ichMin = range.Start.RenderParaPosition;           // appropriate if the selection starts in THIS paragraph
            int ichLim = range.End.RenderParaPosition;             // appropriate if the selection ends in THIS paragraph

            if (range.Start.Para != this)
            {
                ichMin = 0;                 // It presumably starts before this paragraph, or it would not have been asked to draw it
            }
            if (range.End.Para != this)
            {
                ichLim = Source.Length;                 // It presumably ends after this paragraph, or it would not have been asked to draw it.
            }
            DoRangePaintingOp(ichMin, ichLim, vg, ptrans, op);
        }
Esempio n. 2
0
		// Do a range-painting operation (actual painting, or measuring, which involve much of the same work
		// except for the innermost step) for a given range of rendered characters.
		// This may be called for an actual range, or for an insertion point rendered as a substitute prompt.
		private void DoRangePaintingOp(int ichMin, int ichLim, IVwGraphics vg, PaintTransform ptrans, RangePaintingOp op)
		{
			if (Lines.Count == 0)
				return;
			PaintTransform childTrans = ptrans.PaintTransformOffsetBy(Left, Top);
			var previousBottom = childTrans.ToPaintY(Lines[0].Top);
			for (int i = 0; i < Lines.Count; i++)
			{
				var line = Lines[i];
				var bottom = line.Bottom;
				if (i != Lines.Count - 1)
					bottom = (Lines[i + 1].Top + bottom) / 2; // split the difference between this line and the next
				bottom = childTrans.ToPaintY(bottom);
				foreach (var box in line.Boxes)
				{
					op(box, vg, childTrans, previousBottom, bottom, ichMin, ichLim);
				}
				previousBottom = bottom;
			}
		}
Esempio n. 3
0
		// Do a range-painting operation (actual painting, or measuring, which involve much of the same work
		// except for the innermost step) for a given range selection.
		private void DoRangePaintingOp(RangeSelection range, IVwGraphics vg, PaintTransform ptrans,
			RangePaintingOp op)
		{
			int ichMin = range.Start.RenderParaPosition; // appropriate if the selection starts in THIS paragraph
			int ichLim = range.End.RenderParaPosition; // appropriate if the selection ends in THIS paragraph
			if (range.Start.Para != this)
				ichMin = 0; // It presumably starts before this paragraph, or it would not have been asked to draw it
			if (range.End.Para != this)
				ichLim = Source.Length; // It presumably ends after this paragraph, or it would not have been asked to draw it.
			DoRangePaintingOp(ichMin, ichLim, vg, ptrans, op);
		}
Esempio n. 4
0
        // Do a range-painting operation (actual painting, or measuring, which involve much of the same work
        // except for the innermost step) for a given range of rendered characters.
        // This may be called for an actual range, or for an insertion point rendered as a substitute prompt.
        private void DoRangePaintingOp(int ichMin, int ichLim, IVwGraphics vg, PaintTransform ptrans, RangePaintingOp op)
        {
            if (Lines.Count == 0)
            {
                return;
            }
            PaintTransform childTrans     = ptrans.PaintTransformOffsetBy(Left, Top);
            var            previousBottom = childTrans.ToPaintY(Lines[0].Top);

            for (int i = 0; i < Lines.Count; i++)
            {
                var line   = Lines[i];
                var bottom = line.Bottom;
                if (i != Lines.Count - 1)
                {
                    bottom = (Lines[i + 1].Top + bottom) / 2;                     // split the difference between this line and the next
                }
                bottom = childTrans.ToPaintY(bottom);
                foreach (var box in line.Boxes)
                {
                    op(box, vg, childTrans, previousBottom, bottom, ichMin, ichLim);
                }
                previousBottom = bottom;
            }
        }