int MathData::pos2x(BufferView const * bv, size_type pos) const
-{
- return pos2x(bv, pos, 0);
-}
-
-
-int MathData::pos2x(BufferView const * bv, size_type pos, int glue) const
{
int x = 0;
size_type target = min(pos, size());
CoordCache::Insets const & coords = bv->coordCache().getInsets();
for (size_type i = 0; i < target; ++i) {
const_iterator it = begin() + i;
- if ((*it)->getChar() == ' ')
- x += glue;
//lyxerr << "char: " << (*it)->getChar()
// << "width: " << (*it)->width() << endl;
x += coords.dim((*it).nucleus()).wid;
MathData::size_type MathData::x2pos(BufferView const * bv, int targetx) const
-{
- return x2pos(bv, targetx, 0);
-}
-
-
-MathData::size_type MathData::x2pos(BufferView const * bv, int targetx, int glue) const
{
const_iterator it = begin();
int lastx = 0;
// find first position after targetx
for (; currx < targetx && it != end(); ++it) {
lastx = currx;
- if ((*it)->getChar() == ' ')
- currx += glue;
currx += coords.dim((*it).nucleus()).wid;
}
/// returns x coordinate of given position in the array
int pos2x(BufferView const * bv, size_type pos) const;
/// returns position of given x coordinate
- int pos2x(BufferView const * bv, size_type pos, int glue) const;
- /// returns position of given x coordinate
size_type x2pos(BufferView const * bv, int targetx) const;
- /// returns position of given x coordinate starting from a certain pos
- size_type x2pos(BufferView const * bv, int targetx, int glue) const;
/// returns distance of this cell to the point given by x and y
// assumes valid position and size cache
int dist(BufferView const & bv, int x, int y) const;