]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
use the new sstream return non-pods as const, use string instead of char * in a lot...
[lyx.git] / src / mathed / math_inset.C
index ea81e507bde5f0e10656876b38c85830ef55f9f2..dfcce43cd83360797b01f5bc4644c91eb1454747 100644 (file)
@@ -7,7 +7,7 @@
  *
  *  Dependencies: Xlib, XForms
  *
- *  Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
  *
  *   Version: 0.8beta.
  *
@@ -26,7 +26,7 @@
 #include "symbol_def.h"
 
 
-inline
+static inline
 char * strnew(char const * s)
 {
    char * s1 = new char[strlen(s)+1];
@@ -47,21 +47,21 @@ MathedInset::MathedInset(MathedInset * inset)
       objtype = LM_OT_UNDEF;
       size = LM_ST_TEXT;
       width = ascent = descent = 0;
-      name = 0;
+      //name = 0;
    }
 }
 
 
-MathFuncInset::MathFuncInset(char const * nm, short ot, short st)
+MathFuncInset::MathFuncInset(string const & nm, short ot, short st)
        : MathedInset("", ot, st)
 {
    ln = 0;
    lims = (GetType() == LM_OT_FUNCLIM);
     if (GetType() == LM_OT_UNDEF) {
-       fname = strnew(nm);
+       fname = nm;
        SetName(fname);
     } else {
-       fname = 0;
+       //fname = 0;
        SetName(nm);
     }
 }
@@ -84,7 +84,7 @@ MathedInset * MathSpaceInset::Clone()
 }
 
 
-MathParInset::MathParInset(short st, char const * nm, short ot)
+MathParInset::MathParInset(short st, string const & nm, short ot)
        : MathedInset(nm, ot, st)
 {
     array = 0;
@@ -338,8 +338,8 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
        while (mrow) {
            r = new MathedRowSt(nc + 1);
            r->numbered = mrow->numbered;
-           if (mrow->label) 
-             r->label = strnew(mrow->label);
+           //if (mrow->label) 
+             r->label = mrow->label;
            if (!ro) 
              row = r;
            else
@@ -416,16 +416,16 @@ void MathMatrixInset::SetData(LyxArrayBase * a)
 }
 
 
-void MathMatrixInset::Draw(int x, int baseline)
+void MathMatrixInset::draw(Painter & pain, int x, int baseline)
 {
-    MathParInset::Draw(x, baseline);
-}                
+    MathParInset::draw(pain, x, baseline);
+}
 
 
 void MathMatrixInset::Metrics()
 {
-    int i, hl, h= 0;
-    MathedRowSt * cprow= 0, * cxrow;
+    int i, hl, h = 0;
+    MathedRowSt * cprow= 0;
 
     if (!row) {
 //     lyxerr << " MIDA ";
@@ -434,7 +434,7 @@ void MathMatrixInset::Metrics()
     } 
     
     // Clean the arrays      
-    cxrow = row;
+    MathedRowSt * cxrow = row;
     while (cxrow) {   
        for (i = 0; i <= nc; ++i) cxrow->w[i] = 0;
        cxrow = cxrow->next;
@@ -534,7 +534,7 @@ MathedInset * MathAccentInset::Clone()
 }
 
 
-MathBigopInset::MathBigopInset(char const* nam, int id, short st)
+MathBigopInset::MathBigopInset(string const & nam, int id, short st)
        : MathedInset(nam, LM_OT_BIGOP, st), sym(id)
 {
    lims = -1;
@@ -547,7 +547,7 @@ MathedInset * MathBigopInset::Clone()
 }
 
 
-MathDotsInset::MathDotsInset(char const * nam, int id, short st)
+MathDotsInset::MathDotsInset(string const & nam, int id, short st)
        : MathedInset(nam, LM_OT_DOTS, st), code(id) {}