]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetVSpace.cpp
Move isMultiCell() to Cursor, and use it.
[lyx.git] / src / insets / InsetVSpace.cpp
index c233eb8d1efebbed200d12e1c218fa6bb962bf7b..0b782f00b859c36eb154623c8905d9e3adbcc683 100644 (file)
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Lexer.h"
-#include "Text.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "Text.h"
 
 #include "support/debug.h"
 #include "support/gettext.h"
+#include "support/lassert.h"
 
 #include "frontends/Application.h"
 #include "frontends/FontMetrics.h"
@@ -88,9 +89,8 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
                        VSpace vspace;
                        InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
                        status.setOnOff(vspace == space_);
-               } else {
-                       status.enabled(true);
-               }
+               } 
+               status.setEnabled(true);
                return true;
        default:
                return Inset::getStatus(cur, cmd, status);
@@ -107,17 +107,12 @@ void InsetVSpace::edit(Cursor & cur, bool, EntryDirection)
 
 void InsetVSpace::read(Lexer & lex)
 {
-       BOOST_ASSERT(lex.isOK());
+       LASSERT(lex.isOK(), /**/);
        string vsp;
        lex >> vsp;
        if (lex)
                space_ = VSpace(vsp);
-
-       string end_token;
-       lex >> end_token;
-       if (end_token != "\\end_inset")
-               lex.printError("Missing \\end_inset at this point. "
-                              "Read: `$$Token'");
+       lex >> "\\end_inset";
 }
 
 
@@ -257,18 +252,8 @@ void InsetVSpace::string2params(string const & in, VSpace & vspace)
        istringstream data(in);
        Lexer lex;
        lex.setStream(data);
-
-       string name;
-       lex >> name;
-       if (!lex || name != "vspace") {
-               LYXERR0("Expected arg 1 to be \"vspace\" in " << in);
-               return;
-       }
-
-       string vsp;
-       lex >> vsp;
-       if (lex)
-               vspace = VSpace(vsp);
+       lex.setContext("InsetVSpace::string2params");
+       lex >> "vspace" >> vspace;
 }