]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_textinset.C
bug + spped fixes + small stuff
[lyx.git] / src / mathed / math_textinset.C
index 0c8772d7c36bda2f255e406f6379ff146866866d..952692be2896f205eee0a27939b0e5a03c5c32b4 100644 (file)
 
 #include "math_textinset.h"
 #include "math_data.h"
-#include "metricsinfo.h"
+
+#include "cursor_slice.h"
 #include "debug.h"
+#include "metricsinfo.h"
 
 using std::auto_ptr;
 using std::endl;
@@ -40,12 +42,13 @@ MathInset::idx_type MathTextInset::pos2row(pos_type pos) const
 }
 
 
-void MathTextInset::getScreenPos(idx_type /*idx*/, pos_type pos, int & x, int & y) const
+void MathTextInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
 {
-       idx_type const i = pos2row(pos);
-       pos_type const p = pos - cache_.cellinfo_[i].begin_;
-       cache_.getScreenPos(i, p, x, y);
-       y = cache_.cell(i).yo();
+       CursorSlice c = cur;
+       c.idx() = pos2row(cur.pos());
+       c.pos() -= cache_.cellinfo_[c.idx()].begin_;
+       cache_.getCursorPos(c, x, y);
+       y = cache_.cell(c.idx()).yo();
 }
 
 
@@ -111,14 +114,14 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
                        safepos = i;
                        ++spaces;
                        // restart chunk with size of the space
-                       curr = cell(0)[i].width_;
+                       curr = cell(0)[i]->width();
                        continue;
                }
 
                if (c != '\n') {
                        // This is a regular char. Go on if we either don't care for
                        // the width limit or have not reached that limit.
-                       curr += cell(0)[i].width_;
+                       curr += cell(0)[i]->width();
                        if (curr + safe <= mi.base.textwidth)
                                continue;
                }
@@ -184,8 +187,10 @@ void MathTextInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+/*
 void MathTextInset::drawSelection(PainterInfo & pi,
                idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const
 {
        cache_.drawSelection(pi, idx1, pos1, idx2, pos2);
 }
+*/