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
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::metrics(MathMetricsInfo const & mi) const
|
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
LyXFont font;
|
|
|
|
whichFont(font, LM_TC_VAR, mi);
|
2002-03-20 07:30:32 +00:00
|
|
|
double h = mathed_char_ascent(font, 'I');
|
2002-02-14 12:38:02 +00:00
|
|
|
double f = increase();
|
|
|
|
width_ = 6;
|
|
|
|
ascent_ = int(h + f * h);
|
|
|
|
descent_ = int(f * h);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::draw(Painter & pain, int x, int y) const
|
|
|
|
{
|
|
|
|
mathed_draw_deco(pain, x + 1, y - ascent_, 4, height(), delim_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
os << '\\' << name_ << ' ' << delim_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigInset::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << "[" << name_ << ' ' << delim_ << ']';
|
|
|
|
}
|