]> git.lyx.org Git - lyx.git/blob - src/mathed/math_factory.C
More fonts in mathed.
[lyx.git] / src / mathed / math_factory.C
1 #include <config.h>
2
3 #include "math_parser.h"
4 #include "math_bigopinset.h"
5 #include "math_binominset.h"
6 #include "math_decorationinset.h"
7 #include "math_dotsinset.h"
8 #include "math_funcinset.h"
9 #include "math_funcliminset.h"
10 #include "math_fracinset.h"
11 #include "math_kerninset.h"
12 #include "math_macro.h"
13 #include "math_macrotable.h"
14 #include "math_noglyphinset.h"
15 #include "math_notinset.h"
16 #include "math_rootinset.h"
17 #include "math_spaceinset.h"
18 #include "math_specialcharinset.h"
19 #include "math_sqrtinset.h"
20 #include "math_symbolinset.h"
21 #include "math_stackrelinset.h"
22
23
24 MathInset * createMathInset(latexkeys const * l)
25 {
26         switch (l->token) {
27         case LM_TK_NOGLYPH:
28         case LM_TK_NOGLYPHB:
29                 return new MathNoglyphInset(l);
30         case LM_TK_BIGSYM:
31                 return new MathBigopInset(l);
32         case LM_TK_FUNCLIM:
33                 return new MathFuncLimInset(l);
34         case LM_TK_SPECIAL:
35                 return new MathSpecialCharInset(l->id);
36         case LM_TK_SYM:
37         case LM_TK_CMSY:
38         case LM_TK_CMM:
39         case LM_TK_CMEX:
40         case LM_TK_MSA:
41         case LM_TK_MSB:
42                 return new MathSymbolInset(l);
43         case LM_TK_STACK:
44                 return new MathStackrelInset;
45         case LM_TK_KERN: 
46                 return new MathKernInset;
47         case LM_TK_BINOM:
48         case LM_TK_CHOOSE:
49                 return new MathBinomInset;
50         case LM_TK_OVER:
51         case LM_TK_FRAC:
52                 return new MathFracInset;
53         case LM_TK_ATOP:
54                 return new MathFracInset(true);
55         case LM_TK_NOT:
56                 return new MathNotInset;
57         case LM_TK_SQRT:
58                 return new MathSqrtInset;
59         case LM_TK_ROOT:
60                 return new MathRootInset;
61         case LM_TK_DECORATION:
62                 return new MathDecorationInset(l);
63         case LM_TK_SPACE:
64                 return new MathSpaceInset(l->id);
65         case LM_TK_DOTS:
66                 return new MathDotsInset(l);
67         }
68         return new MathFuncInset(l->name);
69 }
70
71
72 MathInset * createMathInset(string const & s)
73 {
74         latexkeys const * l = in_word_set(s);
75         if (l) 
76                 return createMathInset(l);
77
78         if (MathMacroTable::hasTemplate(s)) 
79                 return new MathMacro(MathMacroTable::provideTemplate(s));
80
81         return new MathFuncInset(s);
82 }