+2004-08-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * metricsinfo.h: add a new field ltr_pos to PainterInfo
+
+ * rowpainter.C (paintInset): initialize PainterInfo::ltr_pos
+
+ * text.C (singleWidth): remove useless test
+
2004-08-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* tabular.h: remove bogus comments
+2004-08-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * insetnewline.C (draw): use PainterInfo::ltr_pos instead of ownerPar.
2004-08-14 André Pönitz <poenitz@gmx.net>
int const wid = font_metrics::width('n', pi.base.font);
int const asc = font_metrics::maxAscent(pi.base.font);
- // hack, and highly dubious
- lyx::pos_type pos = ownerPar(*pi.base.bv->buffer(), this)
- .getPositionOfInset(this);
- bool const ltr_pos = (pi.base.bv->text()->bidi.level(pos) % 2 == 0);
-
int xp[3];
int yp[3];
yp[1] = int(y - 0.500 * asc * 0.75);
yp[2] = int(y - 0.125 * asc * 0.75);
- if (ltr_pos) {
+ if (pi.ltr_pos) {
xp[0] = int(x + wid * 0.375);
xp[1] = int(x);
xp[2] = int(x + wid * 0.375);
yp[1] = int(y - 0.500 * asc * 0.75);
yp[2] = int(y - asc * 0.75);
- if (ltr_pos) {
+ if (pi.ltr_pos) {
xp[0] = int(x);
xp[1] = int(x + wid);
xp[2] = int(x + wid);
PainterInfo::PainterInfo(BufferView * bv, Painter & painter)
- : pain(painter)
+ : pain(painter), ltr_pos(false)
{
base.bv = bv;
}
MetricsBase base;
///
Painter & pain;
+ /// Whether the text at this point is right-to-left (for InsetNewline)
+ bool ltr_pos;
};
BOOST_ASSERT(inset);
PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
pi.base.font = getFont(pos);
+ pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
theCoords.insets_.add(inset, int(x_), yo_ + row_.baseline());
inset->drawSelection(pi, int(x_), yo_ + row_.baseline());
inset->draw(pi, int(x_), yo_ + row_.baseline());
int LyXText::singleWidth(par_type par, pos_type pos) const
{
- if (pos >= pars_[par].size())
- return 0;
-
char const c = pars_[par].getChar(pos);
return singleWidth(par, pos, c, getFont(par, pos));
}