X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_binominset.C;h=cfdb835ca000c0dd9baaacba1e0777ae5042036b;hb=c649284611c4198c9d70be8a16d153cdf1ec0700;hp=7ffbd19fee98d040939ee7b049b66a9e3e49538e;hpb=40b2b89d4dbd9f948732741503574333ac7b7df7;p=lyx.git diff --git a/src/mathed/math_binominset.C b/src/mathed/math_binominset.C index 7ffbd19fee..cfdb835ca0 100644 --- a/src/mathed/math_binominset.C +++ b/src/mathed/math_binominset.C @@ -1,10 +1,16 @@ +#include + #ifdef __GNUG__ #pragma implementation #endif #include "math_binominset.h" -#include "support.h" +#include "math_support.h" #include "support/LOstream.h" +#include "math_mathmlstream.h" + + +using std::max; MathBinomInset::MathBinomInset() @@ -12,7 +18,7 @@ MathBinomInset::MathBinomInset() MathInset * MathBinomInset::clone() const -{ +{ return new MathBinomInset(*this); } @@ -28,41 +34,35 @@ int MathBinomInset::dw() const } -void MathBinomInset::metrics(MathMetricsInfo const & st) const +void MathBinomInset::metrics(MathMetricsInfo & mi) const { - MathMetricsInfo mi = st; - smallerStyleFrac(mi); + MathScriptChanger(mi.base); xcell(0).metrics(mi); xcell(1).metrics(mi); ascent_ = xcell(0).height() + 4 + 5; - descent_ = xcell(1).height() + 4 - 5; - width_ = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4; + descent_ = xcell(1).height() + 4 - 5; + width_ = max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4; } -void MathBinomInset::draw(Painter & pain, int x, int y) const +void MathBinomInset::draw(MathPainterInfo & pi, int x, int y) const { - xo(x); - yo(y); int m = x + width() / 2; - xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5); - xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5); - mathed_draw_deco(pain, x, y - ascent_, dw(), height(), "("); - mathed_draw_deco(pain, x + width() - dw(), y - ascent_, dw(), height(), ")"); + MathScriptChanger(pi.base); + xcell(0).draw(pi, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5); + xcell(1).draw(pi, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5); + mathed_draw_deco(pi, x, y - ascent_, dw(), height(), "("); + mathed_draw_deco(pi, x + width() - dw(), y - ascent_, dw(), height(), ")"); } -void MathBinomInset::write(MathWriteInfo & os) const +void MathBinomInset::write(WriteStream & os) const { os << '{' << cell(0) << " \\choose " << cell(1) << '}'; } -void MathBinomInset::writeNormal(std::ostream & os) const +void MathBinomInset::normalize(NormalStream & os) const { - os << "[binom "; - cell(0).writeNormal(os); - os << " "; - cell(1).writeNormal(os); - os << "] "; + os << "[binom " << cell(0) << ' ' << cell(1) << ']'; }