7 #include "math_spaceinset.h"
10 #include "mathed/support.h"
11 #include "support/LOstream.h"
14 MathSpaceInset::MathSpaceInset(int sp, MathInsetTypes ot)
15 : MathInset("", ot), space_(sp)
19 MathInset * MathSpaceInset::clone() const
21 return new MathSpaceInset(*this);
25 void MathSpaceInset::draw(Painter & pain, int x, int y)
28 // XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
30 // Sadly, HP-UX CC can't handle that kind of initialization.
35 xp[0] = ++x; yp[0] = y - 3;
37 xp[2] = x + width_ - 2; yp[2] = y;
38 xp[3] = x + width_ - 2; yp[3] = y - 3;
40 pain.lines(xp, yp, 4, (space_) ? LColor::latex : LColor::math);
44 void MathSpaceInset::Write(std::ostream & os, bool /* fragile */) const
46 if (space_ >= 0 && space_ < 6) {
47 os << '\\' << latex_mathspace[space_] << ' ';
52 void MathSpaceInset::WriteNormal(std::ostream & os) const
54 os << "[space " << space_ << "] ";
58 void MathSpaceInset::Metrics(MathStyles st)
61 width_ = space_ ? space_ * 2 : 2;
72 void MathSpaceInset::SetSpace(int sp)
79 int MathSpaceInset::GetSpace()