]> git.lyx.org Git - features.git/commitdiff
* moved atom_dim_ to coord cache in the buffer view to make it dependent on the buffe...
authorStefan Schimanski <sts@lyx.org>
Mon, 24 Dec 2007 10:52:58 +0000 (10:52 +0000)
committerStefan Schimanski <sts@lyx.org>
Mon, 24 Dec 2007 10:52:58 +0000 (10:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22290 a592a061-630c-0410-9148-cb99ea01b6c8

31 files changed:
src/mathed/InsetMathBig.cpp
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathColor.cpp
src/mathed/InsetMathComment.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDots.cpp
src/mathed/InsetMathEnv.cpp
src/mathed/InsetMathExFunc.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathLefteqn.cpp
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathOverset.cpp
src/mathed/InsetMathPhantom.cpp
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathSize.cpp
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathStackrel.cpp
src/mathed/InsetMathSymbol.cpp
src/mathed/InsetMathUnderset.cpp
src/mathed/InsetMathXArrow.cpp
src/mathed/MathData.cpp
src/mathed/MathData.h
src/mathed/MathMacroTemplate.cpp

index 692d35d26291715e4959018f7441ed87d6bf42de..c547a7bb975ff554e4ec0232907cbd58d8d44522 100644 (file)
@@ -69,8 +69,6 @@ void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.wid = 6;
        dim.asc = int(h + f * h);
        dim.des = int(f * h);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 6ef4de7099b862cbbf17b2fe0d4e6573278bc8ce..45ed5355ef42719211aaa72b5ac0c00894a37301 100644 (file)
@@ -38,8 +38,6 @@ void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
        ++dim.wid;  // for 'double stroke'
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 013e35bd93f2ce1098e4fc5305e1aec0f874a610..641f50e370c20d0bbf6126e6a860a1256b05576b 100644 (file)
@@ -56,8 +56,6 @@ void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const
        FontSetChanger dummy(mi.base, "textnormal");
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -93,8 +91,6 @@ void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
@@ -148,8 +144,6 @@ void InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const
        dim += cell(1).dimension(*mi.base.bv);
        dim += cell(2).dimension(*mi.base.bv);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -213,8 +207,6 @@ void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
        metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -274,8 +266,6 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
        dim  += cell(2).dimension(*mi.base.bv);
        dim.wid += 4 * w_ + 4;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index fa50c461e2797d8b3fd5463aae32293eac55da93..d5b6da44dc768f3cb3f09a8fea6a8ba4570eaff4 100644 (file)
@@ -53,8 +53,6 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.des = max(dim0.des, t.des);
        dim.wid = dim0.width() + 2 * t.wid;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 02013d901367196c6499b8f4865a2a125084276c..8c8f1ef141e37cc278059fa0813fca3c86584ef5 100644 (file)
@@ -84,8 +84,6 @@ void InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
                dim.wid += 2 * theFontMetrics(font_).width(' ');
        lyxerr << "InsetMathChar::metrics: " << dim << endl;
 #endif
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 9246f3d45973f46da82cf2a0ae9258a0a23e2dec..f5854f3712dbead99a906e0a752d4e0e2d3dcc0a 100644 (file)
@@ -45,8 +45,6 @@ void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index b856ffc2401a2a8140c4c6ca95512c2d52ec41a5..5bf046d08e87e229ab2a711024a056540d82ff04 100644 (file)
@@ -44,8 +44,6 @@ void InsetMathComment::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index ecf5f58c2bf56ab2c97d0ec02e9042fc9dc723c0..3878da7f8c09d668acdef684404b3c03bee77981 100644 (file)
@@ -119,8 +119,6 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
        }
 
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 5c732751a6d1649b4a68a5918fa0b145c9ee2775..403c1cf65d315fca1e2b56e3880eb72a2c1417b5 100644 (file)
@@ -87,8 +87,6 @@ void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
index 7bbfa0b3e02b23700122b4acfbb07f38023fdea7..6e54907653e4131cbd9d7011c458db55e69c7655 100644 (file)
@@ -49,8 +49,6 @@ void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
        }
        else if (key_->name == "ddots")
                dh_ = dim.asc;
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index adbca074e8245648894925f27765ef57c58e4e4e..82460b986c539f7a8857eca038824f4849726de7 100644 (file)
@@ -36,8 +36,6 @@ void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 7b03387ba3abc06d96c0833a985c244ea04e9499..9a871f49d40c4fcd86e9c8261a6db9eed63c4c71 100644 (file)
@@ -45,8 +45,6 @@ Inset * InsetMathExFunc::clone() const
 void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        mathed_string_dim(mi.base.font, name_, dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 33f65751ad8e6bc1a3df49f6f5b1dad0217f49ec..2d73d64710223259947fa958a33ade3e7043260c 100644 (file)
@@ -49,8 +49,6 @@ void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
        FontSetChanger dummy(mi.base, key_->name);
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index c46defe89729d6388d2dac2e05372d55c624ba7b..fda63bdba4f1b7bd9dccb66915ec7697e3af5146 100644 (file)
@@ -40,8 +40,6 @@ void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
        FontSetChanger dummy(mi.base, key_->name.c_str());
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index ff0596250abf6a75b1730272a8fa1ddc6b4f1519..915169becc67602f4d03084a090983a8e60bf98b 100644 (file)
@@ -45,7 +45,7 @@ bool InsetMathFracBase::idxUpDown(Cursor & cur, bool up) const
        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;
 }
 
@@ -94,7 +94,7 @@ bool InsetMathFrac::idxForward(Cursor & cur) const
        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;
 }
 
@@ -112,7 +112,7 @@ bool InsetMathFrac::idxBackward(Cursor & cur) const
        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;
 }
 
@@ -168,8 +168,6 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
                }
        }
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -373,8 +371,6 @@ void InsetMathDFrac::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
@@ -433,8 +429,6 @@ void InsetMathTFrac::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
@@ -510,8 +504,6 @@ void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
@@ -584,8 +576,6 @@ void InsetMathDBinom::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
@@ -654,8 +644,6 @@ void InsetMathTBinom::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
index cc542399c23aa01d5f53f57f12aa5bf72bdcfa57..214ca7e9faea33619ae66418642a7dd77216e606 100644 (file)
@@ -813,7 +813,7 @@ bool InsetMathGrid::idxUpDown(Cursor & cur, bool up) const
                        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;
 }
 
index dffa982b9aa6c658c9a1dc2100c1ccc990befb0f..f66c815179365d9e443ec006f2a170be00e5e573 100644 (file)
@@ -35,8 +35,6 @@ void InsetMathLefteqn::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.des += 2;
        dim.wid = 4;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 00d4e2ac6e0c7759f4e48fd7cd99221dc907f65d..77c3c8215d853b34071df547c2a47aaa9270f756 100644 (file)
@@ -131,7 +131,7 @@ void InsetMathNest::cursorPos(BufferView const & bv,
        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()
@@ -257,9 +257,9 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
        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: "
@@ -1231,7 +1231,7 @@ Inset * InsetMathNest::editXY(Cursor & cur, int x, int y)
        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) {
index bd56bff79fa457820c43bbbec306b239e0c249f0..62a82427cdc0f50a064bff0ffd04f99896e58813 100644 (file)
@@ -38,8 +38,6 @@ void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = dim1.asc + dim0.height() + 4;
        dim.des = dim1.des;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 0000175ad0e43f3acaf350834954aa1da343fbf4..079098094afa0cc16f127c2a8f06a685c9daf32e 100644 (file)
@@ -36,8 +36,6 @@ void InsetMathPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 0017e1c9542e38111970fac0ce880dd1d6b9e97a..f9424ed4ed211be9519026b7de6a14b832d5bac3 100644 (file)
@@ -43,8 +43,6 @@ void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
 }
 
 
index a8142612cd31c96f9d0ae578f076e0ddae26820e..3fd94d11d88ad3d02724a09a9dd1463ac58ad15b 100644 (file)
@@ -340,8 +340,6 @@ void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
        } else
                dim.des = nd;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 42f13d858d605441e61a4d872f881e57386ad3ed..c014d90adfea13057dcfdc4ec1bbe95764cf3599 100644 (file)
@@ -39,8 +39,6 @@ void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
        StyleChanger dummy(mi.base, style_);
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 23ded20156eb97e9c6d9dea34901d8e8f860a21c..941ad92b92f8d8e41a4af15b78dbc5c5f2d74b98 100644 (file)
@@ -37,8 +37,6 @@ void InsetMathSqrt::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.des += 2;
        dim.wid += 12;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 1618de2cc1abc65f688218a47b8a2e86b1d4e764..2879659e1ecb25a5aa6ec556308b7bb771ff1106 100644 (file)
@@ -39,8 +39,6 @@ void InsetMathStackrel::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = dim1.ascent() + dim0.height() + 4;
        dim.des = dim1.descent();
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index 33a22f9b283531d243389109b4aead7a6497f802..52d6eee85855ccb41e155d7f252fc1b69071660c 100644 (file)
@@ -82,9 +82,6 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
                if (sym_->inset == "cmex" || sym_->inset == "esint" ||
                    sym_->extra == "funclim")
                        scriptable_ = true;
-
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index d34260451ea640c508c8aa75a1964fbe085da652..a66a225af2b45d9218a808138960d01b139c4c5f 100644 (file)
@@ -38,8 +38,6 @@ void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = dim1.ascent();
        dim.des = dim1.descent() + dim0.height() + 4;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -79,7 +77,7 @@ bool InsetMathUnderset::idxUpDown(Cursor & cur, bool up) const
        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;
 }
 
index 407b5f5d56e5127a31b1e0f4522b984e76f84170..3faee295f3b10602d7590e3fd5f6dbb91a7cf631 100644 (file)
@@ -45,8 +45,6 @@ void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = dim0.height() + 10;
        dim.des = dim1.height();
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
index e579ece41ea812c856266a3eeb4d382c8a4e5546..114f5b762262d76d64cca989ee951f21ac1e457e 100644 (file)
@@ -253,11 +253,11 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
        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);
@@ -287,12 +287,13 @@ void MathData::draw(PainterInfo & pi, int x, int y) const
                || 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;
        }
 }
 
@@ -733,45 +734,47 @@ void MathData::collectParameters(Cursor * cur,
 }
 
 
-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;
        }
 
        /**
index c0388aa6710389e13ea6c543e56e54b2e0fcae95..2e1b12cfccbed9e47f93b61f7c94f3c17b8fec51 100644 (file)
@@ -132,13 +132,13 @@ public:
        /// 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;
@@ -187,8 +187,6 @@ private:
                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_;
 };
 
 ///
index 68926d47aef40849a248fe4a91224d20c6cc7589..f1d8e439e5cc13c8dfdd2c62ae783b9f2fac313f 100644 (file)
@@ -137,8 +137,6 @@ void InsetLabelBox::metrics(MetricsInfo & mi, Dimension & dim) const
                if (!parent_.premetrics())
                        dim.des += maxasc + maxdes + 1;
        }
-
-       setDimCache(mi, dim);
 }
 
 
@@ -221,7 +219,6 @@ void DisplayLabelBox::metrics(MetricsInfo & mi, Dimension & dim) const
                dim.wid = 0;
                dim.asc = 0;
                dim.des = 0;
-               setDimCache(mi, dim);
        }
 }