]> git.lyx.org Git - features.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 15:35:45 +0000 (16:35 +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
status.20x

index d3f9271c6a75d8851c1a98b3baf7fe7afb91398e..c8078b9b5c23bfc915d99dcd2d2d667401933170 100644 (file)
@@ -45,7 +45,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 */)
@@ -104,8 +113,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 6eb0da03fc52c540c7d0fa3d88b15d4d14653bcd..6061938bb4077547dad9e1df41fe88b6f4a59a33 100644 (file)
@@ -31,6 +31,8 @@ class InsetCitation : public InsetCommand
 public:
        ///
        InsetCitation(Buffer * buf, InsetCommandParams const &);
+       ///
+       ~InsetCitation();
 
        /// \name Public functions inherited from Inset class
        //@{
index 1815a245503b1cd288556ef6073e15585363a45e..e8fd820b9c35e863a6af2f47d4d368b53e59b709 100644 (file)
@@ -98,6 +98,8 @@ What's new
 
 - Use document language when exporting citations to LyXHTML (bug 7732).
 
+- Reordering citations in LyX is now rendered in the output (bug 6955).
+
 - Fix InsetLayout's LatexParam output: \begin{inset}[latexparam].