]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
the spellcheck cleanup
[lyx.git] / src / lyxfunc.C
index 91bf61f3b96913f7d0a7be1af02c091ea2a58776..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())) == DispatchResult(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 DispatchResult(DISPATCHED) BY Cursor::dispatch() ###\n";
+               lyxerr << "### NOT DispatchResult(true, true) BY Cursor::dispatch() ###\n";
        }
 #endif
 
@@ -933,27 +939,30 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
 
                        // Hand-over to inset's own dispatch:
                        result = inset->dispatch(FuncRequest(view(), action, argument));
-                       if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
+                       if (result.dispatched()) {
+                               if (result.update())
+                                       view()->update();
+
                                goto exit_with_message;
                        }
 
-                       // If DispatchResult(UNDISPATCHED), just soldier on
-                       if (result == DispatchResult(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:
-                               // DispatchResult(FINISHED) means that the cursor should be
+                               // FINISHED means that the cursor should be
                                // one position after the inset.
                        }
 
-                       if (result == DispatchResult(FINISHED_RIGHT)) {
+                       if (result.val() == FINISHED_RIGHT) {
                                view()->text->cursorRight(view());
                                moveCursorUpdate();
                                owner->clearMessage();
                                goto exit_with_message;
                        }
 
-                       if (result == DispatchResult(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 == DispatchResult(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
@@ -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;
        }