]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDecoration.cpp
Introduce hooks to encapsulate macro code of MathRow
[lyx.git] / src / mathed / InsetMathDecoration.cpp
index 438d16153cd1f42d300b2cdf1968f302be26b4b3..47792498915e4737d09c02d77a391e2d57703417 100644 (file)
@@ -105,9 +105,7 @@ InsetMath::mode_type InsetMathDecoration::currentMode() const
 
 void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       bool really_change_font = currentMode() == TEXT_MODE
-                               && isMathFont(from_ascii(mi.base.fontname));
-       Changer dummy = mi.base.changeFontSet("textnormal", really_change_font);
+       Changer dummy = mi.base.changeEnsureMath(currentMode());
 
        cell(0).metrics(mi, dim);
 
@@ -121,26 +119,20 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
                dy_ = dim.des + 1;
                dim.des += dh_ + 2;
        }
-
-       metricsMarkers(dim);
 }
 
 
 void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
 {
-       bool really_change_font = currentMode() == TEXT_MODE
-                               && isMathFont(from_ascii(pi.base.fontname));
-       Changer dummy = pi.base.changeFontSet("textnormal", really_change_font);
+       Changer dummy = pi.base.changeEnsureMath(currentMode());
 
-       cell(0).draw(pi, x + 1, y);
+       cell(0).draw(pi, x, y);
        Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
        if (wide())
                mathed_draw_deco(pi, x + 1, y + dy_, dim0.wid, dh_, key_->name);
        else
                mathed_draw_deco(pi, x + 1 + (dim0.wid - dw_) / 2,
                        y + dy_, dw_, dh_, key_->name);
-       drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
 }