From ca7b18a5dbef0b7c4fd49bf4f5c3d9a02ac1f46c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 3 Aug 2009 10:30:34 +0000 Subject: [PATCH] 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 --- src/mathed/InsetMathHull.cpp | 7 +------ src/mathed/InsetMathNest.cpp | 11 +++++++++++ src/mathed/InsetMathNest.h | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index be89a71a67..f632b80288 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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]) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 99bfc5f46a..484418ea4a 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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(); diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index 7b320e61c3..2607f5bbbb 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -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! -- 2.39.2