X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_braceinset.C;h=614666d56efe84e74f253ef59ecded74bbd43e61;hb=d359dd8fca52c4f0100f7cf4bf636113c5c4e49f;hp=ff1c46965190bd05fe82307841e951a0d3ddad9c;hpb=1b787e207d68610c6c8a1b3e21fce15891e38bef;p=lyx.git diff --git a/src/mathed/math_braceinset.C b/src/mathed/math_braceinset.C index ff1c469651..614666d56e 100644 --- a/src/mathed/math_braceinset.C +++ b/src/mathed/math_braceinset.C @@ -8,6 +8,9 @@ #include "math_parser.h" #include "math_support.h" #include "math_mathmlstream.h" +#include "support/LOstream.h" + +using std::max; MathBraceInset::MathBraceInset() @@ -15,40 +18,53 @@ MathBraceInset::MathBraceInset() {} +MathBraceInset::MathBraceInset(MathArray const & ar) + : MathNestInset(1) +{ + cell(0) = ar; +} + + MathInset * MathBraceInset::clone() const -{ +{ return new MathBraceInset(*this); } -void MathBraceInset::write(MathWriteInfo & os) const +void MathBraceInset::metrics(MathMetricsInfo & mi) const { - os << '{' << cell(0) << '}'; + xcell(0).metrics(mi); + int a, d; + mathed_char_dim(mi.base.font, '{', a, d, wid_); + ascent_ = max(xcell(0).ascent(), a); + descent_ = max(xcell(0).descent(), a); + width_ = xcell(0).width() + 2 * wid_; } -void MathBraceInset::writeNormal(NormalStream & os) const +void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const { - os << "[block "; - cell(0).writeNormal(os); - os << "]"; + LyXFont font = pi.base.font; + font.setColor(LColor::latex); + drawChar(pi, font, x, y, '{'); + xcell(0).draw(pi, x + wid_, y); + drawChar(pi, font, x + width_ - wid_, y, '}'); } -void MathBraceInset::metrics(MathMetricsInfo const & mi) const +void MathBraceInset::write(WriteStream & os) const { - xcell(0).metrics(mi); - int a, d; - mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_); - ascent_ = std::max(xcell(0).ascent(), a); - descent_ = std::max(xcell(0).descent(), a); - width_ = xcell(0).width() + 2 * wid_; + os << '{' << cell(0) << '}'; } -void MathBraceInset::draw(Painter & pain, int x, int y) const -{ - drawChar(pain, LM_TC_TEX, mi_, x, y, '{'); - xcell(0).draw(pain, x + wid_, y); - drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}'); +void MathBraceInset::normalize(NormalStream & os) const +{ + os << "[block " << cell(0) << ']'; +} + + +void MathBraceInset::infoize(std::ostream & os) const +{ + os << "Nested Block: "; }