}
-int TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const
+LyXAlignment TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const
{
Layout const & layout = par.layout();
- int align;
+ LyXAlignment align;
if (par.params().align() == LYX_ALIGN_LAYOUT)
align = layout.align;
else
/** If we have separators, and this row has
* not be broken abruptly by a display inset
* or newline, then stretch it */
- if (ns && !row.right_boundary()
+ if (ns && !row.right_boundary()
&& row.endpos() != par.size()) {
setSeparatorWidth(row, w / ns);
row.dimension().wid = width;
row.x += w;
break;
case LYX_ALIGN_CENTER:
- row.dimension().wid = width - w / 2;
+ row.dimension().wid = width - int(w / 2);
row.x += w / 2;
break;
+ case LYX_ALIGN_LEFT:
+ case LYX_ALIGN_NONE:
+ case LYX_ALIGN_LAYOUT:
+ case LYX_ALIGN_SPECIAL:
+ case LYX_ALIGN_DECIMAL:
+ break;
}
}
for ( ; cit != cend; ++cit) {
if (row.label_hfill && cit->endpos == body_pos
&& cit->type == Row::SPACE)
- cit->dim.wid -= row.label_hfill * (nlh - 1);
+ cit->dim.wid -= int(row.label_hfill * (nlh - 1));
if (!cit->inset || !cit->inset->isHfill())
continue;
if (pm.hfillExpansion(row, cit->pos))
Paragraph const & par = text_->getPar(pit);
LBUFERR(par.beginOfBody() > 0 || par.isEnvSeparator(0));
- int w = 0;
+ double w = 0;
Row::const_iterator cit = row.begin();
Row::const_iterator const end = row.end();
// iterate over elements before main body (except the last one,
FontMetrics const & fm
= theFontMetrics(text_->labelFont(par));
- return max(0, fm.width(label) - w);
+ return max(0, fm.width(label) - int(w));
}
pos_type pos = row.pos();
boundary = false;
if (row.empty())
- x = row.x;
+ x = int(row.x);
else if (x <= row.x) {
pos = row.front().left_pos();
- x = row.x;
+ x = int(row.x);
} else if (x >= row.width() - row.right_margin) {
pos = row.back().right_pos();
x = row.width() - row.right_margin;
if (w <= x && w + cit->width() > x) {
double x_offset = x - w;
pos = cit->x2pos(x_offset);
- x = x_offset + w;
+ x = int(x_offset + w);
break;
}
w += cit->width();
}
/** This tests for the case where the cursor is set at the end
- * of a row which has been broken due to a display inset on
- * next row. This is indicated by Row::right_boundary.
+ * of a row which has been broken due something else than a
+ * separator (a display inset or a forced breaking of the
+ * row). We know that there is a separator when the end of the
+ * row is larger than the end of its last element.
*/
if (!row.empty() && pos == row.back().endpos
&& row.back().endpos == row.endpos())
- boundary = row.right_boundary();
+ boundary = true;
x += xo;
return pos;