2 * \file InsetMathBrace.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 "InsetMathBrace.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
18 #include "MetricsInfo.h"
20 #include "frontends/FontMetrics.h"
21 #include "frontends/Painter.h"
28 InsetMathBrace::InsetMathBrace()
33 InsetMathBrace::InsetMathBrace(MathData const & ar)
40 Inset * InsetMathBrace::clone() const
42 return new InsetMathBrace(*this);
46 void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
49 cell(0).metrics(mi, dim0);
50 Dimension t = theFontMetrics(mi.base.font).dimension('{');
51 dim.asc = std::max(dim0.asc, t.asc);
52 dim.des = std::max(dim0.des, t.des);
53 dim.wid = dim0.width() + 2 * t.wid;
55 // Cache the inset dimension.
60 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
62 FontInfo font = pi.base.font;
63 font.setColor(Color_latex);
64 Dimension t = theFontMetrics(font).dimension('{');
65 pi.pain.text(x, y, '{', font);
66 cell(0).draw(pi, x + t.wid, y);
67 Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
68 pi.pain.text(x + t.wid + dim0.width(), y, '}', font);
69 drawMarkers(pi, x, y);
73 void InsetMathBrace::write(WriteStream & os) const
75 os << '{' << cell(0) << '}';
79 void InsetMathBrace::normalize(NormalStream & os) const
81 os << "[block " << cell(0) << ']';
85 void InsetMathBrace::maple(MapleStream & os) const
91 void InsetMathBrace::octave(OctaveStream & os) const
97 void InsetMathBrace::mathmlize(MathStream & os) const
99 os << MTag("mrow") << cell(0) << ETag("mrow");
103 void InsetMathBrace::mathematica(MathematicaStream & os) const
109 void InsetMathBrace::infoize(odocstream & os) const
111 os << "Nested Block: ";