]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_rootinset.C
first shot at preview. It crashes. Don't know why. To see it work a bit, change
[lyx.git] / src / mathed / math_rootinset.C
index 597cf0a9ce6f2002d47b6e5da6d3eb71930cc1c2..bf3c211f94f9dbf12d1effc501aa81dad24ce1f3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  File:        math_root.C
- *  Purpose:     Implementation of the root object 
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
+ *  Purpose:     Implementation of the root object
+ *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
  *  Created:     January 1999
  *  Description: Root math object
  *
@@ -17,7 +17,7 @@
 
 #include "math_rootinset.h"
 #include "math_mathmlstream.h"
-#include "Painter.h"
+#include "frontends/Painter.h"
 
 
 using std::max;
@@ -34,7 +34,7 @@ MathInset * MathRootInset::clone() const
 }
 
 
-void MathRootInset::metrics(MathMetricsInfo const & mi) const
+void MathRootInset::metrics(MathMetricsInfo & mi) const
 {
        MathNestInset::metrics(mi);
        ascent_  = max(xcell(0).ascent()  + 5, xcell(1).ascent())  + 2;
@@ -43,7 +43,7 @@ void MathRootInset::metrics(MathMetricsInfo const & mi) const
 }
 
 
-void MathRootInset::draw(Painter & pain, int x, int y) const
+void MathRootInset::draw(MathPainterInfo & pain, int x, int y) const
 {
        int const w = xcell(0).width();
        // the "exponent"
@@ -59,7 +59,7 @@ 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::math);
+       pain.pain.lines(xp, yp, 5, LColor::math);
 }
 
 
@@ -71,24 +71,16 @@ void MathRootInset::write(WriteStream & os) const
 
 void MathRootInset::normalize(NormalStream & os) const
 {
-       os << "[root " << cell(1) << ' ' << cell(1) << ']';
+       os << "[root " << cell(0) << ' ' << cell(1) << ']';
 }
 
 
-bool MathRootInset::idxUp(idx_type & idx) const
+bool MathRootInset::idxUpDown(idx_type & idx, bool up) const
 {
-       if (idx == 0)
+       bool target = !up; // up ? 0 : 1;
+       if (idx == target)
                return false;
-       idx = 0;
-       return true;
-}
-
-
-bool MathRootInset::idxDown(idx_type & idx) const
-{
-       if (idx == 1)
-               return false;
-       idx = 1;
+       idx = target;
        return true;
 }