]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathRoot.cpp
Get rid of Inset::setPosCache
[lyx.git] / src / mathed / InsetMathRoot.cpp
index 050787cca891d696fe7dde721aab2b75dc403396..8c4d1fa5ac784b94403c964b20bb729ee0014d74 100644 (file)
 
 #include "InsetMathRoot.h"
 
-#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
+
 #include "Cursor.h"
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
 
 #include "frontends/Painter.h"
 
+
 using namespace std;
 
 namespace lyx {
@@ -38,18 +41,20 @@ Inset * InsetMathRoot::clone() const
 
 void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+       Changer dummy = mi.base.changeEnsureMath();
        InsetMathNest::metrics(mi);
        Dimension const & dim0 = cell(0).dimension(*mi.base.bv);
        Dimension const & dim1 = cell(1).dimension(*mi.base.bv);
        dim.asc = max(dim0.ascent()  + 5, dim1.ascent())  + 2;
        dim.des = max(dim0.descent() - 5, dim1.descent()) + 2;
        dim.wid = dim0.width() + dim1.width() + 10;
-       metricsMarkers(dim);
+       metricsMarkers(mi, dim);
 }
 
 
 void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
 {
+       Changer dummy = pi.base.changeEnsureMath();
        Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
        int const w = dim0.width();
        // the "exponent"
@@ -62,12 +67,12 @@ void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
        int xp[4];
        int yp[4];
        pi.pain.line(x + dim.width(), y - a + 1,
-                                                        x + w + 4, y - a + 1, Color_math);
+                               x + w + 4, y - a + 1, pi.base.font.color());
        xp[0] = x + w + 4;         yp[0] = y - a + 1;
        xp[1] = x + w;             yp[1] = y + d;
        xp[2] = x + w - 2;         yp[2] = y + (d - a)/2 + 2;
        xp[3] = x + w - 5;         yp[3] = y + (d - a)/2 + 4;
-       pi.pain.lines(xp, yp, 4, Color_math);
+       pi.pain.lines(xp, yp, 4, pi.base.font.color());
        drawMarkers(pi, x, y);
 }
 
@@ -133,10 +138,9 @@ void InsetMathRoot::htmlize(HtmlStream & os) const
 void InsetMathRoot::validate(LaTeXFeatures & features) const
 {
        if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
+               features.addCSSSnippet(
                        "span.rootof{border-top: thin solid black;}\n"
-                       "span.root sup{font-size: 75%;}\n"
-                       "</style>");
+                       "span.root sup{font-size: 75%;}");
        InsetMathNest::validate(features);
 }