lyx_mirror/src/mathed/math_scopeinset.C
André Pönitz 74124b4bf8 make {} a proper inset; simplifications to the parser;
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2489 a592a061-630c-0410-9148-cb99ea01b6c8
2001-08-10 15:32:26 +00:00

59 lines
1.1 KiB
C

#ifdef __GNUG__
#pragma implementation
#endif
#include "math_scopeinset.h"
#include "LColor.h"
#include "Painter.h"
#include "support.h"
#include "support/LOstream.h"
MathScopeInset::MathScopeInset()
: MathNestInset(1)
{}
MathInset * MathScopeInset::clone() const
{
return new MathScopeInset(*this);
}
void MathScopeInset::metrics(MathStyles st) const
{
xcell(0).metrics(st);
size_ = st;
ascent_ = xcell(0).ascent();
descent_ = xcell(0).descent();
width_ = xcell(0).width() + mathed_string_width(LM_TC_TEX, st, "{}");
}
void MathScopeInset::draw(Painter & pain, int x, int y) const
{
xo(x);
yo(y);
int d = mathed_char_width(LM_TC_TEX, size_, '{');
drawChar(pain, LM_TC_TEX, size_, x, y, '{');
xcell(0).draw(pain, x + d, y);
drawChar(pain, LM_TC_TEX, size_, x + width_ - d, y, '}');
//pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
}
void MathScopeInset::write(std::ostream & os, bool fragile) const
{
os << '{';
cell(0).write(os, fragile);
os << '}';
}
void MathScopeInset::writeNormal(std::ostream & os) const
{
os << "[scope ";
cell(0).writeNormal(os);
os << "] ";
}