]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / Buffer.cpp
index 63dee570eb036335eeeabaf30bd884e724a4de6a..9b8730d4658f080f398f3b1917b26efbc843ca04 100644 (file)
@@ -1457,8 +1457,8 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
        LaTeXFeatures features(*this, params(), runparams);
        validate(features);
        updateLabels(UpdateMaster, true);
-
-       d->texrow.reset();
+       checkBibInfoCache();
+       d->bibinfo_.collectCitedEntries(*this);
 
        if (!only_body) {
                os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
@@ -1640,18 +1640,23 @@ BiblioInfo const & Buffer::masterBibInfo() const
 
 BiblioInfo const & Buffer::localBibInfo() const
 {
-       if (d->bibinfoCacheValid_) {
-               support::FileNameList const & bibfilesCache = getBibfilesCache();
-               // compare the cached timestamps with the actual ones.
-               support::FileNameList::const_iterator ei = bibfilesCache.begin();
-               support::FileNameList::const_iterator en = bibfilesCache.end();
-               for (; ei != en; ++ ei) {
-                       time_t lastw = ei->lastModified();
-                       if (lastw != d->bibfileStatus_[*ei]) {
-                               d->bibinfoCacheValid_ = false;
-                               d->bibfileStatus_[*ei] = lastw;
-                               break;
-                       }
+       checkBibInfoCache();
+       return d->bibinfo_;
+}
+
+
+void Buffer::checkBibInfoCache() const 
+{
+       support::FileNameList const & bibfilesCache = getBibfilesCache();
+       // compare the cached timestamps with the actual ones.
+       support::FileNameList::const_iterator ei = bibfilesCache.begin();
+       support::FileNameList::const_iterator en = bibfilesCache.end();
+       for (; ei != en; ++ ei) {
+               time_t lastw = ei->lastModified();
+               time_t prevw = d->bibfileStatus_[*ei];
+               if (lastw != prevw) {
+                       d->bibinfoCacheValid_ = false;
+                       d->bibfileStatus_[*ei] = lastw;
                }
        }
 
@@ -1660,8 +1665,7 @@ BiblioInfo const & Buffer::localBibInfo() const
                for (InsetIterator it = inset_iterator_begin(inset()); it; ++it)
                        it->fillWithBibKeys(d->bibinfo_, it);
                d->bibinfoCacheValid_ = true;
-       }
-       return d->bibinfo_;
+       }       
 }
 
 
@@ -3203,6 +3207,14 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
        if (!success)
                return false;
 
+       if (d->cloned_buffer_) {
+               // Enable reverse dvi or pdf to work by copying back the texrow
+               // object to the cloned buffer.
+               // FIXME: There is a possibility of concurrent access to texrow
+               // here from the main GUI thread that should be securized.
+               d->cloned_buffer_->d->texrow = d->texrow;
+       }
+
        if (put_in_tempdir) {
                result_file = tmp_result_file.absFilename();
                return true;