]> git.lyx.org Git - lyx.git/blobdiff - src/factory.C
cosmetic fix
[lyx.git] / src / factory.C
index fa05ac87da5ba16d287f6847e3401b1a093f7896..ad09f2151730a625adbe6de46a2a0f58fd018c0b 100644 (file)
@@ -38,7 +38,6 @@
 #include "insets/insetminipage.h"
 #include "insets/insetnote.h"
 #include "insets/insetoptarg.h"
-#include "insets/insetparent.h"
 #include "insets/insetref.h"
 #include "insets/insetspace.h"
 #include "insets/insettabular.h"
 
 #include <cstdio>
 
+using namespace lyx::support;
+
 using std::endl;
 
-Inset * createInset(FuncRequest const & cmd)
+InsetOld * createInset(FuncRequest const & cmd)
 {
        BufferView * bv = cmd.view();
        BufferParams const & params = bv->buffer()->params;
@@ -70,7 +71,7 @@ Inset * createInset(FuncRequest const & cmd)
                return new InsetMinipage(params);
 
        case LFUN_INSERT_NOTE:
-               return new InsetNote(params);
+               return new InsetNote(params, "Note");
 
        case LFUN_INSET_ERT:
                return new InsetERT(params);
@@ -158,10 +159,6 @@ Inset * createInset(FuncRequest const & cmd)
        case LFUN_TOC_INSERT:
                return new InsetTOC(InsetCommandParams("tableofcontents"));
 
-       case LFUN_PARENTINSERT:
-               return new InsetParent(
-                       InsetCommandParams("lyxparent", cmd.argument), *bv->buffer());
-
        case LFUN_ENVIRONMENT_INSERT:
                return new InsetEnvironment(params, cmd.argument);
 
@@ -201,18 +198,21 @@ Inset * createInset(FuncRequest const & cmd)
                        return inset;
 
                } else if (name == "external") {
+                       Buffer const * buffer = cmd.view()->buffer();
                        InsetExternal::Params iep;
-                       InsetExternalMailer::string2params(cmd.argument, iep);
+                       InsetExternalMailer::string2params(cmd.argument,
+                                                          *buffer, iep);
                        InsetExternal * inset = new InsetExternal;
-                       inset->setFromParams(iep);
+                       inset->setParams(iep, buffer);
                        return inset;
 
                } else if (name == "graphics") {
+                       Buffer const & buffer = *cmd.view()->buffer();
                        InsetGraphicsParams igp;
-                       InsetGraphicsMailer::string2params(cmd.argument, igp);
+                       InsetGraphicsMailer::string2params(cmd.argument,
+                                                          buffer, igp);
                        InsetGraphics * inset = new InsetGraphics;
-                       string const fpath = cmd.view()->buffer()->filePath();
-                       inset->setParams(igp, fpath);
+                       inset->setParams(igp);
                        return inset;
 
                } else if (name == "include") {
@@ -281,7 +281,7 @@ Inset * createInset(FuncRequest const & cmd)
 }
 
 
-Inset * readInset(LyXLex & lex, Buffer const & buf)
+InsetOld * readInset(LyXLex & lex, Buffer const & buf)
 {
        // consistency check
        if (lex.getString() != "\\begin_inset") {
@@ -289,7 +289,7 @@ Inset * readInset(LyXLex & lex, Buffer const & buf)
                       << endl;
        }
 
-       Inset * inset = 0;
+       InsetOld * inset = 0;
 
        lex.next();
        string const tmptok = lex.getString();
@@ -339,8 +339,6 @@ Inset * readInset(LyXLex & lex, Buffer const & buf)
                        inset = new InsetFloatList("table");
                } else if (cmdName == "printindex") {
                        inset = new InsetPrintIndex(inscmd);
-               } else if (cmdName == "lyxparent") {
-                       inset = new InsetParent(inscmd, buf);
                }
        } else {
                if (tmptok == "Quotes") {
@@ -353,8 +351,9 @@ Inset * readInset(LyXLex & lex, Buffer const & buf)
                        inset = new InsetFormula;
                } else if (tmptok == "Graphics") {
                        inset = new InsetGraphics;
-               } else if (tmptok == "Note") {
-                       inset = new InsetNote(buf.params);
+               } else if (tmptok == "Note"     || tmptok == "Comment"
+                               || tmptok == "Greyedout") {
+                       inset = new InsetNote(buf.params, tmptok);
                } else if (tmptok == "Include") {
                        InsetCommandParams p("Include");
                        inset = new InsetInclude(p, buf);