This commit is contained in:
Richard Kimberly Heck 2021-01-14 01:15:19 -05:00
parent 9504ec84c5
commit 1582a2afe1
7 changed files with 27 additions and 25 deletions

View File

@ -1006,7 +1006,7 @@ int Buffer::readHeader(Lexer & lex)
params().shell_escape = theSession().shellescapeFiles().find(absFileName());
params().makeDocumentClass();
params().makeDocumentClass(isClone(), isInternal());
return unknown_tokens;
}

View File

@ -2567,7 +2567,7 @@ LayoutFileIndex const & BufferParams::baseClassID() const
}
void BufferParams::makeDocumentClass(bool const clone)
void BufferParams::makeDocumentClass(bool clone, bool internal)
{
if (!baseClass())
return;
@ -2577,7 +2577,7 @@ void BufferParams::makeDocumentClass(bool const clone)
for (auto const & mod : layout_modules_)
mods.push_back(mod);
doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone);
doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone, internal);
TextClass::ReturnValues success = TextClass::OK;
if (!forced_local_layout_.empty())

View File

@ -151,7 +151,7 @@ public:
/// on to class BufferView::updateDocumentClass(). The exception, of course,
/// is in GuiDocument, where we use a BufferParams simply to hold a copy of
/// the parameters from the active Buffer.
void makeDocumentClass(bool const clone = false);
void makeDocumentClass(bool clone = false, bool internal = false);
/// Returns the DocumentClass currently in use: the BaseClass as modified
/// by modules.
DocumentClass const & documentClass() const;

View File

@ -1024,7 +1024,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
void BufferView::makeDocumentClass()
{
DocumentClassConstPtr olddc = buffer_.params().documentClassPtr();
buffer_.params().makeDocumentClass();
buffer_.params().makeDocumentClass(buffer_.isClone(), buffer_.isInternal());
updateDocumentClass(olddc);
}

View File

@ -396,7 +396,7 @@ void Compare::run()
dest_buffer->params().documentClassPtr();
// We do not want to share the DocumentClass with the other Buffer.
// See bug #10295.
dest_buffer->params().makeDocumentClass();
dest_buffer->params().makeDocumentClass(dest_buffer->isClone(), dest_buffer->isInternal());
doStatusMessage();
// Do the real work

View File

@ -1868,25 +1868,26 @@ Layout TextClass::createBasicLayout(docstring const & name, bool unknown) const
}
DocumentClassPtr getDocumentClass(
LayoutFile const & baseClass, LayoutModuleList const & modlist,
string const & cengine, bool const clone)
DocumentClassPtr getDocumentClass(LayoutFile const & baseClass, LayoutModuleList const & modlist,
string const & cengine, bool clone, bool internal)
{
bool const show_warnings = !clone && !internal;
DocumentClassPtr doc_class =
DocumentClassPtr(new DocumentClass(baseClass));
for (auto const & mod : modlist) {
LyXModule * lm = theModuleList[mod];
if (!lm) {
docstring const msg =
bformat(_("The module %1$s has been requested by\n"
"this document but has not been found in the list of\n"
"available modules. If you recently installed it, you\n"
"probably need to reconfigure LyX.\n"), from_utf8(mod));
if (!clone)
if (show_warnings) {
docstring const msg =
bformat(_("The module %1$s has been requested by\n"
"this document but has not been found in the list of\n"
"available modules. If you recently installed it, you\n"
"probably need to reconfigure LyX.\n"), from_utf8(mod));
frontend::Alert::warning(_("Module not available"), msg);
}
continue;
}
if (!lm->isAvailable() && !clone) {
if (!lm->isAvailable() && show_warnings) {
docstring const prereqs = from_utf8(getStringFromVector(lm->prerequisites(), "\n\t"));
docstring const msg =
bformat(_("The module %1$s requires a package that is not\n"
@ -1911,14 +1912,15 @@ DocumentClassPtr getDocumentClass(
LyXCiteEngine * ce = theCiteEnginesList[cengine];
if (!ce) {
docstring const msg =
bformat(_("The cite engine %1$s has been requested by\n"
"this document but has not been found in the list of\n"
"available engines. If you recently installed it, you\n"
"probably need to reconfigure LyX.\n"), from_utf8(cengine));
if (!clone)
if (show_warnings) {
docstring const msg =
bformat(_("The cite engine %1$s has been requested by\n"
"this document but has not been found in the list of\n"
"available engines. If you recently installed it, you\n"
"probably need to reconfigure LyX.\n"), from_utf8(cengine));
frontend::Alert::warning(_("Cite Engine not available"), msg);
} else if (!ce->isAvailable() && !clone) {
}
} else if (!ce->isAvailable() && show_warnings) {
docstring const prereqs = from_utf8(getStringFromVector(ce->prerequisites(), "\n\t"));
docstring const msg =
bformat(_("The cite engine %1$s requires a package that is not\n"

View File

@ -564,7 +564,7 @@ private:
friend DocumentClassPtr
getDocumentClass(LayoutFile const &, LayoutModuleList const &,
std::string const &,
bool const clone);
bool clone, bool internal);
};
@ -575,7 +575,7 @@ private:
DocumentClassPtr getDocumentClass(LayoutFile const & baseClass,
LayoutModuleList const & modlist,
std::string const & cengine = std::string(),
bool const clone = false);
bool clone = false, bool internal = false);
/// convert page sides option to text 1 or 2
std::ostream & operator<<(std::ostream & os, PageSides p);