}
-// Returns the paragraph position of the last character in the specified row
-pos_type LyXText::rowLast(Row const * row) const
-{
- if (!row->par()->size())
- return 0;
-
- if (!row->next() || row->next()->par() != row->par()) {
- return row->par()->size() - 1;
- } else {
- return row->next()->pos() - 1;
- }
-}
-
-
-pos_type LyXText::rowLastPrintable(Row const * row) const
-{
- pos_type const last = rowLast(row);
- bool ignore_the_space_on_the_last_position = true;
- Inset * ins;
- // we have to consider a space on the last position in this case!
- if (row->next() && row->par() == row->next()->par() &&
- row->next()->par()->getChar(last + 1) == Paragraph::META_INSET &&
- (ins=row->next()->par()->getInset(last + 1)) &&
- (ins->needFullRow() || ins->display()))
- {
- ignore_the_space_on_the_last_position = false;
- }
- if (last >= row->pos()
- && row->next()
- && row->next()->par() == row->par()
- && row->par()->isSeparator(last)
- && ignore_the_space_on_the_last_position)
- return last - 1;
- else
- return last;
-}
-
-
void LyXText::computeBidiTables(Buffer const * buf, Row * row) const
{
bidi_same_direction = true;
}
bidi_start = row->pos();
- bidi_end = rowLastPrintable(row);
+ bidi_end = row->lastPrintablePos();
if (bidi_start > bidi_end) {
bidi_start = -1;
int level = 0;
bool rtl = false;
bool rtl0 = false;
- pos_type const main_body = beginningOfMainBody(buf, row->par());
+ pos_type const main_body = row->par()->beginningOfMainBody();
for (pos_type lpos = bidi_start; lpos <= bidi_end; ++lpos) {
bool is_space = row->par()->isLineSeparator(lpos);
bool hebrew, bool arabic)
{
pos_type pos = vis2log(vpos);
- pos_type const last = rowLastPrintable(p.row);
+ pos_type const last = p.row->lastPrintablePos();
LyXFont orig_font(getFont(p.bv->buffer(), p.row->par(), pos));
// first character
break;
case MARGIN_MANUAL:
x += font_metrics::signedWidth(layout->labelindent, labelfont);
- if (row->pos() >= beginningOfMainBody(bview->buffer(), row->par())) {
+ if (row->pos() >= row->par()->beginningOfMainBody()) {
if (!row->par()->getLabelWidthString().empty()) {
x += font_metrics::width(row->par()->getLabelWidthString(),
labelfont);
break;
case MARGIN_FIRST_DYNAMIC:
if (layout->labeltype == LABEL_MANUAL) {
- if (row->pos() >= beginningOfMainBody(bview->buffer(), row->par())) {
+ if (row->pos() >= row->par()->beginningOfMainBody()) {
x += font_metrics::signedWidth(layout->leftmargin,
labelfont);
} else {
pos_type last_separator = -1;
width -= rightMargin(bview->buffer(), row);
- pos_type const main_body =
- beginningOfMainBody(bview->buffer(), par);
+ pos_type const main_body = par->beginningOfMainBody();
LyXLayout_ptr const & layout = par->layout();
pos_type i = pos;
if (in->display() &&
(layout->isCommand() ||
(layout->labeltype == LABEL_MANUAL
- && i < beginningOfMainBody(bview->buffer(), par))))
+ && i < par->beginningOfMainBody())))
{
// display istn't allowd
in->display(false);
int w;
// get the pure distance
- pos_type const last = rowLastPrintable(row);
+ pos_type const last = row->lastPrintablePos();
// special handling of the right address boxes
if (row->par()->layout()->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
LyXLayout_ptr const & layout = row->par()->layout();
- pos_type const main_body =
- beginningOfMainBody(bview->buffer(), row->par());
+ pos_type const main_body = row->par()->beginningOfMainBody();
pos_type i = row->pos();
while (i <= last) {
// returns the minimum space a manual label needs on the screen in pixel
int LyXText::labelFill(BufferView * bview, Row const * row) const
{
- pos_type last = beginningOfMainBody(bview->buffer(), row->par()) - 1;
+ pos_type last = row->par()->beginningOfMainBody() - 1;
// -1 because a label ends either with a space that is in the label,
// or with the beginning of a footnote that is outside the label.
}
-// returns the number of separators in the specified row. The separator
-// on the very last column doesnt count
-int LyXText::numberOfSeparators(Buffer const * buf, Row const * row) const
-{
- pos_type last = rowLastPrintable(row);
- pos_type p = max(row->pos(), beginningOfMainBody(buf, row->par()));
-
- int n = 0;
- for (; p <= last; ++p) {
- if (row->par()->isSeparator(p)) {
- ++n;
- }
- }
- return n;
-}
-
-
-// returns the number of hfills in the specified row. The LyX-Hfill is
-// a LaTeX \hfill so that the hfills at the beginning and at the end were
-// ignored. This is *MUCH* more usefull than not to ignore!
-int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const
-{
- pos_type const last = rowLast(row);
- pos_type first = row->pos();
-
- if (first) {
- // hfill *DO* count at the beginning of paragraphs!
- while (first <= last && row->par()->isHfill(first)) {
- ++first;
- }
- }
-
- first = max(first, beginningOfMainBody(buf, row->par()));
- int n = 0;
- for (pos_type p = first; p <= last; ++p) {
- // last, because the end is ignored!
-
- if (row->par()->isHfill(p)) {
- ++n;
- }
- }
- return n;
-}
-
-
-// like NumberOfHfills, but only those in the manual label!
-int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const
-{
- pos_type last = rowLast(row);
- pos_type first = row->pos();
- if (first) {
- // hfill *DO* count at the beginning of paragraphs!
- while (first < last && row->par()->isHfill(first))
- ++first;
- }
-
- last = min(last, beginningOfMainBody(buf, row->par()));
- int n = 0;
- for (pos_type p = first; p < last; ++p) {
- // last, because the end is ignored!
- if (row->par()->isHfill(p)) {
- ++n;
- }
- }
- return n;
-}
-
-
-// returns true, if a expansion is needed.
-// Rules are given by LaTeX
-bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
- pos_type pos) const
-{
- // by the way, is it a hfill?
- if (!row_ptr->par()->isHfill(pos))
- return false;
-
- // at the end of a row it does not count
- // unless another hfill exists on the line
- if (pos >= rowLast(row_ptr)) {
- pos_type i = row_ptr->pos();
- while (i < pos && !row_ptr->par()->isHfill(i)) {
- ++i;
- }
- if (i == pos) {
- return false;
- }
- }
-
- // at the beginning of a row it does not count, if it is not
- // the first row of a paragaph
- if (!row_ptr->pos())
- return true;
-
- // in some labels it does not count
- if (row_ptr->par()->layout()->margintype != MARGIN_MANUAL
- && pos < beginningOfMainBody(buf, row_ptr->par()))
- return false;
-
- // if there is anything between the first char of the row and
- // the sepcified position that is not a newline and not a hfill,
- // the hfill will count, otherwise not
- pos_type i = row_ptr->pos();
- while (i < pos && (row_ptr->par()->isNewline(i)
- || row_ptr->par()->isHfill(i)))
- ++i;
-
- return i != pos;
-}
-
-
LColor::color LyXText::backgroundColor()
{
if (inset_owner)
return LColor::background;
}
-void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
+void LyXText::setHeightOfRow(BufferView * bview, Row * row) const
{
// get the maximum ascent and the maximum descent
int asc = 0;
// Correction: only the fontsize count. The other properties
// are taken from the layoutfont. Nicer on the screen :)
- Paragraph * par = row_ptr->par();
- Paragraph * firstpar = row_ptr->par();
+ Paragraph * par = row->par();
+ Paragraph * firstpar = row->par();
LyXLayout_ptr const & layout = firstpar->layout();
// as max get the first character of this row then it can increase but not
// decrease the height. Just some point to start with so we don't have to
// do the assignment below too often.
- LyXFont font = getFont(bview->buffer(), par, row_ptr->pos());
+ LyXFont font = getFont(bview->buffer(), par, row->pos());
LyXFont::FONT_SIZE const tmpsize = font.size();
font = getLayoutFont(bview->buffer(), par);
LyXFont::FONT_SIZE const size = font.size();
LyXFont labelfont = getLabelFont(bview->buffer(), par);
float spacing_val = 1.0;
- if (!row_ptr->par()->params().spacing().isDefault()) {
- spacing_val = row_ptr->par()->params().spacing().getValue();
+ if (!row->par()->params().spacing().isDefault()) {
+ spacing_val = row->par()->params().spacing().getValue();
} else {
spacing_val = bview->buffer()->params.spacing.getValue();
}
layout->spacing.getValue() *
spacing_val);
- pos_type const pos_end = rowLast(row_ptr);
+ pos_type const pos_end = row->lastPos();
int labeladdon = 0;
int maxwidth = 0;
// Check if any insets are larger
- for (pos_type pos = row_ptr->pos(); pos <= pos_end; ++pos) {
- if (row_ptr->par()->isInset(pos)) {
- tmpfont = getFont(bview->buffer(), row_ptr->par(), pos);
- tmpinset = row_ptr->par()->getInset(pos);
+ for (pos_type pos = row->pos(); pos <= pos_end; ++pos) {
+ if (row->par()->isInset(pos)) {
+ tmpfont = getFont(bview->buffer(), row->par(), pos);
+ tmpinset = row->par()->getInset(pos);
if (tmpinset) {
#if 1 // this is needed for deep update on initialitation
tmpinset->update(bview, tmpfont);
maxdesc = max(maxdesc, desc);
}
} else {
- maxwidth += singleWidth(bview, row_ptr->par(), pos);
+ maxwidth += singleWidth(bview, row->par(), pos);
}
}
// This is not completely correct, but we can live with the small,
// cosmetic error for now.
LyXFont::FONT_SIZE maxsize =
- row_ptr->par()->highestFontInRange(row_ptr->pos(), pos_end, size);
+ row->par()->highestFontInRange(row->pos(), pos_end, size);
if (maxsize > font.size()) {
font.setSize(maxsize);
++maxasc;
++maxdesc;
- row_ptr->ascent_of_text(maxasc);
+ row->ascent_of_text(maxasc);
// is it a top line?
- if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
+ if (!row->pos() && (row->par() == firstpar)) {
// some parksips VERY EASY IMPLEMENTATION
if (bview->buffer()->params.paragraph_separation ==
}
}
- // the paper margins
- if (!row_ptr->par()->previous() && bv_owner)
+ // the top margin
+ if (!row->par()->previous() && isTopLevel())
maxasc += PAPER_MARGIN;
// add the vertical spaces, that the user added
firstpar, 0));
// and now the pagebreaks
if (firstpar->params().pagebreakTop())
- maxasc += 3 * defaultHeight();
+ maxasc += 3 * defaultRowHeight();
// This is special code for the chapter, since the label of this
// layout is printed in an extra row
&& bview->buffer()->params.secnumdepth >= 0)
{
float spacing_val = 1.0;
- if (!row_ptr->par()->params().spacing().isDefault()) {
- spacing_val = row_ptr->par()->params().spacing().getValue();
+ if (!row->par()->params().spacing().isDefault()) {
+ spacing_val = row->par()->params().spacing().getValue();
} else {
spacing_val = bview->buffer()->params.spacing.getValue();
}
if ((layout->labeltype == LABEL_TOP_ENVIRONMENT
|| layout->labeltype == LABEL_BIBLIO
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
- && row_ptr->par()->isFirstInSequence()
- && !row_ptr->par()->getLabelstring().empty())
+ && row->par()->isFirstInSequence()
+ && !row->par()->getLabelstring().empty())
{
float spacing_val = 1.0;
- if (!row_ptr->par()->params().spacing().isDefault()) {
- spacing_val = row_ptr->par()->params().spacing().getValue();
+ if (!row->par()->params().spacing().isDefault()) {
+ spacing_val = row->par()->params().spacing().getValue();
} else {
spacing_val = bview->buffer()->params.spacing.getValue();
}
+(font_metrics::maxDescent(labelfont) *
layout->spacing.getValue() *
spacing_val)
- + layout->topsep * defaultHeight()
- + layout->labelbottomsep * defaultHeight());
+ + layout->topsep * defaultRowHeight()
+ + layout->labelbottomsep * defaultRowHeight());
}
// and now the layout spaces, for example before and after a section,
// or between the items of a itemize or enumerate environment
if (!firstpar->params().pagebreakTop()) {
- Paragraph * prev = row_ptr->par()->previous();
+ Paragraph * prev = row->par()->previous();
if (prev)
- prev = row_ptr->par()->depthHook(row_ptr->par()->getDepth());
+ prev = row->par()->depthHook(row->par()->getDepth());
if (prev && prev->layout() == firstpar->layout() &&
prev->getDepth() == firstpar->getDepth() &&
prev->getLabelWidthString() == firstpar->getLabelWidthString())
{
- layoutasc = (layout->itemsep * defaultHeight());
- } else if (row_ptr->previous()) {
+ layoutasc = (layout->itemsep * defaultRowHeight());
+ } else if (row->previous()) {
tmptop = layout->topsep;
- if (row_ptr->previous()->par()->getDepth() >= row_ptr->par()->getDepth())
- tmptop -= row_ptr->previous()->par()->layout()->bottomsep;
+ if (row->previous()->par()->getDepth() >= row->par()->getDepth())
+ tmptop -= row->previous()->par()->layout()->bottomsep;
if (tmptop > 0)
- layoutasc = (tmptop * defaultHeight());
- } else if (row_ptr->par()->params().lineTop()) {
+ layoutasc = (tmptop * defaultRowHeight());
+ } else if (row->par()->params().lineTop()) {
tmptop = layout->topsep;
if (tmptop > 0)
- layoutasc = (tmptop * defaultHeight());
+ layoutasc = (tmptop * defaultRowHeight());
}
- prev = row_ptr->par()->outerHook();
+ prev = row->par()->outerHook();
if (prev) {
- maxasc += int(prev->layout()->parsep * defaultHeight());
+ maxasc += int(prev->layout()->parsep * defaultRowHeight());
} else {
if (firstpar->previous() &&
firstpar->previous()->getDepth() == 0 &&
{
// avoid parsep
} else if (firstpar->previous()) {
- maxasc += int(layout->parsep * defaultHeight());
+ maxasc += int(layout->parsep * defaultRowHeight());
}
}
}
}
// is it a bottom line?
- if (row_ptr->par() == par
- && (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par()))
+ if (row->par() == par
+ && (!row->next() || row->next()->par() != row->par()))
{
- // the paper margins
- if (!par->next() && bv_owner)
+ // the bottom margin
+ if (!par->next() && isTopLevel())
maxdesc += PAPER_MARGIN;
// add the vertical spaces, that the user added
// and now the pagebreaks
if (firstpar->params().pagebreakBottom())
- maxdesc += 3 * defaultHeight();
+ maxdesc += 3 * defaultRowHeight();
// and now the layout spaces, for example before and after
// a section, or between the items of a itemize or enumerate
// environment
if (!firstpar->params().pagebreakBottom()
- && row_ptr->par()->next()) {
- Paragraph * nextpar = row_ptr->par()->next();
- Paragraph * comparepar = row_ptr->par();
+ && row->par()->next()) {
+ Paragraph * nextpar = row->par()->next();
+ Paragraph * comparepar = row->par();
float usual = 0;
float unusual = 0;
if (comparepar->getDepth() > nextpar->getDepth()) {
- usual = (comparepar->layout()->bottomsep * defaultHeight());
+ usual = (comparepar->layout()->bottomsep * defaultRowHeight());
comparepar = comparepar->depthHook(nextpar->getDepth());
if (comparepar->layout()!= nextpar->layout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
{
- unusual = (comparepar->layout()->bottomsep * defaultHeight());
+ unusual = (comparepar->layout()->bottomsep * defaultRowHeight());
}
if (unusual > usual)
layoutdesc = unusual;
if (comparepar->layout() != nextpar->layout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
- layoutdesc = int(comparepar->layout()->bottomsep * defaultHeight());
+ layoutdesc = int(comparepar->layout()->bottomsep * defaultRowHeight());
}
}
}
maxdesc += int(layoutdesc * 2 / (2 + firstpar->getDepth()));
// calculate the new height of the text
- height -= row_ptr->height();
+ height -= row->height();
- row_ptr->height(maxasc + maxdesc + labeladdon);
- row_ptr->baseline(maxasc + labeladdon);
+ row->height(maxasc + maxdesc + labeladdon);
+ row->baseline(maxasc + labeladdon);
- height += row_ptr->height();
+ height += row->height();
- row_ptr->top_of_text(row_ptr->baseline() - font_metrics::maxAscent(font));
+ row->top_of_text(row->baseline() - font_metrics::maxAscent(font));
float x = 0;
if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) {
float dummy;
// this IS needed
- row_ptr->width(maxwidth);
- prepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false);
+ row->width(maxwidth);
+ prepareToPrint(bview, row, x, dummy, dummy, dummy, false);
}
- row_ptr->width(int(maxwidth + x));
+ row->width(int(maxwidth + x));
if (inset_owner) {
Row * r = firstrow;
width = max(0,workWidth(bview));
return;
}
} else if (IsNewlineChar(c)) {
- if (cursor.pos() <= beginningOfMainBody(bview->buffer(),
- cursor.par()))
- {
+ if (cursor.pos() <= cursor.par()->beginningOfMainBody()) {
charInserted();
return;
}
status(bview, LyXText::NEED_MORE_REFRESH);
breakAgainOneRow(bview, row);
// will the cursor be in another row now?
- if (rowLast(row) <= cursor.pos() + 1 && row->next()) {
+ if (row->lastPos() <= cursor.pos() + 1 && row->next()) {
if (row->next() && row->next()->par() == row->par())
// this should always be true
row = row->next();
if (layout->margintype == MARGIN_MANUAL
&& layout->labeltype == LABEL_MANUAL) {
// one more since labels are left aligned
- nlh = numberOfLabelHfills(bview->buffer(), row) + 1;
+ nlh = row->numberOfLabelHfills() + 1;
if (nlh && !row->par()->getLabelWidthString().empty()) {
fill_label_hfill = labelFill(bview, row) / nlh;
}
}
// are there any hfills in the row?
- float const nh = numberOfHfills(bview->buffer(), row);
+ float const nh = row->numberOfHfills();
if (nh) {
if (w > 0)
switch (align) {
case LYX_ALIGN_BLOCK:
- ns = numberOfSeparators(bview->buffer(), row);
+ ns = row->numberOfSeparators();
if (ns && row->next() && row->next()->par() == row->par() &&
!(row->next()->par()->isNewline(row->next()->pos() - 1))
&& !(row->next()->par()->isInset(row->next()->pos())
computeBidiTables(bview->buffer(), row);
if (is_rtl) {
- pos_type main_body =
- beginningOfMainBody(bview->buffer(), row->par());
- pos_type last = rowLast(row);
+ pos_type main_body = row->par()->beginningOfMainBody();
+ pos_type last = row->lastPos();
if (main_body > 0 &&
(main_body - 1 > last ||
pos_type z;
// remember that a space at the end of a row doesnt count
// when calculating the fill
- if (cursor.pos() < rowLast(row) ||
+ if (cursor.pos() < row->lastPos() ||
!cursor.par()->isLineSeparator(cursor.pos())) {
row->fill(row->fill() + singleWidth(bview,
cursor.par(),
// delete newlines at the beginning of paragraphs
while (!cursor.par()->empty() &&
cursor.par()->isNewline(cursor.pos()) &&
- cursor.pos() == beginningOfMainBody(bview->buffer(),
- cursor.par())) {
+ cursor.pos() == cursor.par()->beginningOfMainBody()) {
cursor.par()->erase(cursor.pos());
// refresh the positions
tmprow = row;
// break the cursor row again
if (row->next() && row->next()->par() == row->par() &&
- (rowLast(row) == row->par()->size() - 1 ||
- nextBreakPoint(bview, row, workWidth(bview)) != rowLast(row))) {
+ (row->lastPos() == row->par()->size() - 1 ||
+ nextBreakPoint(bview, row, workWidth(bview)) != row->lastPos())) {
// it can happen that a paragraph loses one row
// without a real breakup. This is when a word
// is to long to be broken. Well, I don t care this
// hack ;-)
- if (rowLast(row) == row->par()->size() - 1)
+ if (row->lastPos() == row->par()->size() - 1)
removeRow(row->next());
refresh_y = y;
breakAgainOneRow(bview, row);
// will the cursor be in another row now?
if (row->next() && row->next()->par() == row->par() &&
- rowLast(row) <= cursor.pos()) {
+ row->lastPos() <= cursor.pos()) {
row = row->next();
breakAgainOneRow(bview, row);
}
Inset * inset = 0;
LyXFont font(LyXFont::ALL_SANE);
- pos_type const last = rowLastPrintable(p.row);
+ pos_type const last = p.row->lastPrintablePos();
if (!p.bv->screen().forceClear() && last == p.row->pos()
&& p.row->par()->isInset(p.row->pos())) {
Buffer const * buffer = p.bv->buffer();
Paragraph * par = row->par();
- pos_type main_body = beginningOfMainBody(buffer, par);
- pos_type const last = rowLastPrintable(row);
+ pos_type const main_body = par->beginningOfMainBody();
+ pos_type const last = row->lastPrintablePos();
float tmpx = p.x;
for (pos_type vpos = row->pos(); vpos <= last; ++vpos) {
tmpx -= singleWidth(p.bv, par, main_body - 1);
}
- if (hfillExpansion(buffer, row, pos)) {
+ if (row->hfillExpansion(pos)) {
tmpx += singleWidth(p.bv, par, pos);
if (pos >= main_body)
tmpx += p.hfill;
void LyXText::paintChangeBar(DrawRowParams & p)
{
pos_type const start = p.row->pos();
- pos_type const end = rowLastPrintable(p.row);
+ pos_type const end = p.row->lastPrintablePos();
if (!p.row->par()->isChanged(start, end))
return;
p.pain->line(text_end, y, p.xo + p.width, y,
LColor::pagebreak, Painter::line_onoffdash);
- return 3 * defaultHeight();
+ return 3 * defaultRowHeight();
}
int y_top = 0;
- // think about the margins
- if (!p.row->previous() && bv_owner)
+ // the top margin
+ if (!p.row->previous() && isTopLevel())
y_top += PAPER_MARGIN;
// draw a top pagebreak
if (parparams.pagebreakTop()) {
y_top += paintPageBreak(_("Page Break (top)"),
- p.yo + y_top + 2 * defaultHeight(), p);
+ p.yo + y_top + 2 * defaultRowHeight(), p);
}
// draw the additional space if needed:
int const maxdesc =
int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
- + int(layout->parsep) * defaultHeight();
+ + int(layout->parsep) * defaultRowHeight();
if (is_rtl) {
x = ww - leftMargin(p.bv, p.row) -
int maxdesc =
int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
- + (layout->labelbottomsep * defaultHeight()));
+ + (layout->labelbottomsep * defaultRowHeight()));
float x = p.x;
if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
ParagraphParameters const & parparams = par->params();
int y_bottom = p.row->height() - 1;
- // think about the margins
- if (!p.row->next() && bv_owner)
+ // the bottom margin
+ if (!p.row->next() && isTopLevel())
y_bottom -= PAPER_MARGIN;
int const ww = p.bv->workWidth();
// draw a bottom pagebreak
if (parparams.pagebreakBottom()) {
y_bottom -= paintPageBreak(_("Page Break (bottom)"),
- p.yo + y_bottom - 2 * defaultHeight(), p);
+ p.yo + y_bottom - 2 * defaultRowHeight(), p);
}
// draw the additional space if needed:
Paragraph * par = p.row->par();
Buffer const * buffer = p.bv->buffer();
- pos_type const last = rowLastPrintable(p.row);
- pos_type main_body =
- beginningOfMainBody(buffer, par);
+ pos_type const last = p.row->lastPrintablePos();
+ pos_type main_body = par->beginningOfMainBody();
if (main_body > 0 &&
(main_body - 1 > last ||
!par->isLineSeparator(main_body - 1))) {
p.x += 1;
int const y0 = p.yo + p.row->baseline();
- int const y1 = y0 - defaultHeight() / 2;
+ int const y1 = y0 - defaultRowHeight() / 2;
p.pain->line(int(p.x), y1, int(p.x), y0,
LColor::added_space);
- if (hfillExpansion(buffer, p.row, pos)) {
+ if (p.row->hfillExpansion(pos)) {
int const y2 = (y0 + y1) / 2;
if (pos >= main_body) {
}
-int LyXText::defaultHeight() const
-{
- LyXFont font(LyXFont::ALL_SANE);
- return int(font_metrics::maxAscent(font)
- + font_metrics::maxDescent(font) * 1.5);
-}
-
-
// returns the column near the specified x-coordinate of the row
// x is set to the real beginning of this column
pos_type
fill_hfill, fill_label_hfill);
pos_type vc = row->pos();
- pos_type last = rowLastPrintable(row);
+ pos_type last = row->lastPrintablePos();
pos_type c = 0;
LyXLayout_ptr const & layout = row->par()->layout();
bool left_side = false;
- pos_type main_body = beginningOfMainBody(bview->buffer(), row->par());
+ pos_type main_body = row->par()->beginningOfMainBody();
float last_tmpx = tmpx;
if (main_body > 0 &&
tmpx -= singleWidth(bview, row->par(), main_body-1);
}
- if (hfillExpansion(bview->buffer(), row, c)) {
+ if (row->hfillExpansion(c)) {
tmpx += singleWidth(bview, row->par(), c);
if (c >= main_body)
tmpx += fill_hfill;
else
tmpx += fill_label_hfill;
- }
- else if (row->par()->isSeparator(c)) {
+ } else if (row->par()->isSeparator(c)) {
tmpx += singleWidth(bview, row->par(), c);
if (c >= main_body)
tmpx+= fill_separator;
- } else
+ } else {
tmpx += singleWidth(bview, row->par(), c);
+ }
++vc;
}