]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formulabase.C
further code uglification to make Jean-Marc's compiler happy
[lyx.git] / src / mathed / formulabase.C
index 2436eda6a7fdf20e708c6f78f0b8f3f0cff2a40c..4b963fb02e4bac1404e59faa54b0f82733ebddf0 100644 (file)
@@ -1,9 +1,8 @@
  /*
-*  File:        formula.C
-*  Purpose:     Implementation of formula inset
+*  File:        formulabase.C
+*  Purpose:     Implementation of common parts of the LyX  math insets
 *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
 *  Created:     January 1996
-*  Description: Allows the edition of math paragraphs inside Lyx.
 *
 *  Copyright: 1996-1998 Alejandro Aguilar Sierra
 *
@@ -61,13 +60,6 @@ int sel_x;
 int sel_y;
 bool sel_flag;
 
-void mathed_init_fonts();
-
-string nicelabel(string const & label)
-{
-       return "(" + (label.empty() ? "#" : label) + ")";
-}
-
 void handleFont(BufferView * bv, MathTextCodes t) 
 {
        if (mathcursor->selection())
@@ -99,7 +91,7 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
 
 
 // returns the nearest enclosing grid
-MathArrayInset * matrixpar(int & idx)
+MathArrayInset * matrixpar(unsigned int & idx)
 {
        idx = 0;
        return (mathcursor ? mathcursor->enclosingArray(idx) : 0); 
@@ -118,44 +110,6 @@ InsetFormulaBase::InsetFormulaBase()
 }
 
 
-void InsetFormulaBase::read(Buffer const *, LyXLex & lex)
-{
-       read(lex);
-}
-
-
-void InsetFormulaBase::write(Buffer const *, ostream & os) const
-{
-       write(os);
-}
-
-
-int InsetFormulaBase::latex(Buffer const *, ostream & os,
-       bool fragile, bool spacing) const
-{
-       return latex(os, fragile, spacing);
-}
-
-
-int InsetFormulaBase::ascii(Buffer const *, ostream & os, int spacing) const
-{
-       return ascii(os, spacing);
-}
-
-
-int InsetFormulaBase::linuxdoc(Buffer const *, ostream & os) const
-{
-       return linuxdoc(os);
-}
-
-
-int InsetFormulaBase::docbook(Buffer const *, ostream & os) const
-{
-       return docbook(os);
-}
-
-
-
 // Check if uses AMS macros
 void InsetFormulaBase::validate(LaTeXFeatures &) const
 {}
@@ -601,7 +555,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
                lyxerr << "handling halign '" << arg << "'\n";
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                if (!p)
                        break; 
@@ -614,7 +568,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
                lyxerr << "handling valign '" << arg << "'\n";
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                if (!p)
                        break; 
@@ -626,7 +580,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_ROW_INSERT:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                lyxerr << " calling LFUN_MATH_ROW_INSERT on " << p << endl;
                if (!p)
@@ -639,7 +593,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_ROW_DELETE:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                lyxerr << " calling LFUN_MATH_ROW_DELETE on " << p << endl;
                if (!p)
@@ -652,7 +606,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_COLUMN_INSERT:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                if (!p)
                        break; 
@@ -664,7 +618,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_COLUMN_DELETE:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               int idx;
+               unsigned int idx;
                MathArrayInset * p = matrixpar(idx);
                if (!p)
                        break; 
@@ -692,8 +646,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                break;
 
        default:
-               lyxerr << "Closed by action " << action << endl;
-               result = FINISHED_RIGHT;
+               result = UNDISPATCHED;
        }
 
        //mathcursor->normalize();
@@ -735,15 +688,15 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
 
                InsetFormulaBase * f;
                if (sel.empty()) {
-                               f = new InsetFormula;
-                               if (openNewInset(bv, f)) {
-                                       // don't do that also for LFUN_MATH_MODE unless you want end up with
-                                       // always changing to mathrm when opening an inlined inset
-                                       // -- I really hate "LyXfunc overloading"...
-                                       if (display)
-                                               f->localDispatch(bv, LFUN_MATH_DISPLAY, string());
-                                       f->localDispatch(bv, LFUN_INSERT_MATH, arg);
-                               }
+                       f = new InsetFormula;
+                       if (openNewInset(bv, f)) {
+                               // don't do that also for LFUN_MATH_MODE unless you want end up with
+                               // always changing to mathrm when opening an inlined inset
+                               // -- I really hate "LyXfunc overloading"...
+                               if (display)
+                                       f->localDispatch(bv, LFUN_MATH_DISPLAY, string());
+                               f->localDispatch(bv, LFUN_INSERT_MATH, arg);
+                       }
                } else {
                        // create a macro if we see "\\newcommand" somewhere, and an ordinary
                        // formula otherwise