void ZLTextView::paint() { preparePaintInfo(); myTextElementMap.clear(); myTreeNodeMap.clear(); context().clear(ZLTextStyleCollection::instance().baseStyle().BackgroundColorOption.value()); if (empty()) { return; } std::vector<size_t> labels; labels.reserve(myLineInfos.size() + 1); labels.push_back(0); int y = topMargin(); for (std::vector<ZLTextLineInfoPtr>::const_iterator it = myLineInfos.begin(); it != myLineInfos.end(); ++it) { const ZLTextLineInfo &info = **it; prepareTextLine(info, y); y += info.Height + info.Descent + info.VSpaceAfter; labels.push_back(myTextElementMap.size()); } mySelectionModel.update(); y = topMargin(); int index = 0; for (std::vector<ZLTextLineInfoPtr>::const_iterator it = myLineInfos.begin(); it != myLineInfos.end(); ++it) { const ZLTextLineInfo &info = **it; drawTextLine(info, y, labels[index], labels[index + 1]); y += info.Height + info.Descent + info.VSpaceAfter; ++index; } fb::shared_ptr<ZLTextPositionIndicatorInfo> indicatorInfo = this->indicatorInfo(); if (!indicatorInfo.isNull() && (indicatorInfo->type() == ZLTextPositionIndicatorInfo::FB_INDICATOR)) { positionIndicator()->draw(); } if (myDoUpdateScrollbar && !indicatorInfo.isNull()) { myDoUpdateScrollbar = false; const size_t full = positionIndicator()->sizeOfTextBeforeParagraph(positionIndicator()->endTextIndex()); const size_t from = positionIndicator()->sizeOfTextBeforeCursor(startCursor()); const size_t to = positionIndicator()->sizeOfTextBeforeCursor(endCursor()); bool showScrollbar = (indicatorInfo->type() == ZLTextPositionIndicatorInfo::OS_SCROLLBAR) && (to - from < full); if (showScrollbar) { setScrollbarEnabled(VERTICAL, true); setScrollbarParameters(VERTICAL, full, from, to); } else { setScrollbarEnabled(VERTICAL, false); } } ZLTextParagraphCursorCache::cleanup(); }
void ZLTextView::paint() { context().clear(backgroundColor()); // PB // myTextAreaController.area().setOffsets( // textArea().isRtl() ? rightMargin() : leftMargin(), topMargin() // ); myTextAreaController.area().setOffsets(0, 0); // if (!) preparePaintInfo(); ////<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<, if (textArea().isEmpty()) { return; } if (!ZLNXPaintContext::lock_drawing) myTextAreaController.area().paint(); /////<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< shared_ptr<ZLTextPositionIndicatorInfo> indicatorInfo = this->indicatorInfo(); if (!indicatorInfo.isNull() && (indicatorInfo->type() == ZLTextPositionIndicatorInfo::FB_INDICATOR)) { positionIndicator()->draw(); } if (myDoUpdateScrollbar && !indicatorInfo.isNull()) { myDoUpdateScrollbar = false; const size_t full = positionIndicator()->sizeOfTextBeforeParagraph(positionIndicator()->endTextIndex()); const size_t from = positionIndicator()->sizeOfTextBeforeCursor(textArea().startCursor()); const size_t to = positionIndicator()->sizeOfTextBeforeCursor(textArea().endCursor()); bool showScrollbar = (indicatorInfo->type() == ZLTextPositionIndicatorInfo::OS_SCROLLBAR) && (to - from < full); if (showScrollbar) { setScrollbarEnabled(VERTICAL, true); setScrollbarParameters(VERTICAL, full, from, to); } else { setScrollbarEnabled(VERTICAL, false); } } ZLTextParagraphCursorCache::cleanup(); }
void ZLTextView::paint() { context().clear(backgroundColor()); myTextAreaController.area().setOffsets( textArea().isRtl() ? rightMargin() : leftMargin(), topMargin() + headerHeight() ); preparePaintInfo(); if (textArea().isEmpty()) { return; } myTextAreaController.area().paint(); shared_ptr<ZLTextPositionIndicatorInfo> indicatorInfo = this->indicatorInfo(); if (!indicatorInfo.isNull()) { switch (indicatorInfo->type()) { default: break; case ZLTextPositionIndicatorInfo::PAGE_FOOTER: positionIndicator()->draw(); break; case ZLTextPositionIndicatorInfo::PAGE_HEADER: paintHeader(); break; } } if (myDoUpdateScrollbar && !indicatorInfo.isNull()) { myDoUpdateScrollbar = false; const std::size_t full = sizeOfTextBeforeParagraph(endTextIndex()); const std::size_t from = sizeOfTextBeforeCursor(textArea().startCursor()); const std::size_t to = sizeOfTextBeforeCursor(textArea().endCursor()); bool showScrollbar = (indicatorInfo->type() == ZLTextPositionIndicatorInfo::OS_SCROLLBAR) && (to - from < full); if (showScrollbar) { setScrollbarEnabled(VERTICAL, true); setScrollbarParameters(VERTICAL, full, from, to); } else { setScrollbarEnabled(VERTICAL, false); } } ZLTextParagraphCursorCache::cleanup(); }
void ZLBlockTreeView::paint() { ZLPaintContext &context = this->context(); context.clear(backgroundColor()); bool firstNodeFound = false; int vOffset = 0 - myNodePartToSkip; const int maxY = context.height(); std::size_t before = myNodePartToSkip; for (ZLBlockTreeNode *node = &myRootNode; node != 0; node = node->next()) { std::size_t h = node->height(context); if (!firstNodeFound) { if (node == myFirstVisibleNode) { firstNodeFound = true; } if (!firstNodeFound) { before += h; continue; } } if (vOffset <= maxY) { node->paint(context, vOffset); } vOffset += h; } if (!firstNodeFound || (((int) before) + vOffset <= maxY && (myFirstVisibleNode != &myRootNode || myNodePartToSkip != 0) ) ) { myFirstVisibleNode = &myRootNode; myNodePartToSkip = 0; paint(); return; } const std::size_t after = (vOffset <= maxY) ? 0 : vOffset - maxY; const bool showScrollbar = before > 0 || after > 0; myCanScrollForward = after > 0; setScrollbarEnabled(VERTICAL, showScrollbar); if (showScrollbar) { setScrollbarParameters(VERTICAL, before + maxY + after, before, before + maxY ); } }