Ejemplo n.º 1
0
Archivo: Text.cs Proyecto: dzamkov/DUIP
 public UniformStyledTextSection(TextSection Source, TextStyle NormalStyle, TextStyle SelectedStyle)
 {
     this.Source = Source;
     this.NormalStyle = NormalStyle;
     this.SelectedStyle = SelectedStyle;
 }
Ejemplo n.º 2
0
Archivo: Text.cs Proyecto: dzamkov/DUIP
 public ConcatTextSection(TextSection A, TextSection B)
     : base(A.Size + B.Size)
 {
     this.A = A;
     this.B = B;
 }
Ejemplo n.º 3
0
Archivo: Text.cs Proyecto: dzamkov/DUIP
 /// <summary>
 /// Gets a figure to display the given text section with the given style.
 /// </summary>
 /// <param name="Line">The index of the line where the text section begins.</param>
 /// <param name="Offset">The offset (in cells) of the beginning of the text section from the start of the line.</param>
 private static Figure _GetFigure(TextBlockStyle BlockStyle, TextStyle Style, TextSection TextSection, ref int Line, ref int Offset)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
Archivo: Text.cs Proyecto: dzamkov/DUIP
        /// <summary>
        /// Inserts the given text section into this section at the given position and returns the resulting text section.
        /// </summary>
        public TextSection Insert(int Position, TextSection Section)
        {
            if (Position == 0)
                return Section + this;
            if (Position == this.Size)
                return this + Section;

            ConcatTextSection cts = this as ConcatTextSection;
            if (cts != null)
            {
                int asize = cts.A.Size;
                if (Position <= asize)
                    return cts.A.Insert(Position, Section) + cts.B;
                else
                    return cts.A + cts.B.Insert(Position, Section);
            }

            return this.Subsection(0, Position) + Section + this.Subsection(Position, this.Size);
        }
Ejemplo n.º 5
0
Archivo: Text.cs Proyecto: dzamkov/DUIP
        /// <summary>
        /// Performs initial measurements on a text section to be used in a layout.
        /// </summary>
        /// <param name="LineIndices">A list to which the indices of line start items should be appened.</param>
        /// <param name="Index">The index of the first item in the text section.</param>
        /// <param name="Offset">The offset of the start of text section from the beginning of the current line. This will be changed to the
        /// offset of the end of the text section from the beginning of the latest line.</param>
        /// <param name="Width">The lower bound on the line width needed to contain the text section.</param>
        private static void _Measure(TextBlockStyle Style, TextSection Section, int Index, List<int> LineIndices, ref int Offset, ref int Width)
        {
            TextItem ti = Section as TextItem;
            if (ti != null)
            {
                if (ti == LineStartTextItem.Instance)
                {
                    Offset = 0;
                    LineIndices.Add(Index);
                    return;
                }

                _AppendLine(Style, ti, ref Offset);
                Width = Math.Max(Width, Offset);
                return;
            }

            ConcatTextSection cts = Section as ConcatTextSection;
            if (cts != null)
            {
                _Measure(Style, cts.A, Index, LineIndices, ref Offset, ref Width);
                _Measure(Style, cts.B, Index + cts.A.Size, LineIndices, ref Offset, ref Width);
            }
        }