]> git.lyx.org Git - features.git/commitdiff
mathed53.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 10 Mar 2001 09:01:23 +0000 (09:01 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 10 Mar 2001 09:01:23 +0000 (09:01 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1729 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_matrixinset.C
src/mathed/math_xiter.C
src/mathed/math_xiter.h

index 9252083331b83582630aa3dff836e70a0d42c413..56f81a59f7f239941de53b9102cd4e7a936d8039 100644 (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"
index 30842ab21a3c14f3a19f6f4fece160d14010e6d1..6964eaeabd9267a4f1a82a0a2fc197bd33482b7e 100644 (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)
index d242a58081f12a51a40f730225b10d7f068997fb..c29e1b6d46f73f5043df86268fe442b80df858b8 100644 (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
 {
index fb5201aafbbe6cf6299cf66c247f31078b7462b9..6012083339a88699e260b0f1da3c4eacbfc37a30 100644 (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