]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_support.C
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
[lyx.git] / src / mathed / math_support.C
index 29c1d6b4ffc8b8e9dad161309fa85ef872dc54f8..14c37c95c552540227253498569cef8c431c3af8 100644 (file)
@@ -6,6 +6,7 @@
 #include "lyxfont.h"
 #include "FontLoader.h"
 #include "font.h"
+#include "math_cursor.h"
 #include "math_defs.h"
 #include "math_inset.h"
 #include "math_parser.h"
@@ -85,12 +86,7 @@ enum MathFont {
 
 void mathed_init_fonts()
 {
-       MathFonts = new LyXFont[FONT_NUM]; //DEC cxx cannot initialize all fonts
-       //at once (JMarc) rc
-
-       for (int i = 0 ; i < FONT_NUM ; ++i) {
-               MathFonts[i] = LyXFont(LyXFont::ALL_SANE);
-       }
+       MathFonts = new LyXFont[FONT_NUM];
 
        MathFonts[FONT_IT].setShape(LyXFont::ITALIC_SHAPE);
 
@@ -153,6 +149,7 @@ LyXFont const & whichFontBaseIntern(MathTextCodes type)
        case LM_TC_TT:
                return MathFonts[FONT_TT];
 
+       case LM_TC_BOX:
        case LM_TC_TEXTRM:
        case LM_TC_CONST:
        case LM_TC_TEX:
@@ -189,6 +186,7 @@ LyXFont const & whichFontBaseIntern(MathTextCodes type)
        return MathFonts[1];
 }
 
+
 LyXFont const & whichFontBase(MathTextCodes type)
 {
        if (!MathFonts)
@@ -253,7 +251,7 @@ LyXFont whichFont(MathTextCodes type, MathMetricsInfo const & size)
                break;
        }
 
-       if (type != LM_TC_TEXTRM)
+       if (type != LM_TC_TEXTRM && type != LM_TC_BOX)
                f.setColor(LColor::math);
 
        if (type == LM_TC_TEX)
@@ -713,6 +711,14 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
 }
 
 
+void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const * p)
+{
+       if (mathcursor && mathcursor->isInside(p))
+               pain.rectangle(x, y - p->ascent(), p->width(), p->height(),
+                       LColor::mathframe);
+}
+
+
 // In the future maybe we use a better fonts renderer
 void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
        int x, int y, string const & s)
@@ -770,6 +776,13 @@ char const * latex_mathspace[] = {
 };
 
 
+char const * latex_mathstyle[] = {
+       "textstyle", "displaystyle", "scriptstyle", "scriptscriptstyle", 
+       "mathbf", "mathcal","mathrm","mathtt", "mathsf", "mathit",
+       "mathbb","mathfrak", "textrm", "mathnormal"
+};
+
+
 char const * math_font_name(MathTextCodes code)
 {
        static char const * theFontNames[] = {