]> git.lyx.org Git - lyx.git/blob - src/mathed/math_scopeinset.C
Added new FINISED states FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN.
[lyx.git] / src / mathed / math_scopeinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_scopeinset.h"
6 #include "LColor.h"
7 #include "Painter.h"
8 #include "support.h"
9 #include "support/LOstream.h"
10
11
12 MathScopeInset::MathScopeInset()
13         : MathNestInset(1)
14 {}
15
16
17 MathInset * MathScopeInset::clone() const
18 {   
19         return new MathScopeInset(*this);
20 }
21
22
23 void MathScopeInset::metrics(MathStyles st) const
24 {
25         xcell(0).metrics(st);
26         size_    = st;
27         ascent_  = xcell(0).ascent();
28         descent_ = xcell(0).descent();
29         width_   = xcell(0).width() + mathed_string_width(LM_TC_TEX, st, "{}");
30 }
31
32
33 void MathScopeInset::draw(Painter & pain, int x, int y) const
34
35         xo(x);
36         yo(y);
37         int d = mathed_char_width(LM_TC_TEX, size_, '{');
38         drawChar(pain, LM_TC_TEX, size_, x, y, '{');
39         xcell(0).draw(pain, x + d, y); 
40         drawChar(pain, LM_TC_TEX, size_, x + width_ - d, y, '}');
41         //pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
42 }
43
44
45 void MathScopeInset::write(std::ostream & os, bool fragile) const
46 {
47         os << '{';
48         cell(0).write(os, fragile); 
49         os << '}';
50 }
51
52
53 void MathScopeInset::writeNormal(std::ostream & os) const
54 {
55         os << "[scope ";
56         cell(0).writeNormal(os); 
57         os << "] ";
58 }