2002-02-14 12:38:02 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "math_biginset.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
#include "math_parser.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
|
|
|
|
|
|
|
|
MathBigInset::MathBigInset(string const & name, string const & delim)
|
|
|
|
: name_(name), delim_(delim)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathBigInset::clone() const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-02-14 12:38:02 +00:00
|
|
|
return new MathBigInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-18 16:32:52 +00:00
|
|
|
MathBigInset::size_type MathBigInset::size() const
|
2002-02-14 12:38:02 +00:00
|
|
|
{
|
|
|
|
return name_.size() - 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double MathBigInset::increase() const
|
|
|
|
{
|
|
|
|
switch (size()) {
|
|
|
|
case 1: return 0.2;
|
|
|
|
case 2: return 0.44;
|
|
|
|
case 3: return 0.7;
|
|
|
|
default: return 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-28 13:22:36 +00:00
|
|
|
Dimension MathBigInset::metrics(MetricsInfo & mi) const
|
2002-02-14 12:38:02 +00:00
|
|
|
{
|
2002-07-11 11:27:24 +00:00
|
|
|
double const h = mathed_char_ascent(mi.base.font, 'I');
|
|
|
|
double const f = increase();
|
2003-05-27 13:55:03 +00:00
|
|
|
dim_.wid = 6;
|
|
|
|
dim_.asc = int(h + f * h);
|
|
|
|
dim_.des = int(f * h);
|
2003-05-28 13:22:36 +00:00
|
|
|
return dim_;
|
2002-02-14 12:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathBigInset::draw(PainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(), delim_);
|
2002-02-14 12:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
os << '\\' << name_ << ' ' << delim_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::normalize(NormalStream & os) const
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
os << '[' << name_ << ' ' << delim_ << ']';
|
2002-02-14 12:38:02 +00:00
|
|
|
}
|