+
+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"
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)
}
-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
{
#include "math_rowst.h"
class MathParInset;
+class MathMatrixInset;
/**
A graphic iterator (updates position.) Used for
/// Delete every object from current position to pos2
void Clean(int pos2);
///
- MathedRowSt * adjustVerticalSt();
- ///
virtual void ipush();
///
virtual void ipop();
return crow_;
}
-private:
+protected:
///
MathedRowContainer & container();
/// This function is not recursive, as MathPar::Metrics is
///
MathedRowContainer::iterator crow_;
///
- //friend class MathedCursor;
+ friend class MathMatrixInset;
};
#endif