]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMath.cpp
Assure correct spacing of colored items in mathed
[lyx.git] / src / mathed / InsetMath.cpp
index cbf33cdf8707bf76aa82d51131fa181fc3eb53e3..bddd82fe7a261df04a129cfff9f46f9fda9e2ea8 100644 (file)
@@ -52,52 +52,35 @@ MathData const & InsetMath::cell(idx_type) const
 }
 
 
-MathClass InsetMath::mathClass() const
+InsetMath::marker_type InsetMath::marker(BufferView const *) const
 {
-       return MC_ORD;
+       return nargs() > 0 ? MARKER : NO_MARKER;
 }
 
 
 bool InsetMath::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
 {
-       MathRow::Element e(MathRow::INSET, mi);
+       MathRow::Element e(mi, MathRow::INSET, mathClass());
        e.inset = this;
-       e.mclass = mathClass();
+       e.marker = mi.base.macro_nesting ? NO_MARKER : marker(mi.base.bv);
        mrow.push_back(e);
        return true;
 }
 
-void InsetMath::metricsMarkers(MetricsInfo & mi, Dimension & dim,
-                           int framesize) const
-{
-       if (!mi.base.macro_nesting)
-               Inset::metricsMarkers(dim, framesize);
-}
-
-
-void InsetMath::metricsMarkers2(MetricsInfo & mi, Dimension & dim,
-                            int framesize) const
-{
-       if (!mi.base.macro_nesting)
-               Inset::metricsMarkers2(dim, framesize);
-}
-
-
-void InsetMath::drawMarkers(PainterInfo & pi, int x, int y) const
-{
-       if (!pi.base.macro_nesting)
-               Inset::drawMarkers(pi, x, y);
-}
 
-
-void InsetMath::drawMarkers2(PainterInfo & pi, int x, int y) const
+/// write LaTeX and LyX code
+void InsetMath::writeLimits(WriteStream & os) const
 {
-       if (!pi.base.macro_nesting)
-               Inset::drawMarkers2(pi, x, y);
+       if (limits() == LIMITS) {
+               os << "\\limits";
+               os.pendingSpace(true);
+       } else if (limits() == NO_LIMITS) {
+               os << "\\nolimits ";
+               os.pendingSpace(true);
+       }
 }
 
 
-
 void InsetMath::dump() const
 {
        lyxerr << "---------------------------------------------" << endl;
@@ -134,7 +117,7 @@ void InsetMath::write(WriteStream & os) const
 }
 
 
-int InsetMath::plaintext(odocstringstream &, 
+int InsetMath::plaintext(odocstringstream &,
         OutputParams const &, size_t) const
 {
        // all math plain text output shall take place in InsetMathHull
@@ -177,13 +160,13 @@ void InsetMath::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMath::mathmlize(MathStream & os) const
+void InsetMath::mathmlize(MathStream & ms) const
 {
-       os << "<!-- " << from_utf8(insetName(lyxCode())) << " -->";
-       os << MTag("mi");
-       NormalStream ns(os.os());
+       ms << "<!-- " << from_utf8(insetName(lyxCode())) << " -->";
+       ms << MTag("mi");
+       NormalStream ns(ms.os());
        normalize(ns);
-       os << ETag("mi");
+       ms << ETag("mi");
 }