-bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
- int /*x*/, int y, int asc, int desc)
-{
- int const vheight = workarea().workHeight();
- int const topy = bv->top_y();
- int newtop = topy;
-
-
- if (y + desc - topy >= vheight)
- newtop = y - 3 * vheight / 4; // the scroll region must be so big!!
- else if (y - asc < topy && topy > 0)
- newtop = y - vheight / 4;
-
- newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
-
- if (newtop == topy)
- return false;
-
- bv->top_y(newtop);
- return true;
-}
-
-
-unsigned int LyXScreen::topCursorVisible(LyXText * text)
-{
- LyXCursor const & cursor = text->cursor;
- int top_y = text->bv()->top_y();
- int newtop = top_y;
- int const vheight = workarea().workHeight();
-
- RowList::iterator row = text->cursorRow();
-
- if (int(cursor.y() - row->baseline() + row->height() - top_y) >= vheight) {
- if (row->height() < vheight
- && row->height() > vheight / 4) {
- newtop = cursor.y()
- + row->height()
- - row->baseline() - vheight;
- } else {
- // scroll down, the scroll region must be so big!!
- newtop = cursor.y() - vheight / 2;
- }
-
- } else if (int(cursor.y() - row->baseline()) < top_y && top_y > 0) {
- if (row->height() < vheight && row->height() > vheight / 4) {
- newtop = cursor.y() - row->baseline();
- } else {
- // scroll up
- newtop = cursor.y() - vheight / 2;
- newtop = min(newtop, top_y);
- }
- }
-
- return max(newtop, 0);
-}
-
-
-bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)