]> git.lyx.org Git - lyx.git/blobdiff - src/factory.cpp
GuiToc::initialiseParams(): Fix list type parsing
[lyx.git] / src / factory.cpp
index 7eeaa238043bc26300331896390785d24662b5aa..fd823085ee6e6b194dbc2f95ca3b05585224946e 100644 (file)
@@ -68,6 +68,7 @@
 #include <sstream>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -101,9 +102,7 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
 
                case LFUN_FLEX_INSERT: {
                        string s = cmd.getArg(0);
-                       TextClass const & tclass = params.getTextClass();
-                       InsetLayout const & il = tclass.insetlayout(from_utf8(s));
-                       return new InsetFlex(params, il);
+                       return new InsetFlex(params, params.getTextClassPtr(), s);
                }
 
                case LFUN_NOTE_INSERT: {
@@ -358,12 +357,12 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
                        break;
                }
 
-       } catch (support::ExceptionMessage const & message) {
-               if (message.type_ == support::ErrorException) {
+       } catch (ExceptionMessage const & message) {
+               if (message.type_ == ErrorException) {
+                       // This should never happen!
                        Alert::error(message.title_, message.details_);
-                       LyX::cref().emergencyCleanup();
-                       abort();
-               } else if (message.type_ == support::WarningException) {
+                       LyX::cref().exit(1);
+               } else if (message.type_ == WarningException) {
                        Alert::warning(message.title_, message.details_);
                        return 0;
                }
@@ -384,8 +383,6 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
 
        auto_ptr<Inset> inset;
 
-       TextClass const & tclass = buf.params().getTextClass();
-
        lex.next();
        string tmptok = lex.getString();
 
@@ -479,8 +476,8 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
                } else if (tmptok == "Flex") {
                        lex.next();
                        string s = lex.getString();
-                       InsetLayout const & il = tclass.insetlayout(from_utf8(s));
-                       inset.reset(new InsetFlex(buf.params(), il));
+                       inset.reset(new InsetFlex(buf.params(), 
+                               buf.params().getTextClassPtr(), s));
                } else if (tmptok == "Branch") {
                        inset.reset(new InsetBranch(buf.params(),
                                                    InsetBranchParams()));