]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Typos.
[lyx.git] / src / LyXFunc.cpp
index 9e25d5c4d89f4553868b7d1dc3c72f8062e5bc39..5fb648e05142531e7dd13e86c372a02e6e3c7f01 100644 (file)
@@ -533,6 +533,23 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                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());
@@ -731,6 +748,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                       << lyxaction.getActionName(action)
                       << " [" << action << "] is disabled at this location");
                setErrorMessage(flag.message());
+               if (lyx_view_)
+                       lyx_view_->restartCursor();
        } else {
                switch (action) {
 
@@ -1344,6 +1363,23 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        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)) {