bibliography information in updateBuffer(), rather than doing a wholly
separate traversal. We still do a separate traversal in two cases, as a
full updateBuffer() call just isn't needed there.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36696
a592a061-630c-0410-9148-
cb99ea01b6c8
+BiblioInfo & Buffer::masterBibInfo()
+{
+ Buffer * tmp = const_cast<Buffer *>(masterBuffer());
+ if (tmp != this)
+ return tmp->masterBibInfo();
+ return d->bibinfo_;
+}
+
+
bool Buffer::isBibInfoCacheValid() const
{
bool Buffer::isBibInfoCacheValid() const
{
+ // use the master's cache
+ Buffer const * const tmp = masterBuffer();
+ if (tmp != this)
+ return tmp->isBibInfoCacheValid();
return d->bibinfo_cache_valid_;
}
return d->bibinfo_cache_valid_;
}
// do this only if we are the top-level Buffer
if (master == this)
// do this only if we are the top-level Buffer
if (master == this)
+ checkIfBibInfoCacheIsValid();
// keep the buffers to be children in this set. If the call from the
// master comes back we can see which of them were actually seen (i.e.
// keep the buffers to be children in this set. If the call from the
// master comes back we can see which of them were actually seen (i.e.
/// whether the cache is valid. If so, we do nothing. If not, then we
/// reload all the BibTeX info.
/// Note that this operates on the master document.
/// whether the cache is valid. If so, we do nothing. If not, then we
/// reload all the BibTeX info.
/// Note that this operates on the master document.
+ /// Normally, this is done (more cheaply) in updateBuffer(), but there are
+ /// times when we need to force it to be done and don't need a full buffer
+ /// update. This is in GuiCitation and in changeRefsIfUnique() now.
void reloadBibInfoCache() const;
/// Was the cache valid the last time we checked?
bool isBibInfoCacheValid() const;
/// \return the bibliography information for this buffer's master,
/// or just for it, if it isn't a child.
BiblioInfo const & masterBibInfo() const;
void reloadBibInfoCache() const;
/// Was the cache valid the last time we checked?
bool isBibInfoCacheValid() const;
/// \return the bibliography information for this buffer's master,
/// or just for it, if it isn't a child.
BiblioInfo const & masterBibInfo() const;
+ BiblioInfo & masterBibInfo();
///
void fillWithBibKeys(BiblioInfo & keys) const;
///
///
void fillWithBibKeys(BiblioInfo & keys) const;
///
} else {
autolabel_ = from_ascii("??");
}
} else {
autolabel_ = from_ascii("??");
}
+ if (!buffer().isBibInfoCacheValid()) {
+ BiblioInfo bi = buffer().masterBibInfo();
+ docstring const key = getParam("key");
+ BibTeXInfo keyvalmap(false);
+ keyvalmap.label(bibLabel());
+ keyvalmap[from_ascii("ref")] = it.paragraph().asString();
+ bi[key] = keyvalmap;
+ }
+void InsetBibtex::updateBuffer(ParIterator const &, UpdateType)
+{
+ if (buffer().isBibInfoCacheValid())
+ return;
+ BiblioInfo & bi = buffer().masterBibInfo();
+ fillWithBibKeys(bi);
+}
+
+
int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
{
// the sequence of the commands:
int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
{
// the sequence of the commands:
-// This method returns a comma separated list of Bibtex entries
void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist,
InsetIterator const & /*di*/) const
void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist,
InsetIterator const & /*di*/) const
+{
+ fillWithBibKeys(keylist);
+}
+
+
+void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist) const
{
// This bibtex parser is a first step to parse bibtex files
// more precisely.
{
// This bibtex parser is a first step to parse bibtex files
// more precisely.
///
int latex(odocstream &, OutputParams const &) const;
///
///
int latex(odocstream &, OutputParams const &) const;
///
+ void updateBuffer(ParIterator const &, UpdateType);
+ ///
void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
///
void validate(LaTeXFeatures &) const;
void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
///
void validate(LaTeXFeatures &) const;
getBibTeXPath(docstring const & filename, Buffer const & buf);
///
void editDatabases() const;
getBibTeXPath(docstring const & filename, Buffer const & buf);
///
void editDatabases() const;
+ ///
+ void fillWithBibKeys(BiblioInfo &) const;
/// \name Private functions inherited from Inset class
//@{
/// \name Private functions inherited from Inset class
//@{