]> git.lyx.org Git - features.git/blob - src/mathed/math_bigopinset.C
tiny
[features.git] / src / mathed / math_bigopinset.C
1 #include "math_bigopinset.h"
2 #include "Painter.h"
3 #include "mathed/support.h"
4 #include "support/LOstream.h"
5
6
7 using std::ostream;
8
9 MathBigopInset::MathBigopInset(string const & name, int id)
10         : MathInset(0, name), sym_(id)
11 {}
12
13
14 MathInset * MathBigopInset::clone() const
15 {
16         return new MathBigopInset(*this);
17 }
18
19
20 void MathBigopInset::write(ostream & os, bool /* fragile */) const
21 {
22         //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
23         os << '\\' << name();
24 }
25
26
27 void MathBigopInset::writeNormal(ostream & os) const
28 {
29         os << "[bigop " << name() << "] ";
30 }
31
32
33 void MathBigopInset::metrics(MathStyles st)
34 {
35         //cerr << "\nBigopDraw\n";
36         size(st);
37         
38         if (sym_ < 256 || sym_ == LM_oint) {
39                 ssym_ = string();
40                 ssym_ += (sym_ == LM_oint) ? LM_int : sym_;
41                 code_ = LM_TC_BSYM;
42         } else {
43                 ssym_ = name();
44                 code_ = LM_TC_TEXTRM;
45         }
46
47         mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
48         if (sym_ == LM_oint)
49                 width_ += 2;
50 }
51
52
53 void MathBigopInset::draw(Painter & pain, int x, int y)
54 {  
55         xo(x);
56         yo(y);
57
58         drawStr(pain, code_, size_, x, y, ssym_);
59
60         if (sym_ == LM_oint) {
61                 int xx = x - 1;
62                 int yy = y - (ascent_ - descent_) / 2;
63                 pain.arc(xx, yy, width_, width_, 0, 360 * 64, LColor::mathline);
64         }
65 }