* \endvar
*/
{ LFUN_COMMAND_SEQUENCE, "command-sequence", NoBuffer, System },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_COMMAND_ALTERNATIVES
+ * \li Action: Runs the first listed command that is enabled.
+ * \li Syntax: command-alternatives <CMDS>
+ * \li Params: <CMDS>: Sequence of commands separated by semicolons.
+ * \li Sample: command-alternatives completion-accept;cell-forward
+ * \li Origin: rgh, 24 September 2008
+ * \endvar
+ */
+ { LFUN_COMMAND_ALTERNATIVES, "command-alternatives", NoBuffer, System },
/*!
* \var lyx::FuncCode lyx::LFUN_MESSAGE
* \li Action: Shows message in statusbar (for script purposes).
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());
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)) {