8 #include "math_inset.h"
9 #include "mathed/support.h"
10 #include "math_defs.h"
18 MathXArray::MathXArray()
19 : width_(0), ascent_(0), descent_(0), xo_(0), yo_(0), style_(LM_ST_TEXT)
23 void MathXArray::metrics(MathStyles st) const
26 mathed_char_dim(LM_TC_VAR, st, 'I', ascent_, descent_, width_);
35 //lyxerr << "MathXArray::metrics(): '" << data_ << "'\n";
36 for (int pos = 0; pos < data_.size(); ++pos) {
37 MathInset const * p = data_.nextInset(pos);
39 int asc = p->ascent();
40 int des = p->descent();
42 ascent_ = max(ascent_, asc);
43 descent_ = max(descent_, des);
49 void MathXArray::draw(Painter & pain, int x, int y) const
55 pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
59 for (int pos = 0; pos < data_.size(); ++pos) {
60 MathInset const * p = data_.nextInset(pos);
67 int MathXArray::pos2x(int targetpos) const
70 targetpos = min(targetpos, data_.size());
71 for (int pos = 0; pos < targetpos; ++pos)
77 int MathXArray::x2pos(int targetx) const
82 for ( ; currx < targetx && pos < data_.size(); ++pos) {
86 if (abs(lastx - targetx) < abs(currx - targetx) && pos > 0)
92 int MathXArray::width(int pos) const
94 if (pos >= data_.size())
96 return data_.nextInset(pos)->width();
100 std::ostream & operator<<(std::ostream & os, MathXArray const & ar)