3 #include "math_bigopinset.h"
6 #include "mathed/support.h"
7 #include "support/LOstream.h"
11 MathBigopInset::MathBigopInset(string const & name, int id)
12 : MathScriptInset(true, false), lims_(-1), sym_(id)
18 MathInset * MathBigopInset::Clone() const
20 return new MathBigopInset(*this);
25 void MathBigopInset::Write(ostream & os, bool fragile) const
27 //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
31 else if (limits() == -1)
35 MathScriptInset::Write(os, fragile);
39 void MathBigopInset::WriteNormal(ostream & os) const
41 os << "[bigop " << name();
44 else if (limits() == -1)
48 MathScriptInset::WriteNormal(os);
52 void MathBigopInset::Metrics(MathStyles st)
54 MathScriptInset::Metrics(st);
59 if (sym_ < 256 || sym_ == LM_oint) {
60 char const c = (sym_ == LM_oint) ? LM_int : sym_;
69 mathed_string_dim(t, size(), s, asc, des, wid);
74 ascent_ = asc + xcell(0).height() + 2;
75 descent_ = des + xcell(1).height() + 2;
76 width_ = max(width_, wid);
78 ascent_ = max(ascent_, asc);
79 descent_ = max(descent_, des);
86 void MathBigopInset::draw(Painter & pain, int x, int y)
94 if (sym_ < 256 || sym_ == LM_oint) {
95 s += (sym_ == LM_oint) ? LM_int : sym_;
101 if (sym_ == LM_oint) {
102 pain.arc(x, y - 5 * width_ / 4, width_, width_, 0, 360 * 64,
108 mathed_string_dim(t, size(), s, asc, des, wid);
112 pain.text(x + (w - wid)/2, y, s, mathed_get_font(t, size()));
114 (pain, x + (w - xcell(0).width())/2, y - asc - xcell(0).descent() - 1);
116 (pain, x + (w - xcell(1).width())/2, y + des + xcell(1).ascent() + 1);
118 pain.text(x, y, s, mathed_get_font(t, size()));
119 MathScriptInset::draw(pain, x + wid, y);
124 int MathBigopInset::limits() const
130 void MathBigopInset::limits(int limit)
135 bool MathBigopInset::hasLimits() const
137 return limits() == 1 || (limits() == 0 && size() == LM_ST_DISPLAY);
141 bool MathBigopInset::idxDelete(int idx)
143 // ignore the return value, we do not want the inset to be deleted
144 MathScriptInset::idxDelete(idx);