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().shell_escape = theSession().shellescapeFiles().find(absFileName());
params().makeDocumentClass(); params().makeDocumentClass(isClone(), isInternal());
return unknown_tokens; 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()) if (!baseClass())
return; return;
@ -2577,7 +2577,7 @@ void BufferParams::makeDocumentClass(bool const clone)
for (auto const & mod : layout_modules_) for (auto const & mod : layout_modules_)
mods.push_back(mod); 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; TextClass::ReturnValues success = TextClass::OK;
if (!forced_local_layout_.empty()) if (!forced_local_layout_.empty())

View File

@ -151,7 +151,7 @@ public:
/// on to class BufferView::updateDocumentClass(). The exception, of course, /// on to class BufferView::updateDocumentClass(). The exception, of course,
/// is in GuiDocument, where we use a BufferParams simply to hold a copy of /// is in GuiDocument, where we use a BufferParams simply to hold a copy of
/// the parameters from the active Buffer. /// 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 /// Returns the DocumentClass currently in use: the BaseClass as modified
/// by modules. /// by modules.
DocumentClass const & documentClass() const; DocumentClass const & documentClass() const;

View File

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

View File

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

View File

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

View File

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