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

This commit is contained in:
Juergen Spitzmueller 2014-02-10 08:40:35 +01:00
parent 8431f55f73
commit 07baa69875
7 changed files with 15 additions and 11 deletions

View File

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

@ -2044,12 +2044,12 @@ LayoutFileIndex const & BufferParams::baseClassID() const
}
void BufferParams::makeDocumentClass()
void BufferParams::makeDocumentClass(bool const clone)
{
if (!baseClass())
return;
doc_class_ = &(DocumentClassBundle::get().makeDocumentClass(*baseClass(), layout_modules_));
doc_class_ = &(DocumentClassBundle::get().makeDocumentClass(*baseClass(), layout_modules_, clone));
if (!local_layout.empty()) {
if (!doc_class_->read(local_layout, TextClass::MODULE)) {

View File

@ -123,7 +123,7 @@ public:
bool setBaseClass(std::string const & classname);
/// Adds the module information to the baseClass information to
/// create our local DocumentClass.
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

@ -1313,7 +1313,7 @@ DocumentClassBundle & DocumentClassBundle::get()
DocumentClass & DocumentClassBundle::makeDocumentClass(
LayoutFile const & baseClass, LayoutModuleList const & modlist)
LayoutFile const & baseClass, LayoutModuleList const & modlist, bool const clone)
{
DocumentClass & doc_class = newClass(baseClass);
LayoutModuleList::const_iterator it = modlist.begin();
@ -1327,10 +1327,11 @@ DocumentClass & DocumentClassBundle::makeDocumentClass(
"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"
@ -1343,7 +1344,7 @@ DocumentClass & DocumentClassBundle::makeDocumentClass(
frontend::Alert::warning(_("Package not available"), msg, true);
}
FileName layout_file = libFileSearch("layouts", lm->getFilename());
if (!doc_class.read(layout_file, TextClass::MODULE)) {
if (!doc_class.read(layout_file, TextClass::MODULE) && !clone) {
docstring const msg =
bformat(_("Error reading module %1$s\n"), from_utf8(modName));
frontend::Alert::warning(_("Read Error"), msg);

View File

@ -467,7 +467,8 @@ public:
/// \return A new DocumentClass based on baseClass, with info added
/// from the modules in modlist.
DocumentClass & makeDocumentClass(LayoutFile const & baseClass,
LayoutModuleList const & modlist);
LayoutModuleList const & modlist,
bool const clone = false);
private:
/// control instantiation
DocumentClassBundle() {}

View File

@ -2151,7 +2151,7 @@ void GuiDocument::updateDefaultFormat()
if (idx >= 0) {
string const classname = classes_model_.getIDString(idx);
param_copy.setBaseClass(classname);
param_copy.makeDocumentClass();
param_copy.makeDocumentClass(true);
}
outputModule->defaultFormatCO->blockSignals(true);
outputModule->defaultFormatCO->clear();

View File

@ -77,6 +77,8 @@ What's new
- Fix the missing dynamic menus in general and restore correctly from fullscreen.
- Prevent recurrent pop-up of "missing module requirements" warning (bug 8864).
* DOCUMENTATION AND LOCALIZATION