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(false, true), lims_(0), 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) {
107 mathed_char_dim(t, size(), LM_int, asc, des, wid);
109 pain.arc(x - 1, y - (asc - des) / 2, wid, wid, 0, 360 * 64, LColor::mathline);
113 mathed_string_dim(t, size(), s, asc, des, wid);
117 pain.text(x + (w - wid)/2, y, s, mathed_get_font(t, size()));
119 (pain, x + (w - xcell(0).width())/2, y - asc - xcell(0).descent() - 1);
121 (pain, x + (w - xcell(1).width())/2, y + des + xcell(1).ascent() + 1);
123 pain.text(x, y, s, mathed_get_font(t, size()));
124 MathScriptInset::draw(pain, x + wid, y);
129 int MathBigopInset::limits() const
135 void MathBigopInset::limits(int limit)
140 bool MathBigopInset::hasLimits() const
142 return limits() == 1 || (limits() == 0 && size() == LM_ST_DISPLAY);
146 void MathBigopInset::idxDelete(int & idx, bool & popit, bool & deleteit)