2 * \file InsetMathMakebox.cpp
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 "InsetMathMakebox.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
18 #include "support/std_ostream.h"
23 InsetMathMakebox::InsetMathMakebox()
28 Inset * InsetMathMakebox::clone() const
30 return new InsetMathMakebox(*this);
34 void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
36 FontSetChanger dummy(mi.base, from_ascii("textnormal"));
37 w_ = mathed_char_width(mi.base.font, '[');
38 InsetMathNest::metrics(mi);
39 dim = cell(0).dimension(*mi.base.bv);
40 dim += cell(1).dimension(*mi.base.bv);
41 dim += cell(2).dimension(*mi.base.bv);
42 dim.wid += 4 * w_ + 4;
44 // Cache the inset dimension.
49 void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
51 FontSetChanger dummy(pi.base, from_ascii("textnormal"));
52 drawMarkers(pi, x, y);
54 drawStrBlack(pi, x, y, from_ascii("["));
56 cell(0).draw(pi, x, y);
57 x += cell(0).dimension(*pi.base.bv).width();
58 drawStrBlack(pi, x, y, from_ascii("]"));
61 drawStrBlack(pi, x, y, from_ascii("["));
63 cell(1).draw(pi, x, y);
64 x += cell(1).dimension(*pi.base.bv).wid;
65 drawStrBlack(pi, x, y, from_ascii("]"));
68 cell(2).draw(pi, x, y);
69 setPosCache(pi, x, y);
73 void InsetMathMakebox::write(WriteStream & os) const
76 os << '[' << cell(0) << ']';
78 os << '[' << cell(1) << ']';
79 os << '{' << cell(2) << '}';
83 void InsetMathMakebox::normalize(NormalStream & os) const
85 os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
89 void InsetMathMakebox::infoize(odocstream & os) const
91 os << "Makebox (width: " << cell(0)
92 << " pos: " << cell(1) << ")";