- int y_bottom = row_ptr->height();
-
- // is it a first row?
- if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
-
- // start of appendix?
- if (row_ptr->par()->params().startOfAppendix()) {
- pain.line(1, y_offset,
- ww - 2, y_offset,
- LColor::appendixline);
- }
-
- // think about the margins
- if (!row_ptr->previous() && bv_owner)
- y_top += LYX_PAPER_MARGIN;
-
- // draw a top pagebreak
- if (row_ptr->par()->params().pagebreakTop()) {
- LyXFont pb_font;
- pb_font.setColor(LColor::pagebreak).decSize();
- int w = 0;
- int a = 0;
- int d = 0;
- pain.line(0, y_offset + y_top + 2*defaultHeight(),
- ww,
- y_offset + y_top + 2 * defaultHeight(),
- LColor::pagebreak,
- Painter::line_onoffdash);
- lyxfont::rectText(_("Page Break (top)"), pb_font,
- w, a, d);
- pain.rectText((ww - w)/2,
- y_offset + y_top + 2 * defaultHeight() + d,
- _("Page Break (top)"),
- pb_font,
- backgroundColor(),
- backgroundColor());
- y_top += 3 * defaultHeight();
- }
-
- if (row_ptr->par()->params().spaceTop().kind() == VSpace::VFILL) {
- // draw a vfill top
- pain.line(0, y_offset + 2 + y_top,
- LYX_PAPER_MARGIN, y_offset + 2 + y_top,
- LColor::vfillline);
-
- pain.line(0, y_offset + y_top + 3 * defaultHeight(),
- LYX_PAPER_MARGIN,
- y_offset + y_top + 3 * defaultHeight(),
- LColor::vfillline);
-
- pain.line(LYX_PAPER_MARGIN / 2, y_offset + 2 + y_top,
- LYX_PAPER_MARGIN / 2,
- y_offset + y_top + 3 * defaultHeight(),
- LColor::vfillline);
-
- y_top += 3 * defaultHeight();
- }
-
- // think about user added space
- y_top += int(row_ptr->par()->params().spaceTop().inPixels(bview));
-
- // think about the parskip
- // some parskips VERY EASY IMPLEMENTATION
- if (bview->buffer()->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
- if (layout.latextype == LATEX_PARAGRAPH
- && firstpar->getDepth() == 0
- && firstpar->previous())
- y_top += bview->buffer()->params.getDefSkip().inPixels(bview);
- else if (firstpar->previous()
- && textclasslist.Style(bview->buffer()->params.textclass,
- firstpar->previous()->getLayout()).latextype == LATEX_PARAGRAPH
- && firstpar->previous()->getDepth() == 0)
- // is it right to use defskip here, too? (AS)
- y_top += bview->buffer()->params.getDefSkip().inPixels(bview);
- }
-
- if (row_ptr->par()->params().lineTop()) {
- // draw a top line
- y_top += lyxfont::ascent('x',
- getFont(bview->buffer(),
- row_ptr->par(), 0));
- int const w = (inset_owner ?
- inset_owner->width(bview, font) : ww);
- int const xp = static_cast<int>(inset_owner ? x : 0);
- pain.line(xp, y_offset + y_top,
- w, y_offset + y_top,
- LColor::topline,
- Painter::line_solid,
- Painter::line_thick);
-
- y_top += lyxfont::ascent('x',getFont(bview->buffer(),
- row_ptr->par(), 0));
- }
-
- // should we print a label?
- if (layout.labeltype >= LABEL_STATIC
- && (layout.labeltype != LABEL_STATIC
- || layout.latextype != LATEX_ENVIRONMENT
- || row_ptr->par()->isFirstInSequence())) {
- font = getLabelFont(bview->buffer(), row_ptr->par());
- if (!row_ptr->par()->getLabelstring().empty()) {
- tmpx = x;
- string const tmpstring =
- row_ptr->par()->getLabelstring();
-
- if (layout.labeltype == LABEL_COUNTER_CHAPTER) {
- if (bview->buffer()->params.secnumdepth >= 0) {
- // this is special code for
- // the chapter layout. This is
- // printed in an extra row
- // and has a pagebreak at
- // the top.
- float spacing_val = 1.0;
- if (!row_ptr->par()->params().spacing().isDefault()) {
- spacing_val = row_ptr->par()->params().spacing().getValue();
- } else {
- spacing_val = bview->buffer()->params.spacing.getValue();
- }
-
- maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val)
- + int(layout.parsep) * defaultHeight();
- if (is_rtl)
- tmpx = ww - leftMargin(bview, row_ptr) -
- lyxfont::width(tmpstring, font);
- pain.text(int(tmpx),
- y_offset + row_ptr->baseline() - row_ptr->ascent_of_text() - maxdesc,
- tmpstring, font);
- }
- } else {
- if (is_rtl) {
- tmpx = ww - leftMargin(bview, row_ptr)
- + lyxfont::width(layout.labelsep, font);
- } else
- tmpx = x - lyxfont::width(layout.labelsep, font)
- - lyxfont::width(tmpstring, font);