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_);
33 //lyxerr << "MathXArray::metrics(): '" << data_ << "'\n";
34 for (int pos = 0; pos < data_.size(); ++pos) {
35 MathInset const * p = data_.nextInset(pos);
37 int asc = p->ascent();
38 int des = p->descent();
40 ascent_ = max(ascent_, asc);
41 descent_ = max(descent_, des);
47 void MathXArray::draw(Painter & pain, int x, int y) const
53 pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
57 for (int pos = 0; pos < data_.size(); ++pos) {
58 MathInset const * p = data_.nextInset(pos);
65 int MathXArray::pos2x(int targetpos) const
68 targetpos = min(targetpos, data_.size());
69 for (int pos = 0; pos < targetpos; ++pos)
75 int MathXArray::x2pos(int targetx) const
80 for ( ; currx < targetx && pos < data_.size(); ++pos) {
84 if (abs(lastx - targetx) < abs(currx - targetx) && pos > 0)
90 int MathXArray::width(int pos) const
92 if (pos >= data_.size())
94 return data_.nextInset(pos)->width();
98 std::ostream & operator<<(std::ostream & os, MathXArray const & ar)