]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
More 'standard conformant blurb' nonsense.
[lyx.git] / src / text3.C
index e1d1373422fd00ee0cf6877d02749607be5286a2..29c8d568133ce15f93f89ed0aa858af383860f8a 100644 (file)
@@ -240,19 +240,19 @@ void LyXText::cursorPrevious()
 {
        int y = top_y();
 
-       if (cursorRow() == rows().begin()) {
+       RowList::iterator rit = cursorRow();
+
+       if (rit == firstRow()) {
                if (y > 0)
                        bv()->updateScrollbar();
                return;
        }
 
-       RowList::iterator cursorrow = cursorRow();
-
        setCursorFromCoordinates(cursor.x_fix(), y);
        finishUndo();
 
        int new_y;
-       if (cursorrow == bv()->text->cursorRow()) {
+       if (rit == bv()->text->cursorRow()) {
                // we have a row which is taller than the workarea. The
                // simplest solution is to move to the previous row instead.
                cursorUp(true);
@@ -263,24 +263,22 @@ void LyXText::cursorPrevious()
                if (inset_owner) {
                        new_y = bv()->text->cursor.iy()
                                + bv()->theLockingInset()->insetInInsetY() + y
-                               + cursorRow()->height()
+                               + rit->height()
                                - bv()->workHeight() + 1;
                } else {
                        new_y = cursor.y()
-                               - cursorRow()->baseline()
-                               + cursorRow()->height()
+                               - rit->baseline()
+                               + rit->height()
                                - bv()->workHeight() + 1;
                }
        }
-       //bv()->screen().draw(bv()->text, bv(), new_y < 0 ? 0 : new_y);
-       if (cursorRow() != rows().begin()) {
-               LyXCursor cur;
-               setCursor(cur, boost::prior(cursorRow())->par(),
-                         boost::prior(cursorRow())->pos(), false);
-               if (cur.y() > top_y()) {
-                       cursorUp(true);
-               }
-       }
+
+       LyXCursor cur;
+       ParagraphList::iterator pit = cursor.par();
+       previousRow(pit, rit);
+       setCursor(cur, pit, rit->pos(), false);
+       if (cur.y() > top_y())
+               cursorUp(true);
        bv()->updateScrollbar();
 }
 
@@ -289,13 +287,11 @@ void LyXText::cursorNext()
 {
        int topy = top_y();
 
-       if (boost::next(cursorRow()) == rows().end()) {
-               int y = cursor.y() - cursorRow()->baseline() +
-                       cursorRow()->height();
-               if (y > topy + bv()->workHeight()) {
-                       //bv()->screen().draw(bv()->text, bv(), bv()->text->top_y() + bv()->workHeight());
+       RowList::iterator rit = cursorRow();
+       if (rit == lastRow()) {
+               int y = cursor.y() - rit->baseline() + cursorRow()->height();
+               if (y > topy + bv()->workHeight())
                        bv()->updateScrollbar();
-               }
                return;
        }
 
@@ -306,15 +302,15 @@ void LyXText::cursorNext()
                          + bv()->theLockingInset()->insetInInsetY());
        }
 
-       getRowNearY(y);
+       ParagraphList::iterator dummypit;
+       getRowNearY(y, dummypit);
 
-       RowList::iterator cursorrow = cursorRow();
        setCursorFromCoordinates(cursor.x_fix(), y);
        // + bv->workHeight());
        finishUndo();
 
        int new_y;
-       if (cursorrow == bv()->text->cursorRow()) {
+       if (rit == bv()->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);
@@ -328,21 +324,18 @@ void LyXText::cursorNext()
                if (inset_owner) {
                        new_y = bv()->text->cursor.iy()
                                + bv()->theLockingInset()->insetInInsetY()
-                               + y - cursorRow()->baseline();
+                               + y - rit->baseline();
                } else {
-                       new_y =  cursor.y() - cursorRow()->baseline();
-               }
-       }
-       //bv()->screen().draw(bv()->text, bv(), new_y);
-
-       RowList::iterator next_row = boost::next(cursorRow());
-       if (next_row != rows().end()) {
-               LyXCursor cur;
-               setCursor(cur, next_row->par(), next_row->pos(), false);
-               if (cur.y() < top_y() + bv()->workHeight()) {
-                       cursorDown(true);
+                       new_y = cursor.y() - cursorRow()->baseline();
                }
        }
+
+       ParagraphList::iterator pit = cursor.par();
+       nextRow(pit, rit);      
+       LyXCursor cur;
+       setCursor(cur, pit, rit->pos(), false);
+       if (cur.y() < top_y() + bv()->workHeight())
+               cursorDown(true);
        bv()->updateScrollbar();
 }
 
@@ -409,7 +402,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        if (tmp->params().startOfAppendix()) {
                                recordUndo(bv, Undo::ATOMIC, tmp);
                                tmp->params().startOfAppendix(false);
-                               setHeightOfRow(getRow(tmp, 0));
+                               setHeightOfRow(tmp, getRow(tmp, 0));
                                break;
                        }
                }
@@ -1179,14 +1172,10 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                if (!isInInset() && bv->theLockingInset())
                        break;
                if (cmd.button() == mouse_button::button1) {
-                       if (!isInInset())
-                               bv->screen().toggleSelection(this, bv);
                        cursorHome();
                        selection.cursor = cursor;
                        cursorEnd();
                        setSelection();
-                       if (!isInInset())
-                               bv->screen().toggleSelection(this, bv, false);
                        bv->update();
                        bv->haveSelection(selection.set());
                }
@@ -1198,13 +1187,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                if (!isInInset() && bv->theLockingInset())
                        break;
                if (cmd.button() == mouse_button::button1) {
-                       if (!isInInset()) {
-                               bv->screen().toggleSelection(this, bv);
-                               selectWord(lyx::WHOLE_WORD_STRICT);
-                               bv->screen().toggleSelection(this, bv, false);
-                       } else {
-                               selectWord(lyx::WHOLE_WORD_STRICT);
-                       }
+                       selectWord(lyx::WHOLE_WORD_STRICT);
                        bv->update();
                        bv->haveSelection(selection.set());
                }
@@ -1265,7 +1248,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
                bv->text->setSelection();
                bv->update();
-               bv->fitCursor();
                break;
        }
 
@@ -1321,7 +1303,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        selection_possible = true;
 
                // Clear the selection
-               bv->screen().toggleSelection(bv->text, bv);
                bv->text->clearSelection();
                bv->update();
                bv->updateScrollbar();
@@ -1442,7 +1423,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        // stack. They don't *have* to
                        // alter the document...
                        // (Joacim)
-                       // ...or maybe the SetCursorParUndo()
+                       // ...or maybe the recordUndo()
                        // below isn't necessary at all anylonger?
                        if (inset_hit->lyxCode() == InsetOld::REF_CODE)
                                recordUndo(bv, Undo::ATOMIC);
@@ -1512,6 +1493,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_INSET_CAPTION:
 #endif
        case LFUN_INSERT_NOTE:
+       case LFUN_INSERT_BRANCH:
        case LFUN_INSERT_BIBITEM:
        case LFUN_INSET_ERT:
        case LFUN_INSET_FLOAT: