2001-10-29 15:45:24 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "math_braceinset.h"
|
|
|
|
#include "math_parser.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2002-07-09 14:00:59 +00:00
|
|
|
#include "support/LOstream.h"
|
2001-10-29 15:45:24 +00:00
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
using std::max;
|
|
|
|
|
|
|
|
|
2001-10-29 15:45:24 +00:00
|
|
|
MathBraceInset::MathBraceInset()
|
|
|
|
: MathNestInset(1)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-07-11 07:56:14 +00:00
|
|
|
MathBraceInset::MathBraceInset(MathArray const & ar)
|
|
|
|
: MathNestInset(1)
|
|
|
|
{
|
|
|
|
cell(0) = ar;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-29 15:45:24 +00:00
|
|
|
MathInset * MathBraceInset::clone() const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-10-29 15:45:24 +00:00
|
|
|
return new MathBraceInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathBraceInset::metrics(MathMetricsInfo & mi) const
|
2001-10-29 15:45:24 +00:00
|
|
|
{
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).metrics(mi);
|
2002-07-11 11:27:24 +00:00
|
|
|
Dimension t;
|
|
|
|
mathed_char_dim(mi.base.font, '{', t);
|
|
|
|
wid_ = t.w;
|
2002-08-02 14:29:42 +00:00
|
|
|
dim_.a = max(cell(0).ascent(), t.a);
|
|
|
|
dim_.d = max(cell(0).descent(), t.a);
|
|
|
|
dim_.w = cell(0).width() + 2 * wid_;
|
2001-10-29 15:45:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
LyXFont font = pi.base.font;
|
|
|
|
font.setColor(LColor::latex);
|
|
|
|
drawChar(pi, font, x, y, '{');
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).draw(pi, x + wid_, y);
|
2002-07-11 11:27:24 +00:00
|
|
|
drawChar(pi, font, x + width() - wid_, y, '}');
|
2001-10-29 15:45:24 +00:00
|
|
|
}
|
2001-11-09 08:35:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
os << '{' << cell(0) << '}';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << "[block " << cell(0) << ']';
|
|
|
|
}
|
2002-07-09 13:38:27 +00:00
|
|
|
|
|
|
|
|
2002-07-30 17:51:19 +00:00
|
|
|
void MathBraceInset::maplize(MapleStream & os) const
|
|
|
|
{
|
|
|
|
os << cell(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::octavize(OctaveStream & os) const
|
|
|
|
{
|
|
|
|
os << cell(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::mathmlize(MathMLStream & os) const
|
|
|
|
{
|
|
|
|
os << MTag("mrow") << cell(0) << ETag("mrow");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::mathematicize(MathematicaStream & os) const
|
|
|
|
{
|
|
|
|
os << cell(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-09 13:38:27 +00:00
|
|
|
void MathBraceInset::infoize(std::ostream & os) const
|
|
|
|
{
|
|
|
|
os << "Nested Block: ";
|
|
|
|
}
|