]> git.lyx.org Git - lyx.git/blobdiff - src/factory.cpp
Fix bug 1749. CAUTION: lyx2lyx not fully working yet (see FIXMEs).
[lyx.git] / src / factory.cpp
index 3d21819847ab7aa5604960be1f234b4f5bdab6e6..60eb245847ca91b1aef6b28f0c6415e3c82b780a 100644 (file)
@@ -21,7 +21,6 @@
 #include "Color.h"
 #include "Lexer.h"
 #include "LyX.h"
-#include "Paragraph.h"
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetBibtex.h"
@@ -30,6 +29,7 @@
 #include "insets/InsetCharStyle.h"
 #include "insets/InsetEnvironment.h"
 #include "insets/InsetERT.h"
+#include "insets/InsetListings.h"
 #include "insets/InsetExternal.h"
 #include "insets/InsetFloat.h"
 #include "insets/InsetFloatList.h"
@@ -104,7 +104,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
 
                case LFUN_CHARSTYLE_INSERT: {
                        string s = cmd.getArg(0);
-                       LyXTextClass tclass = params.getLyXTextClass();
+                       TextClass tclass = params.getTextClass();
                        CharStyles::iterator found_cs = tclass.charstyle(s);
                        if (found_cs != tclass.charstyles().end())
                                return new InsetCharStyle(params, found_cs);
@@ -136,6 +136,9 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
                case LFUN_ERT_INSERT:
                        return new InsetERT(params);
 
+               case LFUN_LISTING_INSERT:
+                       return new InsetListings(params);
+
                case LFUN_FOOTNOTE_INSERT:
                        return new InsetFoot(params);
 
@@ -151,7 +154,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
                case LFUN_FLOAT_INSERT: {
                        // check if the float type exists
                        string const argument = to_utf8(cmd.argument());
-                       if (params.getLyXTextClass().floats().typeExist(argument))
+                       if (params.getTextClass().floats().typeExist(argument))
                                return new InsetFloat(params, argument);
                        lyxerr << "Non-existent float type: " << argument << endl;
                        return 0;
@@ -160,7 +163,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
                case LFUN_FLOAT_WIDE_INSERT: {
                        // check if the float type exists
                        string const argument = to_utf8(cmd.argument());
-                       if (params.getLyXTextClass().floats().typeExist(argument)) {
+                       if (params.getTextClass().floats().typeExist(argument)) {
                                auto_ptr<InsetFloat> p(new InsetFloat(params, argument));
                                p->wide(true, params);
                                return p.release();
@@ -261,6 +264,11 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
                                InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
                                return new InsetERT(params, st);
 
+                       } else if (name == "listings") {
+                               InsetListingsParams par;
+                               InsetListingsMailer::string2params(to_utf8(cmd.argument()), par);
+                               return new InsetListings(params, par);
+
                        } else if (name == "external") {
                                Buffer const & buffer = *bv->buffer();
                                InsetExternalParams iep;
@@ -382,7 +390,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
 
        auto_ptr<Inset> inset;
 
-       LyXTextClass tclass = buf.params().getLyXTextClass();
+       TextClass tclass = buf.params().getTextClass();
 
        lex.next();
        string tmptok = lex.getString();
@@ -486,6 +494,8 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
                        inset.reset(new InsetEnvironment(buf.params(), lex.getString()));
                } else if (tmptok == "ERT") {
                        inset.reset(new InsetERT(buf.params()));
+               } else if (tmptok == "listings") {
+                       inset.reset(new InsetListings(buf.params()));
                } else if (tmptok == "InsetSpace") {
                        inset.reset(new InsetSpace);
                } else if (tmptok == "Tabular") {