]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / InsetMathHull.cpp
index 956ea8a0b03f7a14d1d7b01c4d9b37b5cc8b9f3e..b7de48c89f537078e2de2d797c9c5b347a800c94 100644 (file)
@@ -172,10 +172,8 @@ InsetMathHull::InsetMathHull(InsetMathHull const & other)
 
 InsetMathHull::~InsetMathHull()
 {
-       for (size_t i = 0; i < label_.size(); ++i) {
-               if (label_[i])
-                       delete label_[i];
-       }
+       for (size_t i = 0; i < label_.size(); ++i)
+               delete label_[i];
 }
 
 
@@ -192,10 +190,8 @@ InsetMathHull & InsetMathHull::operator=(InsetMathHull const & other)
        InsetMathGrid::operator=(other);
        type_  = other.type_;
        nonum_ = other.nonum_;
-       for (size_t i = 0; i < label_.size(); ++i) {
-               if (label_[i])
-                       delete label_[i];
-       }
+       for (size_t i = 0; i < label_.size(); ++i)
+               delete label_[i];
        label_ = other.label_;
        for (size_t i = 0; i != label_.size(); ++i) {
                if (label_[i])
@@ -210,6 +206,12 @@ InsetMathHull & InsetMathHull::operator=(InsetMathHull const & other)
 void InsetMathHull::setBuffer(Buffer & buffer)
 {
        buffer_ = &buffer;
+       for (idx_type i = 0, n = nargs(); i != n; ++i) {
+               MathData & data = cell(i);
+               for (size_t j = 0; j != data.size(); ++j)
+                       data[j].nucleus()->setBuffer(buffer);
+       }
+
        for (size_t i = 0; i != label_.size(); ++i) {
                if (label_[i])
                        label_[i]->setBuffer(buffer);
@@ -699,7 +701,12 @@ void InsetMathHull::swapRow(row_type row)
                return;
        if (row + 1 == nrows())
                --row;
-       swap(nonum_[row], nonum_[row + 1]);
+       // gcc doesn't like this:
+       //      swap(nonum_[row], nonum_[row + 1]);
+       // so we do it manually:
+       bool const b = nonum_[row];
+       nonum_[row] = nonum_[row + 1];
+       nonum_[row + 1] = b;
        swap(label_[row], label_[row + 1]);
        InsetMathGrid::swapRow(row);
 }
@@ -715,8 +722,7 @@ void InsetMathHull::delRow(row_type row)
        if (row == nrows() + 1)
                row--;
        nonum_.erase(nonum_.begin() + row);
-       if (label_[row])
-               delete label_[row];
+       delete label_[row];
        label_.erase(label_.begin() + row);
 }