int xo;
int yo;
Inset const * inset = &it.inset();
- std::map<Inset const *, Point> const & data =
+ std::map<Inset const *, Geometry> const & data =
c.bv().coordCache().getInsets().getData();
- std::map<Inset const *, Point>::const_iterator I = data.find(inset);
+ std::map<Inset const *, Geometry>::const_iterator I = data.find(inset);
// FIXME: in the case where the inset is not in the cache, this
// means that no part of it is visible on screen. In this case
return it;
}
- Point o = I->second;
+ Point o = I->second.pos;
inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
// Convert to absolute
xo += o.x_;
}
+ /*
/// moves position closest to (x, y) in given box
bool bruteFind(Cursor & cursor,
int x, int y, int xlow, int xhigh, int ylow, int yhigh)
return false;
}
+ */
/// moves position closest to (x, y) in given box
}
-void Cursor::setScreenPos(int x, int y)
+void Cursor::setScreenPos(int x, int /*y*/)
{
setTargetX(x);
- bruteFind(*this, x, y, 0, bv().workWidth(), 0, bv().workHeight());
+ //bruteFind(*this, x, y, 0, bv().workWidth(), 0, bv().workHeight());
}
// on space? Take the font before (only for RTL boundary stay)
if (pos > 0) {
+ TextMetrics const & tm = bv().textMetrics(&text);
if (pos == sl.lastpos()
- || (par.isSeparator(pos) &&
- !text.isRTLBoundary(buffer(), par, pos)))
+ || (par.isSeparator(pos)
+ && !tm.isRTLBoundary(sl.pit(), pos)))
--pos;
}
void Cursor::setCurrentFont()
{
- pos_type cpos = pos();
- Paragraph & par = paragraph();
- Text const & ctext = *text();
+ CursorSlice const & cs = innerTextSlice();
+ Paragraph const & par = cs.paragraph();
+ pos_type cpit = cs.pit();
+ pos_type cpos = cs.pos();
+ Text const & ctext = *cs.text();
+ TextMetrics const & tm = bv().textMetrics(&ctext);
// are we behind previous char in fact? -> go to that char
if (cpos > 0 && boundary())
// abc| def -> font of c
// abc |[WERBEH], i.e. boundary==true -> font of c
// abc [WERBEH]| def, font of the space
- if (!ctext.isRTLBoundary(buffer(), par, cpos))
+ if (!tm.isRTLBoundary(cpit, cpos))
--cpos;
}
}
// get font
BufferParams const & bufparams = buffer().params();
current_font = par.getFontSettings(bufparams, cpos);
- real_current_font = ctext.getFont(buffer(), par, cpos);
+ real_current_font = tm.getDisplayFont(cpit, cpos);
// special case for paragraph end
- if (pos() == lastpos()
- && ctext.isRTLBoundary(buffer(), par, pos())
+ if (cs.pos() == lastpos()
+ && tm.isRTLBoundary(cpit, cs.pos())
&& !boundary()) {
Language const * lang = par.getParLanguage(bufparams);
current_font.setLanguage(lang);