]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
EmbeddedObjects.lyx, Math.lyx, UserGuide.lyx: Spanish translation updates by Ignacio
[lyx.git] / src / LyXFunc.cpp
index 4c035bf71159f14e7c54a8545a48ce73b71fed9d..3a29fecedc14d46997b14a0ebbf9faa1a9e7a945 100644 (file)
@@ -4,15 +4,15 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alfredo Braunstein
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  * \author Angus Leeming
  * \author John Levon
- * \author André Pönitz
+ * \author André Pönitz
  * \author Allan Rae
  * \author Dekel Tsur
  * \author Martin Vermeer
- * \author Jürgen Vigna
+ * \author Jürgen Vigna
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -395,7 +395,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);
@@ -568,6 +568,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        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:
@@ -1030,7 +1031,7 @@ 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");
@@ -1043,7 +1044,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");
                        }
@@ -1139,7 +1140,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
-                       updateLabels(*buf);
+                       buf->updateLabels();
                        lyx_view_->setBuffer(buf);
                        view()->setCursorFromRow(row);
                        if (loaded)
@@ -1293,7 +1294,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 +1349,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 +1358,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                func.origin = cmd.origin;
                                dispatch(func);
                        }
+                       if (theBufferList().isLoaded(buffer))
+                               buffer->undo().endUndoGroup();
                        break;
                }
 
@@ -1628,7 +1633,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        // notify insets we just left
                        if (view()->cursor() != old) {
                                old.fixIfBroken();
-                               bool badcursor = notifyCursorLeaves(old, view()->cursor());
+                               bool badcursor = notifyCursorLeavesOrEnters(old, view()->cursor());
                                if (badcursor)
                                        view()->cursor().fixIfBroken();
                        }
@@ -1730,11 +1735,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 +1803,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 +1833,8 @@ 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_AUTOREGIONDELETE:
        case LyXRC::RC_AUTORESET_OPTIONS:
        case LyXRC::RC_AUTOSAVE:
@@ -1942,6 +1950,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 +1978,4 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
 }
 
 } // namespace anon
-
-
 } // namespace lyx