]> git.lyx.org Git - lyx.git/blob - src/mathed/math_funcinset.C
fix pullArg when pressing <Delete> at the end of an cell
[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, MathInsetTypes ot)
18         : MathInset(0, nm, ot)
19 {
20         lims_ = (GetType() == LM_OT_FUNCLIM);
21 }
22
23
24 MathInset * MathFuncInset::clone() const
25 {
26         return new MathFuncInset(*this);
27 }
28
29
30 void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
31 {
32         os << "\\" << name_ << ' ';
33 }
34
35
36 void MathFuncInset::WriteNormal(std::ostream & os) const
37 {
38         os << "[" << name_ << "] ";
39 }
40
41
42 void MathFuncInset::Metrics(MathStyles st, int, int) 
43 {
44         size_ = st;
45         if (name_.empty()) 
46                 mathed_char_dim(LM_TC_TEXTRM, size_, 'I', ascent_, descent_, width_);
47         else 
48                 mathed_string_dim(LM_TC_TEXTRM, size_, name_, ascent_, descent_, width_);
49 }
50
51
52 void MathFuncInset::draw(Painter & pain, int x, int y)
53
54         xo(x);
55         yo(y);
56         if (name_.empty()) 
57                 drawChar(pain, LM_TC_TEXTRM, size_, x, y, ' ');
58         else
59                 drawStr(pain, LM_TC_TEXTRM, size_, x, y, name_);
60 }