]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_data.C
the DocIterator stuff
[lyx.git] / src / mathed / math_data.C
index 35c727e263d229ba291c87157b25a8013d5b1f60..7617621047e771cd031f7eaa09e28b1375f5cda7 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "math_data.h"
-#include "math_cursor.h"
 #include "math_fontinset.h"
 #include "math_scriptinset.h"
 #include "math_mathmlstream.h"
@@ -233,7 +232,7 @@ void MathArray::metrics(MetricsInfo & mi) const
                for (const_iterator it = begin(), et = end(); it != et; ++it) {
                        (*it)->metrics(mi, d);
                        dim_ += d;
-                       it->width_ = d.wid;
+                       //it->width_ = d.wid;
                }
        }
 }
@@ -264,9 +263,9 @@ void MathArray::draw(PainterInfo & pi, int x, int y) const
        }
 
        for (const_iterator it = begin(), et = end(); it != et; ++it) {
-               pi.width = it->width_;
+               //pi.width = it->width_;
                (*it)->draw(pi, x, y);
-               x += it->width_;
+               x += (*it)->width();
        }
 }
 
@@ -295,7 +294,8 @@ void MathArray::drawT(TextPainter & pain, int x, int y) const
 
        for (const_iterator it = begin(), et = end(); it != et; ++it) {
                (*it)->drawT(pain, x, y);
-               x += it->width_;
+               //x += (*it->width_;
+               x += 2;
        }
 }
 
@@ -314,7 +314,9 @@ int MathArray::pos2x(size_type pos, int glue) const
                const_iterator it = begin() + i;
                if ((*it)->getChar() == ' ')
                        x += glue;
-               x += it->width_;
+               //lyxerr << "char: " << (*it)->getChar()
+               //      << "width: " << (*it)->width() << std::endl;
+               x += (*it)->width();
        }
        return x;
 }
@@ -335,7 +337,7 @@ MathArray::size_type MathArray::x2pos(int targetx, int glue) const
                lastx = currx;
                if ((*it)->getChar() == ' ')
                        currx += glue;
-               currx += it->width_;
+               currx += (*it)->width();
        }
        if (abs(lastx - targetx) < abs(currx - targetx) && it != begin())
                --it;
@@ -371,6 +373,13 @@ void MathArray::boundingBox(int & x1, int & x2, int & y1, int & y2)
 }
 
 
+bool MathArray::contains(int x, int y) const
+{
+       return xo_ <= x && x <= xo_ + width()
+              && yo_ - ascent() <= y && y <= yo_ + descent();
+}
+
+
 void MathArray::center(int & x, int & y) const
 {
        x = xo_ + width() / 2;
@@ -403,6 +412,7 @@ void MathArray::notifyCursorLeaves()
 {
        // do not recurse!
 
+/*
        // remove base-only "scripts"
        for (pos_type i = 0; i + 1 < size(); ++i) {
                MathScriptInset * p = operator[](i).nucleus()->asScriptInset();
@@ -424,5 +434,5 @@ void MathArray::notifyCursorLeaves()
                        mathcursor->adjust(i, -1);
                }
        }
-
+*/
 }