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"
26 InsetMathMakebox::InsetMathMakebox()
31 auto_ptr<Inset> InsetMathMakebox::doClone() const
33 return auto_ptr<Inset>(new InsetMathMakebox(*this));
37 bool InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
39 FontSetChanger dummy(mi.base, from_ascii("textnormal"));
40 w_ = mathed_char_width(mi.base.font, '[');
41 InsetMathNest::metrics(mi);
45 dim.wid += 4 * w_ + 4;
54 void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
56 FontSetChanger dummy(pi.base, from_ascii("textnormal"));
57 drawMarkers(pi, x, y);
59 drawStrBlack(pi, x, y, from_ascii("["));
61 cell(0).draw(pi, x, y);
63 drawStrBlack(pi, x, y, from_ascii("]"));
66 drawStrBlack(pi, x, y, from_ascii("["));
68 cell(1).draw(pi, x, y);
70 drawStrBlack(pi, x, y, from_ascii("]"));
73 cell(2).draw(pi, x, y);
74 setPosCache(pi, x, y);
78 void InsetMathMakebox::write(WriteStream & os) const
81 os << '[' << cell(0) << ']';
83 os << '[' << cell(1) << ']';
84 os << '{' << cell(2) << '}';
88 void InsetMathMakebox::normalize(NormalStream & os) const
90 os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
94 void InsetMathMakebox::infoize(odocstream & os) const
96 os << "Makebox (width: " << cell(0)
97 << " pos: " << cell(1) << ")";