#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;
}
-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();
}
#if 0
-bool MathTextInset::idxUpDown2(LCursor & pos, bool up,
- int /*targetx*/) const
+bool MathTextInset::idxUpDown2(LCursor & pos, bool up) const
{
// try to move only one screen row up or down if possible
idx_type i = pos2row(pos);
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;
}
}
+/*
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);
}
+*/