C# (CSharp) SIL.FieldWorks.SharpViews.Paragraphs ParaBuilder - 4 examples found. These are the top rated real world C# (CSharp) examples of SIL.FieldWorks.SharpViews.Paragraphs.ParaBuilder extracted from open source projects. You can rate examples to help us improve the quality of examples.
This class is responsible for laying out the components of a paragraph. It may do a complete layout, or redo the layout of a previously laid out paragraph that is being adjusted, typically because its contents have changed. Its primary organization is a process of assembling lines by adding stuff to them until they are full or there is nothing more to add. Initially, and after each line has been successfully added, its state may be thought of as follows: 1. We are trying to build a box sequence which will be stored in m_para.FirstBox. A chain of boxes built so far begins at m_firstBox (which may initially be null) and continues to m_lastBox. These boxes are organized into lines, stored in m_lines. They correspond to the text from the RenderRuns before m_renderRunIndex, plus the text from RenderRuns[m_renderRunIndex] == m_currentRenderRun, up to m_ichRendered. 2. There may also be a group of lines at the end of the paragraph which we hope to be able to reuse (though they will currently be relative to another, old, TextSource). These lines are stored in m_oldLines, and we have deduced that they correspond to the text in our current source from m_ichStartReusing onwards. If, after completing a line, we find that m_ichRendered == m_ichStartReusing, then we have resynchronized and can reuse the old lines, after adjusting their source and source offset. 3. Otherwise, we have to build a new line, starting with the material at m_ichRendered. Before doing this, if m_ichStartReusing > m_ichRendered, we must discard one (or more) lines of m_oldLines, since we are already past its position. The process of constructing a line is basically to add boxes and text runs (which become string boxes) to the line until it is full. At that point, it may be determined that the current end of the line is not a valid place to break the line. This typically comes about because the last thing on the line is a text box which terminated at a writing system change rather than at a point where the RenderEngine said we could break. When this happens we must backtrack, replacing the last (string) box with a shortened version ending at a good break, or removing it altogether if it is not the first box on the line. (We must always put something on a line, or we get an infinite loop.)