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 "frontends/Painter.h"
15 #include "frontends/screen.h"
16 #include "frontends/font_metrics.h"
17 #include "support/LAssert.h"
18 #include "paragraph.h"
19 #include "paragraph_funcs.h"
20 #include "support/textutils.h"
22 #include "insets/insettext.h"
23 #include "ParagraphParameters.h"
24 #include "BufferView.h"
31 #include "rowpainter.h"
33 #include "lyxrow_funcs.h"
34 #include "metricsinfo.h"
38 using namespace lyx::support;
43 extern int PAPER_MARGIN;
44 extern int CHANGEBAR_MARGIN;
45 extern int LEFT_MARGIN;
49 // "temporary". We'll never get to use more
50 // references until we start adding hacks like
51 // these until other places catch up.
52 BufferView * perv(BufferView const & bv)
54 return const_cast<BufferView *>(&bv);
60 RowPainter::RowPainter(BufferView const & bv,
61 LyXText const & text, RowList::iterator rit)
62 : bv_(bv), pain_(bv_.painter()), text_(text), row_(rit), pit_(rit->par())
67 LyXFont const RowPainter::getFont(pos_type pos) const
69 return text_.getFont(bv_.buffer(), pit_, pos);
73 int RowPainter::singleWidth(lyx::pos_type pos) const
75 return text_.singleWidth(pit_, pos);
79 int RowPainter::singleWidth(lyx::pos_type pos, char c) const
81 return text_.singleWidth(pit_, pos, c);
85 LyXFont const RowPainter::getLabelFont() const
87 return text_.getLabelFont(bv_.buffer(), pit_);
91 char const RowPainter::transformChar(char c, lyx::pos_type pos) const
93 return text_.transformChar(c, *pit_, pos);
97 int RowPainter::leftMargin() const
99 return text_.leftMargin(*row_);
103 void RowPainter::paintInset(pos_type const pos)
105 Inset * inset = const_cast<Inset*>(pit_->getInset(pos));
109 #warning inset->update FIXME
110 inset->update(perv(bv_), false);
112 PainterInfo pi(perv(bv_));
113 pi.base.font = getFont(pos);
114 int const w = inset->width(perv(bv_), pi.base.font);
115 inset->draw(pi, int(x_), yo_ + row_->baseline());
120 void RowPainter::paintHebrewComposeChar(pos_type & vpos)
122 pos_type pos = text_.vis2log(vpos);
127 char c = pit_->getChar(pos);
131 LyXFont const & font = getFont(pos);
132 int const width = font_metrics::width(c, font);
135 for (pos_type i = pos - 1; i >= 0; --i) {
136 c = pit_->getChar(i);
137 if (!Encodings::IsComposeChar_hebrew(c)) {
138 if (IsPrintableNonspace(c)) {
142 dx = (c == 'ø' || c == 'ã')
144 : (width2 - width) / 2;
151 pain_.text(int(x_) + dx, yo_ + row_->baseline(), str, font);
155 void RowPainter::paintArabicComposeChar(pos_type & vpos)
157 pos_type pos = text_.vis2log(vpos);
161 char c = pit_->getChar(pos);
162 c = transformChar(c, pos);
166 LyXFont const & font = getFont(pos);
167 int const width = font_metrics::width(c, font);
170 for (pos_type i = pos - 1; i >= 0; --i) {
171 c = pit_->getChar(i);
172 if (!Encodings::IsComposeChar_arabic(c)) {
173 if (IsPrintableNonspace(c)) {
176 dx = (width2 - width) / 2;
182 pain_.text(int(x_) + dx, yo_ + row_->baseline(), str, font);
186 void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
188 pos_type pos = text_.vis2log(vpos);
189 pos_type const last = lastPrintablePos(text_, row_);
190 LyXFont orig_font(getFont(pos));
194 str += pit_->getChar(pos);
196 unsigned char c = str[0];
197 str[0] = transformChar(c, pos);
200 bool prev_struckout(isDeletedText(*pit_, pos));
201 bool prev_newtext(isInsertedText(*pit_, pos));
205 // collect as much similar chars as we can
206 while (vpos <= last && (pos = text_.vis2log(vpos)) >= 0) {
207 char c = pit_->getChar(pos);
209 if (!IsPrintableNonspace(c))
212 if (prev_struckout != isDeletedText(*pit_, pos))
215 if (prev_newtext != isInsertedText(*pit_, pos))
218 if (arabic && Encodings::IsComposeChar_arabic(c))
220 if (hebrew && Encodings::IsComposeChar_hebrew(c))
223 if (orig_font != getFont(pos))
227 c = transformChar(c, pos);
232 if (prev_struckout) {
233 orig_font.setColor(LColor::strikeout);
234 } else if (prev_newtext) {
235 orig_font.setColor(LColor::newtext);
238 // Draw text and set the new x position
239 pain_.text(int(x_), yo_ + row_->baseline(), str, orig_font);
240 x_ += font_metrics::width(str, orig_font);
244 void RowPainter::paintForeignMark(float const orig_x, LyXFont const & orig_font)
246 if (!lyxrc.mark_foreign_language)
248 if (orig_font.language() == latex_language)
250 if (orig_font.language() == bv_.buffer()->params.language)
253 int const y = yo_ + row_->baseline() + 1;
254 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
258 void RowPainter::paintFromPos(pos_type & vpos)
260 pos_type const pos = text_.vis2log(vpos);
262 LyXFont const & orig_font = getFont(pos);
264 float const orig_x = x_;
266 char const c = pit_->getChar(pos);
268 if (IsInsetChar(c)) {
271 paintForeignMark(orig_x, orig_font);
275 // usual characters, no insets
277 // special case languages
278 bool const hebrew = (orig_font.language()->lang() == "hebrew");
280 orig_font.language()->lang() == "arabic" &&
281 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
282 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
284 // draw as many chars as we can
285 if ((!hebrew && !arabic)
286 || (hebrew && !Encodings::IsComposeChar_hebrew(c))
287 || (arabic && !Encodings::IsComposeChar_arabic(c))) {
288 paintChars(vpos, hebrew, arabic);
290 paintHebrewComposeChar(vpos);
292 paintArabicComposeChar(vpos);
295 paintForeignMark(orig_x, orig_font);
301 void RowPainter::paintBackground()
304 int const y = yo_ < 0 ? 0 : yo_;
305 int const h = yo_ < 0 ? row_->height() + yo_ : row_->height();
306 pain_.fillRectangle(x, y, width_, h, text_.backgroundColor());
310 void RowPainter::paintSelection()
312 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
314 // the current selection
315 int const startx = text_.selection.start.x();
316 int const endx = text_.selection.end.x();
317 int const starty = text_.selection.start.y();
318 int const endy = text_.selection.end.y();
319 RowList::iterator startrow = text_.getRow(text_.selection.start);
320 RowList::iterator endrow = text_.getRow(text_.selection.end);
322 if (text_.bidi_same_direction) {
326 int h = row_->height();
328 if (startrow == row_ && endrow == row_) {
332 pain_.fillRectangle(x, y, w, h, LColor::selection);
336 pain_.fillRectangle(x, y, w, h, LColor::selection);
338 } else if (startrow == row_) {
339 int const x = (is_rtl) ? xo_ : (xo_ + startx);
340 int const w = (is_rtl) ? startx : (width_ - startx);
341 pain_.fillRectangle(x, y, w, h, LColor::selection);
342 } else if (endrow == row_) {
343 int const x = (is_rtl) ? (xo_ + endx) : xo_;
344 int const w = (is_rtl) ? (width_ - endx) : endx;
345 pain_.fillRectangle(x, y, w, h, LColor::selection);
346 } else if (y_ > starty && y_ < endy) {
347 pain_.fillRectangle(xo_, y, width_, h, LColor::selection);
350 } else if (startrow != row_ && endrow != row_) {
351 if (y_ > starty && y_ < endy) {
353 int h = row_->height();
354 pain_.fillRectangle(xo_, yo_, w, h, LColor::selection);
359 if ((startrow != row_ && !is_rtl) || (endrow != row_ && is_rtl))
360 pain_.fillRectangle(xo_, yo_, int(x_), row_->height(), LColor::selection);
362 pos_type const body_pos = pit_->beginningOfBody();
363 pos_type const last = lastPrintablePos(text_, row_);
366 for (pos_type vpos = row_->pos(); vpos <= last; ++vpos) {
367 pos_type pos = text_.vis2log(vpos);
368 float const old_tmpx = tmpx;
369 if (body_pos > 0 && pos == body_pos - 1) {
370 LyXLayout_ptr const & layout = pit_->layout();
371 LyXFont const lfont = getLabelFont();
373 tmpx += label_hfill_ + font_metrics::width(layout->labelsep, lfont);
375 if (pit_->isLineSeparator(body_pos - 1))
376 tmpx -= singleWidth(body_pos - 1);
379 if (hfillExpansion(text_, row_, pos)) {
380 tmpx += singleWidth(pos);
384 tmpx += label_hfill_;
387 else if (pit_->isSeparator(pos)) {
388 tmpx += singleWidth(pos);
392 tmpx += singleWidth(pos);
395 if ((startrow != row_ || text_.selection.start.pos() <= pos) &&
396 (endrow != row_ || pos < text_.selection.end.pos())) {
397 // Here we do not use x_ as xo_ was added to x_.
398 pain_.fillRectangle(int(old_tmpx), yo_,
399 int(tmpx - old_tmpx + 1),
400 row_->height(), LColor::selection);
404 if ((startrow != row_ && is_rtl) || (endrow != row_ && !is_rtl)) {
405 pain_.fillRectangle(xo_ + int(tmpx),
406 yo_, int(bv_.workWidth() - tmpx),
407 row_->height(), LColor::selection);
412 void RowPainter::paintChangeBar()
414 pos_type const start = row_->pos();
415 pos_type const end = lastPrintablePos(text_, row_);
417 if (!pit_->isChanged(start, end))
420 int const height = (boost::next(row_) != text_.rows().end()
421 ? row_->height() + boost::next(row_)->top_of_text()
424 pain_.fillRectangle(4, yo_, 5, height, LColor::changebar);
428 void RowPainter::paintAppendix()
430 if (!pit_->params().appendix())
433 // FIXME: can be just width_ ?
434 int const ww = bv_.workWidth();
438 if (pit_->params().startOfAppendix())
439 y += 2 * defaultRowHeight();
441 pain_.line(1, y, 1, yo_ + row_->height(), LColor::appendix);
442 pain_.line(ww - 2, y, ww - 2, yo_ + row_->height(), LColor::appendix);
446 void RowPainter::paintDepthBar()
448 Paragraph::depth_type const depth = pit_->getDepth();
453 Paragraph::depth_type prev_depth = 0;
454 if (row_ != text_.rows().begin())
455 prev_depth = boost::prior(row_)->par()->getDepth();
456 Paragraph::depth_type next_depth = 0;
458 RowList::iterator next_row = boost::next(row_);
459 if (next_row != text_.rows().end())
460 next_depth = next_row->par()->getDepth();
462 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
463 int x = (PAPER_MARGIN / 5) * i + xo_;
464 // only consider the changebar space if we're drawing outer left
466 x += CHANGEBAR_MARGIN;
467 int const h = yo_ + row_->height() - 1 - (i - next_depth - 1) * 3;
469 pain_.line(x, yo_, x, h, LColor::depthbar);
471 int const w = PAPER_MARGIN / 5;
473 if (i > prev_depth) {
474 pain_.fillRectangle(x, yo_, w, 2, LColor::depthbar);
476 if (i > next_depth) {
477 pain_.fillRectangle(x, h, w, 2, LColor::depthbar);
483 int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
485 if (vsp.kind() == VSpace::NONE)
488 int const arrow_size = 4;
489 int const space_size = int(vsp.inPixels(bv));
493 int const min_size = max(3 * arrow_size,
494 font_metrics::maxAscent(font)
495 + font_metrics::maxDescent(font));
497 if (vsp.length().len().value() < 0.0)
500 return max(min_size, space_size);
504 int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp, int start)
506 if (vsp.kind() == VSpace::NONE)
509 int const arrow_size = 4;
510 int const size = getLengthMarkerHeight(bv_, vsp);
511 int const end = start + size;
513 // the label to display (if any)
515 // y-values for top arrow
517 // y-values for bottom arrow
520 str = prefix + " (" + vsp.asLyXCommand() + ")";
522 if (vsp.kind() == VSpace::VFILL) {
526 // adding or removing space
527 bool const added = vsp.kind() != VSpace::LENGTH ||
528 vsp.length().len().value() > 0.0;
529 ty1 = added ? (start + arrow_size) : start;
530 ty2 = added ? start : (start + arrow_size);
531 by1 = added ? (end - arrow_size) : end;
532 by2 = added ? end : (end - arrow_size);
535 int const leftx = xo_ + leftMargin();
536 int const midx = leftx + arrow_size;
537 int const rightx = midx + arrow_size;
545 font.setColor(LColor::added_space).decSize().decSize();
546 font_metrics::rectText(str, font, w, a, d);
548 pain_.rectText(leftx + 2 * arrow_size + 5,
549 start + ((end - start) / 2) + d,
553 pain_.line(leftx, ty1, midx, ty2, LColor::added_space);
554 pain_.line(midx, ty2, rightx, ty1, LColor::added_space);
557 pain_.line(leftx, by1, midx, by2, LColor::added_space);
558 pain_.line(midx, by2, rightx, by1, LColor::added_space);
561 pain_.line(midx, ty2, midx, by2, LColor::added_space);
567 int RowPainter::paintPageBreak(string const & label, int y)
570 pb_font.setColor(LColor::pagebreak).decSize();
575 font_metrics::rectText(label, pb_font, w, a, d);
577 int const text_start = xo_ + ((width_ - w) / 2);
578 int const text_end = text_start + w;
580 pain_.rectText(text_start, y + d, label, pb_font);
582 pain_.line(xo_, y, text_start, y,
583 LColor::pagebreak, Painter::line_onoffdash);
584 pain_.line(text_end, y, xo_ + width_, y,
585 LColor::pagebreak, Painter::line_onoffdash);
587 return 3 * defaultRowHeight();
591 int RowPainter::paintAppendixStart(int y)
594 pb_font.setColor(LColor::appendix).decSize();
596 string const label = _("Appendix");
600 font_metrics::rectText(label, pb_font, w, a, d);
602 int const text_start = xo_ + ((width_ - w) / 2);
603 int const text_end = text_start + w;
605 pain_.rectText(text_start, y + d, label, pb_font);
607 pain_.line(xo_ + 1, y, text_start, y, LColor::appendix);
608 pain_.line(text_end, y, xo_ + width_ - 2, y, LColor::appendix);
610 return 3 * defaultRowHeight();
614 void RowPainter::paintFirst()
616 ParagraphParameters const & parparams = pit_->params();
620 // start of appendix?
621 if (parparams.startOfAppendix()) {
622 y_top += paintAppendixStart(yo_ + y_top + 2 * defaultRowHeight());
626 if (row_ == text_.rows().begin() && !text_.isInInset())
627 y_top += PAPER_MARGIN;
629 // draw a top pagebreak
630 if (parparams.pagebreakTop()) {
631 y_top += paintPageBreak(_("Page Break (top)"),
632 yo_ + y_top + 2 * defaultRowHeight());
635 // draw the additional space if needed:
636 y_top += paintLengthMarker(_("Space above"), parparams.spaceTop(),
639 Buffer const * buffer = bv_.buffer();
641 LyXLayout_ptr const & layout = pit_->layout();
643 if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
644 if (pit_ != text_.ownerParagraphs().begin()) {
645 if (layout->latextype == LATEX_PARAGRAPH
646 && !pit_->getDepth()) {
647 y_top += buffer->params.getDefSkip().inPixels(bv_);
649 LyXLayout_ptr const & playout =
650 boost::prior(pit_)->layout();
651 if (playout->latextype == LATEX_PARAGRAPH
652 && !boost::prior(pit_)->getDepth()) {
653 // is it right to use defskip here, too? (AS)
654 y_top += buffer->params.getDefSkip().inPixels(bv_);
660 int const ww = bv_.workWidth();
663 if (parparams.lineTop()) {
664 LyXFont font(LyXFont::ALL_SANE);
665 int const asc = font_metrics::ascent('x', getFont(0));
669 int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
670 int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
671 pain_.line(xp, yo_ + y_top, xp + w, yo_ + y_top,
672 LColor::topline, Painter::line_solid,
673 Painter::line_thick);
678 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
680 // should we print a label?
681 if (layout->labeltype >= LABEL_STATIC
682 && (layout->labeltype != LABEL_STATIC
683 || layout->latextype != LATEX_ENVIRONMENT
684 || isFirstInSequence(pit_, text_.ownerParagraphs()))) {
686 LyXFont font = getLabelFont();
687 if (!pit_->getLabelstring().empty()) {
689 string const str = pit_->getLabelstring();
691 // this is special code for the chapter layout. This is
692 // printed in an extra row and has a pagebreak at
694 if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
695 if (buffer->params.secnumdepth >= 0) {
696 float spacing_val = 1.0;
697 if (!parparams.spacing().isDefault()) {
698 spacing_val = parparams.spacing().getValue();
700 spacing_val = buffer->params.spacing.getValue();
704 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
705 + int(layout->parsep) * defaultRowHeight();
708 x = ww - leftMargin() -
709 font_metrics::width(str, font);
713 yo_ + row_->baseline() -
714 row_->ascent_of_text() - maxdesc,
719 x = ww - leftMargin()
720 + font_metrics::width(layout->labelsep, font);
722 x = x_ - font_metrics::width(layout->labelsep, font)
723 - font_metrics::width(str, font);
726 pain_.text(int(x), yo_ + row_->baseline(), str, font);
730 // the labels at the top of an environment.
731 // More or less for bibliography
732 } else if (isFirstInSequence(pit_, text_.ownerParagraphs()) &&
733 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
734 layout->labeltype == LABEL_BIBLIO ||
735 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
736 LyXFont font = getLabelFont();
737 if (!pit_->getLabelstring().empty()) {
738 string const str = pit_->getLabelstring();
739 float spacing_val = 1.0;
740 if (!parparams.spacing().isDefault()) {
741 spacing_val = parparams.spacing().getValue();
743 spacing_val = buffer->params.spacing.getValue();
747 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
748 + (layout->labelbottomsep * defaultRowHeight()));
751 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
752 x = ((is_rtl ? leftMargin() : x_)
753 + ww - text_.rightMargin(*bv_.buffer(), *row_)) / 2;
754 x -= font_metrics::width(str, font) / 2;
756 x = ww - leftMargin() -
757 font_metrics::width(str, font);
759 pain_.text(int(x), yo_ + row_->baseline()
760 - row_->ascent_of_text() - maxdesc,
767 void RowPainter::paintLast()
769 ParagraphParameters const & parparams = pit_->params();
770 int y_bottom = row_->height() - 1;
773 if (boost::next(row_) == text_.rows().end() && !text_.isInInset())
774 y_bottom -= PAPER_MARGIN;
776 int const ww = bv_.workWidth();
778 // draw a bottom pagebreak
779 if (parparams.pagebreakBottom()) {
780 y_bottom -= paintPageBreak(_("Page Break (bottom)"),
781 yo_ + y_bottom - 2 * defaultRowHeight());
784 // draw the additional space if needed:
785 int const height = getLengthMarkerHeight(bv_, parparams.spaceBottom());
786 y_bottom -= paintLengthMarker(_("Space below"), parparams.spaceBottom(),
787 yo_ + y_bottom - height);
789 // draw a bottom line
790 if (parparams.lineBottom()) {
791 LyXFont font(LyXFont::ALL_SANE);
792 int const asc = font_metrics::ascent('x',
793 getFont(max(pos_type(0), pit_->size() - 1)));
797 int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
798 int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
799 int const y = yo_ + y_bottom;
800 pain_.line(xp, y, xp + w, y, LColor::topline, Painter::line_solid,
801 Painter::line_thick);
806 bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
807 int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
812 case END_LABEL_FILLED_BOX:
814 LyXFont const font = getLabelFont();
815 int const size = int(0.75 * font_metrics::maxAscent(font));
816 int const y = (yo_ + row_->baseline()) - size;
817 int x = is_rtl ? LEFT_MARGIN : ww - PAPER_MARGIN - size;
819 if (row_->fill() <= size)
820 x += (size - row_->fill() + 1) * (is_rtl ? -1 : 1);
822 if (endlabel == END_LABEL_BOX) {
823 pain_.rectangle(x, y, size, size, LColor::eolmarker);
825 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
829 case END_LABEL_STATIC:
832 LyXFont font(LyXFont::ALL_SANE);
833 font = getLabelFont();
835 LyXFont font = getLabelFont();
837 string const & str = pit_->layout()->endlabelstring();
838 int const x = is_rtl ?
839 int(x_) - font_metrics::width(str, font)
840 : ww - text_.rightMargin(*bv_.buffer(), *row_) - row_->fill();
841 pain_.text(x, yo_ + row_->baseline(), str, font);
844 case END_LABEL_NO_LABEL:
850 void RowPainter::paintText()
852 pos_type const last = lastPrintablePos(text_, row_);
853 pos_type body_pos = pit_->beginningOfBody();
855 (body_pos - 1 > last ||
856 !pit_->isLineSeparator(body_pos - 1))) {
860 LyXLayout_ptr const & layout = pit_->layout();
862 bool running_strikeout = false;
863 bool is_struckout = false;
864 float last_strikeout_x = 0.0;
866 pos_type vpos = row_->pos();
867 while (vpos <= last) {
868 if (x_ > bv_.workWidth())
870 pos_type pos = text_.vis2log(vpos);
872 if (pos >= pit_->size()) {
877 if (x_ + singleWidth(pos) < 0) {
878 x_ += singleWidth(pos);
883 is_struckout = isDeletedText(*pit_, pos);
885 if (is_struckout && !running_strikeout) {
886 running_strikeout = true;
887 last_strikeout_x = x_;
890 bool const highly_editable_inset = pit_->isInset(pos)
891 && isHighlyEditableInset(pit_->getInset(pos));
893 // if we reach the end of a struck out range, paint it
894 // we also don't paint across things like tables
895 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
896 int const middle = yo_ + row_->top_of_text()
897 + ((row_->baseline() - row_->top_of_text()) / 2);
898 pain_.line(int(last_strikeout_x), middle, int(x_), middle,
899 LColor::strikeout, Painter::line_solid, Painter::line_thin);
900 running_strikeout = false;
903 if (body_pos > 0 && pos == body_pos - 1) {
904 int const lwidth = font_metrics::width(layout->labelsep,
907 x_ += label_hfill_ + lwidth
908 - singleWidth(body_pos - 1);
911 if (pit_->isHfill(pos)) {
914 int const y0 = yo_ + row_->baseline();
915 int const y1 = y0 - defaultRowHeight() / 2;
917 pain_.line(int(x_), y1, int(x_), y0,
918 LColor::added_space);
920 if (hfillExpansion(text_, row_, pos)) {
921 int const y2 = (y0 + y1) / 2;
923 if (pos >= body_pos) {
924 pain_.line(int(x_), y2,
925 int(x_ + hfill_), y2,
927 Painter::line_onoffdash);
930 pain_.line(int(x_), y2,
931 int(x_ + label_hfill_), y2,
933 Painter::line_onoffdash);
936 pain_.line(int(x_), y1,
938 LColor::added_space);
942 } else if (pit_->isSeparator(pos)) {
943 x_ += singleWidth(pos);
952 // if we reach the end of a struck out range, paint it
953 if (running_strikeout) {
954 int const middle = yo_ + row_->top_of_text()
955 + ((row_->baseline() - row_->top_of_text()) / 2);
956 pain_.line(int(last_strikeout_x), middle, int(x_), middle,
957 LColor::strikeout, Painter::line_solid, Painter::line_thin);
958 running_strikeout = false;
964 void RowPainter::paint(int y_offset, int x_offset, int y)
969 width_ = text_.isInInset()
970 ? text_.inset_owner->textWidth(perv(bv_), true) : bv_.workWidth();
972 // FIXME: must be a cleaner way here. Aren't these calculations
973 // belonging to row metrics ?
974 text_.prepareToPrint(row_, x_, separator_, hfill_, label_hfill_);
976 // FIXME: what is this fixing ?
977 if (text_.isInInset() && (x_ < 0))
981 // If we're *not* at the top-level of rows, then the
982 // background has already been cleared.
983 if (&text_ == bv_.text)
986 // paint the selection background
987 if (text_.selection.set()) {
991 // vertical lines for appendix
994 // environment depth brackets
1000 if (row_->isParStart()) {
1004 if (isParEnd(text_, row_)) {