2001-12-18 03:16:46 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-11-12 16:45:09 +00:00
|
|
|
|
|
|
|
#include "math_casesinset.h"
|
|
|
|
#include "math_parser.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_support.h"
|
2002-07-08 16:55:42 +00:00
|
|
|
#include "support/LOstream.h"
|
2001-11-12 16:45:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
2002-07-11 11:27:24 +00:00
|
|
|
dim_.w += 8;
|
2001-11-12 16:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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);
|
2002-11-27 10:30:28 +00:00
|
|
|
os << ']';
|
2001-11-12 16:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::maplize(MapleStream & os) const
|
|
|
|
{
|
|
|
|
os << "cases(";
|
|
|
|
MathGridInset::maplize(os);
|
2002-11-27 10:30:28 +00:00
|
|
|
os << ')';
|
2001-11-12 16:45:09 +00:00
|
|
|
}
|
2002-07-08 16:20:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::infoize(std::ostream & os) const
|
|
|
|
{
|
|
|
|
os << "Cases ";
|
|
|
|
}
|