示例#1
0
文件: Text.cs 项目: 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();
 }
示例#2
0
文件: Text.cs 项目: dzamkov/DUIP
            /// <summary>
            /// Gets a figure to display the given styled text section (using the unselected 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, StyledTextSection TextSection, ref int Line, ref int Offset)
            {
                UniformStyledTextSection usts = TextSection as UniformStyledTextSection;
                if (usts != null)
                {
                    return _GetFigure(BlockStyle, usts.NormalStyle, usts.Source, ref Line, ref Offset);
                }

                ConcatStyledTextSection csts = TextSection as ConcatStyledTextSection;
                if (csts != null)
                {
                    return
                        _GetFigure(BlockStyle, csts.A, ref Line, ref Offset) +
                        _GetFigure(BlockStyle, csts.B, ref Line, ref Offset);
                }

                throw new NotImplementedException();
            }
示例#3
0
文件: Text.cs 项目: dzamkov/DUIP
        /// <summary>
        /// Determines the width of an item when placed at the given offset from the left edge of a text block and adds it to
        /// the offset.
        /// </summary>
        private static void _AppendLine(TextBlockStyle Style, TextItem Item, ref int Offset)
        {
            if (Item is IndentTextItem)
            {
                Style.Indent(ref Offset);
                return;
            }

            SpaceTextItem sti = Item as SpaceTextItem;
            if (sti != null)
            {
                Offset += sti.Length;
                return;
            }

            if (Item is CharacterTextItem)
            {
                Offset++;
                return;
            }
        }
示例#4
0
文件: Text.cs 项目: 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);
            }
        }
示例#5
0
文件: Text.cs 项目: dzamkov/DUIP
 public TextBlock(StyledTextSection Text, TextBlockStyle Style)
 {
     this.Style = Style;
     this._Text = Text;
 }