mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Load child documents unconditionally at updateLabels() time.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23513 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a4d5b78430
commit
af6e88250a
@ -429,9 +429,6 @@ void BiblioInfo::fillWithBibKeys(Buffer const * const buf)
|
||||
return;
|
||||
}
|
||||
|
||||
// Pre-load all child documents.
|
||||
buf->loadChildDocuments();
|
||||
|
||||
for (InsetIterator it = inset_iterator_begin(buf->inset()); it; ++it)
|
||||
it->fillWithBibKeys(*this, it);
|
||||
}
|
||||
|
@ -1069,6 +1069,8 @@ void Buffer::writeLaTeXSource(odocstream & os,
|
||||
OutputParams const & runparams_in,
|
||||
bool const output_preamble, bool const output_body) const
|
||||
{
|
||||
// The child documents, if any, shall be already loaded at this point.
|
||||
|
||||
OutputParams runparams = runparams_in;
|
||||
|
||||
// validate the buffer.
|
||||
@ -1133,12 +1135,10 @@ void Buffer::writeLaTeXSource(odocstream & os,
|
||||
|
||||
LYXERR(Debug::INFO, "preamble finished, now the body.");
|
||||
|
||||
// load children, if not already done.
|
||||
// This includes an updateMacro() call.
|
||||
// Don't move this behind the parent_buffer=0 code below,
|
||||
// because then the macros will not get the right "redefinition"
|
||||
// flag as they don't see the parent macros which are output before.
|
||||
loadChildDocuments();
|
||||
updateMacros();
|
||||
|
||||
// fold macros if possible, still with parent buffer as the
|
||||
// macros will be put in the prefix anyway.
|
||||
@ -1292,7 +1292,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
||||
|
||||
params().documentClass().counters().reset();
|
||||
|
||||
loadChildDocuments();
|
||||
updateMacros();
|
||||
|
||||
sgml::openTag(os, top);
|
||||
os << '\n';
|
||||
@ -1346,7 +1346,7 @@ void Buffer::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
params().validate(features);
|
||||
|
||||
loadChildDocuments();
|
||||
updateMacros();
|
||||
|
||||
for_each(paragraphs().begin(), paragraphs().end(),
|
||||
boost::bind(&Paragraph::validate, _1, boost::ref(features)));
|
||||
@ -1371,7 +1371,7 @@ void Buffer::getLabelList(vector<docstring> & list) const
|
||||
return;
|
||||
}
|
||||
|
||||
loadChildDocuments();
|
||||
updateMacros();
|
||||
|
||||
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it)
|
||||
it.nextInset()->getLabelList(list);
|
||||
@ -2379,26 +2379,6 @@ void Buffer::resetChildDocuments(bool close_them) const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::loadChildDocuments() const
|
||||
{
|
||||
bool parse_error = false;
|
||||
|
||||
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
|
||||
if (it->lyxCode() != INCLUDE_CODE)
|
||||
continue;
|
||||
InsetCommand const & inset = static_cast<InsetCommand const &>(*it);
|
||||
InsetCommandParams const & ip = inset.params();
|
||||
Buffer * child = loadIfNeeded(*this, ip);
|
||||
if (!child)
|
||||
continue;
|
||||
parse_error |= !child->errorList("Parse").empty();
|
||||
child->loadChildDocuments();
|
||||
}
|
||||
|
||||
updateMacros();
|
||||
}
|
||||
|
||||
|
||||
string Buffer::bufferFormat() const
|
||||
{
|
||||
if (isDocBook())
|
||||
|
@ -435,8 +435,6 @@ public:
|
||||
///
|
||||
void autoSave() const;
|
||||
///
|
||||
void loadChildDocuments() const;
|
||||
///
|
||||
void resetChildDocuments(bool close_them) const;
|
||||
|
||||
/// return the format of the buffer on a string
|
||||
|
@ -491,7 +491,7 @@ void updateLabels(Buffer const & buf, bool childonly)
|
||||
// start over the counters
|
||||
textclass.counters().reset();
|
||||
buf.clearReferenceCache();
|
||||
buf.loadChildDocuments();
|
||||
buf.updateMacros();
|
||||
}
|
||||
|
||||
Buffer & cbuf = const_cast<Buffer &>(buf);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "BufferView.h"
|
||||
#include "Cursor.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "ErrorList.h"
|
||||
#include "Exporter.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
@ -297,7 +298,7 @@ Buffer * getChildBuffer(Buffer const & buffer, InsetCommandParams const & params
|
||||
if (!isLyXFilename(included_file))
|
||||
return 0;
|
||||
|
||||
Buffer * childBuffer = theBufferList().getBuffer(included_file);
|
||||
Buffer * childBuffer = loadIfNeeded(buffer, params);
|
||||
|
||||
// FIXME: recursive includes
|
||||
return (childBuffer == &buffer) ? 0 : childBuffer;
|
||||
@ -333,6 +334,10 @@ Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params)
|
||||
theBufferList().release(child);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!child->errorList("Parse").empty()) {
|
||||
// FIXME: Do something.
|
||||
}
|
||||
}
|
||||
child->setParent(&parent);
|
||||
return child;
|
||||
|
Loading…
Reference in New Issue
Block a user