]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Fix caption numbering of child documents.
[lyx.git] / src / BufferView.cpp
index 27beef22c097ef2ef5c315a5ac12510f5ba05315..85ac21a8e34dc280191ebd2e1d8190c0f1c905a6 100644 (file)
@@ -870,10 +870,9 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
        case LFUN_NEXT_INSET_TOGGLE: 
        case LFUN_NEXT_INSET_MODIFY: {
                // this is the real function we want to invoke
-               FuncCode const code = 
-                       (cmd.action == LFUN_NEXT_INSET_TOGGLE) 
+               FuncRequest tmpcmd = cmd;
+               tmpcmd.action = (cmd.action == LFUN_NEXT_INSET_TOGGLE) 
                        ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY;
-               FuncRequest const tmpcmd = FuncRequest(code, cmd.argument());
                // if there is an inset at cursor, see whether it
                // handles the lfun, other start from scratch
                Inset * inset = cur.nextInset();
@@ -936,10 +935,14 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 
        case LFUN_INSET_SETTINGS: {
                InsetCode code = cur.inset().lyxCode();
-               if (cur.nextInset())
-                       code = cur.nextInset()->lyxCode();
+               if (cmd.getArg(0) == insetName(code)) {
+                       flag.enabled(true);
+                       break;
+               }
                bool enable = false;
-               switch (code) {
+               InsetCode next_code = cur.nextInset()
+                       ? cur.nextInset()->lyxCode() : NO_CODE;
+               switch (next_code) {
                        case TABULAR_CODE:
                        case ERT_CODE:
                        case FLOAT_CODE:
@@ -949,7 +952,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
                        case BOX_CODE:
                        case LISTINGS_CODE:
                                enable = (cmd.argument().empty() ||
-                                         cmd.getArg(0) == insetName(code));
+                                         cmd.getArg(0) == insetName(next_code));
                                break;
                        default:
                                break;
@@ -1052,7 +1055,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_PARAGRAPH_GOTO: {
-               int const id = convert<int>(to_utf8(cmd.argument()));
+               int const id = convert<int>(cmd.getArg(0));
+               int const pos = convert<int>(cmd.getArg(1));
                int i = 0;
                for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
                        b = theBufferList().next(b)) {
@@ -1069,6 +1073,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
 
                        if (b == &buffer_) {
                                // Set the cursor
+                               dit.pos() = pos;
                                setCursor(dit);
                                processUpdateFlags(Update::Force | Update::FitCursor);
                        } else {
@@ -1275,8 +1280,9 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                break;
        
        case LFUN_NEXT_INSET_TOGGLE: {
-               // this is the real function we want to invoke
-               FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.origin);
+               // create the the real function we want to invoke
+               FuncRequest tmpcmd = cmd;
+               tmpcmd.action = LFUN_INSET_TOGGLE;
                // if there is an inset at cursor, see whether it
                // wants to toggle.
                Inset * inset = cur.nextInset();
@@ -1285,12 +1291,10 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                                Cursor tmpcur = cur;
                                tmpcur.pushBackward(*inset);
                                inset->dispatch(tmpcur, tmpcmd);
-                               if (tmpcur.result().dispatched()) {
+                               if (tmpcur.result().dispatched())
                                        cur.dispatched();
-                               }
-                       } else if (inset->editable() == Inset::IS_EDITABLE) {
-                               inset->edit(cur, true);
-                       }
+                       } else 
+                               inset->dispatch(cur, tmpcmd);
                }
                // if it did not work, try the underlying inset.
                if (!inset || !cur.result().dispatched())
@@ -1305,8 +1309,9 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_NEXT_INSET_MODIFY: {
-               // this is the real function we want to invoke
-               FuncRequest tmpcmd = FuncRequest(LFUN_INSET_MODIFY, cmd.argument());
+               // create the the real function we want to invoke
+               FuncRequest tmpcmd = cmd;
+               tmpcmd.action = LFUN_INSET_MODIFY;
                // if there is an inset at cursor, see whether it
                // can be modified.
                Inset * inset = cur.nextInset();