]> git.lyx.org Git - lyx.git/blobdiff - src/factory.C
"Inter-word Space"
[lyx.git] / src / factory.C
index 6fbcb377b77c9507ce9adc34cba26a2c4da44833..4c335b06f7ee2dee6a9b0f69b26d8f999d8e8477 100644 (file)
@@ -40,6 +40,7 @@
 #include "insets/insetoptarg.h"
 #include "insets/insetparent.h"
 #include "insets/insetref.h"
+#include "insets/insetspace.h"
 #include "insets/insettabular.h"
 #include "insets/insettext.h"
 #include "insets/insettoc.h"
@@ -112,7 +113,7 @@ Inset * createInset(FuncRequest const & cmd)
                // Try and generate a valid index entry.
                InsetCommandParams icp("index");
                string const contents = cmd.argument.empty() ?
-                       bv->getLyXText()->getStringToIndex(bv) :
+                       bv->getLyXText()->getStringToIndex() :
                        cmd.argument;
                icp.setContents(contents);
 
@@ -172,7 +173,7 @@ Inset * createInset(FuncRequest const & cmd)
                return new InsetTheorem;
 #endif
 
-       case LFUN_INSET_APPLY: {
+       case LFUN_INSET_INSERT: {
                string const name = cmd.getArg(0);
 
                if (name == "bibitem") {
@@ -200,14 +201,14 @@ Inset * createInset(FuncRequest const & cmd)
                        return inset;
 
                } else if (name == "external") {
-                       InsetExternal::Params iep;                      
+                       InsetExternal::Params iep;
                        InsetExternalMailer::string2params(cmd.argument, iep);
                        InsetExternal * inset = new InsetExternal;
                        inset->setFromParams(iep);
                        return inset;
 
                } else if (name == "graphics") {
-                       InsetGraphicsParams igp;                        
+                       InsetGraphicsParams igp;
                        InsetGraphicsMailer::string2params(cmd.argument, igp);
                        InsetGraphics * inset = new InsetGraphics;
                        string const fpath = cmd.view()->buffer()->filePath();
@@ -245,6 +246,31 @@ Inset * createInset(FuncRequest const & cmd)
                        return new InsetUrl(icp);
                }
        }
+
+       case LFUN_SPACE_INSERT: {
+               string const name = cmd.argument;
+               if (name == "normal")
+                       return new InsetSpace(InsetSpace::NORMAL);
+               else if (name == "protected")
+                       return new InsetSpace(InsetSpace::PROTECTED);
+               else if (name == "thin")
+                       return new InsetSpace(InsetSpace::THIN);
+               else if (name == "quad")
+                       return new InsetSpace(InsetSpace::QUAD);
+               else if (name == "qquad")
+                       return new InsetSpace(InsetSpace::QQUAD);
+               else if (name == "enspace")
+                       return new InsetSpace(InsetSpace::ENSPACE);
+               else if (name == "enskip")
+                       return new InsetSpace(InsetSpace::ENSKIP);
+               else if (name == "negthinspace")
+                       return new InsetSpace(InsetSpace::NEGTHIN);
+               else if (name.empty())
+                       lyxerr << "LyX function 'space' needs an argument." << endl;
+               else
+                       lyxerr << "Wrong argument for LyX function 'space'." << endl;
+       }
+
        break;
 
        default:
@@ -294,6 +320,7 @@ Inset * readInset(LyXLex & lex, Buffer const & buf)
                           || cmdName == "htmlurl") {
                        inset = new InsetUrl(inscmd);
                } else if (cmdName == "ref"
+                          || cmdName == "eqref"
                           || cmdName == "pageref"
                           || cmdName == "vref"
                           || cmdName == "vpageref"
@@ -331,8 +358,13 @@ Inset * readInset(LyXLex & lex, Buffer const & buf)
                } else if (tmptok == "Include") {
                        InsetCommandParams p("Include");
                        inset = new InsetInclude(p, buf);
+               } else if (tmptok == "Environment") {
+                       lex.next();
+                       inset = new InsetEnvironment(buf.params, lex.getString());
                } else if (tmptok == "ERT") {
                        inset = new InsetERT(buf.params);
+               } else if (tmptok == "InsetSpace") {
+                       inset = new InsetSpace;
                } else if (tmptok == "Tabular") {
                        inset = new InsetTabular(buf);
                } else if (tmptok == "Text") {