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