Do not issue module warnings when just cloning a buffer (#8864)

This commit is contained in:
Juergen Spitzmueller 2014-02-09 11:15:57 +01:00
parent d7b69d38c6
commit fa6b388cb3
6 changed files with 15 additions and 11 deletions

View File

@ -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(),

View File

@ -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())

View File

@ -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;

View File

@ -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"

View File

@ -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);

View File

@ -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();