]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_rootinset.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_rootinset.C
index d67cd851361bff5ba29097baf781d2138f3629cb..c9bd8e618877cd06dea1d8e7aca5315378a3b8aa 100644 (file)
@@ -20,7 +20,7 @@
 #include "Painter.h"
 
 MathRootInset::MathRootInset()
-       : MathInset(2)
+       : MathNestInset(2)
 {}
 
 
@@ -30,9 +30,9 @@ MathInset * MathRootInset::clone() const
 }
 
 
-void MathRootInset::metrics(MathStyles st)
+void MathRootInset::metrics(MathMetricsInfo const & st) const
 {
-       MathInset::metrics(st);
+       MathNestInset::metrics(st);
        size_    = st;
        ascent_  = std::max(xcell(0).ascent()  + 5, xcell(1).ascent())  + 2;
        descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
@@ -40,7 +40,7 @@ void MathRootInset::metrics(MathStyles st)
 }
 
 
-void MathRootInset::draw(Painter & pain, int x, int y)
+void MathRootInset::draw(Painter & pain, int x, int y) const
 {
        xo(x);
        yo(y);
@@ -60,13 +60,9 @@ void MathRootInset::draw(Painter & pain, int x, int y)
 }
 
 
-void MathRootInset::write(std::ostream & os, bool fragile) const
+void MathRootInset::write(MathWriteInfo & os) const
 {
-       os << "\\sqrt[";
-       cell(0).write(os, fragile);  
-       os << "]{";
-       cell(1).write(os, fragile);
-       os << '}';
+       os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
 }
 
 
@@ -79,15 +75,17 @@ void MathRootInset::writeNormal(std::ostream & os) const
        os << "] ";
 }
 
+
 bool MathRootInset::idxUp(int & idx, int & pos) const
 {
        if (idx == 0)
                return false;
        idx = 0;
-       pos = 0;
+       pos = cell(0).size();
        return true;
 }
 
+
 bool MathRootInset::idxDown(int & idx, int & pos) const
 {
        if (idx == 1)