]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCommand.cpp
Stupid bug fix.
[lyx.git] / src / insets / InsetCommand.cpp
index 6a3a382e55f868f58c4f42c2748950cc3f2ccc58..745cfeca8a1e0956ed43abbeeaf7d1c52a25bebc 100644 (file)
@@ -156,19 +156,19 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
        switch (cmd.action) {
        // suppress these
        case LFUN_ERT_INSERT:
-               status.enabled(false);
+               status.setEnabled(false);
                return true;
        // we handle these
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "changetype") {
                        string const newtype = cmd.getArg(1);
-                       status.enabled(p_.isCompatibleCommand(p_.code(), newtype));
+                       status.setEnabled(p_.isCompatibleCommand(p_.code(), newtype));
                        status.setOnOff(newtype == p_.getCmdName());
-               } else
-                       status.enabled(true);
+               } 
+               status.setEnabled(true);
                return true;
        case LFUN_INSET_DIALOG_UPDATE:
-               status.enabled(true);
+               status.setEnabled(true);
                return true;
        default:
                return Inset::getStatus(cur, cmd, status);
@@ -196,29 +196,12 @@ bool InsetCommand::string2params(string const & name, string const & in,
        params.clear();
        if (in.empty())
                return false;
-
        istringstream data(in);
-       Lexer lex(0,0);
+       Lexer lex;
        lex.setStream(data);
-
-       string n;
-       lex >> n;
-       if (!lex || n != name) {
-               LYXERR0("InsetCommand::string2params(" << in << ")\n"
-                                         "Expected arg 1 to be \"" << name << "\"\n");
-               return false;
-       }
-
-       // This is part of the inset proper that is usually swallowed
-       // by Text::readInset
-       string id;
-       lex >> id;
-       if (!lex || id != "CommandInset") {
-               LYXERR0("InsetCommand::string2params(" << in << ")\n"
-                                         "Expected arg 2 to be \"CommandInset\"\n");
-               return false;
-       }
-
+       lex.setContext("InsetCommand::string2params");
+       lex >> name.c_str(); // check for name
+       lex >> "CommandInset";
        params.read(lex);
        return true;
 }