2002-02-14 12:38:02 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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;
|
|
|
|
}
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathBigInset::metrics(MathMetricsInfo & 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();
|
|
|
|
dim_.w = 6;
|
|
|
|
dim_.a = int(h + f * h);
|
|
|
|
dim_.d = int(f * h);
|
2002-02-14 12:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathBigInset::draw(MathPainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-07-11 11:27:24 +00:00
|
|
|
mathed_draw_deco(pi, x + 1, y - ascent(), 4, 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
|
|
|
}
|