]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_matrixinset.C
update libtool
[lyx.git] / src / mathed / math_matrixinset.C
index 30842ab21a3c14f3a19f6f4fece160d14010e6d1..7495df99a8d10010f36283e348cc738610987d20 100644 (file)
@@ -19,7 +19,6 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st)
 {
        flag = 15;
        if (n > 0) {
-               row_.data_ = new MathedRowSt(nc_ + 1);
                MathedXIter it(this);
                for (int j = 1; j < n; ++j)
                        it.addRow();
@@ -29,7 +28,8 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st)
                                it.insert('T', LM_TC_TAB);
                }
        } else if (n < 0) {
-               row_.data_ = new MathedRowSt(nc_ + 1);
+               MathedXIter it(this);
+               it.addRow();
                nr_ = 1;
        }
 }
@@ -93,11 +93,19 @@ void MathMatrixInset::draw(Painter & pain, int x, int baseline)
 
 void MathMatrixInset::Metrics()
 {
-       if (row_.empty()) {
-               // lyxerr << " MIDA ";
-               MathedXIter it(this);
-               row_.data_ = it.adjustVerticalSt();
-       } 
+       // Adjust row structure
+       MathedXIter it(this);
+       it.GoBegin();
+       int nrows = 1;
+       while (it.OK()) {
+               if (it.IsCR()) {
+                       ++nrows;
+                       if (it.col >= it.ncols)
+                               it.ncols = it.col + 1; 
+               }   
+               it.Next();      
+       }
+       row_.data_.resize(nrows);
        
        // Clean the arrays      
        for (MathedRowContainer::iterator it = row_.begin(); it; ++it)