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/Painter.h"
39 #include "insets/insettext.h"
41 #include "support/textutils.h"
43 #include <boost/crc.hpp>
45 using lyx::frontend::Painter;
46 using lyx::frontend::NullPainter;
60 * A class used for painting an individual row of text.
64 /// initialise and run painter
65 RowPainter(PainterInfo & pi, LyXText const & text,
66 pit_type pit, Row const & row, int x, int y);
68 // paint various parts
71 void paintChangeBar();
77 void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
78 void paintHebrewComposeChar(lyx::pos_type & vpos, LyXFont const & font);
79 void paintArabicComposeChar(lyx::pos_type & vpos, LyXFont const & font);
80 void paintChars(lyx::pos_type & vpos, LyXFont font,
81 bool hebrew, bool arabic);
82 int paintAppendixStart(int y);
83 void paintFromPos(lyx::pos_type & vpos);
84 void paintInset(lyx::pos_type const pos, LyXFont const & font);
86 /// return left margin
87 int leftMargin() const;
89 /// return the label font for this row
90 LyXFont const getLabelFont() const;
92 /// bufferview to paint on
93 BufferView const & bv_;
98 /// LyXText for the row
99 LyXText const & text_;
100 ParagraphList const & pars_;
107 Paragraph const & par_;
109 /// is row erased? (change tracking)
114 int const yo_; // current baseline
123 RowPainter::RowPainter(PainterInfo & pi,
124 LyXText const & text, pit_type pit, Row const & row, int x, int y)
125 : bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
126 row_(row), pit_(pit), par_(text.paragraphs()[pit]),
128 xo_(x), yo_(y), width_(text_.width())
130 RowMetrics m = text_.computeRowMetrics(pit, row_);
133 //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
136 separator_ = m.separator;
138 label_hfill_ = m.label_hfill;
140 BOOST_ASSERT(pit >= 0);
141 BOOST_ASSERT(pit < int(text.paragraphs().size()));
145 LyXFont const RowPainter::getLabelFont() const
147 return text_.getLabelFont(par_);
151 int RowPainter::leftMargin() const
153 return text_.leftMargin(pit_, row_.pos());
157 void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
159 InsetBase const * inset = par_.getInset(pos);
161 PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
162 // FIXME: We should always use font, see documentation of
163 // noFontChange() in insetbase.h.
164 pi.base.font = inset->noFontChange() ?
165 bv_.buffer()->params().getFont() :
167 pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
168 pi.erased_ = erased_ || isDeletedText(par_, pos);
169 theCoords.insets().add(inset, int(x_), yo_);
170 InsetText const * const in = inset->asTextInset();
171 // non-wide insets are painted completely. Recursive
172 bool tmp = bv_.repaintAll();
173 if (!in || !in->Wide()) {
174 bv_.repaintAll(true);
175 lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
177 if (bv_.repaintAll())
178 inset->drawSelection(pi, int(x_), yo_);
179 inset->draw(pi, int(x_), yo_);
181 x_ += inset->width();
185 void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
187 pos_type pos = text_.bidi.vis2log(vpos);
192 char_type c = par_.getChar(pos);
196 int const width = font_metrics::width(c, font);
199 for (pos_type i = pos - 1; i >= 0; --i) {
201 if (!Encodings::isComposeChar_hebrew(c)) {
202 if (isPrintableNonspace(c)) {
204 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
206 dx = (c == 'ø' || c == 'ã')
208 : (width2 - width) / 2;
215 pain_.text(int(x_) + dx, yo_, str, font);
219 void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
221 pos_type pos = text_.bidi.vis2log(vpos);
225 char_type c = par_.getChar(pos);
226 c = par_.transformChar(c, pos);
230 int const width = font_metrics::width(c, font);
233 for (pos_type i = pos - 1; i >= 0; --i) {
235 if (!Encodings::isComposeChar_arabic(c)) {
236 if (isPrintableNonspace(c)) {
238 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
239 dx = (width2 - width) / 2;
245 pain_.text(int(x_) + dx, yo_, str, font);
249 void RowPainter::paintChars(pos_type & vpos, LyXFont font,
250 bool hebrew, bool arabic)
252 pos_type pos = text_.bidi.vis2log(vpos);
253 pos_type const end = row_.endpos();
254 FontSpan const font_span = par_.fontSpan(pos);
255 Change::Type const prev_change = par_.lookupChange(pos).type;
259 str += par_.getChar(pos);
261 unsigned char c = str[0];
262 str[0] = par_.transformChar(c, pos);
265 // collect as much similar chars as we can
266 for (++vpos ; vpos < end ; ++vpos) {
267 pos = text_.bidi.vis2log(vpos);
268 if (pos < font_span.first || pos > font_span.last)
271 if (prev_change != par_.lookupChange(pos))
274 char_type c = par_.getChar(pos);
276 if (!isPrintableNonspace(c))
279 if (arabic && Encodings::isComposeChar_arabic(c))
282 if (hebrew && Encodings::isComposeChar_hebrew(c))
286 c = par_.transformChar(c, pos);
291 if (prev_change == Change::DELETED)
292 font.setColor(LColor::strikeout);
293 else if (prev_change == Change::INSERTED)
294 font.setColor(LColor::newtext);
296 // Draw text and set the new x position
297 //lyxerr << "paint row: yo_ " << yo_ << "\n";
298 pain_.text(int(x_), yo_, str, font);
299 x_ += font_metrics::width(str, font);
303 void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
305 if (!lyxrc.mark_foreign_language)
307 if (font.language() == latex_language)
309 if (font.language() == bv_.buffer()->params().language)
312 int const y = yo_ + 1 + desc;
313 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
317 void RowPainter::paintFromPos(pos_type & vpos)
319 pos_type const pos = text_.bidi.vis2log(vpos);
320 LyXFont orig_font = text_.getFont(par_, pos);
322 double const orig_x = x_;
324 if (par_.isInset(pos)) {
325 paintInset(pos, orig_font);
327 paintForeignMark(orig_x, orig_font,
328 par_.getInset(pos)->descent());
332 // usual characters, no insets
333 char_type const c = par_.getChar(pos);
335 // special case languages
336 std::string const & lang = orig_font.language()->lang();
337 bool const hebrew = lang == "hebrew";
338 bool const arabic = lang == "arabic" &&
339 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
340 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
342 // draw as many chars as we can
343 if ((!hebrew && !arabic)
344 || (hebrew && !Encodings::isComposeChar_hebrew(c))
345 || (arabic && !Encodings::isComposeChar_arabic(c))) {
346 paintChars(vpos, orig_font, hebrew, arabic);
348 paintHebrewComposeChar(vpos, orig_font);
350 paintArabicComposeChar(vpos, orig_font);
353 paintForeignMark(orig_x, orig_font);
357 void RowPainter::paintChangeBar()
359 pos_type const start = row_.pos();
360 pos_type const end = row_.endpos();
362 if (start == end || !par_.isChanged(start, end))
365 int const height = text_.isLastRow(pit_, row_)
369 pain_.fillRectangle(4, yo_ - row_.ascent(), 5, height, LColor::changebar);
373 void RowPainter::paintAppendix()
375 if (!par_.params().appendix())
378 int y = yo_ - row_.ascent();
380 if (par_.params().startOfAppendix())
381 y += 2 * defaultRowHeight();
383 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
384 pain_.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), LColor::appendix);
388 void RowPainter::paintDepthBar()
390 Paragraph::depth_type const depth = par_.getDepth();
395 Paragraph::depth_type prev_depth = 0;
396 if (!text_.isFirstRow(pit_, row_)) {
397 pit_type pit2 = pit_;
400 prev_depth = pars_[pit2].getDepth();
403 Paragraph::depth_type next_depth = 0;
404 if (!text_.isLastRow(pit_, row_)) {
405 pit_type pit2 = pit_;
406 if (row_.endpos() >= pars_[pit2].size())
408 next_depth = pars_[pit2].getDepth();
411 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
412 int const w = nestMargin() / 5;
413 int x = int(xo_) + w * i;
414 // only consider the changebar space if we're drawing outermost text
415 if (text_.isMainText())
416 x += changebarMargin();
418 int const starty = yo_ - row_.ascent();
419 int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
421 pain_.line(x, starty, x, starty + h, LColor::depthbar);
424 pain_.fillRectangle(x, starty, w, 2, LColor::depthbar);
426 pain_.fillRectangle(x, starty + h, w, 2, LColor::depthbar);
431 int RowPainter::paintAppendixStart(int y)
434 pb_font.setColor(LColor::appendix);
437 string const label = _("Appendix");
441 font_metrics::rectText(label, pb_font, w, a, d);
443 int const text_start = int(xo_ + (width_ - w) / 2);
444 int const text_end = text_start + w;
446 pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
448 pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
449 pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
451 return 3 * defaultRowHeight();
455 void RowPainter::paintFirst()
457 ParagraphParameters const & parparams = par_.params();
461 // start of appendix?
462 if (parparams.startOfAppendix())
463 y_top += paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
465 Buffer const & buffer = *bv_.buffer();
467 LyXLayout_ptr const & layout = par_.layout();
469 if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
471 if (layout->latextype == LATEX_PARAGRAPH
472 && !par_.getDepth()) {
473 y_top += buffer.params().getDefSkip().inPixels(bv_);
475 LyXLayout_ptr const & playout = pars_[pit_ - 1].layout();
476 if (playout->latextype == LATEX_PARAGRAPH
477 && !pars_[pit_ - 1].getDepth()) {
478 // is it right to use defskip here, too? (AS)
479 y_top += buffer.params().getDefSkip().inPixels(bv_);
485 bool const is_rtl = text_.isRTL(par_);
486 bool const is_seq = isFirstInSequence(pit_, text_.paragraphs());
487 //lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << std::endl;
489 // should we print a label?
490 if (layout->labeltype >= LABEL_STATIC
491 && (layout->labeltype != LABEL_STATIC
492 || layout->latextype != LATEX_ENVIRONMENT
495 LyXFont const font = getLabelFont();
496 string const str = par_.getLabelstring();
500 // this is special code for the chapter layout. This is
501 // printed in an extra row and has a pagebreak at
503 if (layout->counter == "chapter") {
504 double spacing_val = 1.0;
505 if (!parparams.spacing().isDefault()) {
506 spacing_val = parparams.spacing().getValue();
508 spacing_val = buffer.params().spacing().getValue();
511 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
513 int const maxdesc = int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
514 + int(layout->parsep) * defaultRowHeight();
517 x = width_ - leftMargin() -
518 font_metrics::width(str, font);
521 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
524 x = width_ - leftMargin()
525 + font_metrics::width(layout->labelsep, font);
527 x = x_ - font_metrics::width(layout->labelsep, font)
528 - font_metrics::width(str, font);
531 pain_.text(int(x), yo_, str, font);
535 // the labels at the top of an environment.
536 // More or less for bibliography
538 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
539 layout->labeltype == LABEL_BIBLIO ||
540 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
541 LyXFont font = getLabelFont();
542 if (!par_.getLabelstring().empty()) {
543 string const str = par_.getLabelstring();
544 double spacing_val = 1.0;
545 if (!parparams.spacing().isDefault())
546 spacing_val = parparams.spacing().getValue();
548 spacing_val = buffer.params().spacing().getValue();
550 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
553 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
554 + (layout->labelbottomsep * defaultRowHeight()));
557 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
560 x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
561 x -= font_metrics::width(str, font) / 2;
563 x = width_ - leftMargin() -
564 font_metrics::width(str, font);
566 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
572 void RowPainter::paintLast()
574 bool const is_rtl = text_.isRTL(par_);
575 int const endlabel = getEndLabel(pit_, text_.paragraphs());
580 case END_LABEL_FILLED_BOX: {
581 LyXFont const font = getLabelFont();
582 int const size = int(0.75 * font_metrics::maxAscent(font));
583 int const y = yo_ - size;
584 int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
586 if (width_ - int(row_.width()) <= size)
587 x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);
589 if (endlabel == END_LABEL_BOX)
590 pain_.rectangle(x, y, size, size, LColor::eolmarker);
592 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
596 case END_LABEL_STATIC: {
597 LyXFont font = getLabelFont();
598 string const & str = par_.layout()->endlabelstring();
599 double const x = is_rtl ?
600 x_ - font_metrics::width(str, font)
601 : - text_.rightMargin(par_) - row_.width();
602 pain_.text(int(x), yo_, str, font);
606 case END_LABEL_NO_LABEL:
612 void RowPainter::paintText()
614 pos_type const end = row_.endpos();
615 pos_type body_pos = par_.beginOfBody();
617 (body_pos > end || !par_.isLineSeparator(body_pos - 1))) {
621 LyXLayout_ptr const & layout = par_.layout();
623 bool running_strikeout = false;
624 bool is_struckout = false;
625 int last_strikeout_x = 0;
627 // Use font span to speed things up, see below
631 for (pos_type vpos = row_.pos(); vpos < end; ) {
632 if (x_ > bv_.workWidth())
635 pos_type const pos = text_.bidi.vis2log(vpos);
637 if (pos >= par_.size()) {
642 // Use font span to speed things up, see above
643 if (vpos < font_span.first || vpos > font_span.last) {
644 font_span = par_.fontSpan(vpos);
645 font = text_.getFont(par_, vpos);
648 const int width_pos =
649 text_.singleWidth(par_, pos, par_.getChar(pos), font);
651 if (x_ + width_pos < 0) {
657 is_struckout = isDeletedText(par_, pos);
659 if (is_struckout && !running_strikeout) {
660 running_strikeout = true;
661 last_strikeout_x = int(x_);
664 bool const highly_editable_inset = par_.isInset(pos)
665 && isHighlyEditableInset(par_.getInset(pos));
667 // If we reach the end of a struck out range, paint it.
668 // We also don't paint across things like tables
669 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
670 // Calculate 1/3 height of the buffer's default font
673 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
674 pain_.line(last_strikeout_x, middle, int(x_), middle,
675 LColor::strikeout, Painter::line_solid, Painter::line_thin);
676 running_strikeout = false;
679 if (body_pos > 0 && pos == body_pos - 1) {
680 int const lwidth = font_metrics::width(layout->labelsep,
683 x_ += label_hfill_ + lwidth - width_pos;
686 if (par_.isHfill(pos)) {
690 int const y1 = y0 - defaultRowHeight() / 2;
692 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
694 if (hfillExpansion(par_, row_, pos)) {
695 int const y2 = (y0 + y1) / 2;
697 if (pos >= body_pos) {
698 pain_.line(int(x_), y2, int(x_ + hfill_), y2,
700 Painter::line_onoffdash);
703 pain_.line(int(x_), y2, int(x_ + label_hfill_), y2,
705 Painter::line_onoffdash);
708 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
712 } else if (par_.isSeparator(pos)) {
722 // if we reach the end of a struck out range, paint it
723 if (running_strikeout) {
724 // calculate 1/3 height of the buffer's default font
727 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
728 pain_.line(last_strikeout_x, middle, int(x_), middle,
729 LColor::strikeout, Painter::line_solid, Painter::line_thin);
730 running_strikeout = false;
735 lyx::size_type calculateRowSignature(Row const & row, Paragraph const & par,
738 boost::crc_32_type crc;
739 for (lyx::pos_type i = row.pos(); i < row.endpos(); ++i) {
740 const unsigned char b[] = { par.getChar(i) };
741 crc.process_bytes(b, 1);
743 const unsigned char b[] = { x, y, row.width() };
744 crc.process_bytes(b, 3);
745 return crc.checksum();
749 bool CursorOnRow(PainterInfo & pi, pit_type const pit,
750 RowList::const_iterator rit, LyXText const & text)
752 // Is there a cursor on this row (or inside inset on row)
753 LCursor & cur = pi.base.bv->cursor();
754 for (lyx::size_type d = 0; d < cur.depth(); d++) {
755 CursorSlice const & sl = cur[d];
756 if (sl.text() == &text
758 && sl.pos() >= rit->pos()
759 && sl.pos() <= rit->endpos())
766 bool innerCursorOnRow(PainterInfo & pi, pit_type pit,
767 RowList::const_iterator rit, LyXText const & text)
769 // Is there a cursor inside an inset on this row, and is this inset
770 // the only "character" on this row
771 LCursor & cur = pi.base.bv->cursor();
772 if (rit->pos() + 1 != rit->endpos())
774 for (lyx::size_type d = 0; d < cur.depth(); d++) {
775 CursorSlice const & sl = cur[d];
776 if (sl.text() == &text
778 && sl.pos() == rit->pos())
779 return d < cur.depth() - 1;
786 (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y,
789 // lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
790 static NullPainter nop;
791 static PainterInfo nullpi(pi.base.bv, nop);
792 int const ww = pi.base.bv->workHeight();
794 Paragraph const & par = text.paragraphs()[pit];
796 RowList::const_iterator const rb = par.rows().begin();
797 RowList::const_iterator const re = par.rows().end();
798 theCoords.parPos()[&text][pit] = Point(x, y);
801 lyx::size_type rowno(0);
802 for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
804 // Allow setting of bv->repaintAll() for nested insets in
806 bool tmp = pi.base.bv->repaintAll();
808 // Row signature; has row changed since last paint?
809 lyx::size_type const row_sig = calculateRowSignature(*rit, par, x, y);
810 bool row_has_changed = par.rowSignature()[rowno] != row_sig;
812 bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
813 bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
816 // If this is the only object on the row, we can make it wide
817 for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
818 InsetBase const * const in = par.getInset(i);
820 InsetText const * const t = in->asTextInset();
822 t->Wide() = in_inset_alone_on_row &&
827 // If selection is on, the current row signature differs
828 // from cache, or cursor is inside an inset _on this row_,
829 // then paint the row
830 if (repaintAll || row_has_changed || cursor_on_row) {
831 // Add to row signature cache
832 par.rowSignature()[rowno] = row_sig;
834 bool const inside = (y + rit->descent() >= 0
835 && y - rit->ascent() < ww);
836 RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y);
837 // Clear background of this row
838 // (if paragraph background was not cleared)
840 (!in_inset_alone_on_row || row_has_changed)) {
841 pi.pain.fillRectangle(( rowno ? 0 : x - 10 ), y - rit->ascent(),
842 pi.base.bv->workWidth(), rit->height(),
843 text.backgroundColor());
844 // If outer row has changed, force nested
845 // insets to repaint completely
847 pi.base.bv->repaintAll(true);
850 // Instrumentation for testing row cache (see also
852 if (text.isMainText())
853 lyxerr[Debug::PAINTING] << "#";
855 lyxerr[Debug::PAINTING] << "[" <<
856 repaintAll << row_has_changed <<
857 cursor_on_row << "]";
868 // Restore, see above
869 pi.base.bv->repaintAll(tmp);
871 lyxerr[Debug::PAINTING] << "." << endl;
877 void paintText(BufferView const & bv, ViewMetricsInfo const & vi)
879 Painter & pain = bv.painter();
880 LyXText * const text = bv.text();
881 bool const select = bv.cursor().selection();
883 PainterInfo pi(const_cast<BufferView *>(&bv), pain);
884 // Should the whole screen, including insets, be refreshed?
885 bool repaintAll(select || !vi.singlepar);
888 // Clear background (if not delegated to rows)
889 pain.fillRectangle(0, vi.y1, bv.workWidth(), vi.y2 - vi.y1,
890 text->backgroundColor());
893 text->drawSelection(pi, 0, 0);
898 for (pit_type pit = vi.p1; pit <= vi.p2; ++pit) {
899 bv.repaintAll(repaintAll);
900 Paragraph const & par = text->getPar(pit);
902 paintPar(pi, *bv.text(), pit, 0, yy, repaintAll);
906 // Cache one paragraph above and one below
907 // Note MV: this cannot be suppressed even for singlepar.
908 // Try viewing the User Guide Mobius figure
911 text->redoParagraph(vi.p1 - 1);
912 theCoords.parPos()[bv.text()][vi.p1 - 1] =
913 Point(0, vi.y1 - text->getPar(vi.p1 - 1).descent());
916 if (vi.p2 < lyx::pit_type(text->paragraphs().size()) - 1) {
917 text->redoParagraph(vi.p2 + 1);
918 theCoords.parPos()[bv.text()][vi.p2 + 1] =
919 Point(0, vi.y2 + text->getPar(vi.p2 + 1).ascent());
922 // and grey out above (should not happen later)
923 // lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
924 if (vi.y1 > 0 && !vi.singlepar)
925 pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
927 // and possibly grey out below
928 // lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
929 if (vi.y2 < bv.workHeight() && !vi.singlepar)
930 pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
934 void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y)
936 // lyxerr << " paintTextInset: y: " << y << endl;
938 y -= text.getPar(0).ascent();
939 // This flag can not be set from within same inset:
940 bool repaintAll = pi.base.bv->repaintAll();
941 for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
942 y += text.getPar(pit).ascent();
943 paintPar(pi, text, pit, x, y, repaintAll);
944 y += text.getPar(pit).descent();