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"
|
2003-03-06 08:10:50 +00:00
|
|
|
#include "LaTeXFeatures.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")
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-06-16 11:49:38 +00:00
|
|
|
InsetBase * MathCasesInset::clone() const
|
2001-11-12 16:45:09 +00:00
|
|
|
{
|
|
|
|
return new MathCasesInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-11-12 16:45:09 +00:00
|
|
|
{
|
|
|
|
MathGridInset::metrics(mi);
|
2003-05-27 13:55:03 +00:00
|
|
|
dim_.wid += 8;
|
2003-06-02 10:03:27 +00:00
|
|
|
dim = dim_;
|
2001-11-12 16:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathCasesInset::draw(PainterInfo & pain, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
mathed_draw_deco(pain, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
|
2001-11-12 16:45:09 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
void MathCasesInset::maple(MapleStream & os) const
|
2001-11-12 16:45:09 +00:00
|
|
|
{
|
|
|
|
os << "cases(";
|
2003-02-14 14:30:09 +00:00
|
|
|
MathGridInset::maple(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 ";
|
|
|
|
}
|
2003-03-06 08:10:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathCasesInset::validate(LaTeXFeatures & features) const
|
|
|
|
{
|
|
|
|
features.require("amsmath");
|
|
|
|
MathGridInset::validate(features);
|
|
|
|
}
|