2 * \file math_makeboxinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_makeboxinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_support.h"
18 #include "support/std_ostream.h"
23 MathMakeboxInset::MathMakeboxInset()
28 auto_ptr<InsetBase> MathMakeboxInset::doClone() const
30 return auto_ptr<InsetBase>(new MathMakeboxInset(*this));
34 void MathMakeboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
36 FontSetChanger dummy(mi.base, "textnormal");
37 w_ = mathed_char_width(mi.base.font, '[');
38 MathNestInset::metrics(mi);
42 dim.wid += 4 * w_ + 4;
48 void MathMakeboxInset::draw(PainterInfo & pi, int x, int y) const
50 FontSetChanger dummy(pi.base, "textnormal");
51 drawMarkers(pi, x, y);
53 drawStrBlack(pi, x, y, "[");
55 cell(0).draw(pi, x, y);
57 drawStrBlack(pi, x, y, "]");
60 drawStrBlack(pi, x, y, "[");
62 cell(1).draw(pi, x, y);
64 drawStrBlack(pi, x, y, "]");
67 cell(2).draw(pi, x, y);
68 setPosCache(pi, x, y);
72 void MathMakeboxInset::write(WriteStream & os) const
75 os << '[' << cell(0) << ']';
77 os << '[' << cell(1) << ']';
78 os << '{' << cell(2) << '}';
82 void MathMakeboxInset::normalize(NormalStream & os) const
84 os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
88 void MathMakeboxInset::infoize(std::ostream & os) const
90 os << "Makebox (width: " << cell(0)
91 << " pos: " << cell(1) << ")";