Try to implement properly recursive setBuffer. Normally, implmenting

for InsetMathNest and InsetMathHull is enough.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30847 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-08-03 10:30:34 +00:00
parent 9833b35aa5
commit ca7b18a5db
3 changed files with 14 additions and 6 deletions

View File

@ -211,12 +211,7 @@ 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);
}
InsetMathGrid::setBuffer(buffer);
for (size_t i = 0; i != label_.size(); ++i) {
if (label_[i])

View File

@ -100,6 +100,17 @@ InsetMathNest & InsetMathNest::operator=(InsetMathNest const & inset)
}
void InsetMathNest::setBuffer(Buffer & buffer)
{
InsetMath::setBuffer(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);
}
}
InsetMath::idx_type InsetMathNest::nargs() const
{
return cells_.size();

View File

@ -30,6 +30,8 @@ public:
explicit InsetMathNest(idx_type ncells);
///
virtual ~InsetMathNest() {}
///
void setBuffer(Buffer &);
/// the size is usually some sort of convex hull of the cells
/// hides inset::metrics() intentionally!