break;
}
+ // we want to check if at least one of these is enabled
+ case LFUN_COMMAND_ALTERNATIVES: {
+ // argument contains ';'-terminated commands
+ string arg = to_utf8(cmd.argument());
+ while (!arg.empty()) {
+ string first;
+ arg = split(arg, first, ';');
+ FuncRequest func(lyxaction.lookupFunc(first));
+ func.origin = cmd.origin;
+ flag = getStatus(func);
+ // if this one is enabled, the whole thing is
+ if (flag.enabled())
+ break;
+ }
+ break;
+ }
+
case LFUN_CALL: {
FuncRequest func;
string name = to_utf8(cmd.argument());
<< lyxaction.getActionName(action)
<< " [" << action << "] is disabled at this location");
setErrorMessage(flag.message());
+ if (lyx_view_)
+ lyx_view_->restartCursor();
} else {
switch (action) {
break;
}
+ case LFUN_COMMAND_ALTERNATIVES: {
+ // argument contains ';'-terminated commands
+ string arg = argument;
+ while (!arg.empty()) {
+ string first;
+ arg = split(arg, first, ';');
+ FuncRequest func(lyxaction.lookupFunc(first));
+ func.origin = cmd.origin;
+ FuncStatus stat = getStatus(func);
+ if (stat.enabled()) {
+ dispatch(func);
+ break;
+ }
+ }
+ break;
+ }
+
case LFUN_CALL: {
FuncRequest func;
if (theTopLevelCmdDef().lock(argument, func)) {
case LFUN_LAYOUT_MODULE_ADD: {
LASSERT(lyx_view_, /**/);
Buffer * buffer = lyx_view_->buffer();
- DocumentClass const * const oldClass = buffer->params().documentClassPtr();
+ BufferParams const & params = buffer->params();
+ if (!params.moduleCanBeAdded(argument)) {
+ LYXERR0("Module `" << argument <<
+ "' cannot be added due to failed requirements or "
+ "conflicts with installed modules.");
+ break;
+ }
+ DocumentClass const * const oldClass = params.documentClassPtr();
view()->cursor().recordUndoFullDocument();
buffer->params().addLayoutModule(argument);
buffer->params().makeDocumentClass();