// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
/// A cache for bibliography info
mutable BiblioInfo bibinfo_;
/// whether the bibinfo cache is valid
/// A cache for bibliography info
mutable BiblioInfo bibinfo_;
/// whether the bibinfo cache is valid
/// Cache of timestamps of .bib files
map<FileName, time_t> bibfile_status_;
/// Cache of timestamps of .bib files
map<FileName, time_t> bibfile_status_;
read_only(readonly_), filename(file), file_fully_loaded(false),
toc_backend(owner), macro_lock(false), timestamp_(0),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
read_only(readonly_), filename(file), file_fully_loaded(false),
toc_backend(owner), macro_lock(false), timestamp_(0),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
- cloned_buffer_(cloned_buffer), doing_export(false), parent_buffer(0)
+ bibfile_cache_valid_(false), cloned_buffer_(cloned_buffer),
+ doing_export(false), parent_buffer(0)
bibfiles_cache_ = cloned_buffer_->d->bibfiles_cache_;
bibinfo_ = cloned_buffer_->d->bibinfo_;
bibinfo_cache_valid_ = cloned_buffer_->d->bibinfo_cache_valid_;
bibfiles_cache_ = cloned_buffer_->d->bibfiles_cache_;
bibinfo_ = cloned_buffer_->d->bibinfo_;
bibinfo_cache_valid_ = cloned_buffer_->d->bibinfo_cache_valid_;
LaTeXFeatures features(*this, params(), runparams);
validate(features);
updateBuffer(UpdateMaster, OutputUpdate);
LaTeXFeatures features(*this, params(), runparams);
validate(features);
updateBuffer(UpdateMaster, OutputUpdate);
// If this is a child document, use the parent's cache instead.
Buffer const * const pbuf = d->parent();
if (pbuf && scope != UpdateChildOnly) {
// If this is a child document, use the parent's cache instead.
Buffer const * const pbuf = d->parent();
if (pbuf && scope != UpdateChildOnly) {
- inset.getBibfilesCache();
- d->bibfiles_cache_.insert(d->bibfiles_cache_.end(),
- bibfiles.begin(),
- bibfiles.end());
+ incbuf->getBibfilesCache(UpdateChildOnly);
+ if (!bibfiles.empty()) {
+ d->bibfiles_cache_.insert(d->bibfiles_cache_.end(),
+ bibfiles.begin(),
+ bibfiles.end());
+ }
- // If this is a child document, use the parent's cache instead.
+ d->bibfile_cache_valid_ = false;
+ d->bibinfo_cache_valid_ = false;
+ // also invalidate the cache for the parent buffer
- if (pbuf && scope != UpdateChildOnly)
+ if (pbuf)
+ pbuf->invalidateBibfileCache();
+}
+
+
+support::FileNameList const & Buffer::getBibfilesCache(UpdateScope scope) const
+{
+ // FIXME This is probably unnecessary, given where we call this.
+ // If this is a child document, use the master's cache instead.
+ Buffer const * const pbuf = masterBuffer();
+ if (pbuf != this && scope != UpdateChildOnly)
- // We update the cache when first used instead of at loading time.
- if (d->bibfiles_cache_.empty())
- const_cast<Buffer *>(this)->updateBibfilesCache(scope);
+ if (!d->bibfile_cache_valid_)
+ this->updateBibfilesCache(scope);
- support::FileNameList const & bibfilesCache = getBibfilesCache();
+ // use the master's cache
+ Buffer const * const tmp = masterBuffer();
+ if (tmp != this) {
+ tmp->checkBibInfoCache();
+ return;
+ }
+
+ // this will also reload the cache if it is invalid
+ support::FileNameList const & bibfiles_cache = getBibfilesCache();
+
- support::FileNameList::const_iterator ei = bibfilesCache.begin();
- support::FileNameList::const_iterator en = bibfilesCache.end();
+ support::FileNameList::const_iterator ei = bibfiles_cache.begin();
+ support::FileNameList::const_iterator en = bibfiles_cache.end();
for (; ei != en; ++ ei) {
time_t lastw = ei->lastModified();
time_t prevw = d->bibfile_status_[*ei];
for (; ei != en; ++ ei) {
time_t lastw = ei->lastModified();
time_t prevw = d->bibfile_status_[*ei];
DocumentClass const & textclass = master->params().documentClass();
// do this only if we are the top-level Buffer
DocumentClass const & textclass = master->params().documentClass();
// do this only if we are the top-level Buffer
SpellChecker::Result res = from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions);
if (SpellChecker::misspelled(res)) {
word_lang = wl;
SpellChecker::Result res = from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions);
if (SpellChecker::misspelled(res)) {
word_lang = wl;