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
16 #include "frontends/Painter.h"
17 #include "frontends/screen.h"
18 #include "frontends/font_metrics.h"
19 #include "support/LAssert.h"
20 #include "paragraph.h"
21 #include "support/textutils.h"
23 #include "insets/insettext.h"
24 #include "ParagraphParameters.h"
25 #include "BufferView.h"
32 #include "rowpainter.h"
39 extern int PAPER_MARGIN;
40 extern int CHANGEBAR_MARGIN;
41 extern int LEFT_MARGIN;
45 // "temporary". We'll never get to use more
46 // references until we start adding hacks like
47 // these until other places catch up.
48 BufferView * perv(BufferView const & bv)
50 return const_cast<BufferView *>(&bv);
56 RowPainter::RowPainter(BufferView const & bv, LyXText const & text, Row const & row)
57 : bv_(bv), pain_(bv_.painter()), text_(text), row_(row), par_(*row.par())
63 LyXFont const RowPainter::getFont(pos_type pos) const
65 Paragraph * perverted_par = const_cast<Paragraph *>(&par_);
66 return text_.getFont(bv_.buffer(), perverted_par, pos);
70 int RowPainter::singleWidth(lyx::pos_type pos) const
72 Paragraph * par(const_cast<Paragraph*>(&par_));
73 return text_.singleWidth(par, pos);
77 int RowPainter::singleWidth(lyx::pos_type pos, char c) const
79 Paragraph * par(const_cast<Paragraph*>(&par_));
80 return text_.singleWidth(par, pos, c);
84 LyXFont const RowPainter::getLabelFont() const
86 Paragraph * par(const_cast<Paragraph*>(&par_));
87 return text_.getLabelFont(bv_.buffer(), par);
91 char const RowPainter::transformChar(char c, lyx::pos_type pos) const
93 Paragraph * par(const_cast<Paragraph*>(&par_));
94 return text_.transformChar(c, par, pos);
98 int RowPainter::leftMargin() const
100 Row * row(const_cast<Row *>(&row_));
101 return text_.leftMargin(row);
105 bool RowPainter::paintInset(pos_type const pos)
107 Inset * inset = const_cast<Inset*>(par_.getInset(pos));
111 LyXFont const & font = getFont(pos);
113 #warning inset->update FIXME
114 inset->update(perv(bv_), false);
116 inset->draw(perv(bv_), font, yo_ + row_.baseline(), x_);
118 // return true if something changed when we drew an inset
120 return (!text_.need_break_row && !text_.isInInset()
121 && bv_.text->status() == LyXText::CHANGED_IN_DRAW);
125 void RowPainter::paintHebrewComposeChar(pos_type & vpos)
127 pos_type pos = text_.vis2log(vpos);
132 char c = par_.getChar(pos);
136 LyXFont const & font = getFont(pos);
137 int const width = font_metrics::width(c, font);
140 for (pos_type i = pos - 1; i >= 0; --i) {
142 if (!Encodings::IsComposeChar_hebrew(c)) {
143 if (IsPrintableNonspace(c)) {
147 dx = (c == 'ø' || c == 'ã')
149 : (width2 - width) / 2;
156 pain_.text(int(x_) + dx, yo_ + row_.baseline(), str, font);
160 void RowPainter::paintArabicComposeChar(pos_type & vpos)
162 pos_type pos = text_.vis2log(vpos);
166 char c = par_.getChar(pos);
167 c = transformChar(c, pos);
171 LyXFont const & font = getFont(pos);
172 int const width = font_metrics::width(c, font);
175 for (pos_type i = pos-1; i >= 0; --i) {
177 if (!Encodings::IsComposeChar_arabic(c)) {
178 if (IsPrintableNonspace(c)) {
181 dx = (width2 - width) / 2;
187 pain_.text(int(x_) + dx, yo_ + row_.baseline(), str, font);
191 void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
193 pos_type pos = text_.vis2log(vpos);
194 pos_type const last = row_.lastPrintablePos();
195 LyXFont orig_font(getFont(pos));
199 str += par_.getChar(pos);
201 unsigned char c = str[0];
202 str[0] = transformChar(c, pos);
205 bool prev_struckout(isDeletedText(par_, pos));
206 bool prev_newtext(isInsertedText(par_, pos));
210 // collect as much similar chars as we can
211 while (vpos <= last && (pos = text_.vis2log(vpos)) >= 0) {
212 char c = par_.getChar(pos);
214 if (!IsPrintableNonspace(c))
217 if (prev_struckout != isDeletedText(par_, pos))
220 if (prev_newtext != isInsertedText(par_, pos))
223 if (arabic && Encodings::IsComposeChar_arabic(c))
225 if (hebrew && Encodings::IsComposeChar_hebrew(c))
228 if (orig_font != getFont(pos))
232 c = transformChar(c, pos);
237 if (prev_struckout) {
238 orig_font.setColor(LColor::strikeout);
239 } else if (prev_newtext) {
240 orig_font.setColor(LColor::newtext);
243 // Draw text and set the new x position
244 pain_.text(int(x_), yo_ + row_.baseline(), str, orig_font);
245 x_ += font_metrics::width(str, orig_font);
249 void RowPainter::paintForeignMark(float const orig_x, LyXFont const & orig_font)
251 if (!lyxrc.mark_foreign_language)
253 if (orig_font.language() == latex_language)
255 if (orig_font.language() == bv_.buffer()->params.language)
258 int const y = yo_ + row_.baseline() + 1;
259 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
263 bool RowPainter::paintFromPos(pos_type & vpos)
265 pos_type const pos = text_.vis2log(vpos);
267 LyXFont const & orig_font = getFont(pos);
269 float const orig_x = x_;
271 char const c = par_.getChar(pos);
273 if (IsInsetChar(c)) {
277 paintForeignMark(orig_x, orig_font);
281 // usual characters, no insets
283 // special case languages
284 bool const hebrew = (orig_font.language()->lang() == "hebrew");
286 orig_font.language()->lang() == "arabic" &&
287 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
288 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
290 // draw as many chars as we can
291 if ((!hebrew && !arabic)
292 || (hebrew && !Encodings::IsComposeChar_hebrew(c))
293 || (arabic && !Encodings::IsComposeChar_arabic(c))) {
294 paintChars(vpos, hebrew, arabic);
296 paintHebrewComposeChar(vpos);
298 paintArabicComposeChar(vpos);
301 paintForeignMark(orig_x, orig_font);
307 void RowPainter::paintBackground()
310 int const y = yo_ < 0 ? 0 : yo_;
311 int const h = yo_ < 0 ? row_.height() + yo_ : row_.height();
312 pain_.fillRectangle(x, y, width_, h, text_.backgroundColor());
316 void RowPainter::paintSelection()
318 bool const is_rtl = par_.isRightToLeftPar(bv_.buffer()->params);
320 // the current selection
321 int const startx = text_.selection.start.x();
322 int const endx = text_.selection.end.x();
323 int const starty = text_.selection.start.y();
324 int const endy = text_.selection.end.y();
325 Row const * startrow = text_.selection.start.row();
326 Row const * endrow = text_.selection.end.row();
329 Row const * row = &row_;
331 if (text_.bidi_same_direction) {
335 int h = row_.height();
337 if (startrow == row && endrow == row) {
341 pain_.fillRectangle(x, y, w, h, LColor::selection);
345 pain_.fillRectangle(x, y, w, h, LColor::selection);
347 } else if (startrow == row) {
348 int const x = (is_rtl) ? xo_ : (xo_ + startx);
349 int const w = (is_rtl) ? startx : (width_ - startx);
350 pain_.fillRectangle(x, y, w, h, LColor::selection);
351 } else if (endrow == row) {
352 int const x = (is_rtl) ? (xo_ + endx) : xo_;
353 int const w = (is_rtl) ? (width_ - endx) : endx;
354 pain_.fillRectangle(x, y, w, h, LColor::selection);
355 } else if (y_ > starty && y_ < endy) {
356 pain_.fillRectangle(xo_, y, width_, h, LColor::selection);
359 } else if (startrow != row && endrow != row) {
360 if (y_ > starty && y_ < endy) {
362 int h = row_.height();
363 pain_.fillRectangle(xo_, yo_, w, h, LColor::selection);
368 if ((startrow != row && !is_rtl) || (endrow != row && is_rtl))
369 pain_.fillRectangle(xo_, yo_, int(x_), row_.height(), LColor::selection);
371 pos_type const body_pos = par_.beginningOfBody();
372 pos_type const last = row_.lastPrintablePos();
375 for (pos_type vpos = row_.pos(); vpos <= last; ++vpos) {
376 pos_type pos = text_.vis2log(vpos);
377 float const old_tmpx = tmpx;
378 if (body_pos > 0 && pos == body_pos - 1) {
379 LyXLayout_ptr const & layout = par_.layout();
380 LyXFont const lfont = getLabelFont();
382 tmpx += label_hfill_ + font_metrics::width(layout->labelsep, lfont);
384 if (par_.isLineSeparator(body_pos - 1))
385 tmpx -= singleWidth(body_pos - 1);
388 if (row_.hfillExpansion(pos)) {
389 tmpx += singleWidth(pos);
393 tmpx += label_hfill_;
396 else if (par_.isSeparator(pos)) {
397 tmpx += singleWidth(pos);
401 tmpx += singleWidth(pos);
404 if ((startrow != row || text_.selection.start.pos() <= pos) &&
405 (endrow != row || pos < text_.selection.end.pos())) {
406 // Here we do not use x_ as xo_ was added to x_.
407 pain_.fillRectangle(int(old_tmpx), yo_,
408 int(tmpx - old_tmpx + 1),
409 row_.height(), LColor::selection);
413 if ((startrow != row && is_rtl) || (endrow != row && !is_rtl)) {
414 pain_.fillRectangle(xo_ + int(tmpx),
415 yo_, int(bv_.workWidth() - tmpx),
416 row_.height(), LColor::selection);
421 void RowPainter::paintChangeBar()
423 pos_type const start = row_.pos();
424 pos_type const end = row_.lastPrintablePos();
426 if (!par_.isChanged(start, end))
429 int const height = (row_.next()
430 ? row_.height() + row_.next()->top_of_text()
433 pain_.fillRectangle(4, yo_, 5, height, LColor::changebar);
437 void RowPainter::paintAppendix()
439 if (!par_.params().appendix())
442 // FIXME: can be just width_ ?
443 int const ww = bv_.workWidth();
447 if (par_.params().startOfAppendix())
448 y += 2 * defaultRowHeight();
450 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
451 pain_.line(ww - 2, y, ww - 2, yo_ + row_.height(), LColor::appendix);
455 void RowPainter::paintDepthBar()
457 Paragraph::depth_type const depth = par_.getDepth();
462 Paragraph::depth_type prev_depth = 0;
464 prev_depth = row_.previous()->par()->getDepth();
465 Paragraph::depth_type next_depth = 0;
467 next_depth = row_.next()->par()->getDepth();
469 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
470 int x = (PAPER_MARGIN / 5) * i + xo_;
471 // only consider the changebar space if we're drawing outer left
473 x += CHANGEBAR_MARGIN;
474 int const h = yo_ + row_.height() - 1 - (i - next_depth - 1) * 3;
476 pain_.line(x, yo_, x, h, LColor::depthbar);
478 int const w = PAPER_MARGIN / 5;
480 if (i > prev_depth) {
481 pain_.fillRectangle(x, yo_, w, 2, LColor::depthbar);
483 if (i > next_depth) {
484 pain_.fillRectangle(x, h, w, 2, LColor::depthbar);
490 int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
492 if (vsp.kind() == VSpace::NONE)
495 int const arrow_size = 4;
496 int const space_size = int(vsp.inPixels(bv));
500 int const min_size = max(3 * arrow_size,
501 font_metrics::maxAscent(font)
502 + font_metrics::maxDescent(font));
504 if (vsp.length().len().value() < 0.0)
507 return max(min_size, space_size);
511 int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp, int start)
513 if (vsp.kind() == VSpace::NONE)
516 int const arrow_size = 4;
517 int const size = getLengthMarkerHeight(bv_, vsp);
518 int const end = start + size;
520 // the label to display (if any)
522 // y-values for top arrow
524 // y-values for bottom arrow
527 str = prefix + " (" + vsp.asLyXCommand() + ")";
529 if (vsp.kind() == VSpace::VFILL) {
533 // adding or removing space
534 bool const added = vsp.kind() != VSpace::LENGTH ||
535 vsp.length().len().value() > 0.0;
536 ty1 = added ? (start + arrow_size) : start;
537 ty2 = added ? start : (start + arrow_size);
538 by1 = added ? (end - arrow_size) : end;
539 by2 = added ? end : (end - arrow_size);
542 int const leftx = xo_ + leftMargin();
543 int const midx = leftx + arrow_size;
544 int const rightx = midx + arrow_size;
552 font.setColor(LColor::added_space).decSize().decSize();
553 font_metrics::rectText(str, font, w, a, d);
555 pain_.rectText(leftx + 2 * arrow_size + 5,
556 start + ((end - start) / 2) + d,
560 pain_.line(leftx, ty1, midx, ty2, LColor::added_space);
561 pain_.line(midx, ty2, rightx, ty1, LColor::added_space);
564 pain_.line(leftx, by1, midx, by2, LColor::added_space);
565 pain_.line(midx, by2, rightx, by1, LColor::added_space);
568 pain_.line(midx, ty2, midx, by2, LColor::added_space);
574 int RowPainter::paintPageBreak(string const & label, int y)
577 pb_font.setColor(LColor::pagebreak).decSize();
582 font_metrics::rectText(label, pb_font, w, a, d);
584 int const text_start = xo_ + ((width_ - w) / 2);
585 int const text_end = text_start + w;
587 pain_.rectText(text_start, y + d, label, pb_font);
589 pain_.line(xo_, y, text_start, y,
590 LColor::pagebreak, Painter::line_onoffdash);
591 pain_.line(text_end, y, xo_ + width_, y,
592 LColor::pagebreak, Painter::line_onoffdash);
594 return 3 * defaultRowHeight();
598 int RowPainter::paintAppendixStart(int y)
601 pb_font.setColor(LColor::appendix).decSize();
603 string const label = _("Appendix");
607 font_metrics::rectText(label, pb_font, w, a, d);
609 int const text_start = xo_ + ((width_ - w) / 2);
610 int const text_end = text_start + w;
612 pain_.rectText(text_start, y + d, label, pb_font);
614 pain_.line(xo_ + 1, y, text_start, y, LColor::appendix);
615 pain_.line(text_end, y, xo_ + width_ - 2, y, LColor::appendix);
617 return 3 * defaultRowHeight();
621 void RowPainter::paintFirst()
623 ParagraphParameters const & parparams = par_.params();
627 // start of appendix?
628 if (parparams.startOfAppendix()) {
629 y_top += paintAppendixStart(yo_ + y_top + 2 * defaultRowHeight());
633 if (!row_.previous() && !text_.isInInset())
634 y_top += PAPER_MARGIN;
636 // draw a top pagebreak
637 if (parparams.pagebreakTop()) {
638 y_top += paintPageBreak(_("Page Break (top)"),
639 yo_ + y_top + 2 * defaultRowHeight());
642 // draw the additional space if needed:
643 y_top += paintLengthMarker(_("Space above"), parparams.spaceTop(),
646 Buffer const * buffer = bv_.buffer();
648 LyXLayout_ptr const & layout = par_.layout();
650 if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
651 if (par_.previous()) {
652 if (layout->latextype == LATEX_PARAGRAPH
653 && !par_.getDepth()) {
654 y_top += buffer->params.getDefSkip().inPixels(bv_);
656 LyXLayout_ptr const & playout =
657 par_.previous()->layout();
658 if (playout->latextype == LATEX_PARAGRAPH
659 && !par_.previous()->getDepth()) {
660 // is it right to use defskip here, too? (AS)
661 y_top += buffer->params.getDefSkip().inPixels(bv_);
667 int const ww = bv_.workWidth();
670 if (parparams.lineTop()) {
671 LyXFont font(LyXFont::ALL_SANE);
672 int const asc = font_metrics::ascent('x', getFont(0));
676 int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
677 int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
678 pain_.line(xp, yo_ + y_top, xp + w, yo_ + y_top,
679 LColor::topline, Painter::line_solid,
680 Painter::line_thick);
685 bool const is_rtl = par_.isRightToLeftPar(bv_.buffer()->params);
687 // should we print a label?
688 if (layout->labeltype >= LABEL_STATIC
689 && (layout->labeltype != LABEL_STATIC
690 || layout->latextype != LATEX_ENVIRONMENT
691 || par_.isFirstInSequence())) {
693 LyXFont font = getLabelFont();
694 if (!par_.getLabelstring().empty()) {
696 string const str = par_.getLabelstring();
698 // this is special code for the chapter layout. This is
699 // printed in an extra row and has a pagebreak at
701 if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
702 if (buffer->params.secnumdepth >= 0) {
703 float spacing_val = 1.0;
704 if (!parparams.spacing().isDefault()) {
705 spacing_val = parparams.spacing().getValue();
707 spacing_val = buffer->params.spacing.getValue();
711 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
712 + int(layout->parsep) * defaultRowHeight();
715 x = ww - leftMargin() -
716 font_metrics::width(str, font);
720 yo_ + row_.baseline() -
721 row_.ascent_of_text() - maxdesc,
726 x = ww - leftMargin()
727 + font_metrics::width(layout->labelsep, font);
729 x = x_ - font_metrics::width(layout->labelsep, font)
730 - font_metrics::width(str, font);
733 pain_.text(int(x), yo_ + row_.baseline(), str, font);
737 // the labels at the top of an environment.
738 // More or less for bibliography
739 } else if (par_.isFirstInSequence() &&
740 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
741 layout->labeltype == LABEL_BIBLIO ||
742 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
743 LyXFont font = getLabelFont();
744 if (!par_.getLabelstring().empty()) {
745 string const str = par_.getLabelstring();
746 float spacing_val = 1.0;
747 if (!parparams.spacing().isDefault()) {
748 spacing_val = parparams.spacing().getValue();
750 spacing_val = buffer->params.spacing.getValue();
754 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
755 + (layout->labelbottomsep * defaultRowHeight()));
758 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
759 x = ((is_rtl ? leftMargin() : x_)
760 + ww - text_.rightMargin(*bv_.buffer(), row_)) / 2;
761 x -= font_metrics::width(str, font) / 2;
763 x = ww - leftMargin() -
764 font_metrics::width(str, font);
766 pain_.text(int(x), yo_ + row_.baseline()
767 - row_.ascent_of_text() - maxdesc,
774 void RowPainter::paintLast()
776 ParagraphParameters const & parparams = par_.params();
777 int y_bottom = row_.height() - 1;
780 if (!row_.next() && !text_.isInInset())
781 y_bottom -= PAPER_MARGIN;
783 int const ww = bv_.workWidth();
785 // draw a bottom pagebreak
786 if (parparams.pagebreakBottom()) {
787 y_bottom -= paintPageBreak(_("Page Break (bottom)"),
788 yo_ + y_bottom - 2 * defaultRowHeight());
791 // draw the additional space if needed:
792 int const height = getLengthMarkerHeight(bv_, parparams.spaceBottom());
793 y_bottom -= paintLengthMarker(_("Space below"), parparams.spaceBottom(),
794 yo_ + y_bottom - height);
796 // draw a bottom line
797 if (parparams.lineBottom()) {
798 LyXFont font(LyXFont::ALL_SANE);
799 int const asc = font_metrics::ascent('x',
800 getFont(max(pos_type(0), par_.size() - 1)));
804 int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
805 int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
806 int const y = yo_ + y_bottom;
807 pain_.line(xp, y, xp + w, y, LColor::topline, Painter::line_solid,
808 Painter::line_thick);
813 bool const is_rtl = par_.isRightToLeftPar(bv_.buffer()->params);
814 int const endlabel = par_.getEndLabel();
819 case END_LABEL_FILLED_BOX:
821 LyXFont const font = getLabelFont();
822 int const size = int(0.75 * font_metrics::maxAscent(font));
823 int const y = (yo_ + row_.baseline()) - size;
824 int x = is_rtl ? LEFT_MARGIN : ww - PAPER_MARGIN - size;
826 if (row_.fill() <= size)
827 x += (size - row_.fill() + 1) * (is_rtl ? -1 : 1);
829 if (endlabel == END_LABEL_BOX) {
830 pain_.rectangle(x, y, size, size, LColor::eolmarker);
832 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
836 case END_LABEL_STATIC:
839 LyXFont font(LyXFont::ALL_SANE);
840 font = getLabelFont();
842 LyXFont font = getLabelFont();
844 string const & str = par_.layout()->endlabelstring();
845 int const x = is_rtl ?
846 int(x_) - font_metrics::width(str, font)
847 : ww - text_.rightMargin(*bv_.buffer(), row_) - row_.fill();
848 pain_.text(x, yo_ + row_.baseline(), str, font);
851 case END_LABEL_NO_LABEL:
857 bool RowPainter::paintText()
859 pos_type const last = row_.lastPrintablePos();
860 pos_type body_pos = par_.beginningOfBody();
862 (body_pos - 1 > last ||
863 !par_.isLineSeparator(body_pos - 1))) {
867 LyXLayout_ptr const & layout = par_.layout();
869 bool running_strikeout = false;
870 bool is_struckout = false;
871 float last_strikeout_x = 0.0;
873 pos_type vpos = row_.pos();
874 while (vpos <= last) {
875 if (x_ > bv_.workWidth())
877 pos_type pos = text_.vis2log(vpos);
879 if (pos >= par_.size()) {
884 if (x_ + singleWidth(pos) < 0) {
885 x_ += singleWidth(pos);
890 is_struckout = isDeletedText(par_, pos);
892 if (is_struckout && !running_strikeout) {
893 running_strikeout = true;
894 last_strikeout_x = x_;
897 bool const highly_editable_inset = par_.isInset(pos)
898 && isHighlyEditableInset(par_.getInset(pos));
900 // if we reach the end of a struck out range, paint it
901 // we also don't paint across things like tables
902 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
903 int const middle = yo_ + row_.top_of_text()
904 + ((row_.baseline() - row_.top_of_text()) / 2);
905 pain_.line(int(last_strikeout_x), middle, int(x_), middle,
906 LColor::strikeout, Painter::line_solid, Painter::line_thin);
907 running_strikeout = false;
910 if (body_pos > 0 && pos == body_pos - 1) {
911 int const lwidth = font_metrics::width(layout->labelsep,
914 x_ += label_hfill_ + lwidth
915 - singleWidth(body_pos - 1);
918 if (par_.isHfill(pos)) {
921 int const y0 = yo_ + row_.baseline();
922 int const y1 = y0 - defaultRowHeight() / 2;
924 pain_.line(int(x_), y1, int(x_), y0,
925 LColor::added_space);
927 if (row_.hfillExpansion(pos)) {
928 int const y2 = (y0 + y1) / 2;
930 if (pos >= body_pos) {
931 pain_.line(int(x_), y2,
932 int(x_ + hfill_), y2,
934 Painter::line_onoffdash);
937 pain_.line(int(x_), y2,
938 int(x_ + label_hfill_), y2,
940 Painter::line_onoffdash);
943 pain_.line(int(x_), y1,
945 LColor::added_space);
949 } else if (par_.isSeparator(pos)) {
950 x_ += singleWidth(pos);
955 if (paintFromPos(vpos))
960 // if we reach the end of a struck out range, paint it
961 if (running_strikeout) {
962 int const middle = yo_ + row_.top_of_text()
963 + ((row_.baseline() - row_.top_of_text()) / 2);
964 pain_.line(int(last_strikeout_x), middle, int(x_), middle,
965 LColor::strikeout, Painter::line_solid, Painter::line_thin);
966 running_strikeout = false;
972 bool RowPainter::paint(int y_offset, int x_offset, int y)
977 width_ = text_.isInInset()
978 ? text_.inset_owner->textWidth(perv(bv_), true) : bv_.workWidth();
980 // FIXME: must be a cleaner way here. Aren't these calculations
981 // belonging to row metrics ?
982 Row * row(const_cast<Row *>(&row_));
983 text_.prepareToPrint(row, x_, separator_, hfill_, label_hfill_);
985 // FIXME: what is this fixing ?
986 if (text_.isInInset() && (x_ < 0))
990 // If we're *not* at the top-level of rows, then the
991 // background has already been cleared.
992 if (&text_ == bv_.text)
995 // paint the selection background
996 if (text_.selection.set()) {
1000 // vertical lines for appendix
1003 // environment depth brackets
1009 if (row_.isParStart()) {
1013 if (row_.isParEnd()) {