2001-10-29 15:45:24 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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"
|
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)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathBraceInset::clone() const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-10-29 15:45:24 +00:00
|
|
|
return new MathBraceInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::metrics(MathMetricsInfo const & mi) const
|
|
|
|
{
|
|
|
|
xcell(0).metrics(mi);
|
|
|
|
int a, d;
|
2002-03-19 16:55:58 +00:00
|
|
|
whichFont(font_, LM_TC_TEX, mi);
|
|
|
|
mathed_char_dim(font_, '{', a, d, wid_);
|
2002-02-16 15:59:55 +00:00
|
|
|
ascent_ = max(xcell(0).ascent(), a);
|
|
|
|
descent_ = max(xcell(0).descent(), a);
|
2001-10-29 15:45:24 +00:00
|
|
|
width_ = xcell(0).width() + 2 * wid_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBraceInset::draw(Painter & pain, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
drawChar(pain, font_, x, y, '{');
|
2001-10-29 15:45:24 +00:00
|
|
|
xcell(0).draw(pain, x + wid_, y);
|
2002-03-19 16:55:58 +00:00
|
|
|
drawChar(pain, 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) << ']';
|
|
|
|
}
|