]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFrac.cpp
add busy.gif to resources (in line with cmake)
[lyx.git] / src / mathed / InsetMathFrac.cpp
index 9ec6c7b0862d1dd686b71ee2876c3d120786a867..752dd54bea51d3583dce802437256697012bec37 100644 (file)
@@ -167,7 +167,7 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
                        dim.des = dim1.height() - 5;
                } else {
                        if (kind_ == CFRAC || kind_ == CFRACLEFT
-                       || kind_ == CFRACRIGHT || kind_ == DFRAC) {
+                                 || kind_ == CFRACRIGHT || kind_ == DFRAC) {
                                // \cfrac and \dfrac are always in display size
                                StyleChanger dummy2(mi.base, LM_ST_DISPLAY);
                                cell(0).metrics(mi, dim0);
@@ -254,13 +254,13 @@ void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
                pi.pain.line(xx + dim0.wid,
                                y + dim.des - 2,
                                xx + dim0.wid + 5,
-                               y - dim.asc + 2, Color_math);
+                               y - dim.asc + 2, pi.base.font.color());
        }
        if (kind_ == FRAC || kind_ == CFRAC || kind_ == CFRACLEFT
                || kind_ == CFRACRIGHT || kind_ == DFRAC
                || kind_ == TFRAC || kind_ == OVER)
                pi.pain.line(x + 1, y - 5,
-                               x + dim.wid - 2, y - 5, Color_math);
+                               x + dim.wid - 2, y - 5, pi.base.font.color());
        drawMarkers(pi, x, y);
 }
 
@@ -407,7 +407,7 @@ void InsetMathFrac::validate(LaTeXFeatures & features) const
        if (kind_ == NICEFRAC || kind_ == UNITFRAC || kind_ == UNIT)
                features.require("units");
        if (kind_ == CFRAC || kind_ == CFRACLEFT || kind_ == CFRACRIGHT
-               || kind_ == DFRAC || kind_ == TFRAC)
+                 || kind_ == DFRAC || kind_ == TFRAC)
                features.require("amsmath");
        if (features.runparams().math_flavor == OutputParams::MathAsHTML)
                // CSS adapted from eLyXer
@@ -578,12 +578,49 @@ void InsetMathBinom::mathmlize(MathStream & os) const
 }
 
 
+void InsetMathBinom::htmlize(HtmlStream & os) const
+{
+       char ldelim = ' ';
+       char rdelim = ' ';
+       switch (kind_) {
+       case BINOM:
+       case TBINOM:
+       case DBINOM:
+       case CHOOSE:
+               ldelim = '(';
+               rdelim = ')';
+               break;
+       case BRACE:
+               ldelim = '{';
+               rdelim = '}';
+               break;
+       case BRACK:
+               ldelim = '[';
+               rdelim = ']';
+               break;
+       }
+       os << MTag("span", "class='binomdelim'") << ldelim << ETag("span") << '\n'
+          << MTag("span", "class='binom'") << '\n'
+          << MTag("span") << cell(0) << ETag("span") << '\n'
+          << MTag("span") << cell(1) << ETag("span") << '\n'
+          << ETag("span") << '\n'
+                << MTag("span", "class='binomdelim'") << rdelim << ETag("span") << '\n';
+}
+
+
 void InsetMathBinom::validate(LaTeXFeatures & features) const
 {
-       if (kind_ == BINOM)
-               features.require("binom");
-       if (kind_ == DBINOM || kind_ == TBINOM)
-               features.require("amsmath");
+       if (features.runparams().isLaTeX()) {
+               if (kind_ == BINOM)
+                       features.require("binom");
+               if (kind_ == DBINOM || kind_ == TBINOM)
+                       features.require("amsmath");
+       } else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "span.binom{display: inline-block; vertical-align: bottom; text-align:center;}\n"
+                       "span.binom span{display: block;}\n"
+                       "span.binomdelim{font-size: 2em;}\n"
+                       "</style>");
        InsetMathNest::validate(features);
 }