]> git.lyx.org Git - lyx.git/blob - src/mathed/math_bigopinset.C
iterators for MathArray; cosmetics;
[lyx.git] / src / mathed / math_bigopinset.C
1 #include "math_bigopinset.h"
2 #include "mathed/math_parser.h"
3 #include "support/LOstream.h"
4
5
6 using std::ostream;
7
8 MathBigopInset::MathBigopInset(const latexkeys * l)
9         : sym_(l)
10 {}
11
12
13 MathInset * MathBigopInset::clone() const
14 {
15         return new MathBigopInset(*this);
16 }
17
18
19 void MathBigopInset::write(ostream & os, bool /* fragile */) const
20 {
21         os << '\\' << sym_->name << ' ';
22 }
23
24
25 void MathBigopInset::writeNormal(ostream & os) const
26 {
27         os << "[bigop " << sym_->name << "] ";
28 }
29
30
31 void MathBigopInset::metrics(MathStyles st) const
32 {
33         size_ = st;
34         
35         if (sym_->id > 0 && sym_->id < 256) {
36                 ssym_ = string();
37                 ssym_ += sym_->id;
38                 code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB;
39         } else {
40                 ssym_ = sym_->name;
41                 code_ = LM_TC_TEXTRM;
42         }
43
44         mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
45 }
46
47
48 void MathBigopInset::draw(Painter & pain, int x, int y) const
49 {  
50         xo(x);
51         yo(y);
52
53         drawStr(pain, code_, size_, x, y, ssym_);
54 }