3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "rowpainter.h"
19 #include "bufferparams.h"
20 #include "BufferView.h"
27 #include "lyxrow_funcs.h"
28 #include "metricsinfo.h"
29 #include "paragraph.h"
30 #include "paragraph_funcs.h"
31 #include "ParagraphParameters.h"
34 #include "frontends/font_metrics.h"
35 #include "frontends/Painter.h"
37 #include "insets/insettext.h"
39 #include "support/textutils.h"
47 extern int NEST_MARGIN;
48 extern int CHANGEBAR_MARGIN;
53 * A class used for painting an individual row of text.
57 /// initialise and run painter
58 RowPainter(BufferView const & bv, LyXText const & text,
59 ParagraphList::iterator pit, RowList::iterator rit, int xo, int yo);
61 // paint various parts
62 void paintBackground();
63 void paintSelection();
66 void paintChangeBar();
69 void paintForeignMark(double orig_x, LyXFont const & orig_font);
70 void paintHebrewComposeChar(lyx::pos_type & vpos);
71 void paintArabicComposeChar(lyx::pos_type & vpos);
72 void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
73 int paintAppendixStart(int y);
74 int paintLengthMarker(string const & prefix, VSpace const & vsp, int start);
76 void paintFromPos(lyx::pos_type & vpos);
77 void paintInset(lyx::pos_type const pos);
79 /// return left margin
80 int leftMargin() const;
82 /// return the font at the given pos
83 LyXFont const getFont(lyx::pos_type pos) const;
85 /// return the label font for this row
86 LyXFont const getLabelFont() const;
88 /// return pixel width for the given pos
89 int singleWidth(lyx::pos_type pos) const;
90 int singleWidth(lyx::pos_type pos, char c) const;
92 /// bufferview to paint on
93 BufferView const & bv_;
98 /// LyXText for the row
99 LyXText const & text_;
102 RowList::iterator const rit_;
106 mutable ParagraphList::iterator pit_;
119 RowPainter::RowPainter(BufferView const & bv, LyXText const & text,
120 ParagraphList::iterator pit, RowList::iterator rit,
122 : bv_(bv), pain_(bv_.painter()), text_(text), rit_(rit), row_(*rit),
123 pit_(pit), xo_(xo), yo_(yo), x_(row_.x()),
124 width_(text_.textWidth()),
125 separator_(row_.fill_separator()),
126 hfill_(row_.fill_hfill()),
127 label_hfill_(row_.fill_label_hfill())
131 // background has already been cleared.
132 if (&text_ == bv_.text())
135 // paint the selection background
136 if (text_.selection.set() && &text_ == bv_.cursor().innerText())
139 // vertical lines for appendix
142 // environment depth brackets
151 if (row_.endpos() >= pit_->size())
160 LyXFont const RowPainter::getFont(pos_type pos) const
162 return text_.getFont(pit_, pos);
166 int RowPainter::singleWidth(lyx::pos_type pos) const
168 return text_.singleWidth(pit_, pos);
172 int RowPainter::singleWidth(lyx::pos_type pos, char c) const
174 LyXFont const & font = text_.getFont(pit_, pos);
175 return text_.singleWidth(pit_, pos, c, font);
179 LyXFont const RowPainter::getLabelFont() const
181 return text_.getLabelFont(pit_);
185 int RowPainter::leftMargin() const
187 return text_.leftMargin(pit_, row_.pos());
191 void RowPainter::paintInset(pos_type const pos)
193 InsetOld * inset = const_cast<InsetOld*>(pit_->getInset(pos));
197 PainterInfo pi(const_cast<BufferView *>(&bv_));
198 pi.base.font = getFont(pos);
199 inset->draw(pi, int(x_), yo_ + row_.baseline());
200 x_ += inset->width();
204 void RowPainter::paintHebrewComposeChar(pos_type & vpos)
206 pos_type pos = text_.bidi.vis2log(vpos);
211 char c = pit_->getChar(pos);
215 LyXFont const & font = getFont(pos);
216 int const width = font_metrics::width(c, font);
219 for (pos_type i = pos - 1; i >= 0; --i) {
220 c = pit_->getChar(i);
221 if (!Encodings::IsComposeChar_hebrew(c)) {
222 if (IsPrintableNonspace(c)) {
223 int const width2 = singleWidth(i, c);
225 dx = (c == 'ø' || c == 'ã')
227 : (width2 - width) / 2;
234 pain_.text(int(x_) + dx, yo_ + row_.baseline(), str, font);
238 void RowPainter::paintArabicComposeChar(pos_type & vpos)
240 pos_type pos = text_.bidi.vis2log(vpos);
244 char c = pit_->getChar(pos);
245 c = pit_->transformChar(c, pos);
249 LyXFont const & font = getFont(pos);
250 int const width = font_metrics::width(c, font);
253 for (pos_type i = pos - 1; i >= 0; --i) {
254 c = pit_->getChar(i);
255 if (!Encodings::IsComposeChar_arabic(c)) {
256 if (IsPrintableNonspace(c)) {
257 int const width2 = singleWidth(i, c);
258 dx = (width2 - width) / 2;
264 pain_.text(int(x_) + dx, yo_ + row_.baseline(), str, font);
268 void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
270 pos_type pos = text_.bidi.vis2log(vpos);
271 pos_type const end = row_.endpos();
272 LyXFont orig_font = getFont(pos);
276 str += pit_->getChar(pos);
278 unsigned char c = str[0];
279 str[0] = pit_->transformChar(c, pos);
282 bool prev_struckout = isDeletedText(*pit_, pos);
283 bool prev_newtext = isInsertedText(*pit_, pos);
285 // collect as much similar chars as we can
286 for (++vpos; vpos < end && (pos = text_.bidi.vis2log(vpos)) >= 0; ++vpos) {
287 char c = pit_->getChar(pos);
289 if (!IsPrintableNonspace(c))
292 if (prev_struckout != isDeletedText(*pit_, pos))
295 if (prev_newtext != isInsertedText(*pit_, pos))
298 if (arabic && Encodings::IsComposeChar_arabic(c))
301 if (hebrew && Encodings::IsComposeChar_hebrew(c))
304 if (orig_font != getFont(pos))
308 c = pit_->transformChar(c, pos);
314 orig_font.setColor(LColor::strikeout);
315 else if (prev_newtext)
316 orig_font.setColor(LColor::newtext);
318 // Draw text and set the new x position
319 //lyxerr << "paint row: yo_ " << yo_ << " baseline: " << row_.baseline()
321 pain_.text(int(x_), yo_ + row_.baseline(), str, orig_font);
322 x_ += font_metrics::width(str, orig_font);
326 void RowPainter::paintForeignMark(double orig_x, LyXFont const & orig_font)
328 if (!lyxrc.mark_foreign_language)
330 if (orig_font.language() == latex_language)
332 if (orig_font.language() == bv_.buffer()->params().language)
335 int const y = yo_ + row_.baseline() + 1;
336 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
340 void RowPainter::paintFromPos(pos_type & vpos)
342 pos_type const pos = text_.bidi.vis2log(vpos);
344 LyXFont const & orig_font = getFont(pos);
346 double const orig_x = x_;
348 char const c = pit_->getChar(pos);
350 if (c == Paragraph::META_INSET) {
353 paintForeignMark(orig_x, orig_font);
357 // usual characters, no insets
359 // special case languages
360 bool const hebrew = (orig_font.language()->lang() == "hebrew");
362 orig_font.language()->lang() == "arabic" &&
363 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
364 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
366 // draw as many chars as we can
367 if ((!hebrew && !arabic)
368 || (hebrew && !Encodings::IsComposeChar_hebrew(c))
369 || (arabic && !Encodings::IsComposeChar_arabic(c))) {
370 paintChars(vpos, hebrew, arabic);
372 paintHebrewComposeChar(vpos);
374 paintArabicComposeChar(vpos);
377 paintForeignMark(orig_x, orig_font);
381 void RowPainter::paintBackground()
383 int const x = int(xo_);
384 int const y = yo_ < 0 ? 0 : yo_;
385 int const h = yo_ < 0 ? row_.height() + yo_ : row_.height();
386 pain_.fillRectangle(x, y, width_, h, text_.backgroundColor());
390 void RowPainter::paintSelection()
392 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
394 // the current selection
395 int const startx = text_.selection.start.x();
396 int const endx = text_.selection.end.x();
397 int const starty = text_.selection.start.y();
398 int const endy = text_.selection.end.y();
399 ParagraphList::iterator startpit = text_.getPar(text_.selection.start);
400 ParagraphList::iterator endpit = text_.getPar(text_.selection.end);
401 RowList::iterator startrow = startpit->getRow(text_.selection.start.pos());
402 RowList::iterator endrow = endpit->getRow(text_.selection.end.pos());
403 int const h = row_.height();
405 int const row_y = pit_->y + row_.y_offset();
407 bool const sel_starts_here = startpit == pit_ && startrow == rit_;
408 bool const sel_ends_here = endpit == pit_ && endrow == rit_;
409 bool const sel_on_one_row = sel_starts_here && sel_ends_here;
411 if (text_.bidi.same_direction()) {
414 if (sel_on_one_row) {
416 x = int(xo_) + startx;
422 pain_.fillRectangle(x, yo_, w, h, LColor::selection);
423 } else if (sel_starts_here) {
424 int const x = is_rtl ? int(xo_) : int(xo_ + startx);
425 int const w = is_rtl ? startx : (width_ - startx);
426 pain_.fillRectangle(x, yo_, w, h, LColor::selection);
427 } else if (sel_ends_here) {
428 int const x = is_rtl ? int(xo_ + endx) : int(xo_);
429 int const w = is_rtl ? (width_ - endx) : endx;
430 pain_.fillRectangle(x, yo_, w, h, LColor::selection);
431 } else if (row_y > starty && row_y < endy) {
432 pain_.fillRectangle(int(xo_), yo_, width_, h, LColor::selection);
437 if ((startpit != pit_ && startrow != rit_ && !is_rtl)
438 || (endpit != pit_ && endrow != rit_ && is_rtl))
439 pain_.fillRectangle(int(xo_), yo_,
440 int(x_), h, LColor::selection);
442 pos_type const body_pos = pit_->beginOfBody();
443 pos_type const end = row_.endpos();
446 for (pos_type vpos = row_.pos(); vpos < end; ++vpos) {
447 pos_type pos = text_.bidi.vis2log(vpos);
448 double const old_tmpx = tmpx;
449 if (body_pos > 0 && pos == body_pos - 1) {
450 LyXLayout_ptr const & layout = pit_->layout();
451 LyXFont const lfont = getLabelFont();
453 tmpx += label_hfill_ + font_metrics::width(layout->labelsep, lfont);
455 if (pit_->isLineSeparator(body_pos - 1))
456 tmpx -= singleWidth(body_pos - 1);
459 tmpx += singleWidth(pos);
461 if (hfillExpansion(*pit_, row_, pos)) {
465 tmpx += label_hfill_;
467 if (pit_->isSeparator(pos) && pos >= body_pos)
471 if (((startpit != pit_ && startrow != rit_)
472 || text_.selection.start.pos() <= pos) &&
473 ((endpit != pit_ && endrow != rit_)
474 || pos < text_.selection.end.pos())) {
475 // Here we do not use x_ as xo_ was added to x_.
476 pain_.fillRectangle(int(old_tmpx), yo_,
477 int(tmpx - old_tmpx + 1), h, LColor::selection);
481 if ((startpit != pit_ && startrow != rit_ && is_rtl) ||
482 (endpit != pit_ && endrow != rit_ && !is_rtl)) {
483 pain_.fillRectangle(int(xo_ + tmpx),
484 yo_, int(width_ - tmpx), h, LColor::selection);
489 void RowPainter::paintChangeBar()
491 pos_type const start = row_.pos();
492 pos_type const end = row_.endpos();
494 if (start == end || !pit_->isChanged(start, end - 1))
497 int const height = text_.isLastRow(pit_, row_)
499 : row_.height() + boost::next(rit_)->top_of_text();
501 pain_.fillRectangle(4, yo_, 5, height, LColor::changebar);
505 void RowPainter::paintAppendix()
507 if (!pit_->params().appendix())
510 // FIXME: can be just width_ ?
511 int const ww = width_;
515 if (pit_->params().startOfAppendix())
516 y += 2 * defaultRowHeight();
518 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
519 pain_.line(ww - 2, y, ww - 2, yo_ + row_.height(), LColor::appendix);
523 void RowPainter::paintDepthBar()
525 Paragraph::depth_type const depth = pit_->getDepth();
530 Paragraph::depth_type prev_depth = 0;
531 if (!text_.isFirstRow(pit_, row_)) {
532 ParagraphList::iterator pit2 = pit_;
535 prev_depth = pit2->getDepth();
538 Paragraph::depth_type next_depth = 0;
539 if (!text_.isLastRow(pit_, row_)) {
540 ParagraphList::iterator pit2 = pit_;
541 if (row_.endpos() >= pit2->size())
543 next_depth = pit2->getDepth();
546 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
547 int const w = NEST_MARGIN / 5;
548 int x = int(w * i + xo_);
549 // only consider the changebar space if we're drawing outer left
551 x += CHANGEBAR_MARGIN;
552 int const h = yo_ + row_.height() - 1 - (i - next_depth - 1) * 3;
554 pain_.line(x, yo_, x, h, LColor::depthbar);
557 pain_.fillRectangle(x, yo_, w, 2, LColor::depthbar);
559 pain_.fillRectangle(x, h, w, 2, LColor::depthbar);
564 int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp,
567 if (vsp.kind() == VSpace::NONE)
570 int const arrow_size = 4;
571 int const size = getLengthMarkerHeight(bv_, vsp);
572 int const end = start + size;
574 // the label to display (if any)
576 // y-values for top arrow
578 // y-values for bottom arrow
581 str = prefix + " (" + vsp.asLyXCommand() + ")";
583 if (vsp.kind() == VSpace::VFILL) {
587 // adding or removing space
588 bool const added = vsp.kind() != VSpace::LENGTH ||
589 vsp.length().len().value() > 0.0;
590 ty1 = added ? (start + arrow_size) : start;
591 ty2 = added ? start : (start + arrow_size);
592 by1 = added ? (end - arrow_size) : end;
593 by2 = added ? end : (end - arrow_size);
596 int const leftx = int(xo_) + leftMargin();
597 int const midx = leftx + arrow_size;
598 int const rightx = midx + arrow_size;
606 font.setColor(LColor::added_space);
609 font_metrics::rectText(str, font, w, a, d);
611 pain_.rectText(leftx + 2 * arrow_size + 5,
612 start + (end - start) / 2 + d,
614 LColor::none, LColor::none);
617 pain_.line(leftx, ty1, midx, ty2, LColor::added_space);
618 pain_.line(midx, ty2, rightx, ty1, LColor::added_space);
621 pain_.line(leftx, by1, midx, by2, LColor::added_space);
622 pain_.line(midx, by2, rightx, by1, LColor::added_space);
625 pain_.line(midx, ty2, midx, by2, LColor::added_space);
631 int RowPainter::paintAppendixStart(int y)
634 pb_font.setColor(LColor::appendix);
637 string const label = _("Appendix");
641 font_metrics::rectText(label, pb_font, w, a, d);
643 int const text_start = int(xo_ + (width_ - w) / 2);
644 int const text_end = text_start + w;
646 pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
648 pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
649 pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
651 return 3 * defaultRowHeight();
655 void RowPainter::paintFirst()
657 ParagraphParameters const & parparams = pit_->params();
661 // start of appendix?
662 if (parparams.startOfAppendix())
663 y_top += paintAppendixStart(yo_ + y_top + 2 * defaultRowHeight());
665 // draw the additional space if needed:
666 y_top += paintLengthMarker(_("Space above"), parparams.spaceTop(),
669 Buffer const & buffer = *bv_.buffer();
671 LyXLayout_ptr const & layout = pit_->layout();
673 if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
674 if (pit_ != text_.ownerParagraphs().begin()) {
675 if (layout->latextype == LATEX_PARAGRAPH
676 && !pit_->getDepth()) {
677 y_top += buffer.params().getDefSkip().inPixels(bv_);
679 LyXLayout_ptr const & playout =
680 boost::prior(pit_)->layout();
681 if (playout->latextype == LATEX_PARAGRAPH
682 && !boost::prior(pit_)->getDepth()) {
683 // is it right to use defskip here, too? (AS)
684 y_top += buffer.params().getDefSkip().inPixels(bv_);
690 int const ww = bv_.workWidth();
692 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
693 bool const is_seq = isFirstInSequence(pit_, text_.ownerParagraphs());
694 //lyxerr << "paintFirst: " << pit_->id() << " is_seq: " << is_seq << std::endl;
696 // should we print a label?
697 if (layout->labeltype >= LABEL_STATIC
698 && (layout->labeltype != LABEL_STATIC
699 || layout->latextype != LATEX_ENVIRONMENT
702 LyXFont font = getLabelFont();
703 if (!pit_->getLabelstring().empty()) {
705 string const str = pit_->getLabelstring();
707 // this is special code for the chapter layout. This is
708 // printed in an extra row and has a pagebreak at
710 if (layout->counter == "chapter") {
711 if (buffer.params().secnumdepth >= 0) {
712 float spacing_val = 1.0;
713 if (!parparams.spacing().isDefault()) {
714 spacing_val = parparams.spacing().getValue();
716 spacing_val = buffer.params().spacing().getValue();
720 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
721 + int(layout->parsep) * defaultRowHeight();
724 x = ww - leftMargin() -
725 font_metrics::width(str, font);
729 yo_ + row_.baseline() -
730 row_.ascent_of_text() - maxdesc,
735 x = ww - leftMargin()
736 + font_metrics::width(layout->labelsep, font);
738 x = x_ - font_metrics::width(layout->labelsep, font)
739 - font_metrics::width(str, font);
742 pain_.text(int(x), yo_ + row_.baseline(), str, font);
746 // the labels at the top of an environment.
747 // More or less for bibliography
749 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
750 layout->labeltype == LABEL_BIBLIO ||
751 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
752 LyXFont font = getLabelFont();
753 if (!pit_->getLabelstring().empty()) {
754 string const str = pit_->getLabelstring();
755 float spacing_val = 1.0;
756 if (!parparams.spacing().isDefault()) {
757 spacing_val = parparams.spacing().getValue();
759 spacing_val = buffer.params().spacing().getValue();
763 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
764 + (layout->labelbottomsep * defaultRowHeight()));
767 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
768 x = ((is_rtl ? leftMargin() : x_)
769 + ww - text_.rightMargin(*pit_)) / 2;
770 x -= font_metrics::width(str, font) / 2;
772 x = ww - leftMargin() -
773 font_metrics::width(str, font);
776 yo_ + row_.baseline() - row_.ascent_of_text() - maxdesc,
783 void RowPainter::paintLast()
785 ParagraphParameters const & parparams = pit_->params();
786 int y_bottom = row_.height() - 1;
787 int const ww = bv_.workWidth();
789 // draw the additional space if needed:
790 int const height = getLengthMarkerHeight(bv_, parparams.spaceBottom());
791 y_bottom -= paintLengthMarker(_("Space below"), parparams.spaceBottom(),
792 yo_ + y_bottom - height);
794 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
795 int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
800 case END_LABEL_FILLED_BOX: {
801 LyXFont const font = getLabelFont();
802 int const size = int(0.75 * font_metrics::maxAscent(font));
803 int const y = yo_ + row_.baseline() - size;
804 int x = is_rtl ? NEST_MARGIN + CHANGEBAR_MARGIN: ww - size;
806 if (row_.fill() <= size)
807 x += (size - row_.fill() + 1) * (is_rtl ? -1 : 1);
809 if (endlabel == END_LABEL_BOX)
810 pain_.rectangle(x, y, size, size, LColor::eolmarker);
812 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
816 case END_LABEL_STATIC: {
817 LyXFont font = getLabelFont();
818 string const & str = pit_->layout()->endlabelstring();
819 double const x = is_rtl ?
820 x_ - font_metrics::width(str, font)
821 : ww - text_.rightMargin(*pit_) - row_.fill();
822 pain_.text(int(x), yo_ + row_.baseline(), str, font);
826 case END_LABEL_NO_LABEL:
832 void RowPainter::paintText()
834 pos_type const end = row_.endpos();
835 pos_type body_pos = pit_->beginOfBody();
837 (body_pos > end || !pit_->isLineSeparator(body_pos - 1))) {
841 LyXLayout_ptr const & layout = pit_->layout();
843 bool running_strikeout = false;
844 bool is_struckout = false;
845 int last_strikeout_x = 0;
847 for (pos_type vpos = row_.pos(); vpos < end; ) {
848 if (x_ > bv_.workWidth())
851 pos_type pos = text_.bidi.vis2log(vpos);
853 if (pos >= pit_->size()) {
858 if (x_ + singleWidth(pos) < 0) {
859 x_ += singleWidth(pos);
864 is_struckout = isDeletedText(*pit_, pos);
866 if (is_struckout && !running_strikeout) {
867 running_strikeout = true;
868 last_strikeout_x = int(x_);
871 bool const highly_editable_inset = pit_->isInset(pos)
872 && isHighlyEditableInset(pit_->getInset(pos));
874 // if we reach the end of a struck out range, paint it
875 // we also don't paint across things like tables
876 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
877 int const middle = yo_ + (row_.baseline() + row_.top_of_text()) / 2;
878 pain_.line(last_strikeout_x, middle, int(x_), middle,
879 LColor::strikeout, Painter::line_solid, Painter::line_thin);
880 running_strikeout = false;
883 if (body_pos > 0 && pos == body_pos - 1) {
884 int const lwidth = font_metrics::width(layout->labelsep,
887 x_ += label_hfill_ + lwidth - singleWidth(body_pos - 1);
890 if (pit_->isHfill(pos)) {
893 int const y0 = yo_ + row_.baseline();
894 int const y1 = y0 - defaultRowHeight() / 2;
896 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
898 if (hfillExpansion(*pit_, row_, pos)) {
899 int const y2 = (y0 + y1) / 2;
901 if (pos >= body_pos) {
902 pain_.line(int(x_), y2, int(x_ + hfill_), y2,
904 Painter::line_onoffdash);
907 pain_.line(int(x_), y2, int(x_ + label_hfill_), y2,
909 Painter::line_onoffdash);
912 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
916 } else if (pit_->isSeparator(pos)) {
917 x_ += singleWidth(pos);
926 // if we reach the end of a struck out range, paint it
927 if (running_strikeout) {
928 int const middle = yo_ + (row_.baseline() + row_.top_of_text()) / 2;
929 pain_.line(last_strikeout_x, middle, int(x_), middle,
930 LColor::strikeout, Painter::line_solid, Painter::line_thin);
931 running_strikeout = false;
936 int paintPars(BufferView const & bv, LyXText const & text,
937 ParagraphList::iterator pit, int xo, int yo, int y)
939 //lyxerr << " paintRows: pit: " << &*pit << endl;
940 int const y2 = bv.painter().paperHeight();
943 ParagraphList::iterator end = text.ownerParagraphs().end();
945 for ( ; pit != end; ++pit) {
946 RowList::iterator row = pit->rows.begin();
947 RowList::iterator rend = pit->rows.end();
949 for ( ; row != rend; ++row) {
950 RowPainter(bv, text, pit, row, xo, y + yo);
963 int paintText(BufferView const & bv)
965 ParagraphList::iterator pit;
966 bv.text()->getRowNearY(bv.top_y(), pit);
967 return paintPars(bv, *bv.text(), pit, 0, 0, pit->y);
971 void paintTextInset(BufferView const & bv, LyXText const & text, int xo, int yo)
973 paintPars(bv, text, text.ownerParagraphs().begin(), xo, yo, 0);
977 int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
979 if (vsp.kind() == VSpace::NONE)
982 int const arrow_size = 4;
983 int const space_size = vsp.inPixels(bv);
987 int const min_size = max(3 * arrow_size, font_metrics::maxHeight(font));
989 if (vsp.length().len().value() < 0.0)
992 return max(min_size, space_size);