]> git.lyx.org Git - features.git/commitdiff
Get rid of Inset::setPosCache
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 5 Dec 2016 10:51:18 +0000 (11:51 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Dec 2016 15:15:47 +0000 (16:15 +0100)
This helper method is used to set the inset position cache at drawing
time. However this is already done by the drawing code itself
(MathRow::draw, RowPainter::paintInset), so that there is no need to
do this same work again in a different place.

Note that the inset positions are still set in InsetTabular::draw for
each cell.

This commit comes with a mild risk attached (it might be that some of
these calls were useful after all!), but all of this is fixable.

23 files changed:
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetIPA.cpp
src/insets/InsetPreview.cpp
src/mathed/CommandInset.cpp
src/mathed/InsetMathArray.cpp
src/mathed/InsetMathBig.cpp
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathCases.cpp
src/mathed/InsetMathColor.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDiagram.cpp
src/mathed/InsetMathDots.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathSplit.cpp
src/mathed/InsetMathXYMatrix.cpp
src/mathed/MathMacro.cpp
src/mathed/MathMacroArgument.cpp
src/mathed/MathMacroTemplate.cpp

index 09a45e42d525b9dc304417c4c5301b4a46189a83..c00f27e28de3f6250c38098a2b2a634af92f215d 100644 (file)
@@ -549,7 +549,6 @@ void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
        pi.pain.line(t, d - 3, t, d, pen_color);
        pi.pain.line(x, d, x + 3, d, pen_color);
        pi.pain.line(t - 3, d, t, d, pen_color);
-       setPosCache(pi, x, y);
 }
 
 
@@ -566,7 +565,6 @@ void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const
        pi.pain.line(t, a + 3, t, a, pen_color);
        pi.pain.line(x, a, x + 3, a, pen_color);
        pi.pain.line(t - 3, a, t, a, pen_color);
-       setPosCache(pi, x, y);
 }
 
 
@@ -627,13 +625,6 @@ ColorCode Inset::labelColor() const
 }
 
 
-void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
-{
-       //LYXERR("Inset: set position cache to " << x << " " << y);
-       pi.base.bv->coordCache().insets().add(this, x, y);
-}
-
-
 void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
 {
        mi.base.bv->coordCache().insets().add(this, dim);
index e0418dc439195a7e4fff3400e5bc1f6b8acff93f..1b3f85ebc7ae08cb71a1f29f1db73c0a5cd39bf2 100644 (file)
@@ -216,8 +216,6 @@ public:
        int xo(BufferView const & bv) const;
        /// last drawn position for 'important' insets
        int yo(BufferView const & bv) const;
-       /// set x/y drawing position cache if available
-       virtual void setPosCache(PainterInfo const &, int, int) const;
        ///
        void setDimCache(MetricsInfo const &, Dimension const &) const;
        /// do we cover screen position x/y?
index 1c20866b0d700e558acc372576502253fb470315..a574da86c55601863c82f72fcdeb1e623e894185 100644 (file)
@@ -152,7 +152,6 @@ void InsetIPA::draw(PainterInfo & pi, int x, int y) const
 {
        if (previewState(pi.base.bv)) {
                preview_->draw(pi, x, y);
-               setPosCache(pi, x, y);
                return;
        }
        InsetText::draw(pi, x, y);
index 37aec63b7a9af92193fc27fb1552e81900a8baf5..739322b9b05fffdac82870dea43e8b4a26712454 100644 (file)
@@ -139,7 +139,6 @@ void InsetPreview::draw(PainterInfo & pi, int x, int y) const
        if (previewState(pi.base.bv)) {
                // one pixel gap in front
                preview_->draw(pi, x + 1, y);
-               setPosCache(pi, x, y);
        } else
                InsetText::draw(pi, x, y);
 }
index 0cf041c23ea7e59b2ec9fc62cf30690fca02cda5..6b9466481cd44c8a948130ee409208c164ccb1fb 100644 (file)
@@ -58,7 +58,6 @@ Inset * CommandInset::editXY(Cursor & cur, int /*x*/, int /*y*/)
 void CommandInset::draw(PainterInfo & pi, int x, int y) const
 {
        button_.draw(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index eb8676d1647cbf57365ec84b60c1388b2dc3468b..eeea831d05e5c2d7f2279a88c6aa7a3553ba9c00 100644 (file)
@@ -82,7 +82,6 @@ void InsetMathArray::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathArray::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        Changer dummy2 = pi.base.changeEnsureMath();
        Changer dummy = pi.base.changeArray();
        InsetMathGrid::draw(pi, x, y);
index ff3765aed298e4953a9cb60623ea97504c86c624..76efc571dbf853dcc03a56e10cc2568a1346a8da 100644 (file)
@@ -90,7 +90,6 @@ void InsetMathBig::draw(PainterInfo & pi, int x, int y) const
                (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\");
        mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(),
                         delim);
-       setPosCache(pi, x, y);
 }
 
 
index d0ac82f1a6bcc48bcce4cc4b06ece5b46856fba8..aff3fb6c634847b94e20b86f315c50985547b381 100644 (file)
@@ -146,7 +146,6 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
                dim.width() - 2, dim.height() - 2, Color_foreground);
        Changer dummy = pi.base.changeFontSet("textnormal");
        cell(0).draw(pi, x + 3, y);
-       setPosCache(pi, x, y);
 }
 
 
@@ -370,7 +369,6 @@ void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
        pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
                dim.width() - 2, dim.height() - 2, Color_foreground);
        cell(0).draw(pi, x + 3, y);
-       setPosCache(pi, x, y);
 }
 
 
index 4a7b1512441a342867d815bf187ec9a86df2cef8..0a5fa332b1ab241b7c8a278d0534755f1c335e65 100644 (file)
@@ -56,7 +56,6 @@ void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
        Dimension const dim = dimension(*pi.base.bv);
        mathed_draw_deco(pi, x + 1, y - dim.ascent(), 6, dim.height(), from_ascii("{"));
        InsetMathGrid::draw(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index 966fe5e99adf1e851b63a5f5124a2f87542d41e5..ea4f4ef6e29793c84a8d62be1a906f6523dc7111 100644 (file)
@@ -60,7 +60,6 @@ void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
        cell(0).draw(pi, x + 1, y);
        pi.base.font.setColor(origcol);
        drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index 7a0cfb09c18e616750bc9603fb13fa686f76f24c..f7fd6ea2aa20300162d2e8da059131322b378705 100644 (file)
@@ -142,7 +142,6 @@ void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
                mathed_draw_deco(pi, x + 1 + (dim0.wid - dw_) / 2,
                        y + dy_, dw_, dh_, key_->name);
        drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index d2b284f1907aaddd525514c9d2459094cd9fbd84..e039e64a19170c9b507f725808c24d8b78002ca5 100644 (file)
@@ -131,7 +131,6 @@ void InsetMathDelim::draw(PainterInfo & pi, int x, int y) const
        mathed_draw_deco(pi, x, b, dw_, dim.height(), left_);
        mathed_draw_deco(pi, x + dim.width() - dw_,
                b, dw_, dim.height(), right_);
-       setPosCache(pi, x, y);
 }
 
 
index 6b12949b9ee9dbf0001f0506781bcf40aecbfdf4..c2019d4be856930273f5d456822a6ca327bfec07 100644 (file)
@@ -58,7 +58,6 @@ void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        Changer dummy2 = pi.base.changeEnsureMath();
        FontInfo & f = pi.base.font;
        Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
index b5799643518e735fdffff35655af923e223a8cdb..8c4bd8374b3f35b84cdf06d44f23436c39278ed7 100644 (file)
@@ -69,7 +69,6 @@ void InsetMathDots::draw(PainterInfo & pi, int x, int y) const
                --y;
        mathed_draw_deco(pi, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                key_->name);
-       setPosCache(pi, x, y);
 }
 
 
index 825cf332c497e9b26d4b3101d23815b268f3dd1d..05f9e66e73b081b51fa5653343dfa75d8ff3abd9 100644 (file)
@@ -95,7 +95,6 @@ void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
        Changer dummy = pi.base.changeFontSet(font());
        cell(0).draw(pi, x + 1, y);
        drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index 2362495d771da3f00ece272b62b25adb6b2431b3..ad999a221d76b3ccf57072dab40e87f141bfe55b 100644 (file)
@@ -275,7 +275,6 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        Changer dummy3 = pi.base.changeEnsureMath();
        Dimension const dim = dimension(*pi.base.bv);
        Dimension const dim0 = cell(0).dimension(*pi.base.bv);
index 52442b225b84a149a51900c2111ca45153d1b76b..402770738b84cdb1375b610ee6470eab1710fa5f 100644 (file)
@@ -609,7 +609,6 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
                        // one pixel gap in front
                        preview_->draw(pi, x + 1, y);
                }
-               setPosCache(pi, x, y);
                return;
        }
 
@@ -637,7 +636,6 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        if (canPaintChange(*bv))
                pi.change_.paintCue(pi, x + 1, y + 1 - dim.asc,
                                    x + dim.wid, y + dim.des);
-       setPosCache(pi, x, y);
 }
 
 
index 3794a58f607e6daec42931c6f0fa1ab1db1e5985..ecd823063e092fc357c7b9a4075c16623852671f 100644 (file)
@@ -265,14 +265,13 @@ void InsetMathNest::dump() const
 }
 
 
-void InsetMathNest::draw(PainterInfo & pi, int x, int y) const
+void InsetMathNest::draw(PainterInfo &, int, int) const
 {
 #if 0
        if (lock_)
                pi.pain.fillRectangle(x, y - ascent(), width(), height(),
                                        Color_mathlockbg);
 #endif
-       setPosCache(pi, x, y);
 }
 
 
index 5008a8d336b1aefade7eb0a82faeb7e258b2915e..c260e2e51eb053f159209df4c633494e1ce00e44 100644 (file)
@@ -106,7 +106,6 @@ void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
 {
        Changer dummy = pi.base.changeEnsureMath();
        InsetMathGrid::draw(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
index ab5cb834a318d02cb76470b4dd3461e44aee27b6..0994914a941bccaa0809ac5dddabe911a1b928ac 100644 (file)
@@ -57,7 +57,6 @@ void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        Changer dummy2 = pi.base.changeEnsureMath();
        Changer dummy = pi.base.changeArray();
        InsetMathGrid::draw(pi, x, y);
index 71654b4d1ce516509a9e05948983a2362036e6f4..6a5c904df7161855c8c9286df8e7e95142355870 100644 (file)
@@ -624,7 +624,6 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
 {
        Dimension const dim = dimension(*pi.base.bv);
 
-       setPosCache(pi, x, y);
        int expx = x;
        int expy = y;
 
index 2e6b0e2275e46bd49a531c99528335790a55be79..76b43f3629f255a0fffc3f5a0ee4186ed8e95bc8 100644 (file)
@@ -69,7 +69,6 @@ void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
 void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
 {
        drawStrRed(pi, x, y, str_);
-       setPosCache(pi, x, y);
 }
 
 
index 42d81772b737755ddcb8c89af2bea67a8fe69de7..2a7dc774d6e86b0f5c1b353eb73d3bcbf0c3f2ee 100644 (file)
@@ -590,7 +590,6 @@ void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
        Changer dummy1 = pi.base.changeFontSet("mathnormal");
        Changer dummy2 = pi.base.font.changeStyle(LM_ST_TEXT);
 
-       setPosCache(pi, x, y);
        Dimension const dim = dimension(*pi.base.bv);
 
        // draw outer frame