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