Disentangle moduleCanBeAdded for ordinary layout modules and the

new (but not yet functioning, it seems) citation modules. This
fixes a bug reported on the list:
  http://marc.info/?l=lyx-users&m=135456590710371&w=2
This commit is contained in:
Richard Heck 2012-12-05 11:16:21 -05:00
parent 255ca92be2
commit ae7bc12ab6
4 changed files with 15 additions and 8 deletions

View File

@ -2084,10 +2084,15 @@ void BufferParams::makeDocumentClass()
}
bool BufferParams::moduleCanBeAdded(string const & modName) const
bool BufferParams::layoutModuleCanBeAdded(string const & modName) const
{
return cite_engine_.moduleCanBeAdded(modName, baseClass()) &&
layout_modules_.moduleCanBeAdded(modName, baseClass());
return layout_modules_.moduleCanBeAdded(modName, baseClass());
}
bool BufferParams::citationModuleCanBeAdded(string const & modName) const
{
return cite_engine_.moduleCanBeAdded(modName, baseClass());
}

View File

@ -146,13 +146,15 @@ public:
{ return removed_modules_; }
///
/// Add a module to the list of modules in use. This checks only that the
/// module is not already in the list, so use moduleIsCompatible first if
/// you want to check for compatibility.
/// module is not already in the list, so use layoutModuleCanBeAdeed first
/// if you want to check for compatibility.
/// \return true if module was successfully added.
bool addLayoutModule(std::string const & modName);
/// checks to make sure module's requriements are satisfied, that it does
/// not conflict with already-present modules, isn't already loaded, etc.
bool moduleCanBeAdded(std::string const & modName) const;
bool layoutModuleCanBeAdded(std::string const & modName) const;
/// same, but for citaton modules.
bool citationModuleCanBeAdded(std::string const & modName) const;
///
void addRemovedModule(std::string const & modName)
{ removed_modules_.push_back(modName); }

View File

@ -1274,7 +1274,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
case LFUN_LAYOUT_MODULE_ADD: {
BufferParams const & params = buffer_.params();
if (!params.moduleCanBeAdded(argument)) {
if (!params.layoutModuleCanBeAdded(argument)) {
LYXERR0("Module `" << argument <<
"' cannot be added due to failed requirements or "
"conflicts with installed modules.");

View File

@ -341,7 +341,7 @@ void ModuleSelectionManager::updateAddPB()
string const modname = getAvailableModel()->getIDString(idx.row());
bool const enable =
container_->params().moduleCanBeAdded(modname);
container_->params().layoutModuleCanBeAdded(modname);
addPB->setEnabled(enable);
}