]> git.lyx.org Git - features.git/commitdiff
get rid of several friends small cleanup
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 15 Feb 2001 12:22:01 +0000 (12:22 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 15 Feb 2001 12:22:01 +0000 (12:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1519 a592a061-630c-0410-9148-cb99ea01b6c8

29 files changed:
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/formulamacro.C
src/mathed/math_accentinset.C
src/mathed/math_bigopinset.C
src/mathed/math_decorationinset.C
src/mathed/math_delim.C
src/mathed/math_deliminset.C
src/mathed/math_dotsinset.C
src/mathed/math_fracinset.C
src/mathed/math_funcinset.C
src/mathed/math_hash.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macroarg.C
src/mathed/math_macrotemplate.C
src/mathed/math_macrotemplate.h
src/mathed/math_panel.h
src/mathed/math_parinset.C
src/mathed/math_parinset.h
src/mathed/math_parser.C
src/mathed/math_root.C
src/mathed/math_sqrtinset.C
src/mathed/math_xiter.h
src/mathed/matriz.C
src/mathed/matriz.h
src/mathed/support.C

index 98688659f6e087da12b6034fa3edb30c54aeeb51..4b7eee3a80d068991131bdc416a899bf55e06f75 100644 (file)
@@ -1,3 +1,9 @@
+2001-02-15  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * matriz.C: clean up a bit.
+
+       * several files: changes so that several friends can be removed
+
 2001-02-14  André Pönitz  <poenitz@htwm.de>
 
        * formula.C: reformatting 
index d93444ee14480be136f9666d26a00e75298cbba6..6ea9cb6e28a5220563ad1a4cba5713fb8f29124d 100644 (file)
@@ -18,7 +18,7 @@
 #include "Lsstream.h"
 
 #ifdef __GNUG__
-#pragma implementation "formula.h"
+#pragma implementation
 #endif
 
 #include "formula.h"
@@ -82,76 +82,76 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par);
 LyXFont WhichFont(short type, int size)
 {
        LyXFont f;
-
+       
        if (!Math_Fonts)
                mathed_init_fonts();
 
        switch (type) {
-               case LM_TC_SYMB:        
-                       f = Math_Fonts[2];
-                       break;
-
-               case LM_TC_BSYM:        
-                       f = Math_Fonts[2];
-                       break;
-
-               case LM_TC_VAR:
-               case LM_TC_IT:
-                       f = Math_Fonts[0];
-                       break;
-
-               case LM_TC_BF:
-                       f = Math_Fonts[3];
-                       break;
-
-               case LM_TC_SF:
-                       f = Math_Fonts[7];
-                       break;
-
-               case LM_TC_CAL:
-                       f = Math_Fonts[4];
-                       break;
-
-               case LM_TC_TT:
-                       f = Math_Fonts[5];
-                       break;
-
-               case LM_TC_SPECIAL: //f = Math_Fonts[0]; break;
-               case LM_TC_TEXTRM:
-               case LM_TC_RM:
-                       f = Math_Fonts[6];
-                       break;
-
-               default:
-                       f = Math_Fonts[1];
-                       break;
+       case LM_TC_SYMB:        
+               f = Math_Fonts[2];
+               break;
+
+       case LM_TC_BSYM:        
+               f = Math_Fonts[2];
+               break;
+
+       case LM_TC_VAR:
+       case LM_TC_IT:
+               f = Math_Fonts[0];
+               break;
+
+       case LM_TC_BF:
+               f = Math_Fonts[3];
+               break;
+
+       case LM_TC_SF:
+               f = Math_Fonts[7];
+               break;
+
+       case LM_TC_CAL:
+               f = Math_Fonts[4];
+               break;
+
+       case LM_TC_TT:
+               f = Math_Fonts[5];
+               break;
+
+       case LM_TC_SPECIAL: //f = Math_Fonts[0]; break;
+       case LM_TC_TEXTRM:
+       case LM_TC_RM:
+               f = Math_Fonts[6];
+               break;
+
+       default:
+               f = Math_Fonts[1];
+               break;
        }
 
        f.setSize(lfont_size);
 
        switch (size) {
-               case LM_ST_DISPLAY:
-                       if (type == LM_TC_BSYM) {
-                               f.incSize();
-                               f.incSize();
-                       }
-                       break;
+       case LM_ST_DISPLAY:
+               if (type == LM_TC_BSYM) {
+                       f.incSize();
+                       f.incSize();
+               }
+               break;
 
-               case LM_ST_TEXT:
-                       break;
+       case LM_ST_TEXT:
+               break;
 
-               case LM_ST_SCRIPT:
-                       f.decSize();
-                       break;
+       case LM_ST_SCRIPT:
+               f.decSize();
+               break;
 
-               case LM_ST_SCRIPTSCRIPT:
-                       f.decSize();
-                       f.decSize();
-                       break;
+       case LM_ST_SCRIPTSCRIPT:
+               f.decSize();
+               f.decSize();
+               break;
 
-               default:
-                       lyxerr << "Mathed Error: wrong font size: " << size << endl;
-                       break;
+       default:
+               lyxerr << "Mathed Error: wrong font size: " << size << endl;
+               break;
        }
 
        if (type != LM_TC_TEXTRM)
@@ -192,9 +192,9 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not
        Math_Fonts[7].setFamily(LyXFont::SANS_FAMILY);
 
        LyXFont f = WhichFont(LM_TC_VAR, LM_ST_TEXT);
-       MathedInset::df_asc = lyxfont::maxAscent(f);
-       MathedInset::df_des = lyxfont::maxDescent(f);
-       MathedInset::df_width = lyxfont::width('I', f);
+       MathedInset::defaultAscent(lyxfont::maxAscent(f));
+       MathedInset::defaultDescent(lyxfont::maxDescent(f));
+       MathedInset::defaultWidth(lyxfont::width('I', f));
 }
 
 
@@ -218,8 +218,8 @@ InsetFormula::InsetFormula(MathParInset * p)
                lyxerr << "InsetFormula::InsetFormula: This shouldn't happen" << endl;
 
        par = is_multiline(p->GetType()) ?
-                 new MathMatrixInset(static_cast<MathMatrixInset*>(p)):
-                 new MathParInset(p);
+               new MathMatrixInset(static_cast<MathMatrixInset*>(p)):
+               new MathParInset(p);
        //   mathcursor = 0;
 
        disp_flag = (par->GetType()>0);
@@ -317,12 +317,12 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
                if (lex.GetString() == "\\end_inset")
                        break;
                lyxerr << "InsetFormula::Read: Garbage before \\end_inset,"
-                 " or missing \\end_inset!" << endl;
+                       " or missing \\end_inset!" << endl;
        }
 
-       #ifdef DEBUG
+#ifdef DEBUG
        Write(lyxerr);
-       #endif
+#endif
 }
 
 
@@ -348,7 +348,7 @@ int InsetFormula::width(BufferView * bv, LyXFont const & f) const
 
 
 void InsetFormula::draw(BufferView * bv, LyXFont const & f,
-               int baseline, float & x, bool) const
+                       int baseline, float & x, bool) const
 {
        MathedInset::workWidth = bv->workWidth();
        Painter & pain = bv->painter();
@@ -376,7 +376,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
        x += float(width(bv, font));
 
        if (is_numbered(par->GetType())) {
-               LyXFont wfont = WhichFont(LM_TC_BF, par->size);
+               LyXFont wfont = WhichFont(LM_TC_BF, par->size());
                wfont.setLatex(LyXFont::OFF);
 
                if (is_singlely_numbered(par->GetType())) {
@@ -388,7 +388,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
                        pain.text(int(x + 20), baseline, str, wfont);
                } else {
                        MathMatrixInset * mt =
-                       static_cast<MathMatrixInset*>(par);
+                               static_cast<MathMatrixInset*>(par);
                        int y;
                        MathedRowSt const * crow = mt->getRowSt();
                        while (crow) {
@@ -424,8 +424,8 @@ void InsetFormula::Edit(BufferView * bv, int x, int y, unsigned int)
 
        par->Metrics();
        bv->updateInset(this, false);
-       x += par->xo;
-       y += par->yo;
+       x += par->xo();
+       y += par->yo();
        mathcursor->SetPos(x, y);
        sel_x = 0;
        sel_y = 0;
@@ -460,8 +460,8 @@ void InsetFormula::InsertSymbol(BufferView * bv, string const & s)
 void InsetFormula::GetCursorPos(BufferView *, int & x, int & y) const
 {
        mathcursor->GetPos(x, y);
-       x -= par->xo;
-       y -= par->yo;
+       x -= par->xo();
+       y -= par->yo();
 }
 
 
@@ -474,7 +474,7 @@ void InsetFormula::ToggleInsetCursor(BufferView * bv)
        int y;
        mathcursor->GetPos(x, y);
        //  x -= par->xo;
-       y -= par->yo;
+       y -= par->yo();
        LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT);
        int asc = lyxfont::maxAscent(font);
        int desc = lyxfont::maxDescent(font);
@@ -496,7 +496,7 @@ void InsetFormula::ShowInsetCursor(BufferView * bv, bool)
                        int y;
                        mathcursor->GetPos(x, y);
                        //  x -= par->xo;
-                       y -= par->yo;
+                       y -= par->yo();
                        LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT);
                        int asc = lyxfont::maxAscent(font);
                        int desc = lyxfont::maxDescent(font);
@@ -573,18 +573,18 @@ vector<string> const InsetFormula::getLabelList() const
 void InsetFormula::UpdateLocal(BufferView * bv)
 {
        par->Metrics();  // To inform lyx kernel the exact size
-                        // (there were problems with arrays).
+       // (there were problems with arrays).
        bv->updateInset(this, true);
 }
 
 
 void InsetFormula::InsetButtonRelease(BufferView * bv,
-       int x, int y, int /*button*/)
+                                     int x, int y, int /*button*/)
 {
        if (mathcursor) {
                HideInsetCursor(bv);
-               x += par->xo;
-               y += par->yo;
+               x += par->xo();
+               y += par->yo();
                mathcursor->SetPos(x, y);
                ShowInsetCursor(bv);
                if (sel_flag) {
@@ -597,7 +597,7 @@ void InsetFormula::InsetButtonRelease(BufferView * bv,
 
 
 void InsetFormula::InsetButtonPress(BufferView * bv, int x, int y,
-               int /*button*/)
+                                   int /*button*/)
 {
        sel_flag = false;
        sel_x = x;  sel_y = y;
@@ -609,19 +609,19 @@ void InsetFormula::InsetButtonPress(BufferView * bv, int x, int y,
 
 
 void InsetFormula::InsetMotionNotify(BufferView * bv,
- int x, int y, int /*button*/)
                                   int x, int y, int /*button*/)
 {
        if (sel_x && sel_y && abs(x-sel_x) > 4 && !sel_flag) {
                sel_flag = true;
                HideInsetCursor(bv);
-               mathcursor->SetPos(sel_x + par->xo, sel_y + par->yo);
+               mathcursor->SetPos(sel_x + par->xo(), sel_y + par->yo());
                mathcursor->SelStart();
                ShowInsetCursor(bv);
                mathcursor->GetPos(sel_x, sel_y);
        } else if (sel_flag) {
                HideInsetCursor(bv);
-               x += par->xo;
-               y += par->yo;
+               x += par->xo();
+               y += par->yo();
                mathcursor->SetPos(x, y);
                ShowInsetCursor(bv);
                mathcursor->GetPos(x, y);
@@ -644,7 +644,7 @@ bool InsetFormula::SetNumber(bool numbf)
 {
        if (disp_flag) {
                short type = par->GetType();
-               bool oldf = is_numbered(type);
+               bool const oldf = is_numbered(type);
                if (numbf && !oldf)
                        ++type;
                if (!numbf && oldf)
@@ -676,295 +676,295 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
 
        switch (action) {
                // --- Cursor Movements ---------------------------------------------
-               case LFUN_RIGHTSEL:
-                       sel = true; // fall through...
+       case LFUN_RIGHTSEL:
+               sel = true; // fall through...
 
-               case LFUN_RIGHT:
-                       result = DISPATCH_RESULT(mathcursor->Right(sel));
-                       if (!sel && (result == DISPATCHED))
-                               result = DISPATCHED_NOUPDATE;
-                       break;
+       case LFUN_RIGHT:
+               result = DISPATCH_RESULT(mathcursor->Right(sel));
+               if (!sel && (result == DISPATCHED))
+                       result = DISPATCHED_NOUPDATE;
+               break;
 
 
-               case LFUN_LEFTSEL:
-                       sel = true; // fall through
+       case LFUN_LEFTSEL:
+               sel = true; // fall through
 
-               case LFUN_LEFT:
-                       result = DISPATCH_RESULT(mathcursor->Left(sel));
-                       if (!sel && (result == DISPATCHED))
+       case LFUN_LEFT:
+               result = DISPATCH_RESULT(mathcursor->Left(sel));
+               if (!sel && (result == DISPATCHED))
                        result = DISPATCHED_NOUPDATE;
-                       break;
+               break;
 
 
-               case LFUN_UPSEL:
-                       sel = true;
+       case LFUN_UPSEL:
+               sel = true;
 
-               case LFUN_UP:
-                       result = DISPATCH_RESULT(mathcursor->Up(sel));
-                       if (!sel && (result == DISPATCHED))
-                               result = DISPATCHED_NOUPDATE;
-                       break;
+       case LFUN_UP:
+               result = DISPATCH_RESULT(mathcursor->Up(sel));
+               if (!sel && (result == DISPATCHED))
+                       result = DISPATCHED_NOUPDATE;
+               break;
 
 
-               case LFUN_DOWNSEL:
-                       sel = true;
+       case LFUN_DOWNSEL:
+               sel = true;
 
-               case LFUN_DOWN:
-                       result = DISPATCH_RESULT(mathcursor->Down(sel));
-                       if (!sel && (result == DISPATCHED))
+       case LFUN_DOWN:
+               result = DISPATCH_RESULT(mathcursor->Down(sel));
+               if (!sel && (result == DISPATCHED))
                        result = DISPATCHED_NOUPDATE;
-                       break;
+               break;
 
 
-               case LFUN_HOME:
-                       mathcursor->Home();
-                       result = DISPATCHED_NOUPDATE;
-                       break;
+       case LFUN_HOME:
+               mathcursor->Home();
+               result = DISPATCHED_NOUPDATE;
+               break;
 
-               case LFUN_END:
-                       mathcursor->End();
-                       result = DISPATCHED_NOUPDATE;
-                       break;
+       case LFUN_END:
+               mathcursor->End();
+               result = DISPATCHED_NOUPDATE;
+               break;
 
-               case LFUN_DELETE_LINE_FORWARD:
-                       bv->lockedInsetStoreUndo(Undo::DELETE);
-                       mathcursor->DelLine();
-                       UpdateLocal(bv);
-                       break;
+       case LFUN_DELETE_LINE_FORWARD:
+               bv->lockedInsetStoreUndo(Undo::DELETE);
+               mathcursor->DelLine();
+               UpdateLocal(bv);
+               break;
+
+       case LFUN_BREAKLINE: 
+       {
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               byte c = arg.empty() ? '1' : arg[0];
+               mathcursor->Insert(c, LM_TC_CR);
+               if (!label.empty()) {
+                       mathcursor->setLabel(label);
+                       label.erase();
+               }
+               par = mathcursor->GetPar();
+               UpdateLocal(bv);
+       }
+       break;
 
-               case LFUN_BREAKLINE: 
-                       {
-                               bv->lockedInsetStoreUndo(Undo::INSERT);
-                               byte c = arg.empty() ? '1' : arg[0];
-                               mathcursor->Insert(c, LM_TC_CR);
-                               if (!label.empty()) {
-                                       mathcursor->setLabel(label);
-                                       label.erase();
-                               }
-                               par = mathcursor->GetPar();
-                               UpdateLocal(bv);
-                       }
-                       break;
+       case LFUN_TAB:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               mathcursor->Insert(0, LM_TC_TAB);
+               //UpdateInset(this);
+               break;
 
-               case LFUN_TAB:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       mathcursor->Insert(0, LM_TC_TAB);
-                       //UpdateInset(this);
-                       break;
+       case LFUN_TABINSERT:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               mathcursor->Insert('T', LM_TC_TAB);
+               UpdateLocal(bv);
+               break;
 
-               case LFUN_TABINSERT:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       mathcursor->Insert('T', LM_TC_TAB);
-                       UpdateLocal(bv);
+       case LFUN_BACKSPACE:
+               if (!mathcursor->Left())
                        break;
 
-               case LFUN_BACKSPACE:
-                       if (!mathcursor->Left())
-                               break;
-
-                       if (!mathcursor->InMacroMode() && mathcursor->pullArg()) {
-                               bv->updateInset(this, true);
-                               break;
-                       }
-                       // fall through...
-
-               case LFUN_DELETE:
-                       bv->lockedInsetStoreUndo(Undo::DELETE);
-                       mathcursor->Delete();
+               if (!mathcursor->InMacroMode() && mathcursor->pullArg()) {
                        bv->updateInset(this, true);
                        break;
+               }
+               // fall through...
+
+       case LFUN_DELETE:
+               bv->lockedInsetStoreUndo(Undo::DELETE);
+               mathcursor->Delete();
+               bv->updateInset(this, true);
+               break;
 
                //    case LFUN_GETXY:
                //      sprintf(dispatch_buffer, "%d %d",);
                //      dispatch_result = dispatch_buffer;
                //      break;
-               case LFUN_SETXY:
-                       {
-                               int x;
-                               int y;
-                               int x1;
-                               int y1;
-                               istringstream ist(arg.c_str());
-                               ist >> x >> y;
-                               par->GetXY(x1, y1);
-                               mathcursor->SetPos(x1 + x, y1 + y);
-                       }
-                       break;
+       case LFUN_SETXY:
+       {
+               int x;
+               int y;
+               int x1;
+               int y1;
+               istringstream ist(arg.c_str());
+               ist >> x >> y;
+               par->GetXY(x1, y1);
+               mathcursor->SetPos(x1 + x, y1 + y);
+       }
+       break;
 
                /* cursor selection ---------------------------- */
 
-               case LFUN_PASTE:
-                       if (was_macro)
-                               mathcursor->MacroModeClose();
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       mathcursor->SelPaste();
-                       UpdateLocal(bv);
-                       break;
+       case LFUN_PASTE:
+               if (was_macro)
+                       mathcursor->MacroModeClose();
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               mathcursor->SelPaste();
+               UpdateLocal(bv);
+               break;
 
-               case LFUN_CUT:
-                       bv->lockedInsetStoreUndo(Undo::DELETE);
-                       mathcursor->SelCut();
-                       UpdateLocal(bv);
-                       break;
+       case LFUN_CUT:
+               bv->lockedInsetStoreUndo(Undo::DELETE);
+               mathcursor->SelCut();
+               UpdateLocal(bv);
+               break;
 
-               case LFUN_COPY:
-                       mathcursor->SelCopy();
-                       break;
+       case LFUN_COPY:
+               mathcursor->SelCopy();
+               break;
 
-               case LFUN_HOMESEL:
-               case LFUN_ENDSEL:
-               case LFUN_WORDRIGHTSEL:
-               case LFUN_WORDLEFTSEL:
-                       break;
+       case LFUN_HOMESEL:
+       case LFUN_ENDSEL:
+       case LFUN_WORDRIGHTSEL:
+       case LFUN_WORDLEFTSEL:
+               break;
 
                // --- accented characters ------------------------------
 
-               case LFUN_UMLAUT:     mathcursor->setAccent(LM_ddot); break;
-               case LFUN_CIRCUMFLEX: mathcursor->setAccent(LM_hat); break;
-               case LFUN_GRAVE:      mathcursor->setAccent(LM_grave); break;
-               case LFUN_ACUTE:      mathcursor->setAccent(LM_acute); break;
-               case LFUN_TILDE:      mathcursor->setAccent(LM_tilde); break;
-               case LFUN_MACRON:     mathcursor->setAccent(LM_bar); break;
-               case LFUN_DOT:        mathcursor->setAccent(LM_dot); break;
-               case LFUN_CARON:      mathcursor->setAccent(LM_check); break;
-               case LFUN_BREVE:      mathcursor->setAccent(LM_breve); break;
-               case LFUN_VECTOR:     mathcursor->setAccent(LM_vec); break;
+       case LFUN_UMLAUT:     mathcursor->setAccent(LM_ddot); break;
+       case LFUN_CIRCUMFLEX: mathcursor->setAccent(LM_hat); break;
+       case LFUN_GRAVE:      mathcursor->setAccent(LM_grave); break;
+       case LFUN_ACUTE:      mathcursor->setAccent(LM_acute); break;
+       case LFUN_TILDE:      mathcursor->setAccent(LM_tilde); break;
+       case LFUN_MACRON:     mathcursor->setAccent(LM_bar); break;
+       case LFUN_DOT:        mathcursor->setAccent(LM_dot); break;
+       case LFUN_CARON:      mathcursor->setAccent(LM_check); break;
+       case LFUN_BREVE:      mathcursor->setAccent(LM_breve); break;
+       case LFUN_VECTOR:     mathcursor->setAccent(LM_vec); break;
 
                // Greek mode
-               case LFUN_GREEK:
-                       if (!greek_kb_flag) {
-                               greek_kb_flag = 1;
-                               bv->owner()->getMiniBuffer()->Set(_("Math greek mode on"));
-                       } else
-                               greek_kb_flag = 0;
-                       break;
+       case LFUN_GREEK:
+               if (!greek_kb_flag) {
+                       greek_kb_flag = 1;
+                       bv->owner()->getMiniBuffer()->Set(_("Math greek mode on"));
+               } else
+                       greek_kb_flag = 0;
+               break;
 
                // Greek keyboard
-               case LFUN_GREEK_TOGGLE:
-                       greek_kb_flag = (greek_kb_flag) ? 0 : 2;
-                       if (greek_kb_flag)
-                               bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard on"));
-                       else
-                               bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard off"));
-                       break;
+       case LFUN_GREEK_TOGGLE:
+               greek_kb_flag = (greek_kb_flag) ? 0 : 2;
+               if (greek_kb_flag)
+                       bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard on"));
+               else
+                       bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard off"));
+               break;
 
                //  Math fonts
-               case LFUN_BOLD:  mathcursor->toggleLastCode(LM_TC_BF); break;
-               case LFUN_SANS:  mathcursor->toggleLastCode(LM_TC_SF); break;
-               case LFUN_EMPH:  mathcursor->toggleLastCode(LM_TC_CAL); break;
-               case LFUN_ROMAN: mathcursor->toggleLastCode(LM_TC_RM); break;
-               case LFUN_CODE:  mathcursor->toggleLastCode(LM_TC_TT); break;
-               case LFUN_DEFAULT:  mathcursor->setLastCode(LM_TC_VAR); break;
-
-               case LFUN_TEX:
-                       // varcode = LM_TC_TEX;
-                       mathcursor->setLastCode(LM_TC_TEX);
-                       bv->owner()->getMiniBuffer()->Set(_("TeX mode"));
-                       break;
-
-               case LFUN_MATH_NUMBER:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       if (disp_flag) {
-                               short type = par->GetType();
-                               if (is_numbered(type)) {
-                                       --type;
-                                       if (!label.empty()) {
+       case LFUN_BOLD:  mathcursor->toggleLastCode(LM_TC_BF); break;
+       case LFUN_SANS:  mathcursor->toggleLastCode(LM_TC_SF); break;
+       case LFUN_EMPH:  mathcursor->toggleLastCode(LM_TC_CAL); break;
+       case LFUN_ROMAN: mathcursor->toggleLastCode(LM_TC_RM); break;
+       case LFUN_CODE:  mathcursor->toggleLastCode(LM_TC_TT); break;
+       case LFUN_DEFAULT:  mathcursor->setLastCode(LM_TC_VAR); break;
+
+       case LFUN_TEX:
+               // varcode = LM_TC_TEX;
+               mathcursor->setLastCode(LM_TC_TEX);
+               bv->owner()->getMiniBuffer()->Set(_("TeX mode"));
+               break;
+
+       case LFUN_MATH_NUMBER:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               if (disp_flag) {
+                       short type = par->GetType();
+                       if (is_numbered(type)) {
+                               --type;
+                               if (!label.empty()) {
                                        label.erase();
-                                       }
-                                       bv->owner()->getMiniBuffer()->Set(_("No number"));
-                               } else {
-                                       ++type;
-                                       bv->owner()->getMiniBuffer()->Set(_("Number"));
                                }
-                               par->SetType(type);
-                               UpdateLocal(bv);
+                               bv->owner()->getMiniBuffer()->Set(_("No number"));
+                       } else {
+                               ++type;
+                               bv->owner()->getMiniBuffer()->Set(_("Number"));
                        }
-                       break;
+                       par->SetType(type);
+                       UpdateLocal(bv);
+               }
+               break;
 
-               case LFUN_MATH_NONUMBER:
-                       if (is_multi_numbered(par->GetType())) {
+       case LFUN_MATH_NONUMBER:
+               if (is_multi_numbered(par->GetType())) {
                                //         MathMatrixInset *mt = (MathMatrixInset*)par;
                                //BUG
                                //         mt->SetNumbered(!mt->IsNumbered());
 
-                               #warning This is a terrible hack! We should find a better solution.
-                               while (mathcursor->getLabel() == MathedXIter::error_label) {
-                                       if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
+#warning This is a terrible hack! We should find a better solution.
+                       while (mathcursor->getLabel() == MathedXIter::error_label) {
+                               if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
                                        return DISPATCHED;
-                               }
-                               mathcursor->setNumbered();
-                               UpdateLocal(bv);
                        }
-                       break;
+                       mathcursor->setNumbered();
+                       UpdateLocal(bv);
+               }
+               break;
 
-               case LFUN_MATH_LIMITS:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       if (mathcursor->Limits())
-                               UpdateLocal(bv);
-                       // fall through!
-
-               case LFUN_MATH_SIZE:
-                       if (!arg.empty()) {
-                               latexkeys * l = in_word_set(arg);
-                               int sz = (l) ? l->id: -1;
-                               mathcursor->SetSize(sz);
-                               UpdateLocal(bv);
-                               break;
-                       }
-                       // possible fall through?
+       case LFUN_MATH_LIMITS:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               if (mathcursor->Limits())
+                       UpdateLocal(bv);
+               // fall through!
 
-               case LFUN_INSERT_MATH:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       InsertSymbol(bv, arg);
+       case LFUN_MATH_SIZE:
+               if (!arg.empty()) {
+                       latexkeys * l = in_word_set(arg);
+                       int sz = (l) ? l->id: -1;
+                       mathcursor->SetSize(sz);
+                       UpdateLocal(bv);
                        break;
+               }
+               // possible fall through?
 
+       case LFUN_INSERT_MATH:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               InsertSymbol(bv, arg);
+               break;
 
-               case LFUN_INSERT_MATRIX:
-                       {
-                               bv->lockedInsetStoreUndo(Undo::INSERT);
-                               int k, m, n;
-                               char s[80], arg2[80];
+
+       case LFUN_INSERT_MATRIX:
+       {
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               int k, m, n;
+               char s[80], arg2[80];
                                // This is just so that too long args won't ooze out of s.
-                               strncpy(arg2, arg.c_str(), 80); arg2[79]= '\0';
-                               k = sscanf(arg2, "%d %d %s", &m, &n, s);
-                               s[79] = '\0';
-
-                               if (k < 1) {
-                                       m = n = 1;
-                               } else if (k == 1) {
-                                       n = 1;
-                               }
+               strncpy(arg2, arg.c_str(), 80); arg2[79]= '\0';
+               k = sscanf(arg2, "%d %d %s", &m, &n, s);
+               s[79] = '\0';
+
+               if (k < 1) {
+                       m = n = 1;
+               } else if (k == 1) {
+                       n = 1;
+               }
 
-                               MathMatrixInset * p = new MathMatrixInset(m, n);
-                               if (mathcursor && p) {
-                                       if (k > 2 && int(strlen(s)) > m)
-                                               p->SetAlign(s[0], &s[1]);
-                                       mathcursor->Insert(p, LM_TC_ACTIVE_INSET);
-                                       UpdateLocal(bv);
-                               }
-                               break;
-                       }
+               MathMatrixInset * p = new MathMatrixInset(m, n);
+               if (mathcursor && p) {
+                       if (k > 2 && int(strlen(s)) > m)
+                               p->SetAlign(s[0], &s[1]);
+                       mathcursor->Insert(p, LM_TC_ACTIVE_INSET);
+                       UpdateLocal(bv);
+               }
+               break;
+       }
 
-               case LFUN_MATH_DELIM:
-               {
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       char lf[40], rg[40], arg2[40];
-                       int ilf = '(', irg = '.';
-                       latexkeys * l;
-                       string vdelim("(){}[]./|");
+       case LFUN_MATH_DELIM:
+       {
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               char lf[40], rg[40], arg2[40];
+               int ilf = '(', irg = '.';
+               latexkeys * l;
+               string vdelim("(){}[]./|");
 
-                       if (arg.empty())
-                               break;
-                       ::strncpy(arg2, arg.c_str(), 40);
-                       arg2[39]= '\0';
-                       int n = sscanf(arg2, "%s %s", lf, rg);
-                       lf[39] = '\0';
-                       rg[39] = '\0';
-
-                       if (n > 0) {
-                               if (isdigit(lf[0]))
-                                       ilf = lyx::atoi(lf);
-                               else
+               if (arg.empty())
+                       break;
+               ::strncpy(arg2, arg.c_str(), 40);
+               arg2[39]= '\0';
+               int n = sscanf(arg2, "%s %s", lf, rg);
+               lf[39] = '\0';
+               rg[39] = '\0';
+
+               if (n > 0) {
+                       if (isdigit(lf[0]))
+                               ilf = lyx::atoi(lf);
+                       else
                                if (lf[1]) {
                                        l = in_word_set(lf, strlen(lf));
                                        // Long words will cause l == 0; so check.
@@ -973,258 +973,232 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
                                } else if (vdelim.find(lf[0]) != string::npos)
                                        ilf = lf[0];
 
-                               if (n > 1) {
-                                       if (isdigit(rg[0]))
+                       if (n > 1) {
+                               if (isdigit(rg[0]))
                                        irg = lyx::atoi(rg);
-                                       else
+                               else
                                        if (rg[1]) {
                                                l = in_word_set(rg, strlen(rg));
                                                if (l)
                                                        irg = l->id;
                                        } else if (vdelim.find(rg[0]) != string::npos)
                                                irg = rg[0];
-                               }
                        }
-
-                       MathDelimInset * p = new MathDelimInset(ilf, irg);
-                       mathcursor->Insert(p, LM_TC_ACTIVE_INSET);
-                       UpdateLocal(bv);
-                       break;
                }
 
-               case LFUN_PROTECTEDSPACE:
-                       bv->lockedInsetStoreUndo(Undo::INSERT);
-                       sp = new MathSpaceInset(1);
-                       mathcursor->Insert(sp);
-                       space_on = true;
-                       UpdateLocal(bv);
-                       break;
-
-               case LFUN_INSERT_LABEL:
-                       {
-                               bv->lockedInsetStoreUndo(Undo::INSERT);
-                               if (par->GetType() < LM_OT_PAR)
-                                       break;
-
-                               string old_label = is_multiline(par->GetType())
-                                                    ? mathcursor->getLabel() : label;
-
-                               #warning This is a terrible hack! We should find a better solution.
-                               /// This is needed because in some positions mathcursor->cursor->crow
-                               /// is equal to 0, and therefore the label cannot be inserted.
-                               /// So we move the cursor left until mathcursor->cursor->crow != 0.
-                               while (old_label == MathedXIter::error_label) {
-                                       if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
-                                               return DISPATCHED;
-                                       old_label = mathcursor->getLabel();
-                               }
-
-                               string new_label = arg;
-                               if (new_label.empty()) {
-                                       string default_label = (lyxrc.label_init_length >= 0) ? "eq:" : "";
-                                       pair<bool, string> res = old_label.empty()
-                                               ? askForText(_("Enter new label to insert:"), default_label)
-                                               : askForText(_("Enter label:"), old_label);
-                                       if (!res.first)
-                                               break;
-                                       new_label = frontStrip(strip(res.second));
-                               }
-
-                               if (new_label == old_label)
-                                       break;  // Nothing to do
-
-                               if (!new_label.empty())
-                                       SetNumber(true);
-
-                               if (!new_label.empty() && bv->ChangeRefsIfUnique(old_label, new_label))
-                                       bv->redraw();
-
-                               if (is_multi_numbered(par->GetType()))
-                                       mathcursor->setLabel(new_label);
-                               //        MathMatrixInset *mt = (MathMatrixInset*)par;
-                               //        mt->SetLabel(new_label);
-                               else
-                                       label = new_label;
-
-                               UpdateLocal(bv);
-                               break;
-                       }
-
-               case LFUN_MATH_DISPLAY:
-                       bv->lockedInsetStoreUndo(Undo::EDIT);
-                       display(!disp_flag);
-                       UpdateLocal(bv);
-                       break;
+               MathDelimInset * p = new MathDelimInset(ilf, irg);
+               mathcursor->Insert(p, LM_TC_ACTIVE_INSET);
+               UpdateLocal(bv);
+               break;
+       }
 
-               // Invalid actions under math mode
-               case LFUN_MATH_MODE:
-                       if (mathcursor->getLastCode()!= LM_TC_TEXTRM) {
-                               bv->owner()->getMiniBuffer()->Set(_("math text mode"));
-                               varcode = LM_TC_TEXTRM;
-                       } else {
-                               varcode = LM_TC_VAR;
-                       }
-                       mathcursor->setLastCode(varcode);
-                       break;
+       case LFUN_PROTECTEDSPACE:
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               sp = new MathSpaceInset(1);
+               mathcursor->Insert(sp);
+               space_on = true;
+               UpdateLocal(bv);
+               break;
 
-               case LFUN_UNDO:
-                       bv->owner()->getMiniBuffer()->Set(_("Invalid action in math mode!"));
+       case LFUN_INSERT_LABEL:
+       {
+               bv->lockedInsetStoreUndo(Undo::INSERT);
+               if (par->GetType() < LM_OT_PAR)
                        break;
 
-               //------- dummy actions
-               case LFUN_EXEC_COMMAND:
-                       bv->owner()->getMiniBuffer()->PrepareForCommand();
-                       break;
+               string old_label = is_multiline(par->GetType())
+                       ? mathcursor->getLabel() : label;
+
+#warning This is a terrible hack! We should find a better solution.
+               // This is needed because in some positions
+               // mathcursor->cursor->crow is equal to 0, and therefore
+               // the label cannot be inserted.
+               // So we move the cursor left until
+               // mathcursor->cursor->crow != 0.
+               while (old_label == MathedXIter::error_label) {
+                       if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
+                               return DISPATCHED;
+                       old_label = mathcursor->getLabel();
+               }
 
-               default:
-                       if ((action == -1  || action == LFUN_SELFINSERT) && !arg.empty())  {
-                               unsigned char c = arg[0];
-                               bv->lockedInsetStoreUndo(Undo::INSERT);
+               string new_label = arg;
+               if (new_label.empty()) {
+                       string default_label = (lyxrc.label_init_length >= 0) ? "eq:" : "";
+                       pair<bool, string> res = old_label.empty()
+                               ? askForText(_("Enter new label to insert:"), default_label)
+                               : askForText(_("Enter label:"), old_label);
+                       if (!res.first)
+                               break;
+                       new_label = frontStrip(strip(res.second));
+               }
 
-                               if (c == ' ' && mathcursor->getAccent() == LM_hat) {
-                                       c = '^';
-                                       mathcursor->setAccent(0);
-                               }
+               if (new_label == old_label)
+                       break;  // Nothing to do
 
-                               if (c == 0) {      // Dead key, do nothing
-                                       //lyxerr << "deadkey" << endl;
-                                       break;
-                               }
+               if (!new_label.empty())
+                       SetNumber(true);
 
-                               if (isalpha(c)) {
-                                       if (mathcursor->getLastCode() == LM_TC_TEX) {
-                                               mathcursor->MacroModeOpen();
-                                               mathcursor->clearLastCode();
-                                               varcode = LM_TC_MIN;
-                                       } else
+               if (!new_label.empty() && bv->ChangeRefsIfUnique(old_label, new_label))
+                       bv->redraw();
 
-                                       if (!varcode) {         
-                                               short f = (mathcursor->getLastCode()) ?
-                                                       mathcursor->getLastCode() :
-                                                       static_cast<MathedTextCodes>(mathcursor->GetFCode());
-                                               varcode = MathIsAlphaFont(f) ?
-                                               static_cast<MathedTextCodes>(f) :
-                                               LM_TC_VAR;
-                                       }
+               if (is_multi_numbered(par->GetType())) {
+                       mathcursor->setLabel(new_label);
+                       // MathMatrixInset *mt = (MathMatrixInset*)par;
+                       // mt->SetLabel(new_label);
+               } else
+                       label = new_label;
 
-                                       //           lyxerr << "Varcode << vardoce;
-                                       MathedTextCodes char_code = varcode;
-                                       if (greek_kb_flag) {
-                                               char greek[26] =
-                                               {'A', 'B', 'X',  0 , 'E',  0 ,  0 , 'H', 'I',  0 ,
-                                               'K',  0 , 'M', 'N', 'O',  0 ,  0 , 'P',  0 , 'T',
-                                               'Y',  0,   0,   0,   0 , 'Z' };
-
-                                               if ('A' <= c && c <= 'Z' && greek[c - 'A']) {
-                                                       char_code = LM_TC_RM;
-                                                       c = greek[c - 'A'];
-                                               } else
-                                                       char_code = LM_TC_SYMB;
-                                       }
+               UpdateLocal(bv);
+               break;
+       }
 
-                                       mathcursor->Insert(c, char_code);
+       case LFUN_MATH_DISPLAY:
+               bv->lockedInsetStoreUndo(Undo::EDIT);
+               display(!disp_flag);
+               UpdateLocal(bv);
+               break;
 
-                                       if (greek_kb_flag && char_code == LM_TC_RM )
-                                               mathcursor->setLastCode(LM_TC_VAR);
+               // Invalid actions under math mode
+       case LFUN_MATH_MODE:
+               if (mathcursor->getLastCode()!= LM_TC_TEXTRM) {
+                       bv->owner()->getMiniBuffer()->Set(_("math text mode"));
+                       varcode = LM_TC_TEXTRM;
+               } else {
+                       varcode = LM_TC_VAR;
+               }
+               mathcursor->setLastCode(varcode);
+               break;
 
-                                       varcode = LM_TC_MIN;
+       case LFUN_UNDO:
+               bv->owner()->getMiniBuffer()->Set(_("Invalid action in math mode!"));
+               break;
 
-                                       if (greek_kb_flag<2)
-                                               greek_kb_flag = 0;
+               //------- dummy actions
+       case LFUN_EXEC_COMMAND:
+               bv->owner()->getMiniBuffer()->PrepareForCommand();
+               break;
 
-                               } else
+       default:
+               if ((action == -1  || action == LFUN_SELFINSERT) && !arg.empty())  {
+                       unsigned char c = arg[0];
+                       bv->lockedInsetStoreUndo(Undo::INSERT);
 
-                               if (strchr("!,:;{}", c) && (varcode == LM_TC_TEX||was_macro)) {
-                                       mathcursor->Insert(c, LM_TC_TEX);
-                                       if (c == '{') {
-                                               mathcursor->Insert('}', LM_TC_TEX);
-                                               mathcursor->Left();
-                                       }
-                                       mathcursor->clearLastCode();
-                                       //             varcode = LM_TC_MIN;
-                               } else
+                       if (c == ' ' && mathcursor->getAccent() == LM_hat) {
+                               c = '^';
+                               mathcursor->setAccent(0);
+                       }
 
-                               if (c == '_' && varcode == LM_TC_TEX) {
-                                       mathcursor->Insert(c, LM_TC_SPECIAL);
-                                       mathcursor->clearLastCode();
-                                       //             varcode = LM_TC_MIN;
-                               } else
+                       if (c == 0) {      // Dead key, do nothing
+                               //lyxerr << "deadkey" << endl;
+                               break;
+                       }
 
-                               if (('0'<= c && c<= '9') && (varcode == LM_TC_TEX||was_macro)) {
+                       if (isalpha(c)) {
+                               if (mathcursor->getLastCode() == LM_TC_TEX) {
                                        mathcursor->MacroModeOpen();
                                        mathcursor->clearLastCode();
-                                       mathcursor->Insert(c, LM_TC_MIN);
-                               } else
-
-                               if (('0'<= c && c<= '9') || strchr(";:!|[]().,?", c)) {
-                                       mathcursor->Insert(c, LM_TC_CONST);
-                               } else
-
-                               if (strchr("+/-*<>=", c)) {
-                                       mathcursor->Insert(c, LM_TC_BOP);
-                               } else
-
-                               if (strchr(latex_special_chars, c) && c!= '_') {
-                                       mathcursor->Insert(c, LM_TC_SPECIAL);
-                               } else
-
-                               if (c == '_' || c == '^') {
-                                       char s[2];
-                                       s[0] = c;
-                                       s[1] = 0;
-                                       mathcursor->Interpret(s);
-                               } else
-
-                               if (c == ' ') { 
-                                       if (!varcode) { 
-                                               short f = (mathcursor->getLastCode()) ?
-                                                                       mathcursor->getLastCode() :
-                                                                       static_cast<MathedTextCodes>(mathcursor->GetFCode());
-                                               varcode = MathIsAlphaFont(f) ?
+                                       varcode = LM_TC_MIN;
+                               } else if (!varcode) {          
+                                       short f = (mathcursor->getLastCode()) ?
+                                               mathcursor->getLastCode() :
+                                               static_cast<MathedTextCodes>(mathcursor->GetFCode());
+                                       varcode = MathIsAlphaFont(f) ?
                                                static_cast<MathedTextCodes>(f) :
                                                LM_TC_VAR;
-                                       }
-
-                                       if (varcode == LM_TC_TEXTRM) {
-                                               mathcursor->Insert(c, LM_TC_TEXTRM);
-                                       } else
-
-                                       if (was_macro) {
-                                               mathcursor->MacroModeClose();
+                               }
+                               
+                               //           lyxerr << "Varcode << vardoce;
+                               MathedTextCodes char_code = varcode;
+                               if (greek_kb_flag) {
+                                       char greek[26] =
+                                       {'A', 'B', 'X',  0 , 'E',  0 ,  0 , 'H', 'I',  0 ,
+                                        'K',  0 , 'M', 'N', 'O',  0 ,  0 , 'P',  0 , 'T',
+                                        'Y',  0,   0,   0,   0 , 'Z' };
+                                       
+                                       if ('A' <= c && c <= 'Z' && greek[c - 'A']) {
+                                               char_code = LM_TC_RM;
+                                               c = greek[c - 'A'];
                                        } else
-
-                                       if (sp) {
-                                               int isp = (sp->GetSpace()<5) ? sp->GetSpace()+1: 0;
-                                               sp->SetSpace(isp);
-                                               space_on = true;
-                                       } else 
-
-                                       if (!mathcursor->Pop() && mathcursor->IsEnd())
-                                               result = FINISHED;
-                               } else
-
-                               if (c == '\'' || c == '@') {
-                                       mathcursor->Insert (c, LM_TC_VAR);
-                               } else
-
-                               if (c == '\\') {
-                                       if (was_macro)
-                                               mathcursor->MacroModeClose();
-                                       bv->owner()->getMiniBuffer()->Set(_("TeX mode"));
-                                       mathcursor->setLastCode(LM_TC_TEX);
+                                               char_code = LM_TC_SYMB;
                                }
-                               UpdateLocal(bv);
-                       } else if (action == LFUN_MATH_PANEL) {
-                               result = UNDISPATCHED;
-                       } else {
-                               // lyxerr << "Closed by action " << action << endl;
-                               result =  FINISHED;
+                               
+                               mathcursor->Insert(c, char_code);
+                               
+                               if (greek_kb_flag && char_code == LM_TC_RM )
+                                       mathcursor->setLastCode(LM_TC_VAR);
+                               
+                               varcode = LM_TC_MIN;
+                               
+                               if (greek_kb_flag<2)
+                                       greek_kb_flag = 0;
+                               
+                       } else if (strchr("!,:;{}", c) && (varcode == LM_TC_TEX||was_macro)) {
+                               mathcursor->Insert(c, LM_TC_TEX);
+                               if (c == '{') {
+                                       mathcursor->Insert('}', LM_TC_TEX);
+                                       mathcursor->Left();
+                               }
+                               mathcursor->clearLastCode();
+                               //             varcode = LM_TC_MIN;
+                       } else if (c == '_' && varcode == LM_TC_TEX) {
+                               mathcursor->Insert(c, LM_TC_SPECIAL);
+                               mathcursor->clearLastCode();
+                               //             varcode = LM_TC_MIN;
+                       } else if (('0'<= c && c<= '9') && (varcode == LM_TC_TEX||was_macro)) {
+                               mathcursor->MacroModeOpen();
+                               mathcursor->clearLastCode();
+                               mathcursor->Insert(c, LM_TC_MIN);
+                       } else if (('0'<= c && c<= '9') || strchr(";:!|[]().,?", c)) {
+                               mathcursor->Insert(c, LM_TC_CONST);
+                       } else if (strchr("+/-*<>=", c)) {
+                               mathcursor->Insert(c, LM_TC_BOP);
+                       } else if (strchr(latex_special_chars, c) && c!= '_') {
+                               mathcursor->Insert(c, LM_TC_SPECIAL);
+                       } else if (c == '_' || c == '^') {
+                               char s[2];
+                               s[0] = c;
+                               s[1] = 0;
+                               mathcursor->Interpret(s);
+                       } else if (c == ' ') {  
+                               if (!varcode) { 
+                                       short f = (mathcursor->getLastCode()) ?
+                                               mathcursor->getLastCode() :
+                                               static_cast<MathedTextCodes>(mathcursor->GetFCode());
+                                       varcode = MathIsAlphaFont(f) ?
+                                               static_cast<MathedTextCodes>(f) :
+                                               LM_TC_VAR;
+                               }
+                               
+                               if (varcode == LM_TC_TEXTRM) {
+                                       mathcursor->Insert(c, LM_TC_TEXTRM);
+                               } else if (was_macro) {
+                                       mathcursor->MacroModeClose();
+                               } else if (sp) {
+                                       int isp = (sp->GetSpace()<5) ? sp->GetSpace()+1: 0;
+                                       sp->SetSpace(isp);
+                                       space_on = true;
+                               } else if (!mathcursor->Pop() && mathcursor->IsEnd())
+                                       result = FINISHED;
+                       } else if (c == '\'' || c == '@') {
+                               mathcursor->Insert (c, LM_TC_VAR);
+                       } else if (c == '\\') {
+                               if (was_macro)
+                                       mathcursor->MacroModeClose();
+                               bv->owner()->getMiniBuffer()->Set(_("TeX mode"));
+                               mathcursor->setLastCode(LM_TC_TEX);
                        }
+                       UpdateLocal(bv);
+               } else if (action == LFUN_MATH_PANEL) {
+                       result = UNDISPATCHED;
+               } else {
+                       // lyxerr << "Closed by action " << action << endl;
+                       result =  FINISHED;
+               }
        }
-
+       
        if (was_macro != mathcursor->InMacroMode()
-             && action >= 0
-             && action != LFUN_BACKSPACE) 
+           && action >= 0
+           && action != LFUN_BACKSPACE) 
                UpdateLocal(bv);
 
        if (sp && !space_on)
@@ -1234,7 +1208,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
                ToggleInsetSelection(bv);
 
        if ((result == DISPATCHED) || (result == DISPATCHED_NOUPDATE) ||
-              (result == UNDISPATCHED))
+           (result == UNDISPATCHED))
                ShowInsetCursor(bv);
        else
                bv->unlockInset(this);
@@ -1254,7 +1228,7 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
                        if (it.IsActive()) {
                                MathParInset * p = it.GetActiveInset();
                                if (!features.binom && p->GetType() == LM_OT_MACRO &&
-                                                               p->GetName() == "binom") {
+                                   p->GetName() == "binom") {
                                        features.binom = true;
                                } else {
                                        for (int i = 0; i <= p->getMaxArgumentIdx(); ++i) {
index c1112867ac05233d998dd6d492a7718bc758d155..8a520a013085b33f01fe65101cbcc340d16c028a 100644 (file)
  */
 
 #include <config.h>
-#include <cstdlib>
 
 #ifdef __GNUG__
-#pragma implementation "formulamacro.h"
+#pragma implementation
 #endif
 
 #include "formulamacro.h"
@@ -40,34 +39,34 @@ using std::ostream;
 using std::istream;
 
 InsetFormulaMacro::InsetFormulaMacro()
-       : InsetFormula(true)
+       : InsetFormula(true)
 {
-    tmacro = 0;
-    opened = false;
+       tmacro = 0;
+       opened = false;
 }
 
 
 InsetFormulaMacro::InsetFormulaMacro(string nm, int na, bool /*e*/)
         : InsetFormula(true), name(nm)
 {
-    tmacro = MathMacroTable::mathMTable.getTemplate(name);
-    if (!tmacro) {
-       tmacro = new MathMacroTemplate(name.c_str(), na);
-       MathMacroTable::mathMTable.addTemplate(tmacro);
-    }
-    opened = false;
+       tmacro = MathMacroTable::mathMTable.getTemplate(name);
+       if (!tmacro) {
+               tmacro = new MathMacroTemplate(name.c_str(), na);
+               MathMacroTable::mathMTable.addTemplate(tmacro);
+       }
+       opened = false;
 }
 
 
 InsetFormulaMacro::~InsetFormulaMacro()
 {
-    par = 0;
+       par = 0;
 }
 
 
 Inset * InsetFormulaMacro::Clone(Buffer const &) const
 {
-   return new InsetFormulaMacro(name);
+       return new InsetFormulaMacro(name);
 }
 
 
@@ -88,13 +87,13 @@ int InsetFormulaMacro::Latex(Buffer const *, ostream & os, bool /*fragile*/,
 
 int InsetFormulaMacro::Linuxdoc(Buffer const * buf, ostream & os) const
 {
-    return Ascii(buf, os, 0);
+       return Ascii(buf, os, 0);
 }
 
 
 int InsetFormulaMacro::DocBook(Buffer const * buf, ostream & os) const
 {
-    return Ascii(buf, os, 0);
+       return Ascii(buf, os, 0);
 }
 
 
@@ -121,33 +120,33 @@ void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
 
 int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
 {
-    if (opened) {
-       tmacro->update();
-       return InsetFormula::ascent(pain, f);
-    }
-    return lyxfont::maxAscent(f) + 3;
+       if (opened) {
+               tmacro->update();
+               return InsetFormula::ascent(pain, f);
+       }
+       return lyxfont::maxAscent(f) + 3;
 }
 
 
 int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
 {
-    if (opened) {
-       tmacro->update();
-       return InsetFormula::descent(pain, f);
-    }
-    return lyxfont::maxDescent(f) + 1;
+       if (opened) {
+               tmacro->update();
+               return InsetFormula::descent(pain, f);
+       }
+       return lyxfont::maxDescent(f) + 1;
 }
 
 
 int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
 {
-    if (opened) {
-       tmacro->update();
-       return InsetFormula::width(bv, f);
-    }
-    string ilabel(_("Macro: "));
-    ilabel += name;
-    return 6 + lyxfont::width(ilabel, f);
+       if (opened) {
+               tmacro->update();
+               return InsetFormula::width(bv, f);
+       }
+       string ilabel(_("Macro: "));
+       ilabel += name;
+       return 6 + lyxfont::width(ilabel, f);
 }
 
 
@@ -164,10 +163,9 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
        } else {
                font.setColor(LColor::math);
                
-               int y = baseline - ascent(bv, font) + 1;
-               int w = width(bv, font) - 2;
-               int h = (ascent(bv, font) + descent(bv, font) - 2);
-
+               int const y = baseline - ascent(bv, font) + 1;
+               int const w = width(bv, font) - 2;
+               int const h = (ascent(bv, font) + descent(bv, font) - 2);
        
                pain.fillRectangle(int(x), y, w, h, LColor::mathbg);
                pain.rectangle(int(x), y, w, h, LColor::mathframe);
@@ -188,21 +186,21 @@ string const InsetFormulaMacro::EditMessage() const
 
 void InsetFormulaMacro::Edit(BufferView * bv, int x, int y,unsigned int button)
 {
-    opened = true;
-    par = static_cast<MathParInset*>(tmacro->Clone());
-    InsetFormula::Edit(bv, x, y, button);
+       opened = true;
+       par = static_cast<MathParInset*>(tmacro->Clone());
+       InsetFormula::Edit(bv, x, y, button);
 }
 
               
 void InsetFormulaMacro::InsetUnlock(BufferView * bv)
 {
-    opened = false;
-    MathedArray * tarray = tmacro->GetData();
-    MathedIter it(tarray);
-    it.Clear();
-    tmacro->SetData(par->GetData());
-    tmacro->setEditMode(false);
-    InsetFormula::InsetUnlock(bv);
+       opened = false;
+       MathedArray * tarray = tmacro->GetData();
+       MathedIter it(tarray);
+       it.Clear();
+       tmacro->SetData(par->GetData());
+       tmacro->setEditMode(false);
+       InsetFormula::InsetUnlock(bv);
 }
 
 
@@ -210,19 +208,20 @@ UpdatableInset::RESULT
 InsetFormulaMacro::LocalDispatch(BufferView * bv,
                                 int action, string const & arg)
 {
-    if (action == LFUN_MATH_MACROARG) {
-       int i = lyx::atoi(arg) - 1;
-       if (i >= 0 && i < tmacro->getNoArgs()) {
-           mathcursor->Insert(tmacro->getMacroPar(i), LM_TC_INSET);
-           InsetFormula::UpdateLocal(bv);
-       }
+       if (action == LFUN_MATH_MACROARG) {
+               int i = lyx::atoi(arg) - 1;
+               if (i >= 0 && i < tmacro->getNoArgs()) {
+                       mathcursor->Insert(tmacro->getMacroPar(i),
+                                          LM_TC_INSET);
+                       InsetFormula::UpdateLocal(bv);
+               }
        
-       return DISPATCHED;
-    }
-    tmacro->setEditMode(true);
-    tmacro->Metrics();
-    RESULT result = InsetFormula::LocalDispatch(bv, action, arg);
-    tmacro->setEditMode(false);
+               return DISPATCHED;
+       }
+       tmacro->setEditMode(true);
+       tmacro->Metrics();
+       RESULT result = InsetFormula::LocalDispatch(bv, action, arg);
+       tmacro->setEditMode(false);
     
-    return result;
+       return result;
 }
index c764348f401bea5c6d55d125174fbb98928e11db..989a25c22785e5f3af56b437c92bf907398a8712 100644 (file)
@@ -48,7 +48,7 @@ MathAccentInset::draw(Painter & pain, int x, int y)
        else {
                string s;
                s += c;
-               drawStr(pain, fn, size, x, y, s);
+               drawStr(pain, fn, size(), x, y, s);
        }
        x += (code == LM_not) ? (width-dw) / 2 : 2;
        mathed_draw_deco(pain, x, y - dy, dw, dh, code);
@@ -65,9 +65,9 @@ MathAccentInset::Metrics()
                width = inset->Width();
                dh = ascent;
        } else {
-               mathed_char_height(fn, size, c, ascent, descent);
-               width = mathed_char_width(fn, size, c);
-               dh = (width-2)/2; 
+               mathed_char_height(fn, size(), c, ascent, descent);
+               width = mathed_char_width(fn, size(), c);
+               dh = (width - 2) / 2; 
        }
        if (code == LM_not) {
                ascent += dh;
index 6d8e0ee3391e208c8ff716418a393c61e45ca1e9..c43d421609d544775c24d4244a26c60aa4e7ba59 100644 (file)
@@ -57,7 +57,7 @@ MathBigopInset::draw(Painter & pain, int x, int y)
                         LColor::mathline);
                ++x;
        }
-       pain.text(x, y, s, mathed_get_font(t, size));
+       pain.text(x, y, s, mathed_get_font(t, size()));
 }
 
 
@@ -76,8 +76,8 @@ MathBigopInset::Metrics()
                s = name;
                t = LM_TC_TEXTRM;
        }
-       mathed_string_height(t, size, s, ascent, descent);
-       width = mathed_string_width(t, size, s);
+       mathed_string_height(t, size(), s, ascent, descent);
+       width = mathed_string_width(t, size(), s);
        if (sym == LM_oint) width += 2;
 }
 
index 6c8b30a3fc46aba032b1ac7027e271a80fd89b4e..2156e8e52e1b2dac952de17f0ecce9e51ecfc4dc 100644 (file)
@@ -42,19 +42,20 @@ MathDecorationInset::draw(Painter & pain, int x, int y)
 void
 MathDecorationInset::Metrics()
 {
-       int h = 2*mathed_char_height(LM_TC_VAR, size, 'I', ascent, descent);  
+       int h = 2 * mathed_char_height(LM_TC_VAR, size(), 'I',
+                                      ascent, descent);  
        MathParInset::Metrics();
-       int w = Width()+4;
-       if (w<16) w = 16;
-       dh = w/5;
-       if (dh>h) dh = h;
+       int w = Width() + 4;
+       if (w < 16) w = 16;
+       dh = w / 5;
+       if (dh > h) dh = h;
        
        if (upper) {
-               ascent += dh+2;
+               ascent += dh + 2;
                dy = -ascent;
        } else {
-               dy = descent+2;
-               descent += dh+4;
+               dy = descent + 2;
+               descent += dh + 4;
        }
        dw = width;
        width = w;
index adb70fdd1f0d418a5533677196a8656e35ba8330..31ef0c4df4adb3c71dd18dddbb3c8de27d1f34ce 100644 (file)
@@ -19,7 +19,6 @@
 
 #include FORMS_H_LOCATION
 #include <algorithm>
-#include <cstdlib>
 #include "symbol_def.h"
 #include "math_inset.h"
 #include "LColor.h"
index deecead4ffde0ec67ebde65db34d2719281599ff..0baf32eb78ffd3b19342a92f287683dcd7a6f103 100644 (file)
@@ -57,37 +57,38 @@ void MathDelimInset::Write(ostream & os, bool fragile)
 void
 MathDelimInset::draw(Painter & pain, int x, int y)
 { 
-       xo = x;  yo = y; 
+       xo(x);
+       yo(y); 
        MathParInset::draw(pain, x + dw + 2, y - dh); 
        
        if (left == '.') {
-               pain.line(x + 4, yo - ascent,
-                         x + 4, yo + descent,
+               pain.line(x + 4, yo() - ascent,
+                         x + 4, yo() + descent,
                          LColor::mathcursor, Painter::line_onoffdash);
        } else
                mathed_draw_deco(pain, x, y - ascent, dw, Height(), left);
        x += Width() - dw - 2;
        if (right == '.') {
-               pain.line(x + 4, yo - ascent,
-                         x + 4, yo + descent,
+               pain.line(x + 4, yo() - ascent,
+                         x + 4, yo() + descent,
                          LColor::mathcursor, Painter::line_onoffdash);
        } else
-               mathed_draw_deco(pain, x, y-ascent, dw, Height(), right);
+               mathed_draw_deco(pain, x, y - ascent, dw, Height(), right);
 }
 
 
 void
 MathDelimInset::Metrics()
 {
-   MathParInset::Metrics();
-   int d;
-   
-   mathed_char_height(LM_TC_CONST, size, 'I', d, dh);
-   dh /= 2;
-   ascent += 2 + dh;
-   descent += 2 - dh;
-   dw = Height()/5;
-   if (dw > 15) dw = 15;
-   if (dw<6) dw = 6;
-   width += 2*dw+4;
+       MathParInset::Metrics();
+       int d;
+       
+       mathed_char_height(LM_TC_CONST, size(), 'I', d, dh);
+       dh /= 2;
+       ascent += 2 + dh;
+       descent += 2 - dh;
+       dw = Height()/5;
+       if (dw > 15) dw = 15;
+       if (dw < 6) dw = 6;
+       width += 2 * dw + 4;
 }
index d3deb556c31df75274d70e3f310f1e6a9f1150b6..92fdccec98772e5f02e7cb45a0c8656f51a4a690 100644 (file)
@@ -30,8 +30,8 @@ MathDotsInset::draw(Painter & pain, int x, int y)
 void
 MathDotsInset::Metrics()
 {
-       mathed_char_height(LM_TC_VAR, size, 'M', ascent, descent);
-       width = mathed_char_width(LM_TC_VAR, size, 'M');   
+       mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
+       width = mathed_char_width(LM_TC_VAR, size(), 'M');   
        switch (code) {
        case LM_ldots: dh = 0; break;
        case LM_cdots: dh = ascent/2; break;
index 3e5d5e23b55bf053b283ade290c2d81219faa1d8..3d57c1901ee58d4734e7d2af4cb7fa2c57c4a505 100644 (file)
@@ -56,9 +56,9 @@ void MathFracInset::SetStyle(short st)
 {
        MathParInset::SetStyle(st);
        dh = 0;
-       den->SetStyle((size == LM_ST_DISPLAY) ?
+       den->SetStyle((size() == LM_ST_DISPLAY) ?
                      static_cast<short>(LM_ST_TEXT)
-                     : size);
+                     : size());
 }
 
 
@@ -99,16 +99,19 @@ MathedArray * MathFracInset::GetData()
 
 bool MathFracInset::Inside(int x, int y) 
 {
-       int xx = xo - (width - w0) / 2;
+       int xx = xo() - (width - w0) / 2;
        
-       return x >= xx && x <= xx + width && y <= yo + descent && y >= yo - ascent;
+       return x >= xx
+               && x <= xx + width
+               && y <= yo() + descent
+               && y >= yo() - ascent;
 }
 
 
 void MathFracInset::SetFocus(int /*x*/, int y)
 {  
 //    lyxerr << "y " << y << " " << yo << " " << den->yo << " ";
-       idx = (y > yo) ? 1: 0;
+       idx = (y > yo()) ? 1: 0;
 }
 
 
@@ -116,13 +119,13 @@ void
 MathFracInset::draw(Painter & pain, int x, int y)
 { 
        short idxp = idx;
-       short sizex = size;
+       short sizex = size();
        
        idx = 0;
-       if (size == LM_ST_DISPLAY) ++size;
+       if (size() == LM_ST_DISPLAY) incSize();
        MathParInset::draw(pain, x + (width - w0) / 2, y - des0);
        den->draw(pain, x + (width - w1) / 2, y + den->Ascent() + 2 - dh);
-       size = sizex;
+       size(sizex);
        if (objtype == LM_OT_FRAC)
                pain.line(x + 2, y - dh, x + width - 4, y - dh, LColor::mathline);
        idx = idxp;
@@ -134,14 +137,14 @@ MathFracInset::Metrics()
 {
        if (!dh) {
                int a, b;
-               dh = mathed_char_height(LM_TC_CONST, size, 'I', a, b)/2;
+               dh = mathed_char_height(LM_TC_CONST, size(), 'I', a, b) / 2;
        }
        short idxp = idx;
-       short sizex = size
+       short sizex = size();
        idx = 0;
-       if (size == LM_ST_DISPLAY) ++size
+       if (size() == LM_ST_DISPLAY) incSize()
        MathParInset::Metrics();
-       size = sizex;
+       size(sizex);
        w0 = width;
        int as = Height() + 2 + dh;
        des0 = Descent() + 2 + dh;
index 093ee9c5695d20275baa8e4430521d3dbe9ed7ea..5fe22ba83ee09abbb284298760e36484f7568196 100644 (file)
@@ -54,7 +54,7 @@ void
 MathFuncInset::draw(Painter & pain, int x, int y)
 { 
        if (!name.empty() && name[0] > ' ') {
-               LyXFont font = WhichFont(LM_TC_TEXTRM, size);
+               LyXFont font = WhichFont(LM_TC_TEXTRM, size());
                font.setLatex(LyXFont::ON);
                x += (lyxfont::width('I', font) + 3) / 4;
                pain.text(x, y, name, font);
@@ -66,7 +66,7 @@ MathFuncInset::draw(Painter & pain, int x, int y)
 void MathFuncInset::Metrics() 
 {
        //ln = (name) ? strlen(name): 0;
-       LyXFont  font = WhichFont(LM_TC_TEXTRM, size);
+       LyXFont font = WhichFont(LM_TC_TEXTRM, size());
        font.setLatex(LyXFont::ON);
        if (name.empty()) {
                width = df_width;
@@ -75,6 +75,6 @@ void MathFuncInset::Metrics()
        } else {
                width = lyxfont::width(name, font)
                        + lyxfont::width('I', font) / 2;
-               mathed_string_height(LM_TC_TEXTRM, size, name, ascent, descent);
+               mathed_string_height(LM_TC_TEXTRM, size(), name, ascent, descent);
        }
 }
index b214407ba49268617708f20692772c39013ebeac..c0766e27da7a7c11510769a428120c69a8c9f939 100644 (file)
@@ -2,7 +2,6 @@
 /* Command-line: gperf -a -p -o -t -G -D keywords  */
 #include <config.h>
 
-#include <cstdlib>
 #include <cstring>
 
 #include "math_defs.h"
@@ -18,300 +17,301 @@ int const MAX_HASH_VALUE = 490;
 
 static
 unsigned int
-math_hash (register char const *str, register int len)
+math_hash (register char const * str, register int len)
 {
-  static unsigned short asso_values[] = 
-    {
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
-     491, 491, 491, 491, 491, 491, 491, 491,  95, 491,
-     491,  45, 491,  10, 491, 491, 255, 491, 491,  65,
-      30, 491,   0,  70,  80,  70,  15, 491,  10, 491,
-     491, 491, 491, 491, 491, 491, 491,  50, 200, 140,
-     219,  35, 135, 237, 230,  69,   0,  20,  10, 180,
-     105, 247,  55, 208, 125,   0,  25,  42, 255,  75,
-       5,   0,   0, 491, 491, 491, 491, 491,
-    };
-  return len + asso_values[str[len - 1]] + asso_values[str[0]];
+       static unsigned short asso_values[] = 
+       {
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
+               491, 491, 491, 491, 491, 491, 491, 491,  95, 491,
+               491,  45, 491,  10, 491, 491, 255, 491, 491,  65,
+               30, 491,   0,  70,  80,  70,  15, 491,  10, 491,
+               491, 491, 491, 491, 491, 491, 491,  50, 200, 140,
+               219,  35, 135, 237, 230,  69,   0,  20,  10, 180,
+               105, 247,  55, 208, 125,   0,  25,  42, 255,  75,
+               5,   0,   0, 491, 491, 491, 491, 491,
+       };
+       return len + asso_values[str[len - 1]] + asso_values[str[0]];
 }
 
 static
 latexkeys wordlist[] = 
 {
-      {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, 
-      {"setminus",  LM_TK_SYM, LM_setminus},
-      {"ldots",  LM_TK_DOTS, LM_ldots},
-      {"limits",  LM_TK_LIMIT, 1 },
-      {"stackrel",  LM_TK_STACK, 0},
-      {"ll",  LM_TK_SYM, LM_ll},
-      {"label",  LM_TK_LABEL, 0},
-      {"lceil",  LM_TK_SYM, LM_lceil},
-      {"sqrt",  LM_TK_SQRT, 0},
-      {"times",  LM_TK_SYM, LM_times},
-      {"subset",  LM_TK_SYM, LM_subset},
-      {"supset",  LM_TK_SYM, LM_supset},
-      {"spadesuit",  LM_TK_SYM, LM_spadesuit},
-      {"Re",  LM_TK_SYM, LM_Re},
-      {"left",  LM_TK_LEFT, 0},
-      {"smile",  LM_TK_SYM, LM_smile},
-      {"exists",  LM_TK_SYM, LM_exists},
-      {"Vert",  LM_TK_SYM, LM_Vert},
-      {"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT},
-      {"uplus",  LM_TK_SYM, LM_uplus},
-      {"ell",  LM_TK_SYM, LM_ell},
-      {"langle",  LM_TK_SYM, LM_langle},
-      {"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT},
-      {"zeta",  LM_TK_SYM, LM_zeta},
-      {"sigma",  LM_TK_SYM, LM_sigma},
-      {"arccos",  LM_TK_FUNC, 0},
-      {"sup",  LM_TK_FUNCLIM, 0},
-      {"sharp",  LM_TK_SYM, LM_sharp},
-      {"sqcup",  LM_TK_SYM, LM_sqcup},
-      {"sqcap",  LM_TK_SYM, LM_sqcap},
-      {"approx",  LM_TK_SYM, LM_approx},
-      {"triangleleft",  LM_TK_SYM, LM_triangleleft},
-      {"triangleright",  LM_TK_SYM, LM_triangleright},
-      {"tilde",  LM_TK_ACCENT, LM_tilde},
-      {"lambda",  LM_TK_SYM, LM_lambda},
-      {"emptyset",  LM_TK_MACRO, LM_emptyset},
-      {"triangle",  LM_TK_SYM, LM_triangle},
-      {"textstyle",  LM_TK_STY, LM_ST_TEXT},
-      {"tau",  LM_TK_SYM, LM_tau},
-      {"limsup",  LM_TK_FUNCLIM, 0},
-      {"partial",  LM_TK_SYM, LM_partial},
-      {"parallel",  LM_TK_SYM, LM_parallel},
-      {"infty",  LM_TK_SYM, LM_infty},
-      {"kappa",  LM_TK_SYM, LM_kappa},
-      {"xi",  LM_TK_SYM, LM_xi},
-      {"leftharpoonup",  LM_TK_SYM, LM_leftharpoonup},
-      {"theta",  LM_TK_SYM, LM_theta},
-      {"Xi",  LM_TK_SYM, LM_Xi},
-      {"searrow",  LM_TK_SYM, LM_searrow},
-      {"swarrow",  LM_TK_SYM, LM_swarrow},
-      {"top",  LM_TK_SYM, LM_top},
-      {"Rightarrow",  LM_TK_SYM, LM_Rightarrow},
-      {"underline",  LM_TK_WIDE, LM_underline},
-      {"underbrace",  LM_TK_WIDE, LM_underbrace},
-      {"eta",  LM_TK_SYM, LM_eta},
-      {"acute",  LM_TK_ACCENT, LM_acute},
-      {"angle",  LM_TK_SYM, LM_angle},
-      {"exp",  LM_TK_FUNC, 0},
-      {"leftarrow",  LM_TK_SYM, LM_leftarrow},
-      {"prime",  LM_TK_SYM, LM_prime},
-      {"int",  LM_TK_BIGSYM, LM_int},
-      {"longleftarrow",  LM_TK_SYM, LM_longleftarrow},
-      {"leftrightarrow",  LM_TK_SYM, LM_leftrightarrow},
-      {"longrightarrow",  LM_TK_SYM, LM_longrightarrow},
-      {"Gamma",  LM_TK_SYM, LM_Gamma},
-      {"Pi",  LM_TK_SYM, LM_Pi},
-      {"Phi",  LM_TK_SYM, LM_Phi},
-      {"Psi",  LM_TK_SYM, LM_Psi},
-      {"longleftrightarrow",  LM_TK_SYM, LM_longleftrightarrow},
-      {"alpha",  LM_TK_SYM, LM_alpha},
-      {"widehat",  LM_TK_WIDE, LM_widehat},
-      {"sin",  LM_TK_FUNC, 0},
-      {"asymp",  LM_TK_SYM, LM_asymp},
-      {"nolimits",  LM_TK_LIMIT, 0 },
-      {"perp",  LM_TK_MACRO, LM_perp},
-      {"wedge",  LM_TK_SYM, LM_wedge},
-      {"ln",  LM_TK_FUNC, 0},
-      {"widetilde",  LM_TK_WIDE, LM_widetilde},
-      {"Omega",  LM_TK_SYM, LM_Omega},
-      {"natural",  LM_TK_SYM, LM_natural},
-      {"iota",  LM_TK_SYM, LM_iota},
-      {"uparrow",  LM_TK_SYM, LM_uparrow},
-      {"Sigma",  LM_TK_SYM, LM_Sigma},
-      {"pi",  LM_TK_SYM, LM_pi},
-      {"phi",  LM_TK_SYM, LM_phi},
-      {"psi",  LM_TK_SYM, LM_psi},
-      {"updownarrow",  LM_TK_SYM, LM_updownarrow},
-      {"star",  LM_TK_SYM, LM_star},
-      {"leftharpoondown",  LM_TK_SYM, LM_leftharpoondown},
-      {"wp",  LM_TK_SYM, LM_wp},
-      {"not",  LM_TK_ACCENT, LM_not},
-      {"tan",  LM_TK_FUNC, 0},
-      {"Theta",  LM_TK_SYM, LM_Theta},
-      {"rceil",  LM_TK_SYM, LM_rceil},
-      {"lfloor",  LM_TK_SYM, LM_lfloor},
-      {"rightleftharpoons",  LM_TK_SYM, LM_rightleftharpoons},
-      {"cos",  LM_TK_FUNC, 0},
-      {"sec",  LM_TK_FUNC, 0},
-      {"succ",  LM_TK_SYM, LM_succ},
-      {"cdots",  LM_TK_DOTS, LM_cdots},
-      {"epsilon",  LM_TK_SYM, LM_epsilon},
-      {"ker",  LM_TK_FUNC, 0},
-      {"nu",  LM_TK_SYM, LM_nu},
-      {"Delta",  LM_TK_SYM, LM_Delta},
-      {"forall",  LM_TK_SYM, LM_forall},
-      {"liminf",  LM_TK_FUNCLIM, 0},
-      {"Uparrow",  LM_TK_SYM, LM_Uparrow},
-      {"upsilon",  LM_TK_SYM, LM_upsilon},
-      {"right",  LM_TK_RIGHT, 0},
-      {"Updownarrow",  LM_TK_SYM, LM_Updownarrow},
-      {"Pr",  LM_TK_FUNCLIM, 0},
-      {"nabla",  LM_TK_SYM, LM_nabla},
-      {"arcsin",  LM_TK_FUNC, 0},
-      {"arctan",  LM_TK_FUNC, 0},
-      {"flat",  LM_TK_SYM, LM_flat},
-      {"check",  LM_TK_ACCENT, LM_check},
-      {"rangle",  LM_TK_SYM, LM_rangle},
-      {"cot",  LM_TK_FUNC, 0},
-      {"cdot",  LM_TK_SYM, LM_cdot},
-      {"clubsuit",  LM_TK_SYM, LM_clubsuit},
-      {"in",  LM_TK_SYM, LM_in},
-      {"ni",  LM_TK_SYM, LM_ni},
-      {"Downarrow",  LM_TK_SYM, LM_Downarrow},
-      {"Upsilon",  LM_TK_SYM, LM_Upsilon},
-      {"sim",  LM_TK_SYM, LM_sim},
-      {"sum",  LM_TK_BIGSYM, LM_sum},
-      {"models",  LM_TK_SYM, LM_models},
-      {"nearrow",  LM_TK_SYM, LM_nearrow},
-      {"nwarrow",  LM_TK_SYM, LM_nwarrow},
-      {"max",  LM_TK_FUNCLIM, 0},
-      {"Im",  LM_TK_SYM, LM_Im},
-      {"lim",  LM_TK_FUNCLIM, 0},
-      {"rightharpoonup",  LM_TK_SYM, LM_rightharpoonup},
-      {"mathcal",  LM_TK_FONT, LM_TC_CAL},
-      {"cap",  LM_TK_SYM, LM_cap},
-      {"cup",  LM_TK_SYM, LM_cup},
-      {"prec",  LM_TK_SYM, LM_prec},
-      {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
-      {"wr",  LM_TK_SYM, LM_wr},
-      {"inf",  LM_TK_FUNCLIM, 0},
-      {"bigoplus",  LM_TK_BIGSYM, LM_oplus},
-      {"biguplus",  LM_TK_BIGSYM, LM_biguplus},
-      {"bigotimes",  LM_TK_BIGSYM, LM_otimes},
-      {"rightarrow",  LM_TK_SYM, LM_rightarrow},
-      {"mathit",  LM_TK_FONT, LM_TC_IT},
-      {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
-      {"mathtt",  LM_TK_FONT, LM_TC_TT},
-      {"chi",  LM_TK_SYM, LM_chi},
-      {"simeq",  LM_TK_SYM, LM_simeq},
-      {"succeq",  LM_TK_SYM, LM_succeq},
-      {"notin",  LM_TK_MACRO, LM_notin},
-      {"subseteq",  LM_TK_SYM, LM_subseteq},
-      {"supseteq",  LM_TK_SYM, LM_supseteq},
-      {"sqsubseteq",  LM_TK_SYM, LM_sqsubseteq},
-      {"sqsupseteq",  LM_TK_SYM, LM_sqsupseteq},
-      {"leq",  LM_TK_SYM, LM_leq},
-      {"surd",  LM_TK_SYM, LM_surd},
-      {"ddots",  LM_TK_DOTS, LM_ddots},
-      {"mu",  LM_TK_SYM, LM_mu},
-      {"bot",  LM_TK_SYM, LM_bot},
-      {"bullet",  LM_TK_SYM, LM_bullet},
-      {"bigodot",  LM_TK_BIGSYM, LM_bigodot},
-      {"sinh",  LM_TK_FUNC, 0},
-      {"jmath",  LM_TK_SYM, LM_jmath},
-      {"mp",  LM_TK_SYM, LM_mp},
-      {"pm",  LM_TK_SYM, LM_pm},
-      {"nonumber",  LM_TK_NONUM, 0},
-      {"breve",  LM_TK_ACCENT, LM_breve},
-      {"bigvee",  LM_TK_BIGSYM, LM_vee},
-      {"bowtie",  LM_TK_SYM, LM_bowtie},
-      {"bigwedge",  LM_TK_BIGSYM, LM_wedge},
-      {"frown",  LM_TK_SYM, LM_frown},
-      {"rightharpoondown",  LM_TK_SYM, LM_rightharpoondown},
-      {"det",  LM_TK_FUNCLIM, 0},
-      {"dot",  LM_TK_ACCENT, LM_dot},
-      {"ddot",  LM_TK_ACCENT, LM_ddot},
-      {"lg",  LM_TK_FUNC, 0},
-      {"log",  LM_TK_FUNC, 0},
-      {"oplus",  LM_TK_SYM, LM_oplus},
-      {"ominus",  LM_TK_SYM, LM_ominus},
-      {"otimes",  LM_TK_SYM, LM_otimes},
-      {"beta",  LM_TK_SYM, LM_beta},
-      {"diamondsuit",  LM_TK_SYM, LM_diamondsuit},
-      {"rfloor",  LM_TK_SYM, LM_rfloor},
-      {"end",  LM_TK_END, 0},
-      {"hat",  LM_TK_ACCENT, LM_hat},
-      {"tanh",  LM_TK_FUNC, 0},
-      {"vdots",  LM_TK_DOTS, LM_vdots},
-      {"bigcap",  LM_TK_BIGSYM, LM_cap},
-      {"bigcup",  LM_TK_BIGSYM, LM_cup},
-      {"bigsqcup",  LM_TK_BIGSYM, LM_bigsqcup},
-      {"heartsuit",  LM_TK_SYM, LM_heartsuit},
-      {"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
-      {"longmapsto",  LM_TK_SYM, LM_longmapsto},
-      {"bigtriangleup",  LM_TK_SYM, LM_bigtriangleup},
-      {"preceq",  LM_TK_SYM, LM_preceq},
-      {"delta",  LM_TK_SYM, LM_delta},
-      {"odot",  LM_TK_SYM, LM_odot},
-      {"oint",  LM_TK_BIGSYM, LM_oint},
-      {"grave",  LM_TK_ACCENT, LM_grave},
-      {"pmod",  LM_TK_PMOD, 0},
-      {"prod",  LM_TK_BIGSYM, LM_prod},
-      {"frac",  LM_TK_FRAC, 0},
-      {"csc",  LM_TK_FUNC, 0},
-      {"circ",  LM_TK_SYM, LM_circ},
-      {"aleph",  LM_TK_SYM, LM_aleph},
-      {"min",  LM_TK_FUNCLIM, 0},
-      {"overline",  LM_TK_WIDE, LM_overline},
-      {"arg",  LM_TK_FUNC, 0},
-      {"overbrace",  LM_TK_WIDE, LM_overbrace},
-      {"amalg",  LM_TK_SYM, LM_amalg},
-      {"gamma",  LM_TK_SYM, LM_gamma},
-      {"vee",  LM_TK_SYM, LM_vee},
-      {"equiv",  LM_TK_SYM, LM_equiv},
-      {"omega",  LM_TK_SYM, LM_omega},
-      {"downarrow",  LM_TK_SYM, LM_downarrow},
-      {"imath",  LM_TK_SYM, LM_imath},
-      {"propto",  LM_TK_SYM, LM_propto},
-      {"begin",  LM_TK_BEGIN, 0},
-      {"Lambda",  LM_TK_SYM, LM_Lambda},
-      {"varsigma",  LM_TK_SYM, LM_varsigma},
-      {"vartheta",  LM_TK_SYM, LM_vartheta},
-      {"neq",  LM_TK_SYM, LM_neq},
-      {"hookleftarrow",  LM_TK_SYM, LM_hookleftarrow},
-      {"hookrightarrow",  LM_TK_SYM, LM_hookrightarrow},
-      {"bigtriangledown",  LM_TK_SYM, LM_bigtriangledown},
-      {"mathbf",  LM_TK_FONT, LM_TC_BF},
-      {"mathsf",  LM_TK_FONT, LM_TC_SF},
-      {"bar",  LM_TK_ACCENT, LM_bar},
-      {"varpi",  LM_TK_SYM, LM_varpi},
-      {"varphi",  LM_TK_SYM, LM_varphi},
-      {"newcommand",  LM_TK_NEWCOMMAND, 0 },
-      {"overleftarrow",  LM_TK_WIDE, LM_overleftarrow},
-      {"overrightarrow",  LM_TK_WIDE, LM_overightarrow},
-      {"Leftarrow",  LM_TK_SYM, LM_Leftarrow},
-      {"Longleftarrow",  LM_TK_SYM, LM_Longleftarrow},
-      {"Leftrightarrow",  LM_TK_SYM, LM_Leftrightarrow},
-      {"Longrightarrow",  LM_TK_SYM, LM_Longrightarrow},
-      {"neg",  LM_TK_SYM, LM_neg},
-      {"bigcirc",  LM_TK_SYM, LM_bigcirc},
-      {"Longleftrightarrow",  LM_TK_SYM, LM_Longleftrightarrow},
-      {"dagger",  LM_TK_SYM, LM_dagger},
-      {"ddagger",  LM_TK_SYM, LM_ddagger},
-      {"hbar",  LM_TK_SYM, LM_hbar},
-      {"coprod",  LM_TK_BIGSYM, LM_coprod},
-      {"mathrm",  LM_TK_FONT, LM_TC_RM},
-      {"varepsilon",  LM_TK_SYM, LM_varepsilon},
-      {"cosh",  LM_TK_FUNC, 0},
-      {"coth",  LM_TK_FUNC, 0},
-      {"rho",  LM_TK_SYM, LM_rho},
-      {"cong",  LM_TK_SYM, LM_cong},
-      {"vec",  LM_TK_ACCENT, LM_vec},
-      {"dim",  LM_TK_FUNC, 0},
-      {"mid",  LM_TK_SYM, LM_mid},
-      {"hom",  LM_TK_FUNC, 0},
-      {"bmod",  LM_TK_FUNC, 0},
-      {"quad",  LM_TK_SPACE, LM_quad},
-      {"doteq",  LM_TK_SYM, LM_doteq},
-      {"qquad",  LM_TK_SPACE, LM_qquad},
-      {"mapsto",  LM_TK_SYM, LM_mapsto},
-      {"backslash",  LM_TK_SYM, LM_backslash},
-      {"diamond",  LM_TK_SYM, LM_diamond},
-      {"geq",  LM_TK_SYM, LM_geq},
-      {"deg",  LM_TK_FUNC, 0},
-      {"gcd",  LM_TK_FUNCLIM, 0},
-      {"gg",  LM_TK_SYM, LM_gg},
-      {"div",  LM_TK_SYM, LM_div},
-      {"dashv",  LM_TK_SYM, LM_dashv},
-      {"oslash",  LM_TK_SYM, LM_oslash},
-      {"vdash",  LM_TK_SYM, LM_vdash},
+       {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
+       {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, 
+       {"setminus",  LM_TK_SYM, LM_setminus},
+       {"ldots",  LM_TK_DOTS, LM_ldots},
+       {"limits",  LM_TK_LIMIT, 1 },
+       {"stackrel",  LM_TK_STACK, 0},
+       {"ll",  LM_TK_SYM, LM_ll},
+       {"label",  LM_TK_LABEL, 0},
+       {"lceil",  LM_TK_SYM, LM_lceil},
+       {"sqrt",  LM_TK_SQRT, 0},
+       {"times",  LM_TK_SYM, LM_times},
+       {"subset",  LM_TK_SYM, LM_subset},
+       {"supset",  LM_TK_SYM, LM_supset},
+       {"spadesuit",  LM_TK_SYM, LM_spadesuit},
+       {"Re",  LM_TK_SYM, LM_Re},
+       {"left",  LM_TK_LEFT, 0},
+       {"smile",  LM_TK_SYM, LM_smile},
+       {"exists",  LM_TK_SYM, LM_exists},
+       {"Vert",  LM_TK_SYM, LM_Vert},
+       {"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT},
+       {"uplus",  LM_TK_SYM, LM_uplus},
+       {"ell",  LM_TK_SYM, LM_ell},
+       {"langle",  LM_TK_SYM, LM_langle},
+       {"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT},
+       {"zeta",  LM_TK_SYM, LM_zeta},
+       {"sigma",  LM_TK_SYM, LM_sigma},
+       {"arccos",  LM_TK_FUNC, 0},
+       {"sup",  LM_TK_FUNCLIM, 0},
+       {"sharp",  LM_TK_SYM, LM_sharp},
+       {"sqcup",  LM_TK_SYM, LM_sqcup},
+       {"sqcap",  LM_TK_SYM, LM_sqcap},
+       {"approx",  LM_TK_SYM, LM_approx},
+       {"triangleleft",  LM_TK_SYM, LM_triangleleft},
+       {"triangleright",  LM_TK_SYM, LM_triangleright},
+       {"tilde",  LM_TK_ACCENT, LM_tilde},
+       {"lambda",  LM_TK_SYM, LM_lambda},
+       {"emptyset",  LM_TK_MACRO, LM_emptyset},
+       {"triangle",  LM_TK_SYM, LM_triangle},
+       {"textstyle",  LM_TK_STY, LM_ST_TEXT},
+       {"tau",  LM_TK_SYM, LM_tau},
+       {"limsup",  LM_TK_FUNCLIM, 0},
+       {"partial",  LM_TK_SYM, LM_partial},
+       {"parallel",  LM_TK_SYM, LM_parallel},
+       {"infty",  LM_TK_SYM, LM_infty},
+       {"kappa",  LM_TK_SYM, LM_kappa},
+       {"xi",  LM_TK_SYM, LM_xi},
+       {"leftharpoonup",  LM_TK_SYM, LM_leftharpoonup},
+       {"theta",  LM_TK_SYM, LM_theta},
+       {"Xi",  LM_TK_SYM, LM_Xi},
+       {"searrow",  LM_TK_SYM, LM_searrow},
+       {"swarrow",  LM_TK_SYM, LM_swarrow},
+       {"top",  LM_TK_SYM, LM_top},
+       {"Rightarrow",  LM_TK_SYM, LM_Rightarrow},
+       {"underline",  LM_TK_WIDE, LM_underline},
+       {"underbrace",  LM_TK_WIDE, LM_underbrace},
+       {"eta",  LM_TK_SYM, LM_eta},
+       {"acute",  LM_TK_ACCENT, LM_acute},
+       {"angle",  LM_TK_SYM, LM_angle},
+       {"exp",  LM_TK_FUNC, 0},
+       {"leftarrow",  LM_TK_SYM, LM_leftarrow},
+       {"prime",  LM_TK_SYM, LM_prime},
+       {"int",  LM_TK_BIGSYM, LM_int},
+       {"longleftarrow",  LM_TK_SYM, LM_longleftarrow},
+       {"leftrightarrow",  LM_TK_SYM, LM_leftrightarrow},
+       {"longrightarrow",  LM_TK_SYM, LM_longrightarrow},
+       {"Gamma",  LM_TK_SYM, LM_Gamma},
+       {"Pi",  LM_TK_SYM, LM_Pi},
+       {"Phi",  LM_TK_SYM, LM_Phi},
+       {"Psi",  LM_TK_SYM, LM_Psi},
+       {"longleftrightarrow",  LM_TK_SYM, LM_longleftrightarrow},
+       {"alpha",  LM_TK_SYM, LM_alpha},
+       {"widehat",  LM_TK_WIDE, LM_widehat},
+       {"sin",  LM_TK_FUNC, 0},
+       {"asymp",  LM_TK_SYM, LM_asymp},
+       {"nolimits",  LM_TK_LIMIT, 0 },
+       {"perp",  LM_TK_MACRO, LM_perp},
+       {"wedge",  LM_TK_SYM, LM_wedge},
+       {"ln",  LM_TK_FUNC, 0},
+       {"widetilde",  LM_TK_WIDE, LM_widetilde},
+       {"Omega",  LM_TK_SYM, LM_Omega},
+       {"natural",  LM_TK_SYM, LM_natural},
+       {"iota",  LM_TK_SYM, LM_iota},
+       {"uparrow",  LM_TK_SYM, LM_uparrow},
+       {"Sigma",  LM_TK_SYM, LM_Sigma},
+       {"pi",  LM_TK_SYM, LM_pi},
+       {"phi",  LM_TK_SYM, LM_phi},
+       {"psi",  LM_TK_SYM, LM_psi},
+       {"updownarrow",  LM_TK_SYM, LM_updownarrow},
+       {"star",  LM_TK_SYM, LM_star},
+       {"leftharpoondown",  LM_TK_SYM, LM_leftharpoondown},
+       {"wp",  LM_TK_SYM, LM_wp},
+       {"not",  LM_TK_ACCENT, LM_not},
+       {"tan",  LM_TK_FUNC, 0},
+       {"Theta",  LM_TK_SYM, LM_Theta},
+       {"rceil",  LM_TK_SYM, LM_rceil},
+       {"lfloor",  LM_TK_SYM, LM_lfloor},
+       {"rightleftharpoons",  LM_TK_SYM, LM_rightleftharpoons},
+       {"cos",  LM_TK_FUNC, 0},
+       {"sec",  LM_TK_FUNC, 0},
+       {"succ",  LM_TK_SYM, LM_succ},
+       {"cdots",  LM_TK_DOTS, LM_cdots},
+       {"epsilon",  LM_TK_SYM, LM_epsilon},
+       {"ker",  LM_TK_FUNC, 0},
+       {"nu",  LM_TK_SYM, LM_nu},
+       {"Delta",  LM_TK_SYM, LM_Delta},
+       {"forall",  LM_TK_SYM, LM_forall},
+       {"liminf",  LM_TK_FUNCLIM, 0},
+       {"Uparrow",  LM_TK_SYM, LM_Uparrow},
+       {"upsilon",  LM_TK_SYM, LM_upsilon},
+       {"right",  LM_TK_RIGHT, 0},
+       {"Updownarrow",  LM_TK_SYM, LM_Updownarrow},
+       {"Pr",  LM_TK_FUNCLIM, 0},
+       {"nabla",  LM_TK_SYM, LM_nabla},
+       {"arcsin",  LM_TK_FUNC, 0},
+       {"arctan",  LM_TK_FUNC, 0},
+       {"flat",  LM_TK_SYM, LM_flat},
+       {"check",  LM_TK_ACCENT, LM_check},
+       {"rangle",  LM_TK_SYM, LM_rangle},
+       {"cot",  LM_TK_FUNC, 0},
+       {"cdot",  LM_TK_SYM, LM_cdot},
+       {"clubsuit",  LM_TK_SYM, LM_clubsuit},
+       {"in",  LM_TK_SYM, LM_in},
+       {"ni",  LM_TK_SYM, LM_ni},
+       {"Downarrow",  LM_TK_SYM, LM_Downarrow},
+       {"Upsilon",  LM_TK_SYM, LM_Upsilon},
+       {"sim",  LM_TK_SYM, LM_sim},
+       {"sum",  LM_TK_BIGSYM, LM_sum},
+       {"models",  LM_TK_SYM, LM_models},
+       {"nearrow",  LM_TK_SYM, LM_nearrow},
+       {"nwarrow",  LM_TK_SYM, LM_nwarrow},
+       {"max",  LM_TK_FUNCLIM, 0},
+       {"Im",  LM_TK_SYM, LM_Im},
+       {"lim",  LM_TK_FUNCLIM, 0},
+       {"rightharpoonup",  LM_TK_SYM, LM_rightharpoonup},
+       {"mathcal",  LM_TK_FONT, LM_TC_CAL},
+       {"cap",  LM_TK_SYM, LM_cap},
+       {"cup",  LM_TK_SYM, LM_cup},
+       {"prec",  LM_TK_SYM, LM_prec},
+       {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
+       {"wr",  LM_TK_SYM, LM_wr},
+       {"inf",  LM_TK_FUNCLIM, 0},
+       {"bigoplus",  LM_TK_BIGSYM, LM_oplus},
+       {"biguplus",  LM_TK_BIGSYM, LM_biguplus},
+       {"bigotimes",  LM_TK_BIGSYM, LM_otimes},
+       {"rightarrow",  LM_TK_SYM, LM_rightarrow},
+       {"mathit",  LM_TK_FONT, LM_TC_IT},
+       {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
+       {"mathtt",  LM_TK_FONT, LM_TC_TT},
+       {"chi",  LM_TK_SYM, LM_chi},
+       {"simeq",  LM_TK_SYM, LM_simeq},
+       {"succeq",  LM_TK_SYM, LM_succeq},
+       {"notin",  LM_TK_MACRO, LM_notin},
+       {"subseteq",  LM_TK_SYM, LM_subseteq},
+       {"supseteq",  LM_TK_SYM, LM_supseteq},
+       {"sqsubseteq",  LM_TK_SYM, LM_sqsubseteq},
+       {"sqsupseteq",  LM_TK_SYM, LM_sqsupseteq},
+       {"leq",  LM_TK_SYM, LM_leq},
+       {"surd",  LM_TK_SYM, LM_surd},
+       {"ddots",  LM_TK_DOTS, LM_ddots},
+       {"mu",  LM_TK_SYM, LM_mu},
+       {"bot",  LM_TK_SYM, LM_bot},
+       {"bullet",  LM_TK_SYM, LM_bullet},
+       {"bigodot",  LM_TK_BIGSYM, LM_bigodot},
+       {"sinh",  LM_TK_FUNC, 0},
+       {"jmath",  LM_TK_SYM, LM_jmath},
+       {"mp",  LM_TK_SYM, LM_mp},
+       {"pm",  LM_TK_SYM, LM_pm},
+       {"nonumber",  LM_TK_NONUM, 0},
+       {"breve",  LM_TK_ACCENT, LM_breve},
+       {"bigvee",  LM_TK_BIGSYM, LM_vee},
+       {"bowtie",  LM_TK_SYM, LM_bowtie},
+       {"bigwedge",  LM_TK_BIGSYM, LM_wedge},
+       {"frown",  LM_TK_SYM, LM_frown},
+       {"rightharpoondown",  LM_TK_SYM, LM_rightharpoondown},
+       {"det",  LM_TK_FUNCLIM, 0},
+       {"dot",  LM_TK_ACCENT, LM_dot},
+       {"ddot",  LM_TK_ACCENT, LM_ddot},
+       {"lg",  LM_TK_FUNC, 0},
+       {"log",  LM_TK_FUNC, 0},
+       {"oplus",  LM_TK_SYM, LM_oplus},
+       {"ominus",  LM_TK_SYM, LM_ominus},
+       {"otimes",  LM_TK_SYM, LM_otimes},
+       {"beta",  LM_TK_SYM, LM_beta},
+       {"diamondsuit",  LM_TK_SYM, LM_diamondsuit},
+       {"rfloor",  LM_TK_SYM, LM_rfloor},
+       {"end",  LM_TK_END, 0},
+       {"hat",  LM_TK_ACCENT, LM_hat},
+       {"tanh",  LM_TK_FUNC, 0},
+       {"vdots",  LM_TK_DOTS, LM_vdots},
+       {"bigcap",  LM_TK_BIGSYM, LM_cap},
+       {"bigcup",  LM_TK_BIGSYM, LM_cup},
+       {"bigsqcup",  LM_TK_BIGSYM, LM_bigsqcup},
+       {"heartsuit",  LM_TK_SYM, LM_heartsuit},
+       {"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
+       {"longmapsto",  LM_TK_SYM, LM_longmapsto},
+       {"bigtriangleup",  LM_TK_SYM, LM_bigtriangleup},
+       {"preceq",  LM_TK_SYM, LM_preceq},
+       {"delta",  LM_TK_SYM, LM_delta},
+       {"odot",  LM_TK_SYM, LM_odot},
+       {"oint",  LM_TK_BIGSYM, LM_oint},
+       {"grave",  LM_TK_ACCENT, LM_grave},
+       {"pmod",  LM_TK_PMOD, 0},
+       {"prod",  LM_TK_BIGSYM, LM_prod},
+       {"frac",  LM_TK_FRAC, 0},
+       {"csc",  LM_TK_FUNC, 0},
+       {"circ",  LM_TK_SYM, LM_circ},
+       {"aleph",  LM_TK_SYM, LM_aleph},
+       {"min",  LM_TK_FUNCLIM, 0},
+       {"overline",  LM_TK_WIDE, LM_overline},
+       {"arg",  LM_TK_FUNC, 0},
+       {"overbrace",  LM_TK_WIDE, LM_overbrace},
+       {"amalg",  LM_TK_SYM, LM_amalg},
+       {"gamma",  LM_TK_SYM, LM_gamma},
+       {"vee",  LM_TK_SYM, LM_vee},
+       {"equiv",  LM_TK_SYM, LM_equiv},
+       {"omega",  LM_TK_SYM, LM_omega},
+       {"downarrow",  LM_TK_SYM, LM_downarrow},
+       {"imath",  LM_TK_SYM, LM_imath},
+       {"propto",  LM_TK_SYM, LM_propto},
+       {"begin",  LM_TK_BEGIN, 0},
+       {"Lambda",  LM_TK_SYM, LM_Lambda},
+       {"varsigma",  LM_TK_SYM, LM_varsigma},
+       {"vartheta",  LM_TK_SYM, LM_vartheta},
+       {"neq",  LM_TK_SYM, LM_neq},
+       {"hookleftarrow",  LM_TK_SYM, LM_hookleftarrow},
+       {"hookrightarrow",  LM_TK_SYM, LM_hookrightarrow},
+       {"bigtriangledown",  LM_TK_SYM, LM_bigtriangledown},
+       {"mathbf",  LM_TK_FONT, LM_TC_BF},
+       {"mathsf",  LM_TK_FONT, LM_TC_SF},
+       {"bar",  LM_TK_ACCENT, LM_bar},
+       {"varpi",  LM_TK_SYM, LM_varpi},
+       {"varphi",  LM_TK_SYM, LM_varphi},
+       {"newcommand",  LM_TK_NEWCOMMAND, 0 },
+       {"overleftarrow",  LM_TK_WIDE, LM_overleftarrow},
+       {"overrightarrow",  LM_TK_WIDE, LM_overightarrow},
+       {"Leftarrow",  LM_TK_SYM, LM_Leftarrow},
+       {"Longleftarrow",  LM_TK_SYM, LM_Longleftarrow},
+       {"Leftrightarrow",  LM_TK_SYM, LM_Leftrightarrow},
+       {"Longrightarrow",  LM_TK_SYM, LM_Longrightarrow},
+       {"neg",  LM_TK_SYM, LM_neg},
+       {"bigcirc",  LM_TK_SYM, LM_bigcirc},
+       {"Longleftrightarrow",  LM_TK_SYM, LM_Longleftrightarrow},
+       {"dagger",  LM_TK_SYM, LM_dagger},
+       {"ddagger",  LM_TK_SYM, LM_ddagger},
+       {"hbar",  LM_TK_SYM, LM_hbar},
+       {"coprod",  LM_TK_BIGSYM, LM_coprod},
+       {"mathrm",  LM_TK_FONT, LM_TC_RM},
+       {"varepsilon",  LM_TK_SYM, LM_varepsilon},
+       {"cosh",  LM_TK_FUNC, 0},
+       {"coth",  LM_TK_FUNC, 0},
+       {"rho",  LM_TK_SYM, LM_rho},
+       {"cong",  LM_TK_SYM, LM_cong},
+       {"vec",  LM_TK_ACCENT, LM_vec},
+       {"dim",  LM_TK_FUNC, 0},
+       {"mid",  LM_TK_SYM, LM_mid},
+       {"hom",  LM_TK_FUNC, 0},
+       {"bmod",  LM_TK_FUNC, 0},
+       {"quad",  LM_TK_SPACE, LM_quad},
+       {"doteq",  LM_TK_SYM, LM_doteq},
+       {"qquad",  LM_TK_SPACE, LM_qquad},
+       {"mapsto",  LM_TK_SYM, LM_mapsto},
+       {"backslash",  LM_TK_SYM, LM_backslash},
+       {"diamond",  LM_TK_SYM, LM_diamond},
+       {"geq",  LM_TK_SYM, LM_geq},
+       {"deg",  LM_TK_FUNC, 0},
+       {"gcd",  LM_TK_FUNCLIM, 0},
+       {"gg",  LM_TK_SYM, LM_gg},
+       {"div",  LM_TK_SYM, LM_div},
+       {"dashv",  LM_TK_SYM, LM_dashv},
+       {"oslash",  LM_TK_SYM, LM_oslash},
+       {"vdash",  LM_TK_SYM, LM_vdash},
 };
 
 static short lookup[] = 
@@ -326,43 +326,43 @@ static short lookup[] =
         68, 565,  71,  72, 499,  75,  -1,  76,  -1,  77,  78,  -1,  79, -73,
         -2,  80,  81,  82,  -1,  83,  -1,  84,  85,  -1,  86,  87,  88,  89,
         90, 501,  93,  94,  95,  -1,  96, 493,  -1,  99, -97,  -2, -91,  -2,
-       100, 101, 102, 517, 105, 106,  -1, 107, 108, 109, 110, 497, 113,  -1,
-       114, 115, 116, 117,-111,  -2, 118, 491,-119,  -2, 121, 122, 123,  -1,
-       124, 125,-103,  -2,  -1, 126, -69,  -2, 491,-127,  -2, 129, -55,  -2,
-       130, 491,-131,  -2, 133, 492, 136,-134,  -2,  -1, 137, 138, 139, -42,
+       100, 101, 102, 517, 105, 106,  -1, 107, 108, 109, 110, 497, 113,  -1,
+       114, 115, 116, 117,-111,  -2, 118, 491,-119,  -2, 121, 122, 123,  -1,
+       124, 125,-103,  -2,  -1, 126, -69,  -2, 491,-127,  -2, 129, -55,  -2,
+       130, 491,-131,  -2, 133, 492, 136,-134,  -2,  -1, 137, 138, 139, -42,
         -2, 140, 495, 143, 144,  -1, 145,-141,  -2, -34,  -3, 146, 613, 149,
-       150, 605, 154, 155, 156, 157, 503,  -1, 491,-160,  -2, 162,  -1, 163,
-       491,-164,  -2,  -1, 166,-158,  -2, 167, 168,  -1, 169, 170,  -1, 577,
-       173,  -1, 174, 554,  -1, 177,  -1, 178, 179, 543, 182, 183, 184,  -1,
-       185, 509, 188, 189, 190, 191, 192, 193, 194, 499,  -1, 197, 198,  -1,
-       199, 200, 201, 202,-195,  -2,-186,  -2, 203,  -1, 500, 206, 492, 209,
-      -207,  -2,  -1, 210, 211, 212,-204,  -2, 213,  -1, 498, 216, 494, 219,
+       150, 605, 154, 155, 156, 157, 503,  -1, 491,-160,  -2, 162,  -1, 163,
+       491,-164,  -2,  -1, 166,-158,  -2, 167, 168,  -1, 169, 170,  -1, 577,
+       173,  -1, 174, 554,  -1, 177,  -1, 178, 179, 543, 182, 183, 184,  -1,
+       185, 509, 188, 189, 190, 191, 192, 193, 194, 499,  -1, 197, 198,  -1,
+       199, 200, 201, 202,-195,  -2,-186,  -2, 203,  -1, 500, 206, 492, 209,
+       -207,  -2,  -1, 210, 211, 212,-204,  -2, 213,  -1, 498, 216, 494, 219,
         -1, 220,-217,  -2,-214,  -2,-180,  -2, 221, 222, 223,-175,  -2,  -1,
-       224,  -1, 225, 226,  -1, 491,-227,  -2, 229,  -1, 230, 231, 232, 491,
-      -233,  -2,-171,  -2,-151,  -3, 235, 236, 237,-147,  -2,  -1, 238, 239,
-       240,  -1,  -1, 241,  -1,  -1,  -1, 242, 498, 245,  -1, 246, 247,  -1,
-       248, 249,-243,  -2,  -1,  -1,  -1,  -1,  -1, 250,  -1,  -1,  -1,  -1,
+       224,  -1, 225, 226,  -1, 491,-227,  -2, 229,  -1, 230, 231, 232, 491,
+       -233,  -2,-171,  -2,-151,  -3, 235, 236, 237,-147,  -2,  -1, 238, 239,
+       240,  -1,  -1, 241,  -1,  -1,  -1, 242, 498, 245,  -1, 246, 247,  -1,
+       248, 249,-243,  -2,  -1,  -1,  -1,  -1,  -1, 250,  -1,  -1,  -1,  -1,
         -1, 251, 252,  -1,  -1,  -1, 253,  -1,  -1,  -1, 492, 256,-254,  -2,
         -1,  -1,  -1, 257,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
         -1,  -1,  -1,  -1,  -1,  -1, 258,  -1,  -1,  -1, 491,-259,  -2,  -1,
         -1,  -1,  -1,  -1,  -1,  -1,  -1, 261,  -1,  -1,  -1,  -1,  -1,  -1,
         -1,  -1,  -1, 262,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 263, 492, 266,
-      -264,  -2,  -1,  -1,  -1, 267,  -1,  -1,  -1,  -1,  -1, 268,  -1,  -1,
-       269,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 491,-270,  -2,
+       -264,  -2,  -1,  -1,  -1, 267,  -1,  -1,  -1,  -1,  -1, 268,  -1,  -1,
+       269,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 491,-270,  -2,
         -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-       272, 273,  -1, 274,  -1,  -1,  -1, 275,  -1,  -1,  -1,  -1,  -1,  -1,
-       276,
+       272, 273,  -1, 274,  -1,  -1,  -1, 275,  -1,  -1,  -1,  -1,  -1,  -1,
+       276,
 };
 
 
 latexkeys *
-in_word_set (register char const *str, register int len)
+in_word_set (register char const * str, register int len)
 {
        if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
-               int key = math_hash (str, len);
+               int const key = math_hash (str, len);
                
                if (key <= MAX_HASH_VALUE && key >= 0) {
-                       int idx = lookup[key];
+                       int const idx = lookup[key];
                        
                        if (idx >= 0 && idx < MAX_HASH_VALUE) {
                                char const * s = wordlist[idx].name;
@@ -372,7 +372,7 @@ in_word_set (register char const *str, register int len)
                        } else if (idx < 0 && idx >= -MAX_HASH_VALUE) {
                                return 0;
                        } else {
-                               int offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
+                               int const offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
                                latexkeys * base = &wordlist[-lookup[offset]];
                                latexkeys * ptr = base + -lookup[offset + 1];
                                
@@ -392,22 +392,22 @@ latexkeys * in_word_set(string const & str)
 }
 
 
-latexkeys *lm_get_key_by_id(int t, short tk)
+latexkeys * lm_get_key_by_id(int t, short tk)
 {
-   latexkeys * l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
-   latexkeys * base = &wordlist[MIN_HASH_VALUE];
-   while (--l >= base) {
-     if (t == l->id && tk == l->token)
-       return l;
-   }
-   return 0;
+       latexkeys * l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
+       latexkeys * base = &wordlist[MIN_HASH_VALUE];
+       while (--l >= base) {
+               if (t == l->id && tk == l->token)
+                       return l;
+       }
+       return 0;
 }
 
 
-latexkeys *lm_get_key_by_index(int i)
+latexkeys * lm_get_key_by_index(int i)
 {
-   if (i > 0 && i < TOTAL_KEYWORDS + 2)
-     return &wordlist[i];
-   else
-     return 0;
+       if (i > 0 && i < TOTAL_KEYWORDS + 2)
+               return &wordlist[i];
+       else
+               return 0;
 }
index 2e57a7fbe5e8c5cfae685f348e0e9d09b61a66ca..87bb14e34d3cee39fa17acc770a3a4a7ce181a77 100644 (file)
@@ -36,26 +36,26 @@ int MathedInset::workWidth;
 
 MathedInset::MathedInset(MathedInset * inset) 
 {
-   if (inset) {
-      name = inset->GetName();
-      objtype = inset->GetType();
-      size = inset->GetStyle();
-      width = inset->Width();
-      ascent = inset->Ascent();
-      descent = inset->Descent();
-   } else {
-      objtype = LM_OT_UNDEF;
-      size = LM_ST_TEXT;
-      width = ascent = descent = 0;
-      //name = 0;
-   }
+       if (inset) {
+               name = inset->GetName();
+               objtype = inset->GetType();
+               size_ = inset->GetStyle();
+               width = inset->Width();
+               ascent = inset->Ascent();
+               descent = inset->Descent();
+       } else {
+               objtype = LM_OT_UNDEF;
+               size_ = LM_ST_TEXT;
+               width = ascent = descent = 0;
+               //name = 0;
+       }
 }
 
 
-MathedInset::MathedInset(string const & nm, short ot, short st):
-  name(nm), objtype(ot), size(st) 
+MathedInset::MathedInset(string const & nm, short ot, short st)
+       : name(nm), objtype(ot), size_(st) 
 {
-   width = ascent = descent = 0;
+       width = ascent = descent = 0;
 }
 
 
@@ -65,15 +65,104 @@ void MathedInset::drawStr(Painter & pain, short type, int siz,
 {
        string st;
        if (MathIsBinary(type))
-               for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
+               for (string::const_iterator it = s.begin();
+                    it != s.end(); ++it) {
                        st += ' ';
                        st += *it;
                        st += ' ';
                }
        else
                st = s;
-
+       
        LyXFont const mf = mathed_get_font(type, siz);
        pain.text(x, y, st, mf);
 }
 
+
+int MathedInset::Ascent() const
+{
+       return ascent;
+}
+
+
+int MathedInset::Descent() const
+{
+       return descent;
+}
+
+
+int MathedInset::Width() const
+{
+       return width;
+}
+
+
+int MathedInset::Height() const
+{
+       return ascent + descent;
+}
+
+
+bool MathedInset::GetLimits() const
+{
+       return false;
+}
+
+
+void MathedInset::SetLimits(bool) {}   
+
+
+string const & MathedInset::GetName() const
+{
+       return name;
+}
+
+
+short MathedInset::GetType() const
+{
+       return objtype;
+}
+
+
+short MathedInset::GetStyle() const
+{
+       return size_;
+}
+
+
+void  MathedInset::SetType(short t)
+{
+       objtype = t;
+}
+
+
+void  MathedInset::SetStyle(short st)
+{
+       size_ = st;
+}
+
+
+void MathedInset::SetName(string const & n)
+{
+       name = n;
+}
+
+
+void MathedInset::defaultAscent(int da)
+{
+       df_asc = da;
+}
+
+
+
+void MathedInset::defaultDescent(int dd)
+{
+       df_des = dd;
+}
+
+
+void MathedInset::defaultWidth(int dw)
+{
+       df_width = dw;
+}
+
index 530b82ff868c96fd137e1ec7abbc851afaad7cc4..dd1cb92e0f6e6bdefd4db540365d7188974b7c52 100644 (file)
@@ -35,75 +35,91 @@ class Painter;
     A math insets is for use of the math editor only, it isn't a
     general LyX inset. It's used to represent all the math objects.
     The formulaInset (a LyX inset) encapsulates a math inset.
- */
+*/
 class MathedInset  {
- public: 
-    /// A math inset has a name (usually its LaTeX name), type and font-size
-    MathedInset(string const & nm, short ot, short st);
-    ///
-    explicit
-    MathedInset(MathedInset *);
-    ///
-    virtual ~MathedInset() {}
-    /// Draw the object
-    virtual void draw(Painter &, int x, int baseline) = 0;     
-    /// Write LaTeX and Lyx code
-    virtual void Write(std::ostream &, bool fragile) = 0;
-    /// Reproduces itself
-    virtual MathedInset * Clone() = 0;
-    /// Compute the size of the object
-    virtual void Metrics() = 0; 
-    /// 
-    virtual int Ascent() const { return ascent; }
-    ///
-    virtual int Descent() const { return descent; }
-    ///
-    virtual int Width() const { return width; }
-    ///
-    virtual int Height() const { return ascent + descent; }
-    ///
-    virtual bool GetLimits() const { return false; }
-    ///
-    virtual void SetLimits(bool) {}   
-    ///
-    string const & GetName() const { return name; }
-    ///
-    short GetType() const { return objtype; }
-    ///
-    short GetStyle() const { return size; }
-    //Man:  Avoid to use these functions if it's not strictly necessary 
-    ///
-    virtual void  SetType(short t) { objtype = t; }
-    ///
-    virtual void  SetStyle(short st) { size = st; } // Metrics();
-    ///
-    virtual void  SetName(string const & n) { name = n; }
-    ///
-    static int workWidth;
-        protected:
-    ///
-    string name;
-    ///
-    short objtype;
-    ///
-    int width;
-    ///
-    int ascent;
-    ///
-    int descent;
-    ///
-    short size;
-    /// Default metrics
-    static int df_asc;
-    ///
-    static int df_des;
-    ///
-    static int df_width;
-    /// In a near future maybe we use a better fonts renderer than X
-    void drawStr(Painter &, short, int, int, int, string const &);
-    ///
-    friend class MathedCursor;
-    ///
-    friend void mathed_init_fonts();
+public: 
+       /** A math inset has a name (usually its LaTeX name),
+           type and font-size
+       */
+       MathedInset(string const & nm, short ot, short st);
+       ///
+       explicit
+       MathedInset(MathedInset *);
+       ///
+       virtual ~MathedInset() {}
+       /// Draw the object
+       virtual void draw(Painter &, int x, int baseline) = 0;  
+       /// Write LaTeX and Lyx code
+       virtual void Write(std::ostream &, bool fragile) = 0;
+       /// Reproduces itself
+       virtual MathedInset * Clone() = 0;
+       /// Compute the size of the object
+       virtual void Metrics() = 0; 
+       /// 
+       virtual int Ascent() const;
+       ///
+       virtual int Descent() const;
+       ///
+       virtual int Width() const;
+       ///
+       virtual int Height() const;
+       ///
+       virtual bool GetLimits() const;
+       ///
+       virtual void SetLimits(bool);
+       ///
+       string const & GetName() const;
+       ///
+       short GetType() const;
+       ///
+       short GetStyle() const;
+       //Man:  Avoid to use these functions if it's not strictly necessary 
+       ///
+       virtual void  SetType(short t);
+       ///
+       virtual void  SetStyle(short st);
+       ///
+       virtual void  SetName(string const & n);
+       ///
+       static int workWidth;
+       ///
+       static void defaultAscent(int da);
+       ///
+       static void defaultDescent(int dd);
+       ///
+       static void defaultWidth(int dw);
+       ///
+       short size() const {
+               return size_;
+       }
+protected:
+       ///
+       string name;
+       ///
+       short objtype;
+       ///
+       int width;
+       ///
+       int ascent;
+       ///
+       int descent;
+       /// Default metrics
+       static int df_asc;
+       ///
+       static int df_des;
+       ///
+       static int df_width;
+       /// In a near future maybe we use a better fonts renderer than X
+       void drawStr(Painter &, short, int, int, int, string const &);
+       ///
+       void size(short s) {
+               size_ = s;
+       }
+       void incSize() {
+               ++size_;
+       }
+private:
+       ///
+       short size_;
 };
 #endif
index 79d4d7c37fe270c6a41ffa44b5464232df31c57f..ea8a1546a964054df3b48da4cbd33ce28fc14b7a 100644 (file)
@@ -45,29 +45,29 @@ ostream & operator<<(ostream & o, MathedTextCodes mtc)
 
 
 MathMacro::MathMacro(MathMacroTemplate * t): 
-       MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate(t)
+       MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate_(t)
 {
-       nargs = tmplate->getNoArgs();
-       tcode = tmplate->getTCode();
-       args_.resize(nargs);
-       for (int i = 0; i < nargs; ++i) {
+       nargs_ = tmplate_->getNoArgs();
+       tcode_ = tmplate_->getTCode();
+       args_.resize(nargs_);
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].row = 0;
        }
-       idx = 0;
-       SetName(tmplate->GetName());
+       idx_ = 0;
+       SetName(tmplate_->GetName());
 }
 
 
 MathMacro::MathMacro(MathMacro * m): 
        MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
 {
-       tmplate = m->tmplate;
-       nargs = tmplate->getNoArgs();
-       tcode = tmplate->getTCode();
-       args_.resize(nargs);
-       idx = 0;
-       SetName(tmplate->GetName());
-       for (int i = 0; i < tmplate->nargs; ++i) {
+       tmplate_ = m->tmplate_;
+       nargs_ = tmplate_->getNoArgs();
+       tcode_ = tmplate_->getTCode();
+       args_.resize(nargs_);
+       idx_ = 0;
+       SetName(tmplate_->GetName());
+       for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
                m->setArgumentIdx(i);
                MathedIter it(m->GetData());
                args_[i].row   = m->args_[i].row;
@@ -78,10 +78,10 @@ MathMacro::MathMacro(MathMacro * m):
 
 MathMacro::~MathMacro()
 {
-       for (idx = 0; idx < nargs; ++idx) {
-               MathedIter it(args_[idx].array);
+       for (idx_ = 0; idx_ < nargs_; ++idx_) {
+               MathedIter it(args_[idx_].array);
                it.Clear();
-               delete args_[idx].row;
+               delete args_[idx_].row;
        }
 }
 
@@ -94,34 +94,34 @@ MathedInset * MathMacro::Clone()
 
 void MathMacro::Metrics()
 {
-       if (nargs > 0)
-               tmplate->update(this);
-       tmplate->SetStyle(size);
-       tmplate->Metrics();
-       width = tmplate->Width();
-       ascent = tmplate->Ascent();
-       descent = tmplate->Descent();
+       if (nargs_ > 0)
+               tmplate_->update(this);
+       tmplate_->SetStyle(size());
+       tmplate_->Metrics();
+       width = tmplate_->Width();
+       ascent = tmplate_->Ascent();
+       descent = tmplate_->Descent();
 }
 
 
 void MathMacro::draw(Painter & pain, int x, int y)
 {
-       xo = x;
-       yo = y;
+       xo(x);
+       yo(y);
        Metrics();
-       tmplate->update(this);
-       tmplate->SetStyle(size);
-       tmplate->draw(pain, x, y);
-       for (int i = 0; i < nargs; ++i) {
-               tmplate->GetMacroXY(i, args_[i].x, args_[i].y);
+       tmplate_->update(this);
+       tmplate_->SetStyle(size());
+       tmplate_->draw(pain, x, y);
+       for (int i = 0; i < nargs_; ++i) {
+               tmplate_->GetMacroXY(i, args_[i].x, args_[i].y);
        }
 }
 
 
 bool MathMacro::setArgumentIdx(int i)
 {
-       if (i >= 0 && i < nargs) {
-               idx = i;
+       if (i >= 0 && i < nargs_) {
+               idx_ = i;
                return true;
        } else
                return false;
@@ -130,52 +130,52 @@ bool MathMacro::setArgumentIdx(int i)
 
 int MathMacro::getArgumentIdx() const 
 { 
-       return idx
+       return idx_;
 }
 
 
 int MathMacro::getMaxArgumentIdx() const 
 { 
-       return nargs - 1; 
+       return nargs_ - 1; 
 } 
 
 
 MathedArray * MathMacro::GetData() 
 { 
-       return args_[idx].array; 
+       return args_[idx_].array; 
 } 
 
 
 int MathMacro::GetColumns() const
 {
-       return tmplate->getMacroPar(idx)->GetColumns();
+       return tmplate_->getMacroPar(idx_)->GetColumns();
 }
 
 
 void MathMacro::GetXY(int & x, int & y) const
 {
-       x = args_[idx].x;
-       y = args_[idx].y;
+       x = args_[idx_].x;
+       y = args_[idx_].y;
 }
 
 
 bool MathMacro::Permit(short f) const
 {
-       return (nargs > 0) ?
-               tmplate->getMacroPar(idx)->Permit(f) : MathParInset::Permit(f);
+       return (nargs_ > 0) ?
+               tmplate_->getMacroPar(idx_)->Permit(f) : MathParInset::Permit(f);
 }
 
 
 void MathMacro::SetFocus(int x, int y)
 {
-       tmplate->update(this);
-       tmplate->SetMacroFocus(idx, x, y);
+       tmplate_->update(this);
+       tmplate_->SetMacroFocus(idx_, x, y);
 }
 
 
 void MathMacro::SetData(MathedArray * a)
 {
-       args_[idx].array = a;
+       args_[idx_].array = a;
 }
 
 
@@ -183,25 +183,25 @@ void MathMacro::SetData(MathedArray * a)
 
 MathedRowSt * MathMacro::getRowSt() const
 {
-       return args_[idx].row;
+       return args_[idx_].row;
 }
 
 
 MathedTextCodes MathMacro::getTCode() const
 {
-       return tcode;
+       return tcode_;
 }
        
 
 void MathMacro::Write(ostream & os, bool fragile)
 {
-       if (tmplate->flags & MMF_Exp) {
-               lyxerr[Debug::MATHED] << "Expand " << tmplate->flags
+       if (tmplate_->flags() & MMF_Exp) {
+               lyxerr[Debug::MATHED] << "Expand " << tmplate_->flags()
                                      << ' ' << MMF_Exp << endl; 
-               tmplate->update(this);
-               tmplate->Write(os, fragile);
+               tmplate_->update(this);
+               tmplate_->Write(os, fragile);
        } else {
-               if (tmplate->flags & MMF_Env) {
+               if (tmplate_->flags() & MMF_Env) {
                        os << "\\begin{"
                           << name
                           << "} ";
@@ -214,21 +214,21 @@ void MathMacro::Write(ostream & os, bool fragile)
 //       file += ']';
 //      }
        
-               if (!(tmplate->flags & MMF_Env) && nargs > 0) 
+               if (!(tmplate_->flags() & MMF_Env) && nargs_ > 0) 
                        os << '{';
        
-               for (int i = 0; i < nargs; ++i) {
+               for (int i = 0; i < nargs_; ++i) {
                        array = args_[i].array;
                        MathParInset::Write(os, fragile);
-                       if (i < nargs - 1)  
+                       if (i < nargs_ - 1)  
                                os << "}{";
                }   
-               if (tmplate->flags & MMF_Env) {
+               if (tmplate_->flags() & MMF_Env) {
                        os << "\\end{"
                           << name
                           << '}';
                } else {
-                       if (nargs > 0) 
+                       if (nargs_ > 0) 
                                os << '}';
                        else
                                os << ' ';
index a250e98299ef1e72c988e03d1f398299536763ad..cb827fc9d4b720350fe126cee4d668381ac2504c 100644 (file)
@@ -71,7 +71,7 @@ public:
        bool Permit(short) const;
 private:
        ///
-       MathMacroTemplate * tmplate;
+       MathMacroTemplate * tmplate_;
        ///
        struct MacroArgumentBase {
                /// Position of the macro
@@ -83,16 +83,16 @@ private:
                ///
                MathedArray * array;
                ///
-               MacroArgumentBase() { x = y = 0;  array = 0; row = 0; }
+               MacroArgumentBase()
+                       : x(0), y(0), row(0), array(0)
+                       {}
        };
        std::vector<MacroArgumentBase> args_;
        ///
-       int idx;
+       int idx_;
        ///
-       int nargs;
+       int nargs_;
        ///
-       MathedTextCodes tcode;
-       ///
-       friend class MathMacroTemplate;
+       MathedTextCodes tcode_;
 };
 #endif
index fa25bf42ae7bcdd8e6d0b57b957084cd8c9fcdf2..b79589ef69696936635b99185a8a16692a38a935 100644 (file)
@@ -53,11 +53,10 @@ void MathMacroArgument::draw(Painter & pain, int x, int baseline)
 {
        if (expnd_mode_) {
                MathParInset::draw(pain, x, baseline);
-       }
-       else {
+       } else {
                std::ostringstream ost;
                ost << '#' << number_;
-               drawStr(pain, LM_TC_TEX, size, x, baseline, ost.str().c_str());
+               drawStr(pain, LM_TC_TEX, size(), x, baseline, ost.str().c_str());
        }
 }
 
@@ -68,8 +67,8 @@ void MathMacroArgument::Metrics()
        } else {
                std::ostringstream ost;
                ost << '#' << number_;
-               width = mathed_string_width(LM_TC_TEX, size, ost.str().c_str());
-               mathed_string_height(LM_TC_TEX, size, ost.str().c_str(),
+               width = mathed_string_width(LM_TC_TEX, size(), ost.str().c_str());
+               mathed_string_height(LM_TC_TEX, size(), ost.str().c_str(),
                                     ascent, descent);
        }
 }
index 37d7f0edf47cc2565872c396b5f2a0659175227e..2268f2fa47ca9c4157a95d680757a610bbfbf880 100644 (file)
@@ -10,34 +10,34 @@ using std::ostream;
 
 void  MathMacroTemplate::setTCode(MathedTextCodes t)
 {
-       tcode = t;
+       tcode_ = t;
 }
 
 
 MathedTextCodes MathMacroTemplate::getTCode() const
 {
-       return tcode;
+       return tcode_;
 }
 
 
 int MathMacroTemplate::getNoArgs() const
 {
-       return nargs;
+       return nargs_;
 }
 
 
 MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
        MathParInset(LM_ST_TEXT, nm, LM_OT_MACRO), 
-       flags(flg), nargs(na)
+       flags_(flg), nargs_(na)
 {
-       if (nargs > 0) {
-               tcode = LM_TC_ACTIVE_INSET;
-               args_.resize(nargs);
-               for (int i = 0; i < nargs; ++i) {
+       if (nargs_ > 0) {
+               tcode_ = LM_TC_ACTIVE_INSET;
+               args_.resize(nargs_);
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setNumber(i + 1);
                }
        } else {
-               tcode = LM_TC_INSET;
+               tcode_ = LM_TC_INSET;
                // Here is  nargs != args_.size()
                //args = 0;
        }
@@ -47,7 +47,7 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
 MathMacroTemplate::~MathMacroTemplate()
 {
        // prevent to delete already deleted objects
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].SetData(0);
        }
 }
@@ -56,14 +56,14 @@ MathMacroTemplate::~MathMacroTemplate()
 void MathMacroTemplate::setEditMode(bool ed)
 {
        if (ed) {
-               flags |= MMF_Edit;
-               for (int i = 0; i < nargs; ++i) {
+               flags_ |= MMF_Edit;
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
        }
        else {
-               flags &= ~MMF_Edit;
-               for (int i = 0; i < nargs; ++i) {
+               flags_ &= ~MMF_Edit;
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
        }
@@ -72,23 +72,27 @@ void MathMacroTemplate::setEditMode(bool ed)
 
 void MathMacroTemplate::draw(Painter & pain, int x, int y)
 {
-       int x2, y2;
-       bool expnd = (nargs > 0) ? args_[0].getExpand(): false;
-       if (flags & MMF_Edit) {
-               for (int i = 0; i < nargs; ++i) {
+       int x2;
+       int y2;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
+       if (flags_ & MMF_Edit) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
-               x2 = x; y2 = y;
+               x2 = x;
+               y2 = y;
        } else {
-               for (int i = 0; i < nargs; ++i) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
-               x2 = xo; y2 = yo;
+               x2 = xo();
+               y2 = yo();
        }
        MathParInset::draw(pain, x, y);
-       xo = x2; yo = y2;
+       xo(x2);
+       yo(y2);
 
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(expnd);
        }
 }
@@ -96,20 +100,20 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
 
 void MathMacroTemplate::Metrics()
 {
-       bool expnd = (nargs > 0) ? args_[0].getExpand(): false;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
     
-       if (flags & MMF_Edit) {
-               for (int i = 0; i < nargs; ++i) {
+       if (flags_ & MMF_Edit) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
        } else {
-               for (int i = 0; i < nargs; ++i) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
        }
        MathParInset::Metrics();
     
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(expnd);
        }
 }
@@ -118,7 +122,7 @@ void MathMacroTemplate::Metrics()
 void MathMacroTemplate::update(MathMacro * macro)
 {
        int idx = (macro) ? macro->getArgumentIdx() : 0;
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                if (macro) {
                        macro->setArgumentIdx(i);
                        args_[i].SetData(macro->GetData());
@@ -135,15 +139,15 @@ void MathMacroTemplate::WriteDef(ostream & os, bool fragile)
 {
        os << "\n\\newcommand{\\" << name << "}";
 
-       if (nargs > 0 ) 
-               os << "[" << nargs << "]";
+       if (nargs_ > 0 ) 
+               os << "[" << nargs_ << "]";
 
        os << "{";
 
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(false);
        }        
-       Write(os, fragile); 
+       Write(os, fragile);
        os << "}\n";
 }
 
@@ -162,7 +166,7 @@ void MathMacroTemplate::GetMacroXY(int i, int & x, int & y) const
 
 MathParInset * MathMacroTemplate::getMacroPar(int i) const
 {
-       if (i >= 0 && i < nargs) 
+       if (i >= 0 && i < nargs_
                return const_cast<MathParInset *>
                        (static_cast<MathParInset const *>(&args_[i]));
        else 
@@ -172,7 +176,7 @@ MathParInset * MathMacroTemplate::getMacroPar(int i) const
 
 void MathMacroTemplate::SetMacroFocus(int &idx, int x, int y)
 {
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                if (args_[i].Inside(x, y)) {
                        idx = i;
                        break;
index bf34520575337c80772ea773fada396d8129b7cb..179f4da10a3919721d73e3692214ee79b31ac136 100644 (file)
 class MathMacro;
 
 /// This class contains the macro definition
-class MathMacroTemplate: public MathParInset {
-  public:
-  /// A template constructor needs all the data
-    explicit
-    MathMacroTemplate(string const &, int na = 0, int f = 0);
-    ///
-    ~MathMacroTemplate();
-    ///
-    void draw(Painter &, int, int);
-    ///
-    void Metrics();
-    ///
-    void WriteDef(std::ostream &, bool fragile);
-    /// useful for special insets
-    void  setTCode(MathedTextCodes t);
-    ///
-    MathedTextCodes getTCode() const;
-    /// 
-    void setArgument(MathedArray *, int i= 0);
-    /// Number of arguments
-    int getNoArgs() const;
-    ///
-    void GetMacroXY(int, int &, int &) const;
-    ///
-    MathParInset * getMacroPar(int) const;
-    ///
-    void SetMacroFocus(int &, int, int);
-    ///
-    void setEditMode(bool);
-
-    /// Replace the appropriate arguments with a specific macro's data
-    void update(MathMacro * m = 0);
+class MathMacroTemplate : public MathParInset {
+public:
+       /// A template constructor needs all the data
+       explicit
+       MathMacroTemplate(string const &, int na = 0, int f = 0);
+       ///
+       ~MathMacroTemplate();
+       ///
+       void draw(Painter &, int, int);
+       ///
+       void Metrics();
+       ///
+       void WriteDef(std::ostream &, bool fragile);
+       /// useful for special insets
+       void  setTCode(MathedTextCodes t);
+       ///
+       MathedTextCodes getTCode() const;
+       /// 
+       void setArgument(MathedArray *, int i= 0);
+       /// Number of arguments
+       int getNoArgs() const;
+       ///
+       void GetMacroXY(int, int &, int &) const;
+       ///
+       MathParInset * getMacroPar(int) const;
+       ///
+       void SetMacroFocus(int &, int, int);
+       ///
+       void setEditMode(bool);
+       
+       /// Replace the appropriate arguments with a specific macro's data
+       void update(MathMacro * m = 0);
+       ///
+       short flags() const {
+               return flags_;
+       }
 private:
-    ///
-    short flags;
-    ///
-    MathedTextCodes tcode;
-    ///
-    std::vector<MathMacroArgument> args_;
-    ///
-    int nargs;
-    ///
-    friend class MathMacro;
+       ///
+       short flags_;
+       ///
+       MathedTextCodes tcode_;
+       ///
+       std::vector<MathMacroArgument> args_;
+       ///
+       int nargs_;
 };
 #endif
index f27d49a7fadca1a09c0aa7f6bd5add51efda5b0d..17293d1628f8ee23da650f9aa7c73e3acad68047 100644 (file)
 
 ///
 enum SomeMathValues {
-    ///
-    MM_GREEK,
-    ///
-    MM_ARROW,
-    ///
-    MM_BOP,
-    ///
-    MM_BRELATS,
-    ///
-    MM_VARSIZE,
-    ///
-    MM_MISC,
-    ///
-    MM_FRAC,
-    ///
-    MM_SQRT,
-    ///
-    MM_DELIM,
-    ///
-    MM_MATRIX,
-    ///
-    MM_EQU,
-    ///
-    MM_DECO,
-    ///
-    MM_SPACE,
-    ///
-    MM_DOTS,
-    ///
-    MM_FUNC,
-    ///
-    MM_MAX,
-    ///
-    MM_CLOSE = 1024,
-    ///
-    MM_APPLY,
-    ///
-    MM_OK
+       ///
+       MM_GREEK,
+       ///
+       MM_ARROW,
+       ///
+       MM_BOP,
+       ///
+       MM_BRELATS,
+       ///
+       MM_VARSIZE,
+       ///
+       MM_MISC,
+       ///
+       MM_FRAC,
+       ///
+       MM_SQRT,
+       ///
+       MM_DELIM,
+       ///
+       MM_MATRIX,
+       ///
+       MM_EQU,
+       ///
+       MM_DECO,
+       ///
+       MM_SPACE,
+       ///
+       MM_DOTS,
+       ///
+       MM_FUNC,
+       ///
+       MM_MAX,
+       ///
+       MM_CLOSE = 1024,
+       ///
+       MM_APPLY,
+       ///
+       MM_OK
 };
 
+
 ///
 /// Class to manage bitmap menu bars
 class BitmapMenu {
-   ///
-   static BitmapMenu * active;
-   ///
-   friend int peek_event(FL_FORM *, void *);
-   ///
-   typedef std::vector<FL_OBJECT *>   bitmaps_type;
-   ///
-   typedef bitmaps_type::size_type    size_type;
-   ///
-   BitmapMenu * next, * prev;
-   /// Current bitmap
-   size_type current_;
-   /// Border width
-   int ww;
-   ///
-   int x, y, w, h;
-   ///
-   FL_FORM * form;
-   ///
-   bitmaps_type bitmaps_;
-   ///
-   FL_OBJECT * button;
- public:
-   ///
-   BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx= 0);
-   ///
-   ~BitmapMenu();
-   ///
-   FL_OBJECT * AddBitmap(int id,
-                        int nx, int ny, int bw, int bh,
-                        unsigned char const * data,
-                        Bool vert= True); // Why Bool?
-   ///
-   void Create();
-   ///
-   void Hide();
-   ///
-   void Show();
-   ///
-   void Prev();
-   ///
-   void Next();
-   ///
-   int  GetIndex(FL_OBJECT * ob);
+       ///
+       static BitmapMenu * active;
+       ///
+       friend int peek_event(FL_FORM *, void *);
+       ///
+       typedef std::vector<FL_OBJECT *>   bitmaps_type;
+       ///
+       typedef bitmaps_type::size_type    size_type;
+       ///
+       BitmapMenu * next, * prev;
+       /// Current bitmap
+       size_type current_;
+       /// Border width
+       int ww;
+       ///
+       int x;
+       ///
+       int y;
+       ///
+       int w;
+       ///
+       int h;
+       ///
+       FL_FORM * form;
+       ///
+       bitmaps_type bitmaps_;
+       ///
+       FL_OBJECT * button;
+public:
+       ///
+       BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx= 0);
+       ///
+       ~BitmapMenu();
+       ///
+       FL_OBJECT * AddBitmap(int id,
+                             int nx, int ny, int bw, int bh,
+                             unsigned char const * data,
+                             Bool vert = True); // Why Bool?
+       ///
+       void Create();
+       ///
+       void Hide();
+       ///
+       void Show();
+       ///
+       void Prev();
+       ///
+       void Next();
+       ///
+       int GetIndex(FL_OBJECT * ob);
 };
 
+
 /// This is just a wrapper around peek_event()
 extern "C" int C_peek_event(FL_FORM * form, void * ptr);
 
 
 inline
-void BitmapMenu::Prev()  {
-   Hide();
-   if (prev)
-     prev->Show();
+void BitmapMenu::Prev()
+{
+       Hide();
+       if (prev)
+               prev->Show();
 }
 
+
 inline
-void BitmapMenu::Next()  {
-   Hide();
-   if (next)
-     next->Show();
+void BitmapMenu::Next()
+{
+       Hide();
+       if (next)
+               next->Show();
 }
 
+
 #include "math_forms.h"
 
 ///
index ea10c0baf9b8fd786740c5c0ebca3494526648b9..13e62ade7e92dcc9fbdea7dd45859892c153c01c 100644 (file)
@@ -85,10 +85,12 @@ MathParInset::draw(Painter & pain, int x, int y)
 {
        byte cxp = 0;
        int xp = 0;
-       int asc = df_asc, des = 0;
+       int asc = df_asc;
+       int des = 0;
        bool limits = false;
        
-       xo = x;  yo = y; 
+       xo_ = x;
+       yo_ = y; 
        if (!array || array->empty()) {
                if (array) {
                        MathedXIter data(this);
@@ -104,8 +106,8 @@ MathParInset::draw(Painter & pain, int x, int y)
                byte cx = data.GetChar();
                if (cx >= ' ') {
                        string s = data.GetString();
-                       drawStr(pain, data.FCode(), size, x, y, s);
-                       mathed_char_height(LM_TC_CONST, size, 'y', asc, des);
+                       drawStr(pain, data.FCode(), size(), x, y, s);
+                       mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
                        limits = false;
                }
                else {
@@ -195,15 +197,16 @@ MathParInset::Metrics()
                cx = data.GetChar();      
                if (cx >= ' ') {
                        string s = data.GetString();
-                       mathed_string_height(data.FCode(), size, s, asc, des);
+                       mathed_string_height(data.FCode(),
+                                            size(), s, asc, des);
                        if (asc > ascent) ascent = asc;
                        if (des > descent) descent = des;
                        limits = false;
-                       mathed_char_height(LM_TC_CONST, size, 'y', asc, des);
+                       mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
                } else
                        if (MathIsInset(cx)) {
                                MathedInset * p = data.GetInset();
-                               p->SetStyle(size);   
+                               p->SetStyle(size());   
                                p->Metrics();
                                if (cx == LM_TC_UP) {
                                        asc += (limits) ? p->Height() + 4: p->Ascent() + 
@@ -290,7 +293,7 @@ void MathParInset::Write(ostream & os, bool fragile)
        data.Reset();
        
        if (!Permit(LMPF_FIXED_SIZE)) { 
-               l = lm_get_key_by_id(size, LM_TK_STY);
+               l = lm_get_key_by_id(size(), LM_TK_STY);
                if (l) {
                        os << '\\' << l->name << ' ';
                }
@@ -397,22 +400,22 @@ void MathParInset::Write(ostream & os, bool fragile)
 
 bool MathParInset::Inside(int x, int y) 
 {
-  return (x >= xo && x <= xo + width
-         && y <= yo + descent && y >= yo - ascent);
+  return (x >= xo() && x <= xo() + width
+         && y <= yo() + descent && y >= yo() - ascent);
 }
 
 
 void MathParInset::GetXY(int & x, int & y) const
 {
-   x = xo;
-   y = yo;
+   x = xo();
+   y = yo();
 }
 
 
 void MathParInset::UserSetSize(short sz)
 {
    if (sz >= 0) {
-       size = sz;      
+       size(sz);      
        flag = flag & ~LMPF_FIXED_SIZE;
    }
 }
@@ -431,12 +434,6 @@ void MathParInset::SetStyle(short sz)
 }
 
 
-void  MathParInset::setFlag(MathedParFlag f)
-{
-       flag |= f;
-}
-
-
 bool MathParInset::Permit(short f) const
 {
        return bool(f & flag);
@@ -451,6 +448,6 @@ MathedArray * MathParInset::GetData()
 
 void MathParInset::setXY(int x, int y)
 {
-       xo = x;
-       yo = y;
+       xo_ = x;
+       yo_ = y;
 }
index 52ab59ad2daaffd222a45f242f3824d195fe7211..c8e2784d1632500c467c012e382fee7f631a77ce 100644 (file)
@@ -11,86 +11,88 @@ class MathedArray;
 
 /** The math paragraph base class, base to all editable math objects */
 class MathParInset: public MathedInset  {
- public: 
-    ///
-    MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
-                short ot = LM_OT_MIN);
-    ///
-    explicit
-    MathParInset(MathParInset *);
-    ///
-    virtual ~MathParInset();
-    ///
-    virtual MathedInset * Clone();
-    /// Draw the object on a drawable
-    virtual void draw(Painter &, int x, int baseline);
-    /// Write LaTeX code
-    virtual void Write(std::ostream &, bool fragile);
-    ///
-    virtual void Metrics();
-    ///
-    virtual void UserSetSize(short);
-    /// Data is stored in a LyXArray
-    virtual void SetData(MathedArray *);
-    ///
-    virtual MathedArray * GetData();
-    /// Paragraph position
-    virtual void GetXY(int &, int &) const;
-    ///
-    virtual void setXY(int x, int y);
-    ///
-    virtual void SetFocus(int, int) {}
-    ///
-    virtual bool Inside(int, int);   
-    // Tab stuff used by Matrix.
-    ///
-    virtual void SetAlign(char, string const &) {}
-    ///
-    virtual int GetColumns() const { return 1; }
-    ///
-    virtual int GetRows() const { return 1; }
-    ///
-    virtual bool isMatrix() const { return false; }
-    // Vertical switching
-    ///
-    virtual bool setArgumentIdx(int i) { return (i == 0); }
-    ///
-    virtual bool setNextArgIdx() { return false; }
-    ///
-    virtual int getArgumentIdx() const { return 0; }
-    ///
-    virtual int getMaxArgumentIdx() const { return 0; }
-    ///
-    virtual void SetStyle(short);
-    ///
-    virtual MathedRowSt * getRowSt() const;
-    ///
-    virtual void setRowSt(MathedRowSt *) {}
-    ///
-    virtual bool Permit(short f) const;
- protected:
-    /// Paragraph data is stored here
-    MathedArray * array;
-    /// Cursor start position
-    int xo;
-    ///
-    int yo;
-    /// 
-    short flag;
- private:
-    ///
-    virtual void setFlag(MathedParFlag f);
-    ///
-    friend class InsetFormula;
-    ///
-    friend class MathedXIter;
-    ///
-    friend class MathedCursor;
-    ///
-    friend MathedArray * mathed_parse(unsigned flags = 0,
-                                      MathedArray * a = 0,
-                                      MathParInset ** p = 0);
+public: 
+       ///
+       MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
+                    short ot = LM_OT_MIN);
+       ///
+       explicit
+       MathParInset(MathParInset *);
+       ///
+       virtual ~MathParInset();
+       ///
+       virtual MathedInset * Clone();
+       /// Draw the object on a drawable
+       virtual void draw(Painter &, int x, int baseline);
+       /// Write LaTeX code
+       virtual void Write(std::ostream &, bool fragile);
+       ///
+       virtual void Metrics();
+       ///
+       virtual void UserSetSize(short);
+       /// Data is stored in a LyXArray
+       virtual void SetData(MathedArray *);
+       ///
+       virtual MathedArray * GetData();
+       /// Paragraph position
+       virtual void GetXY(int &, int &) const;
+       ///
+       virtual void setXY(int x, int y);
+       ///
+       virtual void SetFocus(int, int) {}
+       ///
+       virtual bool Inside(int, int);   
+       // Tab stuff used by Matrix.
+       ///
+       virtual void SetAlign(char, string const &) {}
+       ///
+       virtual int GetColumns() const { return 1; }
+       ///
+       virtual int GetRows() const { return 1; }
+       ///
+       virtual bool isMatrix() const { return false; }
+       // Vertical switching
+       ///
+       virtual bool setArgumentIdx(int i) { return (i == 0); }
+       ///
+       virtual bool setNextArgIdx() { return false; }
+       ///
+       virtual int getArgumentIdx() const { return 0; }
+       ///
+       virtual int getMaxArgumentIdx() const { return 0; }
+       ///
+       virtual void SetStyle(short);
+       ///
+       virtual MathedRowSt * getRowSt() const;
+       ///
+       virtual void setRowSt(MathedRowSt *) {}
+       ///
+       virtual bool Permit(short f) const;
+       ///
+       int xo() const {
+               return xo_;
+       }
+       ///
+       int yo() const {
+               return yo_;
+       }
+protected:
+       /// Paragraph data is stored here
+       MathedArray * array;
+       /// 
+       short flag;
+       ///
+       void xo(int tx) {
+               xo_ = tx;
+       }
+       ///
+       void yo(int ty) {
+               yo_ = ty;
+       }
+private:
+       /// Cursor start position
+       int xo_;
+       ///
+       int yo_;
 };
-
-
 #endif
index ec10cc7ad0ee298f887a9a1c83ca69815fa0aff1..751ca50605f91beba5798bc2546bc9a74c253d05 100644 (file)
@@ -390,8 +390,8 @@ MathedInset * doAccent(MathedInset * p)
 }
 
 
-MathedArray * mathed_parse(unsigned flags, MathedArray * array,
-                           MathParInset ** mtx)
+MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
+                           MathParInset ** mtx = 0)
 {
    int t = yylex();
    int tprev = 0;
index 0a95822fdf9ce8fb06287888e81dcd33fe19d016..08a55a5b92f854b27327b7a95f33c88caff15f55 100644 (file)
@@ -28,113 +28,113 @@ using std::ostream;
 MathRootInset::MathRootInset(short st)
        : MathSqrtInset(st)
 {
-    idx = 1;
-    uroot = new MathParInset(LM_ST_TEXT); 
+       idx = 1;
+       uroot = new MathParInset(LM_ST_TEXT); 
 }
 
 
 MathRootInset::~MathRootInset() 
 {
-    delete uroot;
+       delete uroot;
 }
 
 
 MathedInset * MathRootInset::Clone()
 {
-   MathRootInset * p = new MathRootInset(GetStyle());
-   MathedIter it(array), itr(uroot->GetData());
-   p->SetData(it.Copy());
-   p->setArgumentIdx(0);
-   p->SetData(itr.Copy());
-
-   return p;
+       MathRootInset * p = new MathRootInset(GetStyle());
+       MathedIter it(array), itr(uroot->GetData());
+       p->SetData(it.Copy());
+       p->setArgumentIdx(0);
+       p->SetData(itr.Copy());
+       
+       return p;
 }
 
 
 void MathRootInset::SetData(MathedArray * d)
 {
-   if (idx == 1)
-     MathParInset::SetData(d);
-   else {
-      uroot->SetData(d);
-   }
+       if (idx == 1)
+               MathParInset::SetData(d);
+       else {
+               uroot->SetData(d);
+       }
 }
 
 
 bool MathRootInset::setArgumentIdx(int i)
 {
-   if (i == 0 || i == 1) {
-       idx = i;
-       return true;
-   } else
-      return false;
+       if (i == 0 || i == 1) {
+               idx = i;
+               return true;
+       } else
+               return false;
 }
 
 
 void MathRootInset::GetXY(int & x, int & y) const
 {
-   if (idx == 1)
-     MathParInset::GetXY(x, y);
-   else
-     uroot->GetXY(x, y);
+       if (idx == 1)
+               MathParInset::GetXY(x, y);
+       else
+               uroot->GetXY(x, y);
 }
 
 
 MathedArray * MathRootInset::GetData()
 {
-   if (idx == 1)
-     return array;
-   else
-     return uroot->GetData();
+       if (idx == 1)
+               return array;
+       else
+               return uroot->GetData();
 }
 
 
 bool MathRootInset::Inside(int x, int y)
 {
-    return (uroot->Inside(x, y) || MathSqrtInset::Inside(x, y));
+       return (uroot->Inside(x, y) || MathSqrtInset::Inside(x, y));
 }
 
 
 void MathRootInset::Metrics()
 {
-    int idxp = idx;
-
-    idx = 1;
-    MathSqrtInset::Metrics();
-    uroot->Metrics();
-    wroot = uroot->Width();
-    dh = Height()/2;
-    width += wroot;
-    //    if (uroot->Ascent() > dh) 
-    if (uroot->Height() > dh) 
-      ascent += uroot->Height() - dh;
-    dh -= descent - uroot->Descent();
-    idx = idxp;
+       int idxp = idx;
+       
+       idx = 1;
+       MathSqrtInset::Metrics();
+       uroot->Metrics();
+       wroot = uroot->Width();
+       dh = Height()/2;
+       width += wroot;
+       //    if (uroot->Ascent() > dh) 
+       if (uroot->Height() > dh) 
+               ascent += uroot->Height() - dh;
+       dh -= descent - uroot->Descent();
+       idx = idxp;
 }
 
 
 void MathRootInset::draw(Painter & pain, int x, int y)
 {
-    int idxp = idx;
-
-    idx = 1;
-    uroot->draw(pain, x, y - dh);
-    MathSqrtInset::draw(pain, x + wroot, y);
-    idx = idxp;
+       int idxp = idx;
+       
+       idx = 1;
+       uroot->draw(pain, x, y - dh);
+       MathSqrtInset::draw(pain, x + wroot, y);
+       idx = idxp;
 }
 
 
 void MathRootInset::SetStyle(short st)
 {
-    MathSqrtInset::SetStyle(st);
-    
-    uroot->SetStyle((size<LM_ST_SCRIPTSCRIPT) ? size+1: size);
+       MathSqrtInset::SetStyle(st);
+       
+       uroot->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
 }
 
 
 void MathRootInset::SetFocus(int x, int)
 {  
-    idx = (x > xo + wroot) ? 1: 0;
+       idx = (x > xo() + wroot) ? 1: 0;
 }
 
 
index 388c4711d6a40eeac3e578c4b169d33308497a42..56432bfe3b3d751d0dfb529ff69c095f054818fd 100644 (file)
@@ -24,10 +24,10 @@ MathedInset * MathSqrtInset::Clone()
 
 bool MathSqrtInset::Inside(int x, int y) 
 {
-       return x >= xo - hmax
-               && x <= xo + width - hmax
-               && y <= yo + descent
-               && y >= yo - ascent;
+       return x >= xo() - hmax
+               && x <= xo() + width - hmax
+               && y <= yo() + descent
+               && y >= yo() - ascent;
 }
 
 
@@ -55,7 +55,7 @@ MathSqrtInset::Metrics()
        ascent += 4;
        descent += 2;
        int a, b;
-       hmax = mathed_char_height(LM_TC_VAR, size, 'I', a, b);
+       hmax = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
        if (hmax < 10) hmax = 10;
        wbody = width + 4;
        width += hmax + 4;
index 7dec324d7f9593933a0bbfbd1fe078e95ecb57e6..2c6568ea5566e311928641479752772fc16e6c89 100644 (file)
@@ -103,7 +103,6 @@ protected:
        /// 
        MathedRowSt * crow;
        
-private:
        ///
        friend class MathedCursor;
 };
index 5efc33be74c90838cabf317347f0a695e59eab89..77b60312b8ab2759649b52a5826930d5ae22624a 100644 (file)
@@ -4,57 +4,55 @@
 
 #include "matriz.h"
 
-inline
+static inline
 int odd(int x) { return ((x) & 1); }
 
-typedef float matriz_data[2][2];
+#define mateq(m1, m2)  memcpy(m1, m2, sizeof(matriz_data))
 
-const matriz_data MATIDEN= { {1, 0}, {0, 1}};
 
-#define mateq(m1, m2)  memcpy(m1, m2, sizeof(matriz_data))
+Matriz::matriz_data const Matriz::MATIDEN = { {1, 0}, {0, 1}};
+
 
 Matriz::Matriz()
 {
-       mateq(m, MATIDEN);
+       mateq(m_, MATIDEN);
 }
 
 
 void Matriz::rota(int code)
 {
-   float cs, sn;
-   
-   matriz_data r;
-   mateq(r, MATIDEN);
-   cs = (odd(code)) ? 0: 1 - code;
-   sn = (odd(code)) ? 2 - code: 0;
-   r[0][0] = cs;         r[0][1] = sn;
-   r[1][0] = -r[0][1];   r[1][1] = r[0][0];
-   matmat(r);
+       matriz_data r;
+       mateq(r, MATIDEN);
+       float const cs = (odd(code)) ? 0 : (1 - code);
+       float const sn = (odd(code)) ? (2 - code) : 0;
+       r[0][0] = cs;         r[0][1] = sn;
+       r[1][0] = -r[0][1];   r[1][1] = r[0][0];
+       matmat(r);
 }
 
 
 void Matriz::escala(float x, float y)
 {
-   matriz_data s;
-   mateq(s, MATIDEN);
-   s[0][0] = x;  s[1][1] = y;
-   matmat(s);
+       matriz_data s;
+       mateq(s, MATIDEN);
+       s[0][0] = x;  s[1][1] = y;
+       matmat(s);
 }
 
 
 void Matriz::matmat(matriz_data & a)
 {
-   matriz_data c;   
-   for (int i = 0;i < 2; ++i) {
-      c[0][i] = a[0][0] * m[0][i] + a[0][1] * m[1][i];
-      c[1][i] = a[1][0] * m[0][i] + a[1][1] * m[1][i];
-   }
-   mateq(m, c);
+       matriz_data c;   
+       for (int i = 0; i < 2; ++i) {
+               c[0][i] = a[0][0] * m_[0][i] + a[0][1] * m_[1][i];
+               c[1][i] = a[1][0] * m_[0][i] + a[1][1] * m_[1][i];
+       }
+       mateq(m_, c);
 }
 
 
 void Matriz::transf(float xp, float yp, float & x, float & y)
 {
-   x = m[0][0] * xp + m[0][1] * yp;
-   y = m[1][0] * xp + m[1][1] * yp;
+       x = m_[0][0] * xp + m_[0][1] * yp;
+       y = m_[1][0] * xp + m_[1][1] * yp;
 }
index ce82122ed1489f9862e822bd8208665d45a566ae..698dd54a95e683242e49be85405cfc46c2f83ef1 100644 (file)
@@ -3,17 +3,26 @@
 #ifndef MATH_MATRIZ_H
 #define MATH_MATRIZ_H
 
-typedef float matriz_data[2][2];
-
+///
 class Matriz {
- public: 
-   Matriz();
-   void rota(int);
-   void escala(float, float);
-   void transf(float, float, float &, float &);
- protected:
-   matriz_data m;
-   void matmat(matriz_data & a);
+public:
+       ///
+       typedef float matriz_data[2][2];
+       ///
+       Matriz();
+       ///
+       void rota(int);
+       ///
+       void escala(float, float);
+       ///
+       void transf(float, float, float &, float &);
+private:
+       ///
+       matriz_data m_;
+       ///
+       void matmat(matriz_data & a);
+       ///
+       static matriz_data const MATIDEN;
 };
 
 #endif
index 2e2e48a70974d211ad5bc8df6ef31a30f565c453..7d36d9b6a287ee5858c3b85fa0ad6f16bdd6b6b2 100644 (file)
@@ -376,7 +376,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
        mt.rota(r);
        mt.escala(w, h);
    
-       int n = (w < h) ? w: h;
+       int n = (w < h) ? w : h;
        sqmt.rota(r);
        sqmt.escala(n, n);
        if (r > 0 && r < 3) y += h;