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>
57 * A class used for painting an individual row of text.
61 /// initialise and run painter
62 RowPainter(PainterInfo & pi, LyXText const & text,
63 pit_type pit, Row const & row, int x, int y);
65 // paint various parts
68 void paintChangeBar();
74 void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
75 void paintHebrewComposeChar(lyx::pos_type & vpos, LyXFont const & font);
76 void paintArabicComposeChar(lyx::pos_type & vpos, LyXFont const & font);
77 void paintChars(lyx::pos_type & vpos, LyXFont font,
78 bool hebrew, bool arabic);
79 int paintAppendixStart(int y);
80 void paintFromPos(lyx::pos_type & vpos);
81 void paintInset(lyx::pos_type const pos, LyXFont const & font);
83 /// return left margin
84 int leftMargin() const;
86 /// return the label font for this row
87 LyXFont const getLabelFont() const;
89 /// bufferview to paint on
90 BufferView const & bv_;
95 /// LyXText for the row
96 LyXText const & text_;
97 ParagraphList const & pars_;
104 Paragraph const & par_;
106 /// is row erased? (change tracking)
111 int const yo_; // current baseline
120 RowPainter::RowPainter(PainterInfo & pi,
121 LyXText const & text, pit_type pit, Row const & row, int x, int y)
122 : bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
123 row_(row), pit_(pit), par_(text.paragraphs()[pit]),
125 xo_(x), yo_(y), width_(text_.width())
127 RowMetrics m = text_.computeRowMetrics(pit, row_);
130 //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
133 separator_ = m.separator;
135 label_hfill_ = m.label_hfill;
137 BOOST_ASSERT(pit >= 0);
138 BOOST_ASSERT(pit < int(text.paragraphs().size()));
142 LyXFont const RowPainter::getLabelFont() const
144 return text_.getLabelFont(par_);
148 int RowPainter::leftMargin() const
150 return text_.leftMargin(pit_, row_.pos());
154 bool isTrueTextInset(InsetBase * in)
156 // Math and tabular insets have isTextInset = true, though they are
157 // not derived from InsetText. Paint them fully
158 return (in && in->isTextInset() && in->asMathInset() == 0
159 && in->lyxCode() != InsetBase::TABULAR_CODE);
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 InsetBase * in = const_cast<InsetBase *>(inset);
177 // non-wide insets are painted completely. Recursive
178 bool tmp = bv_.repaintAll();
179 if (!isTrueTextInset(in) || !static_cast<InsetText*>(in)->Wide())
180 bv_.repaintAll(true);
181 if (bv_.repaintAll())
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 c = par_.getChar(pos);
200 int const width = font_metrics::width(c, font);
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 dx = (c == 'ø' || c == 'ã')
212 : (width2 - width) / 2;
219 pain_.text(int(x_) + dx, yo_, str, font);
223 void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
225 pos_type pos = text_.bidi.vis2log(vpos);
229 char c = par_.getChar(pos);
230 c = par_.transformChar(c, pos);
234 int const width = font_metrics::width(c, font);
237 for (pos_type i = pos - 1; i >= 0; --i) {
239 if (!Encodings::IsComposeChar_arabic(c)) {
240 if (IsPrintableNonspace(c)) {
242 text_.singleWidth(par_, i, c, text_.getFont(par_, i));
243 dx = (width2 - width) / 2;
249 pain_.text(int(x_) + dx, yo_, str, font);
253 void RowPainter::paintChars(pos_type & vpos, LyXFont font,
254 bool hebrew, bool arabic)
256 pos_type pos = text_.bidi.vis2log(vpos);
257 pos_type const end = row_.endpos();
258 FontSpan const font_span = par_.fontSpan(pos);
259 Change::Type const prev_change = par_.lookupChange(pos);
263 str += par_.getChar(pos);
265 unsigned char c = str[0];
266 str[0] = par_.transformChar(c, pos);
269 // collect as much similar chars as we can
270 for (++vpos ; vpos < end ; ++vpos) {
271 pos = text_.bidi.vis2log(vpos);
272 if (pos < font_span.first || pos > font_span.last)
275 if (prev_change != par_.lookupChange(pos))
278 char c = par_.getChar(pos);
280 if (!IsPrintableNonspace(c))
283 if (arabic && Encodings::IsComposeChar_arabic(c))
286 if (hebrew && Encodings::IsComposeChar_hebrew(c))
290 c = par_.transformChar(c, pos);
295 if (prev_change == Change::DELETED)
296 font.setColor(LColor::strikeout);
297 else if (prev_change == Change::INSERTED)
298 font.setColor(LColor::newtext);
300 // Draw text and set the new x position
301 //lyxerr << "paint row: yo_ " << yo_ << "\n";
302 pain_.text(int(x_), yo_, str, font);
303 x_ += font_metrics::width(str, font);
307 void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
309 if (!lyxrc.mark_foreign_language)
311 if (font.language() == latex_language)
313 if (font.language() == bv_.buffer()->params().language)
316 int const y = yo_ + 1 + desc;
317 pain_.line(int(orig_x), y, int(x_), y, LColor::language);
321 void RowPainter::paintFromPos(pos_type & vpos)
323 pos_type const pos = text_.bidi.vis2log(vpos);
324 LyXFont orig_font = text_.getFont(par_, pos);
326 double const orig_x = x_;
328 if (par_.isInset(pos)) {
329 paintInset(pos, orig_font);
331 paintForeignMark(orig_x, orig_font,
332 par_.getInset(pos)->descent());
336 // usual characters, no insets
337 char const c = par_.getChar(pos);
339 // special case languages
340 std::string const & lang = orig_font.language()->lang();
341 bool const hebrew = lang == "hebrew";
342 bool const arabic = lang == "arabic" &&
343 (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
344 lyxrc.font_norm_type == LyXRC::ISO_10646_1);
346 // draw as many chars as we can
347 if ((!hebrew && !arabic)
348 || (hebrew && !Encodings::IsComposeChar_hebrew(c))
349 || (arabic && !Encodings::IsComposeChar_arabic(c))) {
350 paintChars(vpos, orig_font, hebrew, arabic);
352 paintHebrewComposeChar(vpos, orig_font);
354 paintArabicComposeChar(vpos, orig_font);
357 paintForeignMark(orig_x, orig_font);
361 void RowPainter::paintChangeBar()
363 pos_type const start = row_.pos();
364 pos_type const end = row_.endpos();
366 if (start == end || !par_.isChanged(start, end - 1))
369 int const height = text_.isLastRow(pit_, row_)
373 pain_.fillRectangle(4, yo_ - row_.ascent(), 5, height, LColor::changebar);
377 void RowPainter::paintAppendix()
379 if (!par_.params().appendix())
382 int y = yo_ - row_.ascent();
384 if (par_.params().startOfAppendix())
385 y += 2 * defaultRowHeight();
387 pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
388 pain_.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), LColor::appendix);
392 void RowPainter::paintDepthBar()
394 Paragraph::depth_type const depth = par_.getDepth();
399 Paragraph::depth_type prev_depth = 0;
400 if (!text_.isFirstRow(pit_, row_)) {
401 pit_type pit2 = pit_;
404 prev_depth = pars_[pit2].getDepth();
407 Paragraph::depth_type next_depth = 0;
408 if (!text_.isLastRow(pit_, row_)) {
409 pit_type pit2 = pit_;
410 if (row_.endpos() >= pars_[pit2].size())
412 next_depth = pars_[pit2].getDepth();
415 for (Paragraph::depth_type i = 1; i <= depth; ++i) {
416 int const w = nestMargin() / 5;
417 int x = int(xo_) + w * i;
418 // only consider the changebar space if we're drawing outermost text
419 if (text_.isMainText())
420 x += changebarMargin();
422 int const starty = yo_ - row_.ascent();
423 int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
425 pain_.line(x, starty, x, starty + h, LColor::depthbar);
428 pain_.fillRectangle(x, starty, w, 2, LColor::depthbar);
430 pain_.fillRectangle(x, starty + h, w, 2, LColor::depthbar);
435 int RowPainter::paintAppendixStart(int y)
438 pb_font.setColor(LColor::appendix);
441 string const label = _("Appendix");
445 font_metrics::rectText(label, pb_font, w, a, d);
447 int const text_start = int(xo_ + (width_ - w) / 2);
448 int const text_end = text_start + w;
450 pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
452 pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
453 pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
455 return 3 * defaultRowHeight();
459 void RowPainter::paintFirst()
461 ParagraphParameters const & parparams = par_.params();
465 // start of appendix?
466 if (parparams.startOfAppendix())
467 y_top += paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
469 Buffer const & buffer = *bv_.buffer();
471 LyXLayout_ptr const & layout = par_.layout();
473 if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
475 if (layout->latextype == LATEX_PARAGRAPH
476 && !par_.getDepth()) {
477 y_top += buffer.params().getDefSkip().inPixels(bv_);
479 LyXLayout_ptr const & playout = pars_[pit_ - 1].layout();
480 if (playout->latextype == LATEX_PARAGRAPH
481 && !pars_[pit_ - 1].getDepth()) {
482 // is it right to use defskip here, too? (AS)
483 y_top += buffer.params().getDefSkip().inPixels(bv_);
489 bool const is_rtl = text_.isRTL(par_);
490 bool const is_seq = isFirstInSequence(pit_, text_.paragraphs());
491 //lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << std::endl;
493 // should we print a label?
494 if (layout->labeltype >= LABEL_STATIC
495 && (layout->labeltype != LABEL_STATIC
496 || layout->latextype != LATEX_ENVIRONMENT
499 LyXFont const font = getLabelFont();
500 string const str = par_.getLabelstring();
504 // this is special code for the chapter layout. This is
505 // printed in an extra row and has a pagebreak at
507 if (layout->counter == "chapter") {
508 double spacing_val = 1.0;
509 if (!parparams.spacing().isDefault()) {
510 spacing_val = parparams.spacing().getValue();
512 spacing_val = buffer.params().spacing().getValue();
515 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
517 int const maxdesc = int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
518 + int(layout->parsep) * defaultRowHeight();
521 x = width_ - leftMargin() -
522 font_metrics::width(str, font);
525 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
528 x = width_ - leftMargin()
529 + font_metrics::width(layout->labelsep, font);
531 x = x_ - font_metrics::width(layout->labelsep, font)
532 - font_metrics::width(str, font);
535 pain_.text(int(x), yo_, str, font);
539 // the labels at the top of an environment.
540 // More or less for bibliography
542 (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
543 layout->labeltype == LABEL_BIBLIO ||
544 layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
545 LyXFont font = getLabelFont();
546 if (!par_.getLabelstring().empty()) {
547 string const str = par_.getLabelstring();
548 double spacing_val = 1.0;
549 if (!parparams.spacing().isDefault())
550 spacing_val = parparams.spacing().getValue();
552 spacing_val = buffer.params().spacing().getValue();
554 int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
557 int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
558 + (layout->labelbottomsep * defaultRowHeight()));
561 if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
564 x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
565 x -= font_metrics::width(str, font) / 2;
567 x = width_ - leftMargin() -
568 font_metrics::width(str, font);
570 pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
576 void RowPainter::paintLast()
578 bool const is_rtl = text_.isRTL(par_);
579 int const endlabel = getEndLabel(pit_, text_.paragraphs());
584 case END_LABEL_FILLED_BOX: {
585 LyXFont const font = getLabelFont();
586 int const size = int(0.75 * font_metrics::maxAscent(font));
587 int const y = yo_ - size;
588 int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
590 if (width_ - int(row_.width()) <= size)
591 x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);
593 if (endlabel == END_LABEL_BOX)
594 pain_.rectangle(x, y, size, size, LColor::eolmarker);
596 pain_.fillRectangle(x, y, size, size, LColor::eolmarker);
600 case END_LABEL_STATIC: {
601 LyXFont font = getLabelFont();
602 string const & str = par_.layout()->endlabelstring();
603 double const x = is_rtl ?
604 x_ - font_metrics::width(str, font)
605 : - text_.rightMargin(par_) - row_.width();
606 pain_.text(int(x), yo_, str, font);
610 case END_LABEL_NO_LABEL:
616 void RowPainter::paintText()
618 pos_type const end = row_.endpos();
619 pos_type body_pos = par_.beginOfBody();
621 (body_pos > end || !par_.isLineSeparator(body_pos - 1))) {
625 LyXLayout_ptr const & layout = par_.layout();
627 bool running_strikeout = false;
628 bool is_struckout = false;
629 int last_strikeout_x = 0;
631 // Use font span to speed things up, see below
635 for (pos_type vpos = row_.pos(); vpos < end; ) {
636 if (x_ > bv_.workWidth())
639 pos_type const pos = text_.bidi.vis2log(vpos);
641 if (pos >= par_.size()) {
646 // Use font span to speed things up, see above
647 if (vpos < font_span.first || vpos > font_span.last) {
648 font_span = par_.fontSpan(vpos);
649 font = text_.getFont(par_, vpos);
652 const int width_pos =
653 text_.singleWidth(par_, pos, par_.getChar(pos), font);
655 if (x_ + width_pos < 0) {
661 is_struckout = isDeletedText(par_, pos);
663 if (is_struckout && !running_strikeout) {
664 running_strikeout = true;
665 last_strikeout_x = int(x_);
668 bool const highly_editable_inset = par_.isInset(pos)
669 && isHighlyEditableInset(par_.getInset(pos));
671 // If we reach the end of a struck out range, paint it.
672 // We also don't paint across things like tables
673 if (running_strikeout && (highly_editable_inset || !is_struckout)) {
674 // Calculate 1/3 height of the buffer's default font
677 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
678 pain_.line(last_strikeout_x, middle, int(x_), middle,
679 LColor::strikeout, Painter::line_solid, Painter::line_thin);
680 running_strikeout = false;
683 if (body_pos > 0 && pos == body_pos - 1) {
684 int const lwidth = font_metrics::width(layout->labelsep,
687 x_ += label_hfill_ + lwidth - width_pos;
690 if (par_.isHfill(pos)) {
694 int const y1 = y0 - defaultRowHeight() / 2;
696 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
698 if (hfillExpansion(par_, row_, pos)) {
699 int const y2 = (y0 + y1) / 2;
701 if (pos >= body_pos) {
702 pain_.line(int(x_), y2, int(x_ + hfill_), y2,
704 Painter::line_onoffdash);
707 pain_.line(int(x_), y2, int(x_ + label_hfill_), y2,
709 Painter::line_onoffdash);
712 pain_.line(int(x_), y1, int(x_), y0, LColor::added_space);
716 } else if (par_.isSeparator(pos)) {
726 // if we reach the end of a struck out range, paint it
727 if (running_strikeout) {
728 // calculate 1/3 height of the buffer's default font
731 font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
732 pain_.line(last_strikeout_x, middle, int(x_), middle,
733 LColor::strikeout, Painter::line_solid, Painter::line_thin);
734 running_strikeout = false;
739 lyx::size_type calculateRowSignature(Row const & row, Paragraph const & par,
742 boost::crc_32_type crc;
743 for (lyx::pos_type i = row.pos(); i < row.endpos(); ++i) {
744 const unsigned char b[] = { par.getChar(i) };
745 crc.process_bytes(b, 1);
747 const unsigned char b[] = { x, y, row.width() };
748 crc.process_bytes(b, 3);
749 return crc.checksum();
753 bool CursorOnRow(PainterInfo & pi, pit_type const pit,
754 RowList::const_iterator rit, LyXText const & text)
756 // Is there a cursor on this row (or inside inset on row)
757 LCursor & cur = pi.base.bv->cursor();
758 for (lyx::size_type d = 0; d < cur.depth(); d++) {
759 CursorSlice const & sl = cur[d];
760 if (sl.text() == &text
762 && sl.pos() >= rit->pos()
763 && sl.pos() < rit->endpos())
770 bool innerCursorOnRow(PainterInfo & pi, pit_type pit,
771 RowList::const_iterator rit, LyXText const & text)
773 // Is there a cursor inside an inset on this row, and is this inset
774 // the only "character" on this row
775 LCursor & cur = pi.base.bv->cursor();
776 if (rit->pos() + 1 != rit->endpos())
778 for (lyx::size_type d = 0; d < cur.depth(); d++) {
779 CursorSlice const & sl = cur[d];
780 if (sl.text() == &text
782 && sl.pos() == rit->pos())
783 return d < cur.depth() - 1;
790 (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y,
793 // lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
794 static NullPainter nop;
795 static PainterInfo nullpi(pi.base.bv, nop);
796 int const ww = pi.base.bv->workHeight();
798 Paragraph const & par = text.paragraphs()[pit];
800 RowList::const_iterator const rb = par.rows().begin();
801 RowList::const_iterator const re = par.rows().end();
802 theCoords.parPos()[&text][pit] = Point(x, y);
805 lyx::size_type rowno(0);
806 for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
808 // Allow setting of bv->repaintAll() for nested insets in
810 bool tmp = pi.base.bv->repaintAll();
812 // Row signature; has row changed since last paint?
813 lyx::size_type const row_sig = calculateRowSignature(*rit, par, x, y);
814 bool row_has_changed = par.rowSignature()[rowno] != row_sig;
816 bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
817 bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
820 // If this is the only object on the row, we can make it wide
821 for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
823 = const_cast<InsetBase*>(par.getInset(i));
824 if (isTrueTextInset(in))
825 static_cast<InsetText*>(in)->Wide()
826 = in_inset_alone_on_row;
829 // If selection is on, the current row signature differs
830 // from cache, or cursor is inside an inset _on this row_,
831 // then paint the row
832 if (repaintAll || row_has_changed || cursor_on_row) {
833 // Add to row signature cache
834 par.rowSignature()[rowno] = row_sig;
836 bool const inside = (y + rit->descent() >= 0
837 && y - rit->ascent() < ww);
838 RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y);
839 // Clear background of this row
840 // (if paragraph background was not cleared)
842 (!in_inset_alone_on_row || row_has_changed)) {
843 pi.pain.fillRectangle(( rowno ? 0 : x - 10 ), y - rit->ascent(),
844 pi.base.bv->workWidth(), rit->height(),
845 text.backgroundColor());
846 // If outer row has changed, force nested
847 // insets to repaint completely
849 pi.base.bv->repaintAll(true);
852 // Instrumentation for testing row cache (see also
854 if (text.isMainText())
855 lyxerr[Debug::PAINTING] << "#";
857 lyxerr[Debug::PAINTING] << "[" <<
858 repaintAll << row_has_changed <<
859 cursor_on_row << "]";
870 // Restore, see above
871 pi.base.bv->repaintAll(tmp);
873 lyxerr[Debug::PAINTING] << "." << endl;
879 void paintText(BufferView const & bv, ViewMetricsInfo const & vi)
881 Painter & pain = bv.painter();
882 LyXText * const text = bv.text();
883 bool const select = bv.cursor().selection();
885 PainterInfo pi(const_cast<BufferView *>(&bv), pain);
886 // Should the whole screen, including insets, be refreshed?
887 bool repaintAll(select || !vi.singlepar);
890 // Clear background (if not delegated to rows)
891 pain.fillRectangle(0, vi.y1, bv.workWidth(), vi.y2 - vi.y1,
892 text->backgroundColor());
895 text->drawSelection(pi, 0, 0);
900 for (pit_type pit = vi.p1; pit <= vi.p2; ++pit) {
901 bv.repaintAll(repaintAll);
902 Paragraph const & par = text->getPar(pit);
904 paintPar(pi, *bv.text(), pit, 0, yy, repaintAll);
908 // Cache one paragraph above and one below
909 // Note MV: this cannot be suppressed even for singlepar.
910 // Try viewing the User Guide Mobius figure
913 text->redoParagraph(vi.p1 - 1);
914 theCoords.parPos()[bv.text()][vi.p1 - 1] =
915 Point(0, vi.y1 - text->getPar(vi.p1 - 1).descent());
918 if (vi.p2 < lyx::pit_type(text->paragraphs().size()) - 1) {
919 text->redoParagraph(vi.p2 + 1);
920 theCoords.parPos()[bv.text()][vi.p2 + 1] =
921 Point(0, vi.y2 + text->getPar(vi.p2 + 1).ascent());
924 // and grey out above (should not happen later)
925 // lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
926 if (vi.y1 > 0 && !vi.singlepar)
927 pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
929 // and possibly grey out below
930 // lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
931 if (vi.y2 < bv.workHeight() && !vi.singlepar)
932 pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
936 void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y)
938 // lyxerr << " paintTextInset: y: " << y << endl;
940 y -= text.getPar(0).ascent();
941 // This flag can not be set from within same inset:
942 bool repaintAll = pi.base.bv->repaintAll();
943 for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
944 y += text.getPar(pit).ascent();
945 paintPar(pi, text, pit, x, y, repaintAll);
946 y += text.getPar(pit).descent();