]> 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 54ef57e9b37c68f112d4bd1aad794f0f42033c95..6113621b43f1b8e583467055f433d5dc562c5775 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 
 #include "math_nestinset.h"
+#include "math_mathmlstream.h"
 #include "debug.h"
 
 
@@ -48,18 +49,15 @@ void MathNestInset::substitute(MathMacro const & m)
 }
 
 
-void MathNestInset::metrics(MathStyles st) const
+void MathNestInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
        for (idx_type i = 0; i < nargs(); ++i)
-               xcell(i).metrics(st);
+               xcell(i).metrics(mi);
 }
 
 
 void MathNestInset::draw(Painter & pain, int x, int y) const
 {
-       xo(x);
-       yo(y);
        for (idx_type i = 0; i < nargs(); ++i)
                xcell(i).draw(pain, x + xcell(i).xo(), y + xcell(i).yo());
 }
@@ -131,7 +129,6 @@ bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
        pos_type n = cell(idx).size();
        if (pos == n)
                return false;
-
        pos = n;
        return true;
 }
@@ -139,26 +136,36 @@ bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
 
 void MathNestInset::dump() const
 {
-       lyxerr << "---------------------------------------------\n";
-       write(lyxerr, false);
-       lyxerr << "\n";
+       WriteStream os(lyxerr);
+       os << "---------------------------------------------\n";
+       write(os);
+       os << "\n";
        for (idx_type i = 0; i < nargs(); ++i)
-               lyxerr << cell(i) << "\n";
-       lyxerr << "---------------------------------------------\n";
+               os << cell(i) << "\n";
+       os << "---------------------------------------------\n";
 }
 
 
-void MathNestInset::push_back(MathInset * p)
+void MathNestInset::validate(LaTeXFeatures & features) const
 {
-       if (nargs())
-               cells_.back().data_.push_back(p);
-       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;
+}
+
+
+void MathNestInset::replace(ReplaceData & rep)
+{
+       for (idx_type i = 0; i < nargs(); ++i)
+               cell(i).replace(rep);
 }