[LyX/master] Fix bug #12068
Richard Kimberly Heck
rikiheck at lyx.org
Thu Jan 14 06:14:37 UTC 2021
commit 1582a2afe1abf2a01ac573aae2440c63b114d3d4
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date: Thu Jan 14 01:15:19 2021 -0500
Fix bug #12068
---
src/Buffer.cpp | 2 +-
src/BufferParams.cpp | 4 ++--
src/BufferParams.h | 2 +-
src/BufferView.cpp | 2 +-
src/Compare.cpp | 2 +-
src/TextClass.cpp | 36 +++++++++++++++++++-----------------
src/TextClass.h | 4 ++--
7 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 40c91b8..6505b3b 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -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;
}
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index f3f59cf..f7e3d2c 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -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())
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 578070e..4980f21 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -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;
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index d0ce7e1..ec89084 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -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);
}
diff --git a/src/Compare.cpp b/src/Compare.cpp
index 1b46e68..7d90891 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -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
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 9a8db85..3743104 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -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"
diff --git a/src/TextClass.h b/src/TextClass.h
index 741bf33..a4c758f 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -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);
More information about the lyx-cvs
mailing list