5 #include "math_bigopinset.h"
8 #include "mathed/support.h"
9 #include "support/LOstream.h"
13 MathBigopInset::MathBigopInset(string const & name, int id)
14 : MathScriptInset(true, false), lims_(-1), sym_(id)
20 MathInset * MathBigopInset::clone() const
22 return new MathBigopInset(*this);
27 void MathBigopInset::Write(ostream & os, bool fragile) const
29 //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
33 else if (limits() == -1)
37 MathScriptInset::Write(os, fragile);
41 void MathBigopInset::WriteNormal(ostream & os) const
43 os << "[bigop " << name();
46 else if (limits() == -1)
50 MathScriptInset::WriteNormal(os);
54 void MathBigopInset::Metrics(MathStyles st)
56 MathScriptInset::Metrics(st);
61 if (sym_ < 256 || sym_ == LM_oint) {
62 char const c = (sym_ == LM_oint) ? LM_int : sym_;
71 mathed_string_dim(t, size(), s, asc, des, wid);
76 ascent_ = asc + xcell(0).height() + 2;
77 descent_ = des + xcell(1).height() + 2;
78 width_ = std::max(width_, wid);
80 ascent_ = std::max(ascent_, asc);
81 descent_ = std::max(descent_, des);
88 void MathBigopInset::draw(Painter & pain, int x, int y)
96 if (sym_ < 256 || sym_ == LM_oint) {
97 s += (sym_ == LM_oint) ? LM_int : sym_;
103 if (sym_ == LM_oint) {
104 pain.arc(x, y - 5 * width_ / 4, width_, width_, 0, 360 * 64,
110 mathed_string_dim(t, size(), s, asc, des, wid);
114 pain.text(x + (w - wid)/2, y, s, mathed_get_font(t, size()));
116 (pain, x + (w - xcell(0).width())/2, y - asc - xcell(0).descent() - 1);
118 (pain, x + (w - xcell(1).width())/2, y + des + xcell(1).ascent() + 1);
120 pain.text(x, y, s, mathed_get_font(t, size()));
121 MathScriptInset::draw(pain, x + wid, y);
126 int MathBigopInset::limits() const
132 void MathBigopInset::limits(int limit)
137 bool MathBigopInset::hasLimits() const
139 return limits() == 1 || (limits() == 0 && size() == LM_ST_DISPLAY);
143 bool MathBigopInset::idxDelete(int idx)
145 // ignore the return value, we do not want the inset to be deleted
146 MathScriptInset::idxDelete(idx);