]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
more cursor dispatch
[lyx.git] / src / lyxfunc.C
index d079a8970b8c0a54a1b052f9e4be572ab5c75486..eee8bb805e99b32a84bb66e41fb365caf3489c8c 100644 (file)
@@ -162,13 +162,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
 
 void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
 {
-       string argument;
-
-       if (lyxerr.debugging(Debug::KEY)) {
-               lyxerr << "KeySym is "
-                      << keysym->getSymbolName()
-                      << endl;
-       }
+       lyxerr[Debug::KEY] << "KeySym is " << keysym->getSymbolName() << endl;
 
        // Do nothing if we have nothing (JMarc)
        if (!keysym->isOK()) {
@@ -254,9 +248,11 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
                if (encoded_last_key != 0) {
                        string arg;
                        arg += encoded_last_key;
+                       lyxerr << "SelfInsert arg[`"
+                                  << arg << "']" << endl;
                        dispatch(FuncRequest(LFUN_SELFINSERT, arg));
-                       lyxerr[Debug::KEY] << "SelfInsert arg[`"
-                                  << argument << "']" << endl;
+                       lyxerr[Debug::KEY]
+                               << "SelfInsert arg[`" << arg << "']" << endl;
                }
        } else {
                dispatch(func);
@@ -685,7 +681,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                        code = InsetOld::SPACE_CODE;
                break;
        case LFUN_INSET_DIALOG_SHOW: {
-               InsetBase * inset = view()->getLyXText()->getInset();
+               InsetBase * inset = view()->cursor().nextInset();
                disable = !inset;
                if (inset) {
                        code = inset->lyxCode();
@@ -835,14 +831,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
        // we have not done anything wrong yet.
        errorstat = false;
        dispatch_buffer.erase();
-
-#ifdef NEW_DISPATCHER
-       // We try do call the most specific dispatcher first:
-       //  1. the lockinginset's dispatch
-       //  2. the bufferview's dispatch
-       //  3. the lyxview's dispatch
-#endif
-
        selection_possible = false;
 
        // We cannot use this function here
@@ -1164,11 +1152,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                                                                << " found." << endl;
                        }
 
-                       par.lockPath(view());
-                       LyXText * lt = par.text(*view()->buffer());
-
                        // Set the cursor
-                       lt->setCursor(par.pit(), 0);
+                       view()->setCursor(par, 0);
+
                        view()->switchKeyMap();
                        owner->view_state_changed();
 
@@ -1286,7 +1272,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        break;
 
                case LFUN_INSET_DIALOG_SHOW: {
-                       InsetBase * inset = view()->getLyXText()->getInset();
+                       InsetBase * inset = view()->cursor().nextInset();
                        if (inset)
                                inset->dispatch(view()->cursor(), FuncRequest(LFUN_INSET_DIALOG_SHOW));
                        break;
@@ -1440,12 +1426,15 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        break;
 
                default:
-                       view()->cursor().dispatch(cmd);
+                       DispatchResult res = view()->cursor().dispatch(cmd);
+                       if (!res.dispatched());
+                               view()->dispatch(cmd);
                        break;
                }
        }
 
-       view()->owner()->updateLayoutChoice();
+       if (!view()->cursor().inMathed())
+               view()->owner()->updateLayoutChoice();
 
        if (view()->available()) {
                view()->fitCursor();
@@ -1458,7 +1447,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        view()->buffer()->markDirty();
        }
 
-       sendDispatchMessage(getMessage(), cmd, verbose);
+       if (!view()->cursor().inMathed())
+               sendDispatchMessage(getMessage(), cmd, verbose);
 }