theFontMetrics(d->cursor_.getFont().fontInfo());
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
- Point const p = getPos(d->cursor_, d->cursor_.boundary());
+ Point const p = getPos(d->cursor_);
if (p.y_ - asc >= 0 && p.y_ + des < height_)
return false;
}
newy = last;
break;
case CUR_INSIDE:
- int const y = getPos(oldcur, oldcur.boundary()).y_;
+ int const y = getPos(oldcur).y_;
newy = min(last, max(y, first));
if (y == newy)
return;
// FIXME: This does not work within mathed!
CursorStatus BufferView::cursorStatus(DocIterator const & dit) const
{
- Point const p = getPos(dit, dit.boundary());
+ Point const p = getPos(dit);
if (p.y_ < 0)
return CUR_ABOVE;
if (p.y_ > workHeight())
case LFUN_SCREEN_UP:
case LFUN_SCREEN_DOWN: {
- Point p = getPos(cur, cur.boundary());
+ Point p = getPos(cur);
// This code has been commented out to enable to scroll down a
// document, even if there are large insets in it (see bug #5465).
/*if (p.y_ < 0 || p.y_ > height_) {
// The cursor is off-screen so recenter before proceeding.
showCursor();
- p = getPos(cur, cur.boundary());
+ p = getPos(cur);
}*/
int const scrolled = scroll(act == LFUN_SCREEN_UP
? -height_ : height_);
cur.finishUndo();
break;
}
- int y = getPos(cur, cur.boundary()).y_;
+ int y = getPos(cur).y_;
int const ymin = y - height_ + defaultRowHeight();
while (y > ymin && cur.up())
- y = getPos(cur, cur.boundary()).y_;
+ y = getPos(cur).y_;
cur.finishUndo();
dr.update(Update::SinglePar | Update::FitCursor);
cur.finishUndo();
break;
}
- int y = getPos(cur, cur.boundary()).y_;
+ int y = getPos(cur).y_;
int const ymax = y + height_ - defaultRowHeight();
while (y < ymax && cur.down())
- y = getPos(cur, cur.boundary()).y_;
+ y = getPos(cur).y_;
cur.finishUndo();
dr.update(Update::SinglePar | Update::FitCursor);
}
-Point BufferView::getPos(DocIterator const & dit, bool boundary) const
+Point BufferView::getPos(DocIterator const & dit) const
{
if (!paragraphVisible(dit))
return Point(-1, -1);
CursorSlice const & bot = dit.bottom();
TextMetrics const & tm = textMetrics(bot.text());
- Point p = coordOffset(dit, boundary); // offset from outer paragraph
+ Point p = coordOffset(dit, dit.boundary()); // offset from outer paragraph
p.y_ += tm.parMetrics(bot.pit()).position();
return p;
}
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
h = asc + des;
- p = getPos(cur, cur.boundary());
+ p = getPos(cur);
p.y_ -= asc;
}
// avoid invalid nesting when selecting
if (bv.cursorStatus(it) == CUR_INSIDE
&& (!cur.selection() || positionable(it, cur.realAnchor()))) {
- Point p = bv.getPos(it, false);
+ // If this function is ever used again, check whether this
+ // is the same as "bv.getPos(it, false)" with boundary = false.
+ Point p = bv.getPos(it);
int xo = p.x_;
int yo = p.y_;
if (xlow <= xo && xo <= xhigh && ylow <= yo && yo <= yhigh) {
void Cursor::getPos(int & x, int & y) const
{
- Point p = bv().getPos(*this, boundary());
+ Point p = bv().getPos(*this);
x = p.x_;
y = p.y_;
}
// with and without selection are handled differently
if (!selection()) {
- int yo = bv().getPos(*this, boundary()).y_;
+ int yo = bv().getPos(*this).y_;
Cursor old = *this;
// To next/previous row
if (up)
cur.boundary(begin_boundary);
int x1 = cursorX(beg.top(), begin_boundary);
int x2 = cursorX(end.top(), end_boundary);
- int const y1 = bv_->getPos(cur, cur.boundary()).y_ - row.ascent();
+ int const y1 = bv_->getPos(cur).y_ - row.ascent();
int const y2 = y1 + row.height();
int const rm = text_->isMainText() ? bv_->rightMargin() : 0;
wordStart.pos() -= word.length();
// get position on screen of the word start and end
- Point lxy = cur.bv().getPos(wordStart, false);
- Point rxy = cur.bv().getPos(bvcur, bvcur.boundary());
+ //FIXME: Is it necessary to explicitly set this to false?
+ wordStart.boundary(false);
+ Point lxy = cur.bv().getPos(wordStart);
+ Point rxy = cur.bv().getPos(bvcur);
// calculate dimensions of the word
dim = rowHeight(bvcur.pit(), wordStart.pos(), bvcur.pos(), false);