]> git.lyx.org Git - lyx.git/blob - src/mathed/math_sizeinset.C
fix pullArg when pressing <Delete> at the end of an cell
[lyx.git] / src / mathed / math_sizeinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_sizeinset.h"
6 #include "support/LOstream.h"
7
8
9 MathSizeInset::MathSizeInset(MathStyles st)
10         : MathInset(1), style_(st)
11 {
12         name_ = verbose();
13 }
14
15
16 char const * MathSizeInset::verbose() const
17 {
18         switch (style_) {
19                 case LM_ST_DISPLAY:
20                         return "displaystyle";
21                 case LM_ST_TEXT:
22                         return "textstyle";
23                 case LM_ST_SCRIPT:
24                         return "scriptstyle";
25                 case LM_ST_SCRIPTSCRIPT:
26                         return "scriptscriptstyle";
27         }
28         return "unknownstyle";
29 }
30
31
32 MathInset * MathSizeInset::clone() const
33 {
34         return new MathSizeInset(*this);
35 }
36
37
38 void MathSizeInset::draw(Painter & pain, int x, int y)
39 {
40         xo(x);
41         yo(y);
42         xcell(0).draw(pain, x, y);
43 }
44
45
46 void MathSizeInset::Metrics(MathStyles /* st */, int, int)
47 {
48         xcell(0).Metrics(style_);
49         ascent_   = xcell(0).ascent_;
50         descent_  = xcell(0).descent_;
51         width_    = xcell(0).width_;
52 }
53
54
55 void MathSizeInset::Write(std::ostream & os, bool fragile) const
56 {
57         os << "{\\" << name() << " ";
58         cell(0).Write(os, fragile);
59         os << "}";
60 }
61
62
63 void MathSizeInset::WriteNormal(std::ostream & os) const
64 {
65         os << "[" << name() << " ";
66         cell(0).WriteNormal(os);
67         os << "]";
68 }