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 "metricsinfo.h"
29 #include "paragraph.h"
30 #include "paragraph_funcs.h"
31 #include "ParagraphParameters.h"
34 #include "frontends/FontMetrics.h"
35 #include "frontends/nullpainter.h"
36 #include "frontends/Painter.h"
38 #include "insets/insettext.h"
40 #include "support/textutils.h"
42 #include <boost/crc.hpp>
47 using frontend::Painter;
48 using frontend::NullPainter;
49 using frontend::FontMetrics;
59 /// Flag: do a full redraw of inside text of inset
60 /// Working variable indicating a full screen refresh
64 * A class used for painting an individual row of text.
68 /// initialise and run painter
69 RowPainter(PainterInfo & pi, LyXText const & text,
70 pit_type pit, Row const & row, int x, int y);
72 // paint various parts
75 void paintChangeBar();
81 void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
82 void paintHebrewComposeChar(pos_type & vpos, LyXFont const & font);
83 void paintArabicComposeChar(pos_type & vpos, LyXFont const & font);
84 void paintChars(pos_type & vpos, LyXFont font,
85 bool hebrew, bool arabic);
86 int paintAppendixStart(int y);
87 void paintFromPos(pos_type & vpos);
88 void paintInset(pos_type const pos, LyXFont const & font);
90 /// return left margin
91 int leftMargin() const;
93 /// return the label font for this row
94 LyXFont const getLabelFont() const;
96 /// bufferview to paint on
102 /// LyXText for the row
103 LyXText const & text_;
104 ParagraphList const & pars_;
111 Paragraph const & par_;
113 /// is row erased? (change tracking)
118 int const yo_; // current baseline
127 RowPainter::RowPainter(PainterInfo & pi,
128 LyXText const & text, pit_type pit, Row const & row, int x, int y)
129 : bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
130 row_(row), pit_(pit), par_(text.paragraphs()[pit]),
132 xo_(x), yo_(y), width_(text_.width())
134 RowMetrics m = text_.computeRowMetrics(pit, row_);
137 //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
140 separator_ = m.separator;
142 label_hfill_ = m.label_hfill;
144 BOOST_ASSERT(pit >= 0);
145 BOOST_ASSERT(pit < int(text.paragraphs().size()));
149 LyXFont const RowPainter::getLabelFont() const
151 return text_.getLabelFont(par_);
155 int RowPainter::leftMargin() const
157 return text_.leftMargin(pit_, row_.pos());
161 void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
163 InsetBase const * inset = par_.getInset(pos);
165 PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
166 // FIXME: We should always use font, see documentation of
167 // noFontChange() in insetbase.h.
168 pi.base.font = inset->noFontChange() ?
169 bv_.buffer()->params().getFont() :
171 pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
172 pi.erased_ = erased_ || par_.isDeleted(pos);
173 bv_.coordCache().insets().add(inset, int(x_), yo_);
174 InsetText const * const in = inset->asTextInset();
175 // non-wide insets are painted completely. Recursive
176 bool tmp = refreshInside;
177 if (!in || !in->Wide()) {
178 refreshInside = true;
179 lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
182 inset->drawSelection(pi, int(x_), yo_);
183 inset->draw(pi, int(x_), yo_);
185 x_ += inset->width();
189 void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
191 pos_type pos = text_.bidi.vis2log(vpos);
196 char_type c = par_.getChar(pos);
200 int const width = theFontMetrics(font).width(c);
203 for (pos_type i = pos - 1; i >= 0; --i) {
205 if (!Encodings::isComposeChar_hebrew(c)) {
206 if (isPrintableNonspace(c)) {
208 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
210 // This does not work anymore, and non-ascii
211 // characters in source files are forbidden
214 dx = (c == 'ø' || c == 'ã')
216 : (width2 - width) / 2;
224 pain_.text(int(x_) + dx, yo_, str, font);
228 void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
230 pos_type pos = text_.bidi.vis2log(vpos);
234 char_type c = par_.getChar(pos);
235 c = par_.transformChar(c, pos);
239 int const width = theFontMetrics(font).width(c);
242 for (pos_type i = pos - 1; i >= 0; --i) {
244 if (!Encodings::isComposeChar_arabic(c)) {
245 if (isPrintableNonspace(c)) {
247 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
248 dx = (width2 - width) / 2;
254 pain_.text(int(x_) + dx, yo_, str, font);
258 void RowPainter::paintChars(pos_type & vpos, LyXFont font,
259 bool hebrew, bool arabic)
261 pos_type pos = text_.bidi.vis2log(vpos);
262 pos_type const end = row_.endpos();
263 FontSpan const font_span = par_.fontSpan(pos);
264 Change::Type const prev_change = par_.lookupChange(pos).type;
269 str += par_.getChar(pos);
271 std::vector<char_type> str;
272 str.push_back(par_.getChar(pos));
275 char_type c = str[0];
276 str[0] = par_.transformChar(c, pos);
279 // collect as much similar chars as we can
280 for (++vpos ; vpos < end ; ++vpos) {
281 pos = text_.bidi.vis2log(vpos);
282 if (pos < font_span.first || pos > font_span.last)
285 if (prev_change != par_.lookupChange(pos).type)
288 char_type c = par_.getChar(pos);
290 if (!isPrintableNonspace(c))
293 if (arabic && Encodings::isComposeChar_arabic(c))
296 if (hebrew && Encodings::isComposeChar_hebrew(c))
300 c = par_.transformChar(c, pos);
309 if (prev_change == Change::DELETED)
310 font.setColor(LColor::strikeout);
311 else if (prev_change == Change::INSERTED)
312 font.setColor(LColor::newtext);
314 // Draw text and set the new x position
315 //lyxerr << "paint row: yo_ " << yo_ << "\n";
317 int width = pain_.text(int(x_), yo_, str, font);
319 int width = pain_.text(int(x_), yo_, &str[0], str.size(), font);
325 void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
327 if (!lyxrc.mark_foreign_language)
329 if (font.language() == latex_language)
331 if (font.language() == bv_.buffer()->params().language)
334 int const y = yo_ + 1 + desc;
335 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
339 void RowPainter::paintFromPos(pos_type & vpos)
341 pos_type const pos = text_.bidi.vis2log(vpos);
342 LyXFont orig_font = text_.getFont(par_, pos);
344 double const orig_x = x_;
346 if (par_.isInset(pos)) {
347 paintInset(pos, orig_font);
349 paintForeignMark(orig_x, orig_font,
350 par_.getInset(pos)->descent());
354 // usual characters, no insets
355 char_type const c = par_.getChar(pos);
357 // special case languages
358 std::string const & lang = orig_font.language()->lang();
359 bool const hebrew = lang == "hebrew";
360 bool const arabic = lang == "arabic" &&
361 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
362 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
364 // draw as many chars as we can
365 if ((!hebrew && !arabic)
366 || (hebrew && !Encodings::isComposeChar_hebrew(c))
367 || (arabic && !Encodings::isComposeChar_arabic(c))) {
368 paintChars(vpos, orig_font, hebrew, arabic);
370 paintHebrewComposeChar(vpos, orig_font);
372 paintArabicComposeChar(vpos, orig_font);
375 paintForeignMark(orig_x, orig_font);
379 void RowPainter::paintChangeBar()
381 pos_type const start = row_.pos();
382 pos_type const end = row_.endpos();
384 if (start == end || !par_.isChanged(start, end))
387 int const height = text_.isLastRow(pit_, row_)
391 pain_.fillRectangle(5, yo_ - row_.ascent(), 3, height, LColor::changebar);
395 void RowPainter::paintAppendix()
397 if (!par_.params().appendix())
400 int y = yo_ - row_.ascent();
402 if (par_.params().startOfAppendix())
403 y += 2 * defaultRowHeight();
405 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
406 pain_.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), LColor::appendix);
410 void RowPainter::paintDepthBar()
412 depth_type const depth = par_.getDepth();
417 depth_type prev_depth = 0;
418 if (!text_.isFirstRow(pit_, row_)) {
419 pit_type pit2 = pit_;
422 prev_depth = pars_[pit2].getDepth();
425 depth_type next_depth = 0;
426 if (!text_.isLastRow(pit_, row_)) {
427 pit_type pit2 = pit_;
428 if (row_.endpos() >= pars_[pit2].size())
430 next_depth = pars_[pit2].getDepth();
433 for (depth_type i = 1; i <= depth; ++i) {
434 int const w = nestMargin() / 5;
435 int x = int(xo_) + w * i;
436 // only consider the changebar space if we're drawing outermost text
437 if (text_.isMainText())
438 x += changebarMargin();
440 int const starty = yo_ - row_.ascent();
441 int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
443 pain_.line(x, starty, x, starty + h, LColor::depthbar);
446 pain_.fillRectangle(x, starty, w, 2, LColor::depthbar);
448 pain_.fillRectangle(x, starty + h, w, 2, LColor::depthbar);
453 int RowPainter::paintAppendixStart(int y)
456 pb_font.setColor(LColor::appendix);
463 docstring const label = _("Appendix");
464 theFontMetrics(pb_font).rectText(label, w, a, d);
466 int const text_start = int(xo_ + (width_ - w) / 2);
467 int const text_end = text_start + w;
469 pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
471 pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
472 pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
474 return 3 * defaultRowHeight();
478 void RowPainter::paintFirst()
480 ParagraphParameters const & parparams = par_.params();
484 // start of appendix?
485 if (parparams.startOfAppendix())
486 y_top += paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
488 Buffer const & buffer = *bv_.buffer();
490 LyXLayout_ptr const & layout = par_.layout();
492 if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
494 if (layout->latextype == LATEX_PARAGRAPH
495 && !par_.getDepth()) {
496 y_top += buffer.params().getDefSkip().inPixels(bv_);
498 LyXLayout_ptr const & playout = pars_[pit_ - 1].layout();
499 if (playout->latextype == LATEX_PARAGRAPH
500 && !pars_[pit_ - 1].getDepth()) {
501 // is it right to use defskip here, too? (AS)
502 y_top += buffer.params().getDefSkip().inPixels(bv_);
508 bool const is_rtl = text_.isRTL(par_);
509 bool const is_seq = isFirstInSequence(pit_, text_.paragraphs());
510 //lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << std::endl;
512 // should we print a label?
513 if (layout->labeltype >= LABEL_STATIC
514 && (layout->labeltype != LABEL_STATIC
515 || layout->latextype != LATEX_ENVIRONMENT
518 LyXFont const font = getLabelFont();
519 FontMetrics const & fm = theFontMetrics(font);
521 docstring const str = par_.getLabelstring();
525 // this is special code for the chapter layout. This is
526 // printed in an extra row and has a pagebreak at
528 if (layout->counter == "chapter") {
529 double spacing_val = 1.0;
530 if (!parparams.spacing().isDefault()) {
531 spacing_val = parparams.spacing().getValue();
533 spacing_val = buffer.params().spacing().getValue();
536 int const labeladdon = int(fm.maxHeight() * layout->spacing.getValue() * spacing_val);
538 int const maxdesc = int(fm.maxDescent() * layout->spacing.getValue() * spacing_val)
539 + int(layout->parsep) * defaultRowHeight();
542 x = width_ - leftMargin() -
546 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
549 docstring lab = from_utf8(layout->labelsep);
551 x = width_ - leftMargin()
554 x = x_ - fm.width(lab)
558 pain_.text(int(x), yo_, str, font);
562 // the labels at the top of an environment.
563 // More or less for bibliography
565 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
566 layout->labeltype == LABEL_BIBLIO ||
567 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
568 LyXFont font = getLabelFont();
569 if (!par_.getLabelstring().empty()) {
570 docstring const str = par_.getLabelstring();
571 double spacing_val = 1.0;
572 if (!parparams.spacing().isDefault())
573 spacing_val = parparams.spacing().getValue();
575 spacing_val = buffer.params().spacing().getValue();
577 FontMetrics const & fm = theFontMetrics(font);
579 int const labeladdon = int(fm.maxHeight()
580 * layout->spacing.getValue() * spacing_val);
583 int(fm.maxDescent() * layout->spacing.getValue() * spacing_val
584 + (layout->labelbottomsep * defaultRowHeight()));
587 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
590 x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
591 x -= fm.width(str) / 2;
593 x = width_ - leftMargin() - fm.width(str);
595 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
601 void RowPainter::paintLast()
603 bool const is_rtl = text_.isRTL(par_);
604 int const endlabel = getEndLabel(pit_, text_.paragraphs());
609 case END_LABEL_FILLED_BOX: {
610 LyXFont const font = getLabelFont();
611 FontMetrics const & fm = theFontMetrics(font);
612 int const size = int(0.75 * fm.maxAscent());
613 int const y = yo_ - size;
614 int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
616 if (width_ - int(row_.width()) <= size)
617 x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);
619 if (endlabel == END_LABEL_BOX)
620 pain_.rectangle(x, y, size, size, LColor::eolmarker);
622 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
626 case END_LABEL_STATIC: {
627 LyXFont font = getLabelFont();
628 FontMetrics const & fm = theFontMetrics(font);
629 docstring const & str = par_.layout()->endlabelstring();
630 double const x = is_rtl ?
632 : - text_.rightMargin(par_) - row_.width();
633 pain_.text(int(x), yo_, str, font);
637 case END_LABEL_NO_LABEL:
643 void RowPainter::paintText()
645 pos_type const end = row_.endpos();
646 pos_type body_pos = par_.beginOfBody();
648 (body_pos > end || !par_.isLineSeparator(body_pos - 1))) {
652 LyXLayout_ptr const & layout = par_.layout();
654 bool running_strikeout = false;
655 bool is_struckout = false;
656 int last_strikeout_x = 0;
658 // Use font span to speed things up, see below
662 for (pos_type vpos = row_.pos(); vpos < end; ) {
663 if (x_ > bv_.workWidth())
666 pos_type const pos = text_.bidi.vis2log(vpos);
668 if (pos >= par_.size()) {
673 // Use font span to speed things up, see above
674 if (vpos < font_span.first || vpos > font_span.last) {
675 font_span = par_.fontSpan(vpos);
676 font = text_.getFont(par_, vpos);
679 const int width_pos =
680 text_.singleWidth(par_, pos, par_.getChar(pos), font);
682 if (x_ + width_pos < 0) {
688 is_struckout = par_.isDeleted(pos);
690 if (is_struckout && !running_strikeout) {
691 running_strikeout = true;
692 last_strikeout_x = int(x_);
695 bool const highly_editable_inset = par_.isInset(pos)
696 && isHighlyEditableInset(par_.getInset(pos));
698 // If we reach the end of a struck out range, paint it.
699 // We also don't paint across things like tables
700 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
701 // Calculate 1/3 height of the buffer's default font
702 FontMetrics const & fm
703 = theFontMetrics(bv_.buffer()->params().getFont());
704 int const middle = yo_ - fm.maxAscent() / 3;
705 pain_.line(last_strikeout_x, middle, int(x_), middle,
706 LColor::strikeout, Painter::line_solid, Painter::line_thin);
707 running_strikeout = false;
710 if (body_pos > 0 && pos == body_pos - 1) {
712 int const lwidth = theFontMetrics(getLabelFont())
713 .width(from_utf8(layout->labelsep));
715 x_ += label_hfill_ + lwidth - width_pos;
718 if (par_.isHfill(pos)) {
722 int const y1 = y0 - defaultRowHeight() / 2;
724 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
726 if (par_.hfillExpansion(row_, pos)) {
727 int const y2 = (y0 + y1) / 2;
729 if (pos >= body_pos) {
730 pain_.line(int(x_), y2, int(x_ + hfill_), y2,
732 Painter::line_onoffdash);
735 pain_.line(int(x_), y2, int(x_ + label_hfill_), y2,
737 Painter::line_onoffdash);
740 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
744 } else if (par_.isSeparator(pos)) {
754 // if we reach the end of a struck out range, paint it
755 if (running_strikeout) {
756 // calculate 1/3 height of the buffer's default font
757 FontMetrics const & fm
758 = theFontMetrics(bv_.buffer()->params().getFont());
759 int const middle = yo_ - fm.maxAscent() / 3;
760 pain_.line(last_strikeout_x, middle, int(x_), middle,
761 LColor::strikeout, Painter::line_solid, Painter::line_thin);
762 running_strikeout = false;
767 size_type calculateRowSignature(Row const & row, Paragraph const & par,
770 boost::crc_32_type crc;
771 for (pos_type i = row.pos(); i < row.endpos(); ++i) {
772 const unsigned char b[] = { par.getChar(i) };
773 crc.process_bytes(b, 1);
775 const unsigned char b[] = { x, y, row.width() };
776 crc.process_bytes(b, 3);
777 return crc.checksum();
781 bool CursorOnRow(PainterInfo & pi, pit_type const pit,
782 RowList::const_iterator rit, LyXText const & text)
784 // Is there a cursor on this row (or inside inset on row)
785 LCursor & cur = pi.base.bv->cursor();
786 for (size_type d = 0; d < cur.depth(); ++d) {
787 CursorSlice const & sl = cur[d];
788 if (sl.text() == &text
790 && sl.pos() >= rit->pos()
791 && sl.pos() <= rit->endpos())
798 bool innerCursorOnRow(PainterInfo & pi, pit_type pit,
799 RowList::const_iterator rit, LyXText const & text)
801 // Is there a cursor inside an inset on this row, and is this inset
802 // the only "character" on this row
803 LCursor & cur = pi.base.bv->cursor();
804 if (rit->pos() + 1 != rit->endpos())
806 for (size_type d = 0; d < cur.depth(); d++) {
807 CursorSlice const & sl = cur[d];
808 if (sl.text() == &text
810 && sl.pos() == rit->pos())
811 return d < cur.depth() - 1;
818 (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y,
821 // lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
822 static NullPainter nop;
823 static PainterInfo nullpi(pi.base.bv, nop);
824 int const ww = pi.base.bv->workHeight();
826 pi.base.bv->coordCache().parPos()[&text][pit] = Point(x, y);
828 Paragraph const & par = text.paragraphs()[pit];
829 if (par.rows().empty())
832 RowList::const_iterator const rb = par.rows().begin();
833 RowList::const_iterator const re = par.rows().end();
837 for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
839 // Allow setting of refreshInside for nested insets in
841 bool tmp = refreshInside;
843 // Row signature; has row changed since last paint?
844 size_type const row_sig = calculateRowSignature(*rit, par, x, y);
845 bool row_has_changed = par.rowSignature()[rowno] != row_sig;
847 bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
848 bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
851 // If this is the only object on the row, we can make it wide
852 for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
853 InsetBase const * const in = par.getInset(i);
855 InsetText const * const t = in->asTextInset();
857 t->Wide() = in_inset_alone_on_row;
861 // If selection is on, the current row signature differs
862 // from cache, or cursor is inside an inset _on this row_,
863 // then paint the row
864 if (repaintAll || row_has_changed || cursor_on_row) {
865 // Add to row signature cache
866 par.rowSignature()[rowno] = row_sig;
868 bool const inside = (y + rit->descent() >= 0
869 && y - rit->ascent() < ww);
870 RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y);
871 // Clear background of this row
872 // (if paragraph background was not cleared)
874 (!in_inset_alone_on_row || row_has_changed)) {
875 pi.pain.fillRectangle(x, y - rit->ascent(),
876 text.maxwidth_, rit->height(),
877 text.backgroundColor());
878 // If outer row has changed, force nested
879 // insets to repaint completely
881 refreshInside = true;
884 // Instrumentation for testing row cache (see also
886 if (text.isMainText())
887 lyxerr[Debug::PAINTING] << "#";
889 lyxerr[Debug::PAINTING] << "[" <<
890 repaintAll << row_has_changed <<
891 cursor_on_row << "]";
902 // Restore, see above
905 lyxerr[Debug::PAINTING] << "." << endl;
911 void paintText(BufferView & bv, ViewMetricsInfo const & vi,
914 LyXText & text = bv.buffer()->text();
915 bool const select = bv.cursor().selection();
917 PainterInfo pi(const_cast<BufferView *>(&bv), pain);
918 // Should the whole screen, including insets, be refreshed?
919 bool repaintAll = select || !vi.singlepar;
922 // Clear background (if not delegated to rows)
923 pain.fillRectangle(0, vi.y1, bv.workWidth(), vi.y2 - vi.y1,
924 text.backgroundColor());
927 text.drawSelection(pi, 0, 0);
932 for (pit_type pit = vi.p1; pit <= vi.p2; ++pit) {
933 refreshInside = repaintAll;
934 Paragraph const & par = text.getPar(pit);
936 paintPar(pi, text, pit, 0, yy, repaintAll);
940 // Cache one paragraph above and one below
941 // Note MV: this cannot be suppressed even for singlepar.
942 // Try viewing the User Guide Mobius figure
945 text.redoParagraph(vi.p1 - 1);
946 bv.coordCache().parPos()[&text][vi.p1 - 1] =
947 Point(0, vi.y1 - text.getPar(vi.p1 - 1).descent());
950 if (vi.p2 < pit_type(text.paragraphs().size()) - 1) {
951 text.redoParagraph(vi.p2 + 1);
952 bv.coordCache().parPos()[&text][vi.p2 + 1] =
953 Point(0, vi.y2 + text.getPar(vi.p2 + 1).ascent());
956 // and grey out above (should not happen later)
957 // lyxerr << "par ascent: " << text.getPar(vi.p1).ascent() << endl;
958 if (vi.y1 > 0 && !vi.singlepar)
959 pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
961 // and possibly grey out below
962 // lyxerr << "par descent: " << text.getPar(vi.p1).ascent() << endl;
963 if (vi.y2 < bv.workHeight() && !vi.singlepar)
964 pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
968 void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y)
970 // lyxerr << " paintTextInset: y: " << y << endl;
972 y -= text.getPar(0).ascent();
973 // This flag can not be set from within same inset:
974 bool repaintAll = refreshInside;
975 for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
976 y += text.getPar(pit).ascent();
977 paintPar(pi, text, pit, x, y, repaintAll);
978 y += text.getPar(pit).descent();