MathedRowStruct::width expands as needed. Remove explicit sizes. -- André Pönitz ........................................ [EMAIL PROTECTED]
Index: math_matrixinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_matrixinset.C,v retrieving revision 1.16 diff -u -p -r1.16 math_matrixinset.C --- math_matrixinset.C 2001/03/10 09:01:23 1.16 +++ math_matrixinset.C 2001/03/12 17:04:07 @@ -19,7 +19,7 @@ MathMatrixInset::MathMatrixInset(int m, { flag = 15; if (n > 0) { - row_.data_ = new MathedRowSt(nc_ + 1); + row_.data_ = new MathedRowSt; MathedXIter it(this); for (int j = 1; j < n; ++j) it.addRow(); @@ -29,7 +29,7 @@ MathMatrixInset::MathMatrixInset(int m, it.insert('T', LM_TC_TAB); } } else if (n < 0) { - row_.data_ = new MathedRowSt(nc_ + 1); + row_.data_ = new MathedRowSt; nr_ = 1; } } @@ -99,14 +99,14 @@ void MathMatrixInset::Metrics() MathedXIter it(this); it.GoBegin(); if (!it.crow_) { - it.crow_.st_ = new MathedRowSt(it.ncols + 1); // this leaks + it.crow_.st_ = new MathedRowSt; } MathedRowSt * mrow = it.crow_.st_; while (it.OK()) { if (it.IsCR()) { if (it.col >= it.ncols) it.ncols = it.col + 1; - MathedRowSt * r = new MathedRowSt(it.ncols + 1); // this leaks + MathedRowSt * r = new MathedRowSt; it.crow_.st_->next_ = r; it.crow_.st_ = r; } Index: math_parser.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parser.C,v retrieving revision 1.41 diff -u -p -r1.41 math_parser.C --- math_parser.C 2001/03/09 23:55:50 1.41 +++ math_parser.C 2001/03/12 17:04:07 @@ -604,7 +604,7 @@ void mathed_parse(MathedArray & array, u case LM_TK_NEWLINE: if (mt && (flags & FLAG_END)) { if (mt->Permit(LMPF_ALLOW_CR)) { - mt->getRowSt().insert_after(crow, MathedRowSt(mt->GetColumns() + 1)); + mt->getRowSt().insert_after(crow); ++crow; data.insert('K', LM_TC_CR); } else Index: math_rowst.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_rowst.h,v retrieving revision 1.10 diff -u -p -r1.10 math_rowst.h --- math_rowst.h 2001/03/12 13:58:11 1.10 +++ math_rowst.h 2001/03/12 17:04:07 @@ -17,10 +17,8 @@ public: typedef std::vector<int> Widths; /// - explicit - MathedRowStruct(int n) - : asc_(0), desc_(0), y_(0), widths_(n + 1, 0), - numbered_(true) + MathedRowStruct() + : asc_(0), desc_(0), y_(0), numbered_(true) {} /// string const & getLabel() const; @@ -69,8 +67,8 @@ class MathedRowContainer; class MathedRowSt : public MathedRowStruct { public: /// - explicit MathedRowSt(int n) - : MathedRowStruct(n), next_(0) + MathedRowSt() + : next_(0) {} explicit MathedRowSt(MathedRowStruct const & t) : MathedRowStruct(t), next_(0) @@ -153,8 +151,8 @@ struct MathedRowContainer { bool empty() const { return data_ == 0; } /// insert 'item' before 'iterator' - void insert(iterator const & it, MathedRowStruct const & item) { - MathedRowSt * r = new MathedRowSt(item); + void insert(iterator const & it) { + MathedRowSt * r = new MathedRowSt; if (data_ == it.st_) data_ = r; else { @@ -166,8 +164,8 @@ struct MathedRowContainer { } /// insert 'item' after 'iterator' - void insert_after(iterator & it, MathedRowStruct const & item) { - MathedRowSt * r = new MathedRowSt(item); + void insert_after(iterator & it) { + MathedRowSt * r = new MathedRowSt; if (it) { r->next_ = it.st_->next_; it.st_->next_ = r; Index: math_xiter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_xiter.C,v retrieving revision 1.18 diff -u -p -r1.18 math_xiter.C --- math_xiter.C 2001/03/10 09:01:23 1.18 +++ math_xiter.C 2001/03/12 17:04:07 @@ -156,7 +156,7 @@ void MathedXIter::Merge(MathedArray cons while (pos < pos2 && OK()) { if (IsCR()) { if (p_ && p_->Permit(LMPF_ALLOW_CR)) { - container().insert_after(crow_, MathedRowSt(ncols + 1)); + container().insert_after(crow_); ++crow_; } else { Delete(); @@ -369,7 +369,7 @@ void MathedXIter::addRow() } // Create new item for the structure - container().insert_after(crow_, MathedRowSt(ncols + 1)); + container().insert_after(crow_); // Fill missed tabs in current row while (col < ncols - 1) insert('T', LM_TC_TAB);