]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
Point fix, earlier forgotten
[lyx.git] / src / text3.C
index 5ec9b25a46b42362cd898683e9320d00d89bbe6d..2203305b57043c42851a1ad68b8790623b97fa30 100644 (file)
@@ -116,16 +116,16 @@ namespace {
 
                int const width = inset->width();
                int const inset_x = font.isVisibleRightToLeft()
-                       ? (cur.ix() - width) : cur.ix();
+                       ? (cur.x() - width) : cur.x();
 
                Box b(
                        inset_x + inset->scroll(),
                        inset_x + width,
-                       cur.iy() - inset->ascent(),
-                       cur.iy() + inset->descent()
+                       cur.y() - inset->ascent(),
+                       cur.y() + inset->descent()
                );
 
-               if (!b.contained(x, y)) {
+               if (!b.contains(x, y)) {
                        lyxerr[Debug::GUI] << "Missed inset at x,y "
                                           << x << ',' << y
                                           << " box " << b << endl;
@@ -136,7 +136,7 @@ namespace {
 
                x -= b.x1;
                // The origin of an inset is on the baseline
-               y -= text.cursor.iy();
+               y -= text.cursor.y();
 
                return inset;
        }
@@ -146,7 +146,7 @@ namespace {
 
 InsetOld * LyXText::checkInsetHit(int & x, int & y)
 {
-       int y_tmp = y + top_y();
+       int y_tmp = y + bv_owner->top_y();
 
        LyXCursor cur;
        setCursorFromCoordinates(cur, x, y_tmp);
@@ -243,7 +243,7 @@ void LyXText::gotoInset(InsetOld::Code code, bool same_content)
 
 void LyXText::cursorPrevious()
 {
-       int y = top_y();
+       int y = bv_owner->top_y();
 
        RowList::iterator rit = cursorRow();
 
@@ -266,7 +266,7 @@ void LyXText::cursorPrevious()
                // tall rows, but it's not working right now.
        } else {
                if (inset_owner) {
-                       new_y = bv()->text->cursor.iy()
+                       new_y = bv()->text->cursor.y()
                                + bv()->theLockingInset()->insetInInsetY() + y
                                + rit->height()
                                - bv()->workHeight() + 1;
@@ -282,7 +282,7 @@ void LyXText::cursorPrevious()
        ParagraphList::iterator pit = cursor.par();
        previousRow(pit, rit);
        setCursor(cur, pit, rit->pos(), false);
-       if (cur.y() > top_y())
+       if (cur.y() > bv_owner->top_y())
                cursorUp(true);
        bv()->updateScrollbar();
 }
@@ -290,32 +290,32 @@ void LyXText::cursorPrevious()
 
 void LyXText::cursorNext()
 {
-       int topy = top_y();
+       int topy = bv_owner->top_y();
 
        RowList::iterator rit = cursorRow();
        if (rit == lastRow()) {
                int y = cursor.y() - rit->baseline() + cursorRow()->height();
                if (y > topy + bv()->workHeight())
-                       bv()->updateScrollbar();
+                       bv_owner->updateScrollbar();
                return;
        }
 
-       int y = topy + bv()->workHeight();
+       int y = topy + bv_owner->workHeight();
        if (inset_owner && !topy) {
-               y -= (bv()->text->cursor.iy()
-                         - bv()->text->top_y()
-                         + bv()->theLockingInset()->insetInInsetY());
+               y -= (bv_owner->text->cursor.y()
+                         - bv_owner->top_y()
+                         + bv_owner->theLockingInset()->insetInInsetY());
        }
 
        ParagraphList::iterator dummypit;
-       getRowNearY(y, dummypit);
+       y = getRowNearY(y, dummypit)->y();
 
        setCursorFromCoordinates(cursor.x_fix(), y);
        // + bv->workHeight());
        finishUndo();
 
        int new_y;
-       if (rit == bv()->text->cursorRow()) {
+       if (rit == bv_owner->text->cursorRow()) {
                // we have a row which is taller than the workarea. The
                // simplest solution is to move to the next row instead.
                cursorDown(true);
@@ -323,11 +323,11 @@ void LyXText::cursorNext()
                // This is what we used to do, so we wouldn't skip right past
                // tall rows, but it's not working right now.
 #if 0
-               new_y = bv->text->top_y() + bv->workHeight();
+               new_y = bv->top_y() + bv->workHeight();
 #endif
        } else {
                if (inset_owner) {
-                       new_y = bv()->text->cursor.iy()
+                       new_y = bv()->text->cursor.y()
                                + bv()->theLockingInset()->insetInInsetY()
                                + y - rit->baseline();
                } else {
@@ -336,10 +336,10 @@ void LyXText::cursorNext()
        }
 
        ParagraphList::iterator pit = cursor.par();
-       nextRow(pit, rit);      
+       nextRow(pit, rit);
        LyXCursor cur;
        setCursor(cur, pit, rit->pos(), false);
-       if (cur.y() < top_y() + bv()->workHeight())
+       if (cur.y() < bv_owner->top_y() + bv()->workHeight())
                cursorDown(true);
        bv()->updateScrollbar();
 }
@@ -355,7 +355,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
        if (!bv->insertInset(new_inset))
                delete new_inset;
        else
-               bv->updateInset();
+               bv->updateInset(new_inset);
 }
 
 
@@ -1214,11 +1214,11 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        LyXFont font = bv->text->getFont(cursor.par(), cursor.pos());
                        int width = tli->width();
                        int inset_x = font.isVisibleRightToLeft()
-                               ? cursor.ix() - width : cursor.ix();
+                               ? cursor.x() - width : cursor.x();
                        int start_x = inset_x + tli->scroll();
                        FuncRequest cmd1 = cmd;
                        cmd1.x = cmd.x - start_x;
-                       cmd1.y = cmd.y - cursor.iy() + bv->text->top_y();
+                       cmd1.y = cmd.y - cursor.y() + bv->top_y();
                        tli->localDispatch(cmd1);
                        break;
                }
@@ -1233,7 +1233,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                }
 
                RowList::iterator cursorrow = bv->text->cursorRow();
-               bv->text->setCursorFromCoordinates(cmd.x, cmd.y + bv->text->top_y());
+               bv->text->setCursorFromCoordinates(cmd.x, cmd.y + bv->top_y());
        #if 0
                // sorry for this but I have a strange error that the y value jumps at
                // a certain point. This seems like an error in my xforms library or
@@ -1289,7 +1289,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        paste_internally = true;
                }
 
-               int const screen_first = bv->text->top_y();
+               int const screen_first = bv->top_y();
 
                if (bv->theLockingInset()) {
                        // We are in inset locking mode