]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_rootinset.C
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
[lyx.git] / src / mathed / math_rootinset.C
index d5190cea733e9879884afa6fde5c7ae16ac6abde..41162470f11f2ebc8a6ead22fc90c34706a4e171 100644 (file)
@@ -16,7 +16,7 @@
 #endif
 
 #include "math_rootinset.h"
-#include "support/LOstream.h"
+#include "math_mathmlstream.h"
 #include "Painter.h"
 
 
@@ -42,8 +42,6 @@ void MathRootInset::metrics(MathMetricsInfo const & mi) const
 
 void MathRootInset::draw(Painter & pain, int x, int y) const
 {
-       xo(x);
-       yo(y);
        int const w = xcell(0).width();
        xcell(0).draw(pain, x, y - 5 - xcell(0).descent());       // the "exponent"
        xcell(1).draw(pain, x + w + 8, y);   // the "base"
@@ -56,41 +54,47 @@ void MathRootInset::draw(Painter & pain, int x, int y) const
        xp[2] = x + w;        yp[2] = y + d;
        xp[3] = x + w - 2;    yp[3] = y + (d - a)/2 + 2;
        xp[4] = x;            yp[4] = y + (d - a)/2 + 2;
-       pain.lines(xp, yp, 5, LColor::mathline);
+       pain.lines(xp, yp, 5, LColor::math);
 }
 
 
-void MathRootInset::write(MathWriteInfo & os) const
+void MathRootInset::write(WriteStream & os) const
 {
        os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
 }
 
 
-void MathRootInset::writeNormal(std::ostream & os) const
+void MathRootInset::normalize(NormalStream & os) const
 {
-       os << "[root ";
-       cell(1).writeNormal(os);  
-       os << " ";
-       cell(0).writeNormal(os);
-       os << "] ";
+       os << "[root " << cell(1) << ' ' << cell(1) << ']';
 }
 
 
-bool MathRootInset::idxUp(int & idx, int & pos) const
+bool MathRootInset::idxUp(idx_type & idx) const
 {
        if (idx == 0)
                return false;
        idx = 0;
-       pos = cell(0).size();
        return true;
 }
 
 
-bool MathRootInset::idxDown(int & idx, int & pos) const
+bool MathRootInset::idxDown(idx_type & idx) const
 {
        if (idx == 1)
                return false;
        idx = 1;
-       pos = 0;
        return true;
 }
+
+
+void MathRootInset::octavize(OctaveStream & os) const
+{
+       os << "root(" << cell(1) << ',' << cell(0) <<')';
+}
+
+
+void MathRootInset::mathmlize(MathMLStream & os) const
+{
+       os << MTag("mroot") << cell(1) << cell(0) << ETag("mroot");
+}