2001-02-13 13:28:32 +00:00
|
|
|
#include "math_bigopinset.h"
|
|
|
|
#include "Painter.h"
|
|
|
|
#include "mathed/support.h"
|
2001-02-14 15:00:50 +00:00
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
2001-07-12 07:18:29 +00:00
|
|
|
|
2001-02-14 15:00:50 +00:00
|
|
|
using std::ostream;
|
2001-02-13 13:28:32 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
MathBigopInset::MathBigopInset(string const & name, int id)
|
2001-07-26 06:46:50 +00:00
|
|
|
: sym_(id)
|
2001-06-27 14:10:35 +00:00
|
|
|
{
|
2001-07-26 06:56:43 +00:00
|
|
|
setName(name);
|
2001-06-27 14:10:35 +00:00
|
|
|
}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * MathBigopInset::clone() const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
return new MathBigopInset(*this);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathBigopInset::write(ostream & os, bool /* fragile */) const
|
2001-02-28 11:56:36 +00:00
|
|
|
{
|
2001-06-27 14:10:35 +00:00
|
|
|
//bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
|
2001-06-25 00:06:33 +00:00
|
|
|
os << '\\' << name();
|
2001-02-28 11:56:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathBigopInset::writeNormal(ostream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-07-12 07:18:29 +00:00
|
|
|
os << "[bigop " << name() << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|
|
|
|
|
2001-07-12 07:18:29 +00:00
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathBigopInset::metrics(MathStyles st)
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-07-12 07:18:29 +00:00
|
|
|
//cerr << "\nBigopDraw\n";
|
2001-06-25 00:06:33 +00:00
|
|
|
size(st);
|
2001-02-13 13:28:32 +00:00
|
|
|
|
2001-02-28 11:56:36 +00:00
|
|
|
if (sym_ < 256 || sym_ == LM_oint) {
|
2001-07-12 07:18:29 +00:00
|
|
|
ssym_ = string();
|
|
|
|
ssym_ += (sym_ == LM_oint) ? LM_int : sym_;
|
|
|
|
code_ = LM_TC_BSYM;
|
2001-02-13 13:28:32 +00:00
|
|
|
} else {
|
2001-07-12 07:18:29 +00:00
|
|
|
ssym_ = name();
|
|
|
|
code_ = LM_TC_TEXTRM;
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-07-26 06:46:50 +00:00
|
|
|
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
|
2001-06-25 00:06:33 +00:00
|
|
|
if (sym_ == LM_oint)
|
2001-07-26 06:46:50 +00:00
|
|
|
width_ += 2;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathBigopInset::draw(Painter & pain, int x, int y)
|
2001-07-12 07:18:29 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
xo(x);
|
|
|
|
yo(y);
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-07-26 06:46:50 +00:00
|
|
|
drawStr(pain, code_, size_, x, y, ssym_);
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-07-12 07:18:29 +00:00
|
|
|
if (sym_ == LM_oint) {
|
|
|
|
int xx = x - 1;
|
|
|
|
int yy = y - (ascent_ - descent_) / 2;
|
|
|
|
pain.arc(xx, yy, width_, width_, 0, 360 * 64, LColor::mathline);
|
2001-06-27 14:10:35 +00:00
|
|
|
}
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|