dim.wid = 6;
dim.asc = int(h + f * h);
dim.des = int(f * h);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
cell(0).metrics(mi, dim);
metricsMarkers(dim);
++dim.wid; // for 'double stroke'
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
FontSetChanger dummy(mi.base, "textnormal");
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
FontSetChanger dummy(mi.base, "textnormal");
cell(0).metrics(mi, dim);
metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim += cell(1).dimension(*mi.base.bv);
dim += cell(2).dimension(*mi.base.bv);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
{
cell(0).metrics(mi, dim);
metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim += cell(2).dimension(*mi.base.bv);
dim.wid += 4 * w_ + 4;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des = max(dim0.des, t.des);
dim.wid = dim0.width() + 2 * t.wid;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.wid += 2 * theFontMetrics(font_).width(' ');
lyxerr << "InsetMathChar::metrics: " << dim << endl;
#endif
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
}
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.wid = dim0.width() + 2 * dw_ + 8;
dim.asc = max(a0, d0) + h0;
dim.des = max(a0, d0) - h0;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
}
else if (key_->name == "ddots")
dh_ = dim.asc;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_string_dim(mi.base.font, name_, dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
FontSetChanger dummy(mi.base, key_->name);
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
FontSetChanger dummy(mi.base, key_->name.c_str());
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
if (cur.idx() == target)
return false;
cur.idx() = target;
- cur.pos() = cell(target).x2pos(cur.x_target());
+ cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
return true;
}
if (cur.idx() == target)
return false;
cur.idx() = target;
- cur.pos() = cell(target).x2pos(cur.x_target());
+ cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
return true;
}
if (cur.idx() == target)
return false;
cur.idx() = target;
- cur.pos() = cell(target).x2pos(cur.x_target());
+ cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
return true;
}
}
}
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.wid = max(dim0.wid, dim1.wid) + 2;
dim.asc = dim0.height() + 2 + 5;
dim.des = dim1.height() + 2 - 5;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.wid = max(dim0.width(), dim1.width()) + 2;
dim.asc = dim0.height() + 2 + 5;
dim.des = dim1.height() + 2 - 5;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des = dim1.height() + 4 - 5;
dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
metricsMarkers2(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des = dim1.height() + 4 - 5;
dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
metricsMarkers2(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des = dim1.height() + 4 - 5;
dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
metricsMarkers2(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
return false;
cur.idx() += ncols();
}
- cur.pos() = cur.cell().x2pos(cur.x_target() - cur.cell().xo(cur.bv()));
+ cur.pos() = cur.cell().x2pos(&cur.bv(), cur.x_target() - cur.cell().xo(cur.bv()));
return true;
}
dim.des += 2;
dim.wid = 4;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
Point const pt2 = coord_cache.getInsets().xy(this);
//lyxerr << "retrieving position cache for MathData "
// << pt.x_ << ' ' << pt.y_ << endl;
- x = pt.x_ - pt2.x_ + ar.pos2x(sl.pos());
+ x = pt.x_ - pt2.x_ + ar.pos2x(&bv, sl.pos());
y = pt.y_ - pt2.y_;
// lyxerr << "pt.y_ : " << pt.y_ << " pt2_.y_ : " << pt2.y_
// << " asc: " << ascent() << " des: " << descent()
if (s1.idx() == s2.idx()) {
MathData const & c = cell(s1.idx());
Geometry const & g = bv.coordCache().getArrays().geometry(&c);
- int x1 = g.pos.x_ + c.pos2x(s1.pos());
+ int x1 = g.pos.x_ + c.pos2x(pi.base.bv, s1.pos());
int y1 = g.pos.y_ - g.dim.ascent();
- int x2 = g.pos.x_ + c.pos2x(s2.pos());
+ int x2 = g.pos.x_ + c.pos2x(pi.base.bv, s2.pos());
int y2 = g.pos.y_ + g.dim.descent();
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color_selection);
//lyxerr << "InsetMathNest::drawing selection 3: "
MathData & ar = cell(idx_min);
cur.push(*this);
cur.idx() = idx_min;
- cur.pos() = ar.x2pos(x - ar.xo(cur.bv()));
+ cur.pos() = ar.x2pos(&cur.bv(), x - ar.xo(cur.bv()));
//lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
if (dist_min == 0) {
dim.asc = dim1.asc + dim0.height() + 4;
dim.des = dim1.des;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des = max(dim0.descent() - 5, dim1.descent()) + 2;
dim.wid = dim0.width() + dim1.width() + 10;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
} else
dim.des = nd;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
StyleChanger dummy(mi.base, style_);
cell(0).metrics(mi, dim);
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.des += 2;
dim.wid += 12;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.asc = dim1.ascent() + dim0.height() + 4;
dim.des = dim1.descent();
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
if (sym_->inset == "cmex" || sym_->inset == "esint" ||
sym_->extra == "funclim")
scriptable_ = true;
-
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.asc = dim1.ascent();
dim.des = dim1.descent() + dim0.height() + 4;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
if (cur.idx() == target)
return false;
cur.idx() = target;
- cur.pos() = cur.cell().x2pos(cur.x_target());
+ cur.pos() = cur.cell().x2pos(&cur.bv(), cur.x_target());
return true;
}
dim.asc = dim0.height() + 10;
dim.des = dim1.height();
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
dim.asc = 0;
dim.wid = 0;
Dimension d;
- atom_dims_.clear();
+ CoordCacheBase<Inset> & coords = mi.base.bv->coordCache().insets();
for (size_t i = 0, n = size(); i != n; ++i) {
MathAtom const & at = operator[](i);
at->metrics(mi, d);
- atom_dims_.push_back(d);
+ coords.add(at.nucleus(), d);
dim += d;
if (i == n - 1)
kerning_ = at->kerning(mi.base.bv);
|| x >= bv. workWidth())
return;
+ CoordCacheBase<Inset> & coords = pi.base.bv->coordCache().insets();
for (size_t i = 0, n = size(); i != n; ++i) {
MathAtom const & at = operator[](i);
- bv.coordCache().insets().add(at.nucleus(), x, y);
+ coords.add(at.nucleus(), x, y);
at->drawSelection(pi, x, y);
at->draw(pi, x, y);
- x += atom_dims_[i].wid;
+ x += coords.dim(at.nucleus()).wid;
}
}
}
-int MathData::pos2x(size_type pos) const
+int MathData::pos2x(BufferView const * bv, size_type pos) const
{
- return pos2x(pos, 0);
+ return pos2x(bv, pos, 0);
}
-int MathData::pos2x(size_type pos, int glue) const
+int MathData::pos2x(BufferView const * bv, size_type pos, int glue) const
{
int x = 0;
size_type target = min(pos, size());
+ CoordCacheBase<Inset> 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 += atom_dims_[i].wid;
+ x += coords.dim((*it).nucleus()).wid;
}
return x;
}
-MathData::size_type MathData::x2pos(int targetx) const
+MathData::size_type MathData::x2pos(BufferView const * bv, int targetx) const
{
- return x2pos(targetx, 0);
+ return x2pos(bv, targetx, 0);
}
-MathData::size_type MathData::x2pos(int targetx, int glue) const
+MathData::size_type MathData::x2pos(BufferView const * bv, int targetx, int glue) const
{
const_iterator it = begin();
int lastx = 0;
int currx = 0;
+ CoordCacheBase<Inset> const & coords = bv->coordCache().getInsets();
// find first position after targetx
for (; currx < targetx && it < end(); ++it) {
lastx = currx;
if ((*it)->getChar() == ' ')
currx += glue;
- currx += atom_dims_[it - begin()].wid;
+ currx += coords.dim((*it).nucleus()).wid;
}
/**
/// write access to coordinate;
void setXY(BufferView & bv, int x, int y) const;
/// returns x coordinate of given position in the array
- int pos2x(size_type pos) const;
+ int pos2x(BufferView const * bv, size_type pos) const;
/// returns position of given x coordinate
- int pos2x(size_type pos, int glue) const;
+ int pos2x(BufferView const * bv, size_type pos, int glue) const;
/// returns position of given x coordinate
- size_type x2pos(int pos) const;
+ size_type x2pos(BufferView const * bv, int pos) const;
/// returns position of given x coordinate fstarting from a certain pos
- size_type x2pos(int targetx, int glue) const;
+ 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;
const size_type numParams, std::vector<MathData> & params,
size_t & pos, MathAtom & scriptToPutAround,
const pos_type macroPos, const int thisPos, const int thisSlice);
- ///
- mutable std::vector<Dimension> atom_dims_;
};
///
if (!parent_.premetrics())
dim.des += maxasc + maxdes + 1;
}
-
- setDimCache(mi, dim);
}
dim.wid = 0;
dim.asc = 0;
dim.des = 0;
- setDimCache(mi, dim);
}
}