]> git.lyx.org Git - lyx.git/commitdiff
Force BibTeX rerun upon add/remove/change citation (fixes #6955).
authorJulien Rioux <jrioux@lyx.org>
Sat, 12 Jan 2013 00:04:07 +0000 (01:04 +0100)
committerJulien Rioux <jrioux@lyx.org>
Sat, 12 Jan 2013 09:12:25 +0000 (10:12 +0100)
Reordering citations is one case where catching "Citation undefined
on page ..." doesn't catch the need for a bibtex rerun. This patch
ensures the proper ordering is obtained in pdf output without having
to resort to closing and reopening the LyX document.

src/insets/InsetCitation.cpp
src/insets/InsetCitation.h

index d5c43535b101a79a706b559e066b25b8de12f90e..2778e199a06bc21c56501f69f1e7ed08a28a5f58 100644 (file)
@@ -44,7 +44,16 @@ ParamInfo InsetCitation::param_info_;
 
 InsetCitation::InsetCitation(Buffer * buf, InsetCommandParams const & p)
        : InsetCommand(buf, p)
-{}
+{
+       buffer().removeBiblioTempFiles();
+}
+
+
+InsetCitation::~InsetCitation()
+{
+       if (isBufferLoaded())
+               buffer().removeBiblioTempFiles();
+}
 
 
 ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */)
@@ -105,8 +114,10 @@ bool InsetCitation::isCompatibleCommand(string const & cmd)
 
 void InsetCitation::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       if (cmd.action() == LFUN_INSET_MODIFY)
+       if (cmd.action() == LFUN_INSET_MODIFY) {
+               buffer().removeBiblioTempFiles();
                cache.recalculate = true;
+       }
        InsetCommand::doDispatch(cur, cmd);
 }
 
index 0cdde7b2ee7ece7666fcaa85ffcece71dc95a36c..e29c3997fb8fcfa8953512c13cb2fa40c46f5324 100644 (file)
@@ -31,6 +31,8 @@ class InsetCitation : public InsetCommand
 public:
        ///
        InsetCitation(Buffer * buf, InsetCommandParams const &);
+       ///
+       ~InsetCitation();
 
        /// \name Public functions inherited from Inset class
        //@{