]> git.lyx.org Git - lyx.git/blob - src/mathed/math_funcinset.C
small cleanups
[lyx.git] / src / mathed / math_funcinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_funcinset.h"
6 #include "font.h"
7 #include "Painter.h"
8 #include "mathed/support.h"
9 #include "support/LOstream.h"
10
11
12 using std::ostream;
13
14 extern LyXFont WhichFont(short type, int size);
15
16
17 MathFuncInset::MathFuncInset(string const & nm)
18         : MathInset(0, nm)
19 {}
20
21
22 MathInset * MathFuncInset::clone() const
23 {
24         return new MathFuncInset(*this);
25 }
26
27
28 void MathFuncInset::write(std::ostream & os, bool /* fragile */) const
29 {
30         os << "\\" << name_ << ' ';
31 }
32
33
34 void MathFuncInset::writeNormal(std::ostream & os) const
35 {
36         os << "[" << name_ << "] ";
37 }
38
39
40 void MathFuncInset::metrics(MathStyles st) 
41 {
42         size_ = st;
43         if (name_.empty()) 
44                 mathed_char_dim(LM_TC_TEXTRM, size_, 'I', ascent_, descent_, width_);
45         else 
46                 mathed_string_dim(LM_TC_TEXTRM, size_, name_, ascent_, descent_, width_);
47 }
48
49
50 void MathFuncInset::draw(Painter & pain, int x, int y)
51
52         xo(x);
53         yo(y);
54         if (name_.empty()) 
55                 drawChar(pain, LM_TC_TEXTRM, size_, x, y, ' ');
56         else
57                 drawStr(pain, LM_TC_TEXTRM, size_, x, y, name_);
58 }