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 bool 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);
42 dim.wid += 4 * w_ + 4;
51 void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
53 FontSetChanger dummy(pi.base, from_ascii("textnormal"));
54 drawMarkers(pi, x, y);
56 drawStrBlack(pi, x, y, from_ascii("["));
58 cell(0).draw(pi, x, y);
60 drawStrBlack(pi, x, y, from_ascii("]"));
63 drawStrBlack(pi, x, y, from_ascii("["));
65 cell(1).draw(pi, x, y);
67 drawStrBlack(pi, x, y, from_ascii("]"));
70 cell(2).draw(pi, x, y);
71 setPosCache(pi, x, y);
75 void InsetMathMakebox::write(WriteStream & os) const
78 os << '[' << cell(0) << ']';
80 os << '[' << cell(1) << ']';
81 os << '{' << cell(2) << '}';
85 void InsetMathMakebox::normalize(NormalStream & os) const
87 os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
91 void InsetMathMakebox::infoize(odocstream & os) const
93 os << "Makebox (width: " << cell(0)
94 << " pos: " << cell(1) << ")";