WordCursor TextView::buildInfos(const WordCursor &start) { myLineInfos.clear(); WordCursor cursor = start; int textAreaHeight = myStyle.textAreaHeight(); do { WordCursor paragraphEnd = cursor; paragraphEnd.moveToParagraphEnd(); WordCursor paragraphStart = cursor; paragraphStart.moveToParagraphStart(); myStyle.reset(); myStyle.applyControls(paragraphStart, cursor); LineInfo info(cursor, myStyle.style()); while (!info.End.isEndOfParagraph()) { info = processTextLine(info.End, paragraphEnd); textAreaHeight -= info.Height; if (textAreaHeight < 0) { break; } cursor = info.End; myLineInfos.push_back(info); } } while (cursor.isEndOfParagraph() && cursor.nextParagraph() && !cursor.paragraphCursor().isEndOfSection()); return cursor; }
void ArxDbgUiDlgSplash::displayTextLines() { int height; CWnd* wnd = GetDlgItem(ARXDBG_TXT_LINE1); ASSERT(wnd != NULL); if (wnd) { CRect linerect; wnd->GetClientRect(&linerect); height = linerect.Height(); } else height = 5; int numLines = 0; processTextLine(m_str1, ARXDBG_TXT_LINE1, numLines, height); processTextLine(m_str2, ARXDBG_TXT_LINE2, numLines, height); processTextLine(m_str3, ARXDBG_TXT_LINE3, numLines, height); processTextLine(m_str4, ARXDBG_TXT_LINE4, numLines, height); SetWindowPos(NULL, 0, 0, m_picWidth+(3*kBorderX), m_picHeight+(3*kBorderY)+(numLines*height), SWP_NOZORDER|SWP_NOMOVE); }
void TextView::skip(WordCursor &cursor, SizeUnit unit, int size) { WordCursor paragraphStart = cursor; paragraphStart.moveToParagraphStart(); WordCursor paragraphEnd = cursor; paragraphEnd.moveToParagraphEnd(); myStyle.reset(); myStyle.applyControls(paragraphStart, cursor); while (!cursor.isEndOfParagraph() && (size > 0)) { const LineInfo info = processTextLine(cursor, paragraphEnd); cursor = info.End; size -= infoSize(info, unit); } }
int TextView::paragraphSize(const WordCursor &cursor, bool beforeCurrentPosition, SizeUnit unit) { WordCursor word = cursor; word.moveToParagraphStart(); WordCursor end = cursor; if (!beforeCurrentPosition) { end.moveToParagraphEnd(); } myStyle.reset(); int size = 0; while (!word.sameElementAs(end)) { const LineInfo info = processTextLine(word, end); word = info.End; size += infoSize(info, unit); } return size; }