2001-12-18 03:16:46 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-11-12 16:45:09 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_casesinset.h"
|
|
|
|
#include "math_parser.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
|
|
|
|
|
|
|
|
MathCasesInset::MathCasesInset(row_type n)
|
|
|
|
: MathGridInset(2, n, 'c', "ll")
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathCasesInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathCasesInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathCasesInset::metrics(MathMetricsInfo & mi) const
|
2001-11-12 16:45:09 +00:00
|
|
|
{
|
|
|
|
MathGridInset::metrics(mi);
|
|
|
|
width_ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathCasesInset::draw(MathPainterInfo & pain, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-11-12 16:45:09 +00:00
|
|
|
mathed_draw_deco(pain, x + 1, y - ascent(), 6, height(), "{");
|
|
|
|
MathGridInset::draw(pain, x + 8, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::write(WriteStream & os) const
|
|
|
|
{
|
2001-12-03 16:24:50 +00:00
|
|
|
if (os.fragile())
|
2001-11-12 16:45:09 +00:00
|
|
|
os << "\\protect";
|
2002-03-19 16:55:58 +00:00
|
|
|
os << "\\begin{cases}\n";
|
2001-11-12 16:45:09 +00:00
|
|
|
MathGridInset::write(os);
|
2001-12-03 16:24:50 +00:00
|
|
|
if (os.fragile())
|
2001-11-12 16:45:09 +00:00
|
|
|
os << "\\protect";
|
2002-03-18 13:05:52 +00:00
|
|
|
os << "\\end{cases}";
|
2001-11-12 16:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << "[cases ";
|
|
|
|
MathGridInset::normalize(os);
|
|
|
|
os << "]";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::maplize(MapleStream & os) const
|
|
|
|
{
|
|
|
|
os << "cases(";
|
|
|
|
MathGridInset::maplize(os);
|
|
|
|
os << ")";
|
|
|
|
}
|
2002-07-08 16:20:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::infoize(std::ostream & os) const
|
|
|
|
{
|
|
|
|
os << "Cases ";
|
|
|
|
}
|