5 #include "math_spaceinset.h"
6 #include "math_support.h"
9 #include "math_mathmlstream.h"
12 char const * latex_mathspace[] = {
13 "!", ",", ":", ";", "quad", "qquad", "lyxnegspace"
18 MathSpaceInset::MathSpaceInset(int sp)
23 MathInset * MathSpaceInset::clone() const
25 return new MathSpaceInset(*this);
29 void MathSpaceInset::metrics(MathMetricsInfo const &) const
32 case 0: width_ = 6; break;
33 case 1: width_ = 6; break;
34 case 2: width_ = 8; break;
35 case 3: width_ = 10; break;
36 case 4: width_ = 20; break;
37 case 5: width_ = 40; break;
38 case 6: width_ = -2; break;
39 default: width_ = 6; break;
46 void MathSpaceInset::draw(Painter & pain, int x, int y) const
49 // Sadly, HP-UX CC can't handle that kind of initialization.
50 // XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
57 xp[0] = ++x; yp[0] = y - 3;
59 xp[2] = x + width_ - 2; yp[2] = y;
60 xp[3] = x + width_ - 2; yp[3] = y - 3;
62 pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
66 void MathSpaceInset::incSpace()
68 space_ = (space_ + 1) % 6;
72 void MathSpaceInset::maplize(MapleStream & os) const
78 void MathSpaceInset::octavize(OctaveStream & os) const
84 void MathSpaceInset::normalize(NormalStream & os) const
86 os << "[space " << space_ << "] ";
90 void MathSpaceInset::write(WriteStream & os) const
92 if (space_ >= 0 && space_ < 7)
93 os << '\\' << latex_mathspace[space_] << ' ';