]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
* remove outdated RC_CUSTOM_EXPORT_COMMAND and RC_CUSTOM_EXPORT_FORMAT.
[lyx.git] / src / LyXFunc.cpp
index 912b3cd844d9f3a2660dd78e0a8fb614f5a7da4b..a08aa07d4a2c47ba869437ed9e4db4d5fb2c6444 100644 (file)
@@ -66,6 +66,7 @@
 #include "insets/InsetInclude.h"
 #include "insets/InsetListings.h"
 #include "insets/InsetNote.h"
+#include "insets/InsetPhantom.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetTabular.h"
 #include "insets/InsetVSpace.h"
@@ -256,15 +257,27 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
        if (!theBufferList().exists(bm.filename))
                return;
 
+       // bm can be changed when saving
+       BookmarksSection::Bookmark tmp = bm;
+
+       // Special case idx == 0 used for back-from-back jump navigation
+       if (idx == 0)
+               dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
+
        // if the current buffer is not that one, switch to it.
-       if (lyx_view_->buffer()->fileName() != bm.filename) {
+       if (lyx_view_->buffer()->fileName() != tmp.filename) {
                if (!switchToBuffer)
                        return;
                dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
        }
+
        // moveToPosition try paragraph id first and then paragraph (pit, pos).
-       if (!view()->moveToPosition(bm.bottom_pit, bm.bottom_pos,
-               bm.top_id, bm.top_pos))
+       if (!view()->moveToPosition(tmp.bottom_pit, tmp.bottom_pos,
+               tmp.top_id, tmp.top_pos))
+               return;
+
+       // bm changed
+       if (idx == 0)
                return;
 
        // Cursor jump succeeded!
@@ -395,7 +408,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        switch (cmd.action) {
        case LFUN_UNKNOWN_ACTION:
-#ifndef HAVE_LIBAIKSAURUS
+#if !defined(HAVE_LIBMYTHES) && !defined(HAVE_LIBAIKSAURUS)
        case LFUN_THESAURUS_ENTRY:
 #endif
                flag.unknown(true);
@@ -444,11 +457,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        flag.setOnOff(true);
                break;
 
-       case LFUN_BUFFER_EXPORT:
-               enable = cmd.argument() == "custom"
-                       || buf->isExportable(to_utf8(cmd.argument()));
-               break;
-
        case LFUN_BUFFER_CHKTEX:
                enable = buf->isLatex() && !lyxrc.chktex_command.empty();
                break;
@@ -458,7 +466,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        case LFUN_VC_REGISTER:
-               enable = !buf->lyxvc().inUse() && !buf->isUnnamed();
+               enable = !buf->lyxvc().inUse();
                break;
        case LFUN_VC_CHECK_IN:
                enable = buf->lyxvc().checkInEnabled();
@@ -519,7 +527,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        }
 
        case LFUN_BOOKMARK_CLEAR:
-               enable = theSession().bookmarks().size() > 0;
+               enable = theSession().bookmarks().hasValid();
                break;
 
        // this one is difficult to get right. As a half-baked
@@ -566,17 +574,47 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
 
+       case LFUN_VC_COMMAND: {
+               if (cmd.argument().empty())
+                       enable = false;
+
+               if (!buf && contains(cmd.getArg(0), 'D'))
+                       enable = false;
+               break;
+       }
+
+       case LFUN_MASTER_BUFFER_UPDATE:
+       case LFUN_MASTER_BUFFER_VIEW: 
+               if (!buf->parent()) {
+                       enable = false;
+                       break;
+               }
+       case LFUN_BUFFER_UPDATE:
+       case LFUN_BUFFER_VIEW: {
+               string format = to_utf8(cmd.argument());
+               if (cmd.argument().empty())
+                       format = buf->getDefaultOutputFormat();
+               typedef vector<Format const *> Formats;
+               Formats formats;
+               formats = buf->exportableFormats(true);
+               Formats::const_iterator fit = formats.begin();
+               Formats::const_iterator end = formats.end();
+               enable = false;
+               for (; fit != end ; ++fit) {
+                       if ((*fit)->name() == format)
+                               enable = true;
+               }
+               break;
+       }
+
        case LFUN_WORD_FIND_FORWARD:
        case LFUN_WORD_FIND_BACKWARD:
+       case LFUN_WORD_FINDADV:
        case LFUN_COMMAND_PREFIX:
        case LFUN_COMMAND_EXECUTE:
        case LFUN_CANCEL:
        case LFUN_META_PREFIX:
        case LFUN_BUFFER_CLOSE:
-       case LFUN_BUFFER_UPDATE:
-       case LFUN_BUFFER_VIEW:
-       case LFUN_MASTER_BUFFER_UPDATE:
-       case LFUN_MASTER_BUFFER_VIEW:
        case LFUN_BUFFER_IMPORT:
        case LFUN_BUFFER_AUTO_SAVE:
        case LFUN_RECONFIGURE:
@@ -596,7 +634,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_KEYMAP_TOGGLE:
        case LFUN_REPEAT:
        case LFUN_BUFFER_EXPORT_CUSTOM:
-       case LFUN_BUFFER_PRINT:
        case LFUN_PREFERENCES_SAVE:
        case LFUN_MESSAGE:
        case LFUN_INSET_EDIT:
@@ -630,14 +667,25 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                if (lyx_view_->getStatus(cmd, flag))
                        break;
 
-               // If we have a BufferView, try cursor position and
-               // then the BufferView.
+               // If we do not have a BufferView, then other functions are disabled
                if (!view()) {
                        enable = false;
                        break;
                }
-               if (!getLocalStatus(view()->cursor(), cmd, flag))
-                       flag = view()->getStatus(cmd);
+
+               // Is this a function that acts on inset at point?
+               Inset * inset = view()->cursor().nextInset();
+               if (lyxaction.funcHasFlag(cmd.action, LyXAction::AtPoint)
+                   && inset && inset->getStatus(view()->cursor(), cmd, flag))
+                       break;
+
+               bool decided = getLocalStatus(view()->cursor(), cmd, flag);
+               if (!decided)
+                       // try the BufferView
+                       decided = view()->getStatus(cmd, flag);
+               if (!decided)
+                       // try the Buffer
+                       view()->buffer().getStatus(cmd, flag);
        }
 
        if (!enable)
@@ -671,35 +719,35 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 bool LyXFunc::ensureBufferClean(BufferView * bv)
 {
        Buffer & buf = bv->buffer();
-       if (buf.isClean())
+       if (buf.isClean() && !buf.isUnnamed())
                return true;
 
        docstring const file = buf.fileName().displayName(30);
-       docstring text = bformat(_("The document %1$s has unsaved "
+       docstring title;
+       docstring text;
+       if (!buf.isUnnamed()) {
+               text = bformat(_("The document %1$s has unsaved "
                                             "changes.\n\nDo you want to save "
                                             "the document?"), file);
-       int const ret = Alert::prompt(_("Save changed document?"),
-                                     text, 0, 1, _("&Save"),
-                                     _("&Cancel"));
+               title = _("Save changed document?");
+               
+       } else {
+               text = bformat(_("The document %1$s has not been "
+                                            "saved yet.\n\nDo you want to save "
+                                            "the document?"), file);
+               title = _("Save new document?");
+       }
+       int const ret = Alert::prompt(title, text, 0, 1, _("&Save"), _("&Cancel"));
 
        if (ret == 0)
-               dispatch(FuncRequest(LFUN_BUFFER_WRITE));
+               lyx_view_->dispatch(FuncRequest(LFUN_BUFFER_WRITE));
 
-       return buf.isClean();
+       return buf.isClean() && !buf.isUnnamed();
 }
 
 
 namespace {
 
-void showPrintError(string const & name)
-{
-       docstring str = bformat(_("Could not print the document %1$s.\n"
-                                           "Check that your printer is set up correctly."),
-                            makeDisplayPath(name, 50));
-       Alert::error(_("Print document failed"), str);
-}
-
-
 bool loadLayoutFile(string const & name, string const & buf_path)
 {
        if (!LayoutFileList::get().haveClass(name)) {
@@ -826,25 +874,41 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
                }
 
-               case LFUN_BUFFER_UPDATE:
+               case LFUN_BUFFER_UPDATE: {
                        LASSERT(lyx_view_ && buffer, /**/);
-                       buffer->doExport(argument, true);
+                       string format = argument;
+                       if (argument.empty())
+                               format = buffer->getDefaultOutputFormat();
+                       buffer->doExport(format, true);
                        break;
+               }
 
-               case LFUN_BUFFER_VIEW:
+               case LFUN_BUFFER_VIEW: {
                        LASSERT(lyx_view_ && buffer, /**/);
-                       buffer->preview(argument);
+                       string format = argument;
+                       if (argument.empty())
+                               format = buffer->getDefaultOutputFormat();
+                       buffer->preview(format);
                        break;
+               }
 
-               case LFUN_MASTER_BUFFER_UPDATE:
+               case LFUN_MASTER_BUFFER_UPDATE: {
                        LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
-                       buffer->masterBuffer()->doExport(argument, true);
+                       string format = argument;
+                       if (argument.empty())
+                               format = buffer->masterBuffer()->getDefaultOutputFormat();
+                       buffer->masterBuffer()->doExport(format, true);
                        break;
+               }
 
-               case LFUN_MASTER_BUFFER_VIEW:
+               case LFUN_MASTER_BUFFER_VIEW: {
                        LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
-                       buffer->masterBuffer()->preview(argument);
+                       string format = argument;
+                       if (argument.empty())
+                               format = buffer->masterBuffer()->getDefaultOutputFormat();
+                       buffer->masterBuffer()->preview(format);
                        break;
+               }
 
                case LFUN_BUILD_PROGRAM:
                        LASSERT(lyx_view_ && buffer, /**/);
@@ -904,111 +968,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
                }
 
-               case LFUN_BUFFER_PRINT: {
-                       LASSERT(lyx_view_ && buffer, /**/);
-                       // FIXME: cmd.getArg() might fail if one of the arguments
-                       // contains double quotes
-                       string target = cmd.getArg(0);
-                       string target_name = cmd.getArg(1);
-                       string command = cmd.getArg(2);
-
-                       if (target.empty()
-                           || target_name.empty()
-                           || command.empty()) {
-                               lyxerr << "Unable to parse \""
-                                      << argument << '"' << endl;
-                               break;
-                       }
-                       if (target != "printer" && target != "file") {
-                               lyxerr << "Unrecognized target \""
-                                      << target << '"' << endl;
-                               break;
-                       }
-
-                       if (!buffer->doExport("dvi", true)) {
-                               showPrintError(buffer->absFileName());
-                               break;
-                       }
-
-                       // Push directory path.
-                       string const path = buffer->temppath();
-                       // Prevent the compiler from optimizing away p
-                       FileName pp(path);
-                       PathChanger p(pp);
-
-                       // there are three cases here:
-                       // 1. we print to a file
-                       // 2. we print directly to a printer
-                       // 3. we print using a spool command (print to file first)
-                       Systemcall one;
-                       int res = 0;
-                       string const dviname =
-                               changeExtension(buffer->latexName(true), "dvi");
-
-                       if (target == "printer") {
-                               if (!lyxrc.print_spool_command.empty()) {
-                                       // case 3: print using a spool
-                                       string const psname =
-                                               changeExtension(dviname,".ps");
-                                       command += ' ' + lyxrc.print_to_file
-                                               + quoteName(psname)
-                                               + ' '
-                                               + quoteName(dviname);
-
-                                       string command2 =
-                                               lyxrc.print_spool_command + ' ';
-                                       if (target_name != "default") {
-                                               command2 += lyxrc.print_spool_printerprefix
-                                                       + target_name
-                                                       + ' ';
-                                       }
-                                       command2 += quoteName(psname);
-                                       // First run dvips.
-                                       // If successful, then spool command
-                                       res = one.startscript(
-                                               Systemcall::Wait,
-                                               command);
-
-                                       if (res == 0)
-                                               res = one.startscript(
-                                                       Systemcall::DontWait,
-                                                       command2);
-                               } else {
-                                       // case 2: print directly to a printer
-                                       if (target_name != "default")
-                                               command += ' ' + lyxrc.print_to_printer + target_name + ' ';
-                                       res = one.startscript(
-                                               Systemcall::DontWait,
-                                               command + quoteName(dviname));
-                               }
-
-                       } else {
-                               // case 1: print to a file
-                               FileName const filename(makeAbsPath(target_name,
-                                                       buffer->filePath()));
-                               FileName const dvifile(makeAbsPath(dviname, path));
-                               if (filename.exists()) {
-                                       docstring text = bformat(
-                                               _("The file %1$s already exists.\n\n"
-                                                 "Do you want to overwrite that file?"),
-                                               makeDisplayPath(filename.absFilename()));
-                                       if (Alert::prompt(_("Overwrite file?"),
-                                           text, 0, 1, _("&Overwrite"), _("&Cancel")) != 0)
-                                               break;
-                               }
-                               command += ' ' + lyxrc.print_to_file
-                                       + quoteName(filename.toFilesystemEncoding())
-                                       + ' '
-                                       + quoteName(dvifile.toFilesystemEncoding());
-                               res = one.startscript(Systemcall::DontWait,
-                                                     command);
-                       }
-
-                       if (res != 0)
-                               showPrintError(buffer->absFileName());
-                       break;
-               }
-
                // FIXME: There is need for a command-line import.
                /*
                case LFUN_BUFFER_IMPORT:
@@ -1030,10 +989,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                theApp()->dispatch(FuncRequest(LFUN_WINDOW_NEW));
                        string const arg = argument;
                        if (arg.empty()) {
-                               setErrorMessage(from_ascii(N_("Missing argument")));
+                               setErrorMessage(from_utf8(N_("Missing argument")));
                                break;
                        }
-                       FileName const fname = i18nLibFileSearch("doc", arg, "lyx");
+                       FileName fname = i18nLibFileSearch("doc", arg, "lyx");
+                       if (fname.empty()) 
+                               fname = i18nLibFileSearch("examples", arg, "lyx");
+
                        if (fname.empty()) {
                                lyxerr << "LyX: unable to find documentation file `"
                                                         << arg << "'. Bad installation?" << endl;
@@ -1043,7 +1005,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                makeDisplayPath(fname.absFilename())));
                        Buffer * buf = lyx_view_->loadDocument(fname, false);
                        if (buf) {
-                               updateLabels(*buf);
+                               buf->updateLabels();
                                lyx_view_->setBuffer(buf);
                                buf->errors("Parse");
                        }
@@ -1054,11 +1016,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                // --- version control -------------------------------
                case LFUN_VC_REGISTER:
                        LASSERT(lyx_view_ && buffer, /**/);
-                       if (!ensureBufferClean(view()) || buffer->isUnnamed())
+                       if (!ensureBufferClean(view()))
                                break;
                        if (!buffer->lyxvc().inUse()) {
-                               buffer->lyxvc().registrer();
-                               reloadBuffer();
+                               if (buffer->lyxvc().registrer())
+                                       reloadBuffer();
                        }
                        updateFlags = Update::Force;
                        break;
@@ -1139,7 +1101,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
-                       updateLabels(*buf);
+                       buf->updateLabels();
                        lyx_view_->setBuffer(buf);
                        view()->setCursorFromRow(row);
                        if (loaded)
@@ -1167,7 +1129,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                InsetCommandParams p(code);
                                data = InsetCommand::params2string(name, p);
                                break;
-                       } 
+                       }
                        case INCLUDE_CODE: {
                                // data is the include type: one of "include",
                                // "input", "verbatiminput" or "verbatiminput*"
@@ -1177,62 +1139,67 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                InsetCommandParams p(INCLUDE_CODE, data);
                                data = InsetCommand::params2string("include", p);
                                break;
-                       } 
+                       }
                        case BOX_CODE: {
                                // \c data == "Boxed" || "Frameless" etc
                                InsetBoxParams p(data);
                                data = InsetBox::params2string(p);
                                break;
-                       } 
+                       }
                        case BRANCH_CODE: {
                                InsetBranchParams p;
                                data = InsetBranch::params2string(p);
                                break;
-                       } 
+                       }
                        case CITE_CODE: {
                                InsetCommandParams p(CITE_CODE);
                                data = InsetCommand::params2string(name, p);
                                break;
-                       } 
+                       }
                        case ERT_CODE: {
                                data = InsetERT::params2string(InsetCollapsable::Open);
                                break;
-                       } 
+                       }
                        case EXTERNAL_CODE: {
                                InsetExternalParams p;
                                data = InsetExternal::params2string(p, *buffer);
                                break;
-                       } 
+                       }
                        case FLOAT_CODE:  {
                                InsetFloatParams p;
                                data = InsetFloat::params2string(p);
                                break;
-                       } 
+                       }
                        case LISTINGS_CODE: {
                                InsetListingsParams p;
                                data = InsetListings::params2string(p);
                                break;
-                       } 
+                       }
                        case GRAPHICS_CODE: {
                                InsetGraphicsParams p;
                                data = InsetGraphics::params2string(p, *buffer);
                                break;
-                       } 
+                       }
                        case NOTE_CODE: {
                                InsetNoteParams p;
                                data = InsetNote::params2string(p);
                                break;
-                       } 
+                       }
+                       case PHANTOM_CODE: {
+                               InsetPhantomParams p;
+                               data = InsetPhantom::params2string(p);
+                               break;
+                       }
                        case SPACE_CODE: {
                                InsetSpaceParams p;
                                data = InsetSpace::params2string(p);
                                break;
-                       } 
+                       }
                        case VSPACE_CODE: {
                                VSpace space;
                                data = InsetVSpace::params2string(space);
                                break;
-                       } 
+                       }
                        case WRAP_CODE: {
                                InsetWrapParams p;
                                data = InsetWrap::params2string(p);
@@ -1293,7 +1260,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                // This makes insertion of citations and references in the child work,
                                // when the target is in the parent or another child document.
                                child->setParent(buffer);
-                               updateLabels(*child->masterBuffer());
+                               child->masterBuffer()->updateLabels();
                                lyx_view_->setBuffer(child);
                                if (parsed)
                                        child->errors("Parse");
@@ -1348,6 +1315,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                case LFUN_COMMAND_SEQUENCE: {
                        // argument contains ';'-terminated commands
                        string arg = argument;
+                       if (theBufferList().isLoaded(buffer))
+                               buffer->undo().beginUndoGroup();
                        while (!arg.empty()) {
                                string first;
                                arg = split(arg, first, ';');
@@ -1355,6 +1324,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                func.origin = cmd.origin;
                                dispatch(func);
                        }
+                       if (theBufferList().isLoaded(buffer))
+                               buffer->undo().endUndoGroup();
                        break;
                }
 
@@ -1582,6 +1553,48 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        theSession().bookmarks().clear();
                        break;
 
+               case LFUN_VC_COMMAND: {
+                       string flag = cmd.getArg(0);
+                       if (buffer && contains(flag, 'R') && !ensureBufferClean(view()))
+                               break;
+                       docstring message;
+                       if (contains(flag, 'M'))
+                               if (!Alert::askForText(message, _("LyX VC: Log Message")))
+                                       break;
+
+                       string path = cmd.getArg(1);
+                       if (contains(path, "$$p") && buffer)
+                               path = subst(path, "$$p", buffer->filePath());
+                       LYXERR(Debug::LYXVC, "Directory: " << path);
+                       FileName pp(path);
+                       if (!pp.isReadableDirectory()) {
+                               lyxerr << _("Directory is not accessible.") << endl;
+                               break;
+                       }
+                       support::PathChanger p(pp);
+
+                       string command = cmd.getArg(2);
+                       if (command.empty())
+                               break;
+                       if (buffer) {
+                               command = subst(command, "$$i", buffer->absFileName());
+                               command = subst(command, "$$p", buffer->filePath());
+                       }
+                       command = subst(command, "$$m", to_utf8(message));
+                       LYXERR(Debug::LYXVC, "Command: " << command);
+                       Systemcall one;
+                       one.startscript(Systemcall::Wait, command);
+
+                       if (!buffer)
+                               break;
+                       if (contains(flag, 'I'))
+                               buffer->markDirty();
+                       if (contains(flag, 'R'))
+                               reloadBuffer();
+
+                       break;
+               }
+
                default:
                        LASSERT(theApp(), /**/);
                        // Let the frontend dispatch its own actions.
@@ -1619,6 +1632,28 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
+                       // OK, so try the Buffer itself
+                       DispatchResult dr;
+                       view()->buffer().dispatch(cmd, dr);
+                       if (dr.dispatched()) {
+                               updateFlags = dr.update();
+                               break;
+                       }
+
+                       // Is this a function that acts on inset at point?
+                       Inset * inset = view()->cursor().nextInset();
+                       if (lyxaction.funcHasFlag(action, LyXAction::AtPoint)
+                           && inset) {
+                               view()->cursor().result().dispatched(true);
+                               view()->cursor().result().update(Update::FitCursor | Update::Force);
+                               FuncRequest tmpcmd = cmd;
+                               inset->dispatch(view()->cursor(), tmpcmd);
+                               if (view()->cursor().result().dispatched()) {
+                                       updateFlags = view()->cursor().result().update();
+                                       break;
+                               }
+                       }
+
                        // Let the current Cursor dispatch its own actions.
                        Cursor old = view()->cursor();
                        view()->cursor().getPos(cursorPosBeforeDispatchX_,
@@ -1730,11 +1765,14 @@ void LyXFunc::reloadBuffer()
        // The user has already confirmed that the changes, if any, should
        // be discarded. So we just release the Buffer and don't call closeBuffer();
        theBufferList().release(lyx_view_->buffer());
+       // if the lyx_view_ has been destroyed, create a new one
+       if (!lyx_view_)
+               theApp()->dispatch(FuncRequest(LFUN_WINDOW_NEW));
        Buffer * buf = lyx_view_->loadDocument(filename);
        docstring const disp_fn = makeDisplayPath(filename.absFilename());
        docstring str;
        if (buf) {
-               updateLabels(*buf);
+               buf->updateLabels();
                lyx_view_->setBuffer(buf);
                buf->errors("Parse");
                str = bformat(_("Document %1$s reloaded."), disp_fn);
@@ -1795,20 +1833,20 @@ bool LyXFunc::wasMetaKey() const
 }
 
 
-void LyXFunc::updateLayout(DocumentClass const * const oldlayout, Buffer * buffer)
+void LyXFunc::updateLayout(DocumentClass const * const oldlayout, Buffer * buf)
 {
        lyx_view_->message(_("Converting document to new document class..."));
        
        StableDocIterator backcur(view()->cursor());
-       ErrorList & el = buffer->errorList("Class Switch");
+       ErrorList & el = buf->errorList("Class Switch");
        cap::switchBetweenClasses(
-                       oldlayout, buffer->params().documentClassPtr(),
-                       static_cast<InsetText &>(buffer->inset()), el);
+                       oldlayout, buf->params().documentClassPtr(),
+                       static_cast<InsetText &>(buf->inset()), el);
 
-       view()->setCursor(backcur.asDocIterator(&(buffer->inset())));
+       view()->setCursor(backcur.asDocIterator(buf));
 
-       buffer->errors("Class Switch");
-       updateLabels(*buffer);
+       buf->errors("Class Switch");
+       buf->updateLabels();
 }
 
 
@@ -1825,8 +1863,9 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        switch (tag) {
        case LyXRC::RC_ACCEPT_COMPOUND:
        case LyXRC::RC_ALT_LANG:
-       case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
        case LyXRC::RC_PLAINTEXT_LINELEN:
+       case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
+       case LyXRC::RC_AUTOCORRECTION_MATH:
        case LyXRC::RC_AUTOREGIONDELETE:
        case LyXRC::RC_AUTORESET_OPTIONS:
        case LyXRC::RC_AUTOSAVE:
@@ -1851,12 +1890,12 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
        case LyXRC::RC_COPIER:
        case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
-       case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
-       case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
+       case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
        case LyXRC::RC_DATE_INSERT_FORMAT:
        case LyXRC::RC_DEFAULT_LANGUAGE:
        case LyXRC::RC_GUI_LANGUAGE:
        case LyXRC::RC_DEFAULT_PAPERSIZE:
+       case LyXRC::RC_DEFAULT_VIEW_FORMAT:
        case LyXRC::RC_DEFFILE:
        case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
        case LyXRC::RC_DISPLAY_GRAPHICS:
@@ -1935,6 +1974,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SHOW_BANNER:
        case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
        case LyXRC::RC_SPELL_COMMAND:
+       case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
        case LyXRC::RC_TEMPDIRPATH:
        case LyXRC::RC_TEMPLATEPATH:
        case LyXRC::RC_TEX_ALLOWS_SPACES:
@@ -1942,6 +1982,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
                if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
                        os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
                }
+       case LyXRC::RC_THESAURUSDIRPATH:
        case LyXRC::RC_UIFILE:
        case LyXRC::RC_USER_EMAIL:
        case LyXRC::RC_USER_NAME:
@@ -1969,6 +2010,4 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
 }
 
 } // namespace anon
-
-
 } // namespace lyx