mathed53.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1729 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-03-10 09:01:23 +00:00
parent bce1032704
commit 2571b20b34
4 changed files with 29 additions and 27 deletions

View File

@ -1,3 +1,10 @@
2001-03-10 André Pönitz <poenitz@htwm.de>
* math_xiter.[Ch]:
math_matrixinset.C: move adjustVerticalSt to the only place where
it is used. Fix a small bug where the cached row structure and the
actual data get out of sync after the deletion of whole rows
2001-03-09 André Pönitz <poenitz@htwm.de>
* math_cursor.C: use std::vector<> in MathStackXIter
change selstk from a pointer to the "real thing"

View File

@ -93,11 +93,27 @@ void MathMatrixInset::draw(Painter & pain, int x, int baseline)
void MathMatrixInset::Metrics()
{
if (row_.empty()) {
//if (row_.empty()) {
#warning This leaks row_.data but goes away soon
// lyxerr << " MIDA ";
MathedXIter it(this);
row_.data_ = it.adjustVerticalSt();
}
it.GoBegin();
if (!it.crow_) {
it.crow_.st_ = new MathedRowSt(it.ncols + 1); // this leaks
}
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
it.crow_.st_->next_ = r;
it.crow_.st_ = r;
}
it.Next();
}
row_.data_ = mrow;
//}
// Clean the arrays
for (MathedRowContainer::iterator it = row_.begin(); it; ++it)

View File

@ -571,26 +571,6 @@ bool MathedXIter::setLabel(string const & label)
}
MathedRowSt * MathedXIter::adjustVerticalSt()
{
GoBegin();
if (!crow_) {
crow_.st_ = new MathedRowSt(ncols + 1); // this leaks
}
MathedRowSt * mrow = crow_.st_;
while (OK()) {
if (IsCR()) {
if (col >= ncols)
ncols = col + 1;
MathedRowSt * r = new MathedRowSt(ncols + 1); // this leaks
crow_.st_->next_ = r;
crow_.st_ = r;
}
Next();
}
return mrow;
}
string const & MathedXIter::getLabel() const
{

View File

@ -7,6 +7,7 @@
#include "math_rowst.h"
class MathParInset;
class MathMatrixInset;
/**
A graphic iterator (updates position.) Used for
@ -76,8 +77,6 @@ public:
/// Delete every object from current position to pos2
void Clean(int pos2);
///
MathedRowSt * adjustVerticalSt();
///
virtual void ipush();
///
virtual void ipop();
@ -86,7 +85,7 @@ public:
return crow_;
}
private:
protected:
///
MathedRowContainer & container();
/// This function is not recursive, as MathPar::Metrics is
@ -110,6 +109,6 @@ private:
///
MathedRowContainer::iterator crow_;
///
//friend class MathedCursor;
friend class MathMatrixInset;
};
#endif