3 #include "math_bigopinset.h"
6 #include "mathed/support.h"
7 #include "support/LOstream.h"
11 MathBigopInset::MathBigopInset(string const & nam, int id, short st)
12 : MathedInset(nam, LM_OT_BIGOP, st), lims_(-1), sym_(id)
16 MathedInset * MathBigopInset::Clone()
18 return new MathBigopInset(name, sym_, GetStyle());
22 void MathBigopInset::draw(Painter & pain, int x, int y)
27 if (sym_ < 256 || sym_ == LM_oint) {
28 s += (sym_ == LM_oint) ? LM_int : sym_;
34 if (sym_ == LM_oint) {
35 pain.arc(x, y - 5 * width / 4, width, width, 0, 360 * 64,
39 pain.text(x, y, s, mathed_get_font(t, size()));
43 void MathBigopInset::Write(ostream & os, bool /* fragile */)
45 bool const limp = GetLimits();
49 if (limp && !(sym_ != LM_int && sym_ != LM_oint
50 && (GetStyle() == LM_ST_DISPLAY)))
53 if (!limp && (sym_ != LM_int && sym_ != LM_oint
54 && (GetStyle() == LM_ST_DISPLAY)))
61 void MathBigopInset::WriteNormal(ostream & os)
63 bool const limp = GetLimits();
65 os << "[bigop " << name;
67 if (limp && !(sym_ != LM_int && sym_ != LM_oint
68 && (GetStyle() == LM_ST_DISPLAY)))
71 if (!limp && (sym_ != LM_int && sym_ != LM_oint
72 && (GetStyle() == LM_ST_DISPLAY)))
78 void MathBigopInset::Metrics()
84 if (sym_ < 256 || sym_ == LM_oint) {
85 char const c = (sym_ == LM_oint) ? LM_int: sym_;
92 mathed_string_height(t, size(), s, ascent, descent);
93 width = mathed_string_width(t, size(), s);
94 if (sym_ == LM_oint) width += 2;
98 bool MathBigopInset::GetLimits() const
102 return sym_ != LM_int &&
104 GetStyle() == LM_ST_DISPLAY;
112 void MathBigopInset::SetLimits(bool ls)