X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffactory.cpp;h=c49da693105cac8270353242499c3962a369edd3;hb=1797f5218b8819874f9dbe97b44445b3b5d598a0;hp=609abcf7937d12877ce4dd3a40fcad395292da7b;hpb=f9b81e51e943bcaac885d74edbce41a9d74ad3dd;p=lyx.git diff --git a/src/factory.cpp b/src/factory.cpp index 609abcf793..c49da69310 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -64,7 +64,7 @@ #include "support/lstrings.h" #include "support/ExceptionMessage.h" -#include +#include "support/lassert.h" #include @@ -103,7 +103,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) case LFUN_FLEX_INSERT: { string s = cmd.getArg(0); - return new InsetFlex(buf, buf.params().documentClassPtr(), s); + return new InsetFlex(buf, s); } case LFUN_NOTE_INSERT: { @@ -210,8 +210,11 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) case LFUN_ENVIRONMENT_INSERT: return new InsetEnvironment(buf, cmd.argument()); - case LFUN_INFO_INSERT: - return new InsetInfo(buf, to_utf8(cmd.argument())); + case LFUN_INFO_INSERT: { + InsetInfo * inset = new InsetInfo(buf, to_utf8(cmd.argument())); + inset->updateInfo(); + return inset; + } case LFUN_INSET_INSERT: { string const name = cmd.getArg(0); @@ -240,9 +243,8 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) } case ERT_CODE: { - InsetCollapsable::CollapseStatus st; - InsetERT::string2params(to_utf8(cmd.argument()), st); - return new InsetERT(buf, st); + return new InsetERT(buf, + InsetERT::string2params(to_utf8(cmd.argument()))); } case LISTINGS_CODE: { @@ -421,8 +423,8 @@ Inset * readInset(Lexer & lex, Buffer const & buf) auto_ptr inset; - lex.next(); - string tmptok = lex.getString(); + string tmptok; + lex >> tmptok; // test the different insets @@ -476,8 +478,9 @@ Inset * readInset(Lexer & lex, Buffer const & buf) inset.reset(new InsetPrintNomencl(inscmd)); break; case REF_CODE: - if (!inscmd["name"].empty() || !inscmd["reference"].empty()) - inset.reset(new InsetRef(buf, inscmd)); + if (inscmd["name"].empty() && inscmd["reference"].empty()) + return 0; + inset.reset(new InsetRef(buf, inscmd)); break; case TOC_CODE: inset.reset(new InsetTOC(inscmd)); @@ -515,11 +518,9 @@ Inset * readInset(Lexer & lex, Buffer const & buf) } else if (tmptok == "Flex") { lex.next(); string s = lex.getString(); - inset.reset(new InsetFlex(buf, - buf.params().documentClassPtr(), s)); + inset.reset(new InsetFlex(buf, s)); } else if (tmptok == "Branch") { - inset.reset(new InsetBranch(buf, - InsetBranchParams())); + inset.reset(new InsetBranch(buf, InsetBranchParams())); } else if (tmptok == "Environment") { lex.next(); inset.reset(new InsetEnvironment(buf, lex.getDocString()));