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"
17 #include "coordcache.h"
20 #include "bufferparams.h"
21 #include "BufferView.h"
28 #include "lyxrow_funcs.h"
29 #include "metricsinfo.h"
30 #include "paragraph.h"
31 #include "paragraph_funcs.h"
32 #include "ParagraphParameters.h"
35 #include "frontends/font_metrics.h"
36 #include "frontends/nullpainter.h"
37 #include "frontends/LyXView.h"
38 #include "frontends/WorkArea.h"
39 #include "frontends/Painter.h"
41 #include "insets/insettext.h"
43 #include "support/textutils.h"
45 #include <boost/crc.hpp>
47 using lyx::frontend::Painter;
48 using lyx::frontend::NullPainter;
61 /// Flag: do a full redraw of inside text of inset
62 /// Working variable indicating a full screen refresh
66 * A class used for painting an individual row of text.
70 /// initialise and run painter
71 RowPainter(PainterInfo & pi, LyXText const & text,
72 pit_type pit, Row const & row, int x, int y);
74 // paint various parts
77 void paintChangeBar();
83 void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
84 void paintHebrewComposeChar(lyx::pos_type & vpos, LyXFont const & font);
85 void paintArabicComposeChar(lyx::pos_type & vpos, LyXFont const & font);
86 void paintChars(lyx::pos_type & vpos, LyXFont font,
87 bool hebrew, bool arabic);
88 int paintAppendixStart(int y);
89 void paintFromPos(lyx::pos_type & vpos);
90 void paintInset(lyx::pos_type const pos, LyXFont const & font);
92 /// return left margin
93 int leftMargin() const;
95 /// return the label font for this row
96 LyXFont const getLabelFont() const;
98 /// bufferview to paint on
99 BufferView const & bv_;
104 /// LyXText for the row
105 LyXText const & text_;
106 ParagraphList const & pars_;
113 Paragraph const & par_;
115 /// is row erased? (change tracking)
120 int const yo_; // current baseline
129 RowPainter::RowPainter(PainterInfo & pi,
130 LyXText const & text, pit_type pit, Row const & row, int x, int y)
131 : bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
132 row_(row), pit_(pit), par_(text.paragraphs()[pit]),
134 xo_(x), yo_(y), width_(text_.width())
136 RowMetrics m = text_.computeRowMetrics(pit, row_);
139 //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
142 separator_ = m.separator;
144 label_hfill_ = m.label_hfill;
146 BOOST_ASSERT(pit >= 0);
147 BOOST_ASSERT(pit < int(text.paragraphs().size()));
151 LyXFont const RowPainter::getLabelFont() const
153 return text_.getLabelFont(par_);
157 int RowPainter::leftMargin() const
159 return text_.leftMargin(pit_, row_.pos());
163 void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
165 InsetBase const * inset = par_.getInset(pos);
167 PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
168 // FIXME: We should always use font, see documentation of
169 // noFontChange() in insetbase.h.
170 pi.base.font = inset->noFontChange() ?
171 bv_.buffer()->params().getFont() :
173 pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
174 pi.erased_ = erased_ || isDeletedText(par_, pos);
175 theCoords.insets().add(inset, int(x_), yo_);
176 InsetText const * const in = inset->asTextInset();
177 // non-wide insets are painted completely. Recursive
178 bool tmp = refreshInside;
179 if (!in || !in->Wide()) {
180 refreshInside = true;
181 lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
184 inset->drawSelection(pi, int(x_), yo_);
185 inset->draw(pi, int(x_), yo_);
187 x_ += inset->width();
191 void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
193 pos_type pos = text_.bidi.vis2log(vpos);
198 char_type c = par_.getChar(pos);
202 int const width = font_metrics::width(c, font);
205 for (pos_type i = pos - 1; i >= 0; --i) {
207 if (!Encodings::isComposeChar_hebrew(c)) {
208 if (isPrintableNonspace(c)) {
210 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
212 dx = (c == 'ø' || c == 'ã')
214 : (width2 - width) / 2;
221 pain_.text(int(x_) + dx, yo_, str, font);
225 void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
227 pos_type pos = text_.bidi.vis2log(vpos);
231 char_type c = par_.getChar(pos);
232 c = par_.transformChar(c, pos);
236 int const width = font_metrics::width(c, font);
239 for (pos_type i = pos - 1; i >= 0; --i) {
241 if (!Encodings::isComposeChar_arabic(c)) {
242 if (isPrintableNonspace(c)) {
244 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
245 dx = (width2 - width) / 2;
251 pain_.text(int(x_) + dx, yo_, str, font);
255 void RowPainter::paintChars(pos_type & vpos, LyXFont font,
256 bool hebrew, bool arabic)
258 pos_type pos = text_.bidi.vis2log(vpos);
259 pos_type const end = row_.endpos();
260 FontSpan const font_span = par_.fontSpan(pos);
261 Change::Type const prev_change = par_.lookupChange(pos).type;
265 str += par_.getChar(pos);
267 unsigned char c = str[0];
268 str[0] = par_.transformChar(c, pos);
271 // collect as much similar chars as we can
272 for (++vpos ; vpos < end ; ++vpos) {
273 pos = text_.bidi.vis2log(vpos);
274 if (pos < font_span.first || pos > font_span.last)
277 if (prev_change != par_.lookupChange(pos))
280 char_type c = par_.getChar(pos);
282 if (!isPrintableNonspace(c))
285 if (arabic && Encodings::isComposeChar_arabic(c))
288 if (hebrew && Encodings::isComposeChar_hebrew(c))
292 c = par_.transformChar(c, pos);
297 if (prev_change == Change::DELETED)
298 font.setColor(LColor::strikeout);
299 else if (prev_change == Change::INSERTED)
300 font.setColor(LColor::newtext);
302 // Draw text and set the new x position
303 //lyxerr << "paint row: yo_ " << yo_ << "\n";
304 pain_.text(int(x_), yo_, str, font);
305 x_ += font_metrics::width(str, font);
309 void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
311 if (!lyxrc.mark_foreign_language)
313 if (font.language() == latex_language)
315 if (font.language() == bv_.buffer()->params().language)
318 int const y = yo_ + 1 + desc;
319 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
323 void RowPainter::paintFromPos(pos_type & vpos)
325 pos_type const pos = text_.bidi.vis2log(vpos);
326 LyXFont orig_font = text_.getFont(par_, pos);
328 double const orig_x = x_;
330 if (par_.isInset(pos)) {
331 paintInset(pos, orig_font);
333 paintForeignMark(orig_x, orig_font,
334 par_.getInset(pos)->descent());
338 // usual characters, no insets
339 char_type const c = par_.getChar(pos);
341 // special case languages
342 std::string const & lang = orig_font.language()->lang();
343 bool const hebrew = lang == "hebrew";
344 bool const arabic = lang == "arabic" &&
345 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
346 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
348 // draw as many chars as we can
349 if ((!hebrew && !arabic)
350 || (hebrew && !Encodings::isComposeChar_hebrew(c))
351 || (arabic && !Encodings::isComposeChar_arabic(c))) {
352 paintChars(vpos, orig_font, hebrew, arabic);
354 paintHebrewComposeChar(vpos, orig_font);
356 paintArabicComposeChar(vpos, orig_font);
359 paintForeignMark(orig_x, orig_font);
363 void RowPainter::paintChangeBar()
365 pos_type const start = row_.pos();
366 pos_type const end = row_.endpos();
368 if (start == end || !par_.isChanged(start, end))
371 int const height = text_.isLastRow(pit_, row_)
375 pain_.fillRectangle(4, yo_ - row_.ascent(), 5, height, LColor::changebar);
379 void RowPainter::paintAppendix()
381 if (!par_.params().appendix())
384 int y = yo_ - row_.ascent();
386 if (par_.params().startOfAppendix())
387 y += 2 * defaultRowHeight();
389 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
390 pain_.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), LColor::appendix);
394 void RowPainter::paintDepthBar()
396 Paragraph::depth_type const depth = par_.getDepth();
401 Paragraph::depth_type prev_depth = 0;
402 if (!text_.isFirstRow(pit_, row_)) {
403 pit_type pit2 = pit_;
406 prev_depth = pars_[pit2].getDepth();
409 Paragraph::depth_type next_depth = 0;
410 if (!text_.isLastRow(pit_, row_)) {
411 pit_type pit2 = pit_;
412 if (row_.endpos() >= pars_[pit2].size())
414 next_depth = pars_[pit2].getDepth();
417 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
418 int const w = nestMargin() / 5;
419 int x = int(xo_) + w * i;
420 // only consider the changebar space if we're drawing outermost text
421 if (text_.isMainText())
422 x += changebarMargin();
424 int const starty = yo_ - row_.ascent();
425 int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
427 pain_.line(x, starty, x, starty + h, LColor::depthbar);
430 pain_.fillRectangle(x, starty, w, 2, LColor::depthbar);
432 pain_.fillRectangle(x, starty + h, w, 2, LColor::depthbar);
437 int RowPainter::paintAppendixStart(int y)
440 pb_font.setColor(LColor::appendix);
443 string const label = _("Appendix");
447 font_metrics::rectText(label, pb_font, w, a, d);
449 int const text_start = int(xo_ + (width_ - w) / 2);
450 int const text_end = text_start + w;
452 pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
454 pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
455 pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
457 return 3 * defaultRowHeight();
461 void RowPainter::paintFirst()
463 ParagraphParameters const & parparams = par_.params();
467 // start of appendix?
468 if (parparams.startOfAppendix())
469 y_top += paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
471 Buffer const & buffer = *bv_.buffer();
473 LyXLayout_ptr const & layout = par_.layout();
475 if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
477 if (layout->latextype == LATEX_PARAGRAPH
478 && !par_.getDepth()) {
479 y_top += buffer.params().getDefSkip().inPixels(bv_);
481 LyXLayout_ptr const & playout = pars_[pit_ - 1].layout();
482 if (playout->latextype == LATEX_PARAGRAPH
483 && !pars_[pit_ - 1].getDepth()) {
484 // is it right to use defskip here, too? (AS)
485 y_top += buffer.params().getDefSkip().inPixels(bv_);
491 bool const is_rtl = text_.isRTL(par_);
492 bool const is_seq = isFirstInSequence(pit_, text_.paragraphs());
493 //lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << std::endl;
495 // should we print a label?
496 if (layout->labeltype >= LABEL_STATIC
497 && (layout->labeltype != LABEL_STATIC
498 || layout->latextype != LATEX_ENVIRONMENT
501 LyXFont const font = getLabelFont();
502 string const str = par_.getLabelstring();
506 // this is special code for the chapter layout. This is
507 // printed in an extra row and has a pagebreak at
509 if (layout->counter == "chapter") {
510 double spacing_val = 1.0;
511 if (!parparams.spacing().isDefault()) {
512 spacing_val = parparams.spacing().getValue();
514 spacing_val = buffer.params().spacing().getValue();
517 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
519 int const maxdesc = int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
520 + int(layout->parsep) * defaultRowHeight();
523 x = width_ - leftMargin() -
524 font_metrics::width(str, font);
527 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
530 x = width_ - leftMargin()
531 + font_metrics::width(layout->labelsep, font);
533 x = x_ - font_metrics::width(layout->labelsep, font)
534 - font_metrics::width(str, font);
537 pain_.text(int(x), yo_, str, font);
541 // the labels at the top of an environment.
542 // More or less for bibliography
544 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
545 layout->labeltype == LABEL_BIBLIO ||
546 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
547 LyXFont font = getLabelFont();
548 if (!par_.getLabelstring().empty()) {
549 string const str = par_.getLabelstring();
550 double spacing_val = 1.0;
551 if (!parparams.spacing().isDefault())
552 spacing_val = parparams.spacing().getValue();
554 spacing_val = buffer.params().spacing().getValue();
556 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
559 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
560 + (layout->labelbottomsep * defaultRowHeight()));
563 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
566 x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
567 x -= font_metrics::width(str, font) / 2;
569 x = width_ - leftMargin() -
570 font_metrics::width(str, font);
572 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
578 void RowPainter::paintLast()
580 bool const is_rtl = text_.isRTL(par_);
581 int const endlabel = getEndLabel(pit_, text_.paragraphs());
586 case END_LABEL_FILLED_BOX: {
587 LyXFont const font = getLabelFont();
588 int const size = int(0.75 * font_metrics::maxAscent(font));
589 int const y = yo_ - size;
590 int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
592 if (width_ - int(row_.width()) <= size)
593 x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);
595 if (endlabel == END_LABEL_BOX)
596 pain_.rectangle(x, y, size, size, LColor::eolmarker);
598 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
602 case END_LABEL_STATIC: {
603 LyXFont font = getLabelFont();
604 string const & str = par_.layout()->endlabelstring();
605 double const x = is_rtl ?
606 x_ - font_metrics::width(str, font)
607 : - text_.rightMargin(par_) - row_.width();
608 pain_.text(int(x), yo_, str, font);
612 case END_LABEL_NO_LABEL:
618 void RowPainter::paintText()
620 pos_type const end = row_.endpos();
621 pos_type body_pos = par_.beginOfBody();
623 (body_pos > end || !par_.isLineSeparator(body_pos - 1))) {
627 LyXLayout_ptr const & layout = par_.layout();
629 bool running_strikeout = false;
630 bool is_struckout = false;
631 int last_strikeout_x = 0;
633 // Use font span to speed things up, see below
637 for (pos_type vpos = row_.pos(); vpos < end; ) {
638 if (x_ > bv_.workWidth())
641 pos_type const pos = text_.bidi.vis2log(vpos);
643 if (pos >= par_.size()) {
648 // Use font span to speed things up, see above
649 if (vpos < font_span.first || vpos > font_span.last) {
650 font_span = par_.fontSpan(vpos);
651 font = text_.getFont(par_, vpos);
654 const int width_pos =
655 text_.singleWidth(par_, pos, par_.getChar(pos), font);
657 if (x_ + width_pos < 0) {
663 is_struckout = isDeletedText(par_, pos);
665 if (is_struckout && !running_strikeout) {
666 running_strikeout = true;
667 last_strikeout_x = int(x_);
670 bool const highly_editable_inset = par_.isInset(pos)
671 && isHighlyEditableInset(par_.getInset(pos));
673 // If we reach the end of a struck out range, paint it.
674 // We also don't paint across things like tables
675 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
676 // Calculate 1/3 height of the buffer's default font
679 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
680 pain_.line(last_strikeout_x, middle, int(x_), middle,
681 LColor::strikeout, Painter::line_solid, Painter::line_thin);
682 running_strikeout = false;
685 if (body_pos > 0 && pos == body_pos - 1) {
686 int const lwidth = font_metrics::width(layout->labelsep,
689 x_ += label_hfill_ + lwidth - width_pos;
692 if (par_.isHfill(pos)) {
696 int const y1 = y0 - defaultRowHeight() / 2;
698 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
700 if (hfillExpansion(par_, row_, pos)) {
701 int const y2 = (y0 + y1) / 2;
703 if (pos >= body_pos) {
704 pain_.line(int(x_), y2, int(x_ + hfill_), y2,
706 Painter::line_onoffdash);
709 pain_.line(int(x_), y2, int(x_ + label_hfill_), y2,
711 Painter::line_onoffdash);
714 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
718 } else if (par_.isSeparator(pos)) {
728 // if we reach the end of a struck out range, paint it
729 if (running_strikeout) {
730 // calculate 1/3 height of the buffer's default font
733 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
734 pain_.line(last_strikeout_x, middle, int(x_), middle,
735 LColor::strikeout, Painter::line_solid, Painter::line_thin);
736 running_strikeout = false;
741 lyx::size_type calculateRowSignature(Row const & row, Paragraph const & par,
744 boost::crc_32_type crc;
745 for (lyx::pos_type i = row.pos(); i < row.endpos(); ++i) {
746 const unsigned char b[] = { par.getChar(i) };
747 crc.process_bytes(b, 1);
749 const unsigned char b[] = { x, y, row.width() };
750 crc.process_bytes(b, 3);
751 return crc.checksum();
755 bool CursorOnRow(PainterInfo & pi, pit_type const pit,
756 RowList::const_iterator rit, LyXText const & text)
758 // Is there a cursor on this row (or inside inset on row)
759 LCursor & cur = pi.base.bv->cursor();
760 for (lyx::size_type d = 0; d < cur.depth(); d++) {
761 CursorSlice const & sl = cur[d];
762 if (sl.text() == &text
764 && sl.pos() >= rit->pos()
765 && sl.pos() <= rit->endpos())
772 bool innerCursorOnRow(PainterInfo & pi, pit_type pit,
773 RowList::const_iterator rit, LyXText const & text)
775 // Is there a cursor inside an inset on this row, and is this inset
776 // the only "character" on this row
777 LCursor & cur = pi.base.bv->cursor();
778 if (rit->pos() + 1 != rit->endpos())
780 for (lyx::size_type d = 0; d < cur.depth(); d++) {
781 CursorSlice const & sl = cur[d];
782 if (sl.text() == &text
784 && sl.pos() == rit->pos())
785 return d < cur.depth() - 1;
792 (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y,
795 // lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
796 static NullPainter nop;
797 static PainterInfo nullpi(pi.base.bv, nop);
798 int const ww = pi.base.bv->workHeight();
800 theCoords.parPos()[&text][pit] = Point(x, y);
802 Paragraph const & par = text.paragraphs()[pit];
803 if (par.rows().empty())
806 RowList::const_iterator const rb = par.rows().begin();
807 RowList::const_iterator const re = par.rows().end();
810 lyx::size_type rowno(0);
811 for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
813 // Allow setting of refreshInside for nested insets in
815 bool tmp = refreshInside;
817 // Row signature; has row changed since last paint?
818 lyx::size_type const row_sig = calculateRowSignature(*rit, par, x, y);
819 bool row_has_changed = par.rowSignature()[rowno] != row_sig;
821 bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
822 bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
825 // If this is the only object on the row, we can make it wide
826 for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
827 InsetBase const * const in = par.getInset(i);
829 InsetText const * const t = in->asTextInset();
831 t->Wide() = in_inset_alone_on_row;
835 // If selection is on, the current row signature differs
836 // from cache, or cursor is inside an inset _on this row_,
837 // then paint the row
838 if (repaintAll || row_has_changed || cursor_on_row) {
839 // Add to row signature cache
840 par.rowSignature()[rowno] = row_sig;
842 bool const inside = (y + rit->descent() >= 0
843 && y - rit->ascent() < ww);
844 RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y);
845 // Clear background of this row
846 // (if paragraph background was not cleared)
848 (!in_inset_alone_on_row || row_has_changed)) {
849 pi.pain.fillRectangle(x, y - rit->ascent(),
850 text.maxwidth_, rit->height(),
851 text.backgroundColor());
852 // If outer row has changed, force nested
853 // insets to repaint completely
855 refreshInside = true;
858 // Instrumentation for testing row cache (see also
860 if (text.isMainText())
861 lyxerr[Debug::PAINTING] << "#";
863 lyxerr[Debug::PAINTING] << "[" <<
864 repaintAll << row_has_changed <<
865 cursor_on_row << "]";
876 // Restore, see above
879 lyxerr[Debug::PAINTING] << "." << endl;
885 void paintText(BufferView const & bv, ViewMetricsInfo const & vi,
888 LyXText * const text = bv.text();
889 bool const select = bv.cursor().selection();
891 PainterInfo pi(const_cast<BufferView *>(&bv), pain);
892 // Should the whole screen, including insets, be refreshed?
893 bool repaintAll = select || !vi.singlepar;
896 // Clear background (if not delegated to rows)
897 pain.fillRectangle(0, vi.y1, bv.workWidth(), vi.y2 - vi.y1,
898 text->backgroundColor());
901 text->drawSelection(pi, 0, 0);
906 for (pit_type pit = vi.p1; pit <= vi.p2; ++pit) {
907 refreshInside = repaintAll;
908 Paragraph const & par = text->getPar(pit);
910 paintPar(pi, *bv.text(), pit, 0, yy, repaintAll);
914 // Cache one paragraph above and one below
915 // Note MV: this cannot be suppressed even for singlepar.
916 // Try viewing the User Guide Mobius figure
919 text->redoParagraph(vi.p1 - 1);
920 theCoords.parPos()[bv.text()][vi.p1 - 1] =
921 Point(0, vi.y1 - text->getPar(vi.p1 - 1).descent());
924 if (vi.p2 < lyx::pit_type(text->paragraphs().size()) - 1) {
925 text->redoParagraph(vi.p2 + 1);
926 theCoords.parPos()[bv.text()][vi.p2 + 1] =
927 Point(0, vi.y2 + text->getPar(vi.p2 + 1).ascent());
930 // and grey out above (should not happen later)
931 // lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
932 if (vi.y1 > 0 && !vi.singlepar)
933 pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
935 // and possibly grey out below
936 // lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
937 if (vi.y2 < bv.workHeight() && !vi.singlepar)
938 pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
942 void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y)
944 // lyxerr << " paintTextInset: y: " << y << endl;
946 y -= text.getPar(0).ascent();
947 // This flag can not be set from within same inset:
948 bool repaintAll = refreshInside;
949 for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
950 y += text.getPar(pit).ascent();
951 paintPar(pi, text, pit, x, y, repaintAll);
952 y += text.getPar(pit).descent();