commit fa6b388cb3b77995a88ef98987b542ee7bf5d98f
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Feb 9 11:15:57 2014 +0100
Do not issue module warnings when just cloning a buffer (#8864)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 398c6b5..d3aa876 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -529,7 +529,7 @@ void Buffer::cloneWithChildren(BufferMap & bufmap,
CloneList * clones) const
// The clone needs its own DocumentClass, since running updateBuffer()
will
// modify it, and we would otherwise be sharing it with the original
Buffer.
- buffer_clone->params().makeDocumentClass();
+ buffer_clone->params().makeDocumentClass(true);
ErrorList el;
cap::switchBetweenClasses(
params().documentClassPtr(),
buffer_clone->params().documentClassPtr(),
@@ -577,7 +577,7 @@ Buffer * Buffer::cloneBufferOnly() const {
// The clone needs its own DocumentClass, since running updateBuffer()
will
// modify it, and we would otherwise be sharing it with the original
Buffer.
- buffer_clone->params().makeDocumentClass();
+ buffer_clone->params().makeDocumentClass(true);
ErrorList el;
cap::switchBetweenClasses(
params().documentClassPtr(),
buffer_clone->params().documentClassPtr(),
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 0604a99..77769b2 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2101,7 +2101,7 @@ LayoutFileIndex const & BufferParams::baseClassID() const
}
-void BufferParams::makeDocumentClass()
+void BufferParams::makeDocumentClass(bool const clone)
{
if (!baseClass())
return;
@@ -2117,7 +2117,7 @@ void BufferParams::makeDocumentClass()
for (; it != en; ++it)
mods.push_back(*it);
- doc_class_ = getDocumentClass(*baseClass(), mods);
+ doc_class_ = getDocumentClass(*baseClass(), mods, clone);
TextClass::ReturnValues success = TextClass::OK;
if (!forced_local_layout_.empty())
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 9c558a6..0825616 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -128,7 +128,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();
+ void makeDocumentClass(bool const clone = false);
/// Returns the DocumentClass currently in use: the BaseClass as
modified
/// by modules.
DocumentClass const & documentClass() const;
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index b77f31b..391073d 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -1489,7 +1489,8 @@ Layout TextClass::createBasicLayout(docstring const &
name, bool unknown) const
DocumentClassPtr getDocumentClass(
- LayoutFile const & baseClass, LayoutModuleList const & modlist)
+ LayoutFile const & baseClass, LayoutModuleList const & modlist,
+ bool const clone)
{
DocumentClassPtr doc_class =
DocumentClassPtr(new DocumentClass(baseClass));
@@ -1504,10 +1505,11 @@ DocumentClassPtr getDocumentClass(
"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(modName));
- frontend::Alert::warning(_("Module not available"),
msg);
+ if (!clone)
+ frontend::Alert::warning(_("Module not
available"), msg);
continue;
}
- if (!lm->isAvailable()) {
+ if (!lm->isAvailable() && !clone) {
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"
diff --git a/src/TextClass.h b/src/TextClass.h
index 8e27fd8..fff3c23 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -491,7 +491,8 @@ private:
/// The only class that can create a DocumentClass is
/// DocumentClassBundle, which calls the protected constructor.
friend DocumentClassPtr
- getDocumentClass(LayoutFile const &, LayoutModuleList const &);
+ getDocumentClass(LayoutFile const &, LayoutModuleList const &,
+ bool const clone);
///
static InsetLayout plain_insetlayout_;
};
@@ -502,7 +503,8 @@ private:
/// in memory long after their associated Buffer is destroyed, mostly
/// on the CutStack.
DocumentClassPtr getDocumentClass(LayoutFile const & baseClass,
- LayoutModuleList const & modlist);
+ LayoutModuleList const & modlist,
+ bool const clone = false);
/// convert page sides option to text 1 or 2
std::ostream & operator<<(std::ostream & os, PageSides p);
diff --git a/src/frontends/qt4/GuiDocument.cpp
b/src/frontends/qt4/GuiDocument.cpp
index b80348a..1ac9259 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -2491,7 +2491,7 @@ void GuiDocument::updateDefaultFormat()
if (idx >= 0) {
string const classname =
fromqstr(latexModule->classCO->getData(idx));
param_copy.setBaseClass(classname);
- param_copy.makeDocumentClass();
+ param_copy.makeDocumentClass(true);
}
outputModule->defaultFormatCO->blockSignals(true);
outputModule->defaultFormatCO->clear();