]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_nestinset.C
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
[lyx.git] / src / mathed / math_nestinset.C
index 57384587766241bfa396fcd1537eb9d2cff2d299..6113621b43f1b8e583467055f433d5dc562c5775 100644 (file)
@@ -136,7 +136,7 @@ bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
 
 void MathNestInset::dump() const
 {
-       MathWriteInfo os(lyxerr);
+       WriteStream os(lyxerr);
        os << "---------------------------------------------\n";
        write(os);
        os << "\n";
@@ -146,35 +146,26 @@ void MathNestInset::dump() const
 }
 
 
-void MathNestInset::push_back(MathAtom const & t)
+void MathNestInset::validate(LaTeXFeatures & features) const
 {
-       if (nargs())
-               cells_.back().data_.push_back(t);
-       else
-               lyxerr << "can't push without a cell\n";
+       for (idx_type i = 0; i < nargs(); ++i)
+               cell(i).validate(features);
 }
 
 
-void MathNestInset::validate(LaTeXFeatures & features) const
+bool MathNestInset::match(MathInset * p) const
 {
+       if (nargs() != p->nargs())
+               return false;
        for (idx_type i = 0; i < nargs(); ++i)
-               cell(i).validate(features);
+               if (!cell(i).match(p->cell(i)))
+                       return false;
+       return true;
 }
 
 
-bool MathNestInset::covers(int x, int y) const
+void MathNestInset::replace(ReplaceData & rep)
 {
-       if (!nargs())
-               return false;
-       int x0 = xcell(0).xo();
-       int y0 = xcell(0).yo() - xcell(0).ascent();
-       int x1 = xcell(0).xo() + xcell(0).width();
-       int y1 = xcell(0).yo() + xcell(0).descent();
-       for (idx_type i = 1; i < nargs(); ++i) {
-               x0 = std::min(x0, xcell(i).xo());
-               y0 = std::min(y0, xcell(i).yo() - xcell(i).ascent());
-               x1 = std::max(x1, xcell(i).xo() + xcell(i).width());
-               y1 = std::max(y1, xcell(i).yo() + xcell(i).descent());
-       }
-       return x >= x0 && x <= x1 && y >= y0 && y <= y1;
+       for (idx_type i = 0; i < nargs(); ++i)
+               cell(i).replace(rep);
 }