]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
the spellcheck cleanup
[lyx.git] / src / lyxfunc.C
index cc2296d67d4b9f89e8cd1ad4e122005b7cb1fee3..a4bac22fb7dadafc68621160c4b1f061c35ed74e 100644 (file)
@@ -885,11 +885,17 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
        {
                Cursor cursor;
                buildCursor(cursor, *view());
-               if (cursor.dispatch(FuncRequest(func, view())) == DISPATCHED) {
+               DispatchResult result =
+                       cursor.dispatch(FuncRequest(func, view()));
+
+               if (result.dispatched()) {
+                       if (result.update()) {
+                               view()->update();
+                       }
                        lyxerr << "dispatched by Cursor::dispatch()\n";
                        goto exit_with_message;
                }
-               lyxerr << "### NOT DISPATCHED BY Cursor::dispatch() ###\n";
+               lyxerr << "### NOT DispatchResult(true, true) BY Cursor::dispatch() ###\n";
        }
 #endif
 
@@ -933,12 +939,15 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
 
                        // Hand-over to inset's own dispatch:
                        result = inset->dispatch(FuncRequest(view(), action, argument));
-                       if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
+                       if (result.dispatched()) {
+                               if (result.update())
+                                       view()->update();
+
                                goto exit_with_message;
                        }
 
-                       // If UNDISPATCHED, just soldier on
-                       if (result == FINISHED) {
+                       // If DispatchResult(false), just soldier on
+                       if (result.val() == FINISHED) {
                                owner->clearMessage();
                                goto exit_with_message;
                                // We do not need special RTL handling here:
@@ -946,14 +955,14 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                // one position after the inset.
                        }
 
-                       if (result == FINISHED_RIGHT) {
+                       if (result.val() == FINISHED_RIGHT) {
                                view()->text->cursorRight(view());
                                moveCursorUpdate();
                                owner->clearMessage();
                                goto exit_with_message;
                        }
 
-                       if (result == FINISHED_UP) {
+                       if (result.val() == FINISHED_UP) {
                                LyXText * text = view()->text;
                                ParagraphList::iterator pit = text->cursorPar();
                                Row const & row = *pit->getRow(text->cursor.pos());
@@ -963,7 +972,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                                text->cursor.x() + inset_x,
                                                text->cursor.y() -
                                                row.baseline() - 1);
-                                       text->cursor.x_fix(text->cursor.x());
+                                       view()->x_target(text->cursor.x());
 #else
                                        text->cursorUp(view());
 #endif
@@ -975,7 +984,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                goto exit_with_message;
                        }
 
-                       if (result == FINISHED_DOWN) {
+                       if (result.val() == FINISHED_DOWN) {
                                LyXText * text = view()->text;
                                ParagraphList::iterator pit = text->cursorPar();
                                Row const & row = *pit->getRow(text->cursor.pos());
@@ -986,7 +995,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                                text->cursor.y() -
                                                row.baseline() +
                                                row.height() + 1);
-                                       text->cursor.x_fix(text->cursor.x());
+                                       view()->x_target(text->cursor.x());
 #else
                                        text->cursorDown(view());
 #endif
@@ -999,7 +1008,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                        }
 
 #warning I am not sure this is still right, please have a look! (Jug 20020417)
-                       // result == UNDISPATCHED
+                       // result == DispatchResult()
                        //setMessage(N_("Text mode"));
                        switch (action) {
                        case LFUN_UNKNOWN_ACTION:
@@ -1078,7 +1087,8 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                }
                bool fw = (action == LFUN_WORDFINDFORWARD);
                if (!searched_string.empty())
-                       lyx::find::find(view(), searched_string, fw);
+                       lyx::find::find(view(), searched_string,
+                                       true, false, fw);
                break;
        }