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_);
31 math_font_max_dim(LM_TC_TEXTRM, LM_ST_TEXT, ascent_, descent_);
34 //lyxerr << "MathXArray::metrics(): '" << data_ << "'\n";
35 for (int pos = 0; pos < data_.size(); ++pos) {
36 MathInset const * p = data_.nextInset(pos);
38 int asc = p->ascent();
39 int des = p->descent();
41 ascent_ = max(ascent_, asc);
42 descent_ = max(descent_, des);
48 void MathXArray::draw(Painter & pain, int x, int y) const
54 pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
58 for (int pos = 0; pos < data_.size(); ++pos) {
59 MathInset const * p = data_.nextInset(pos);
66 int MathXArray::pos2x(int targetpos) const
69 targetpos = min(targetpos, data_.size());
70 for (int pos = 0; pos < targetpos; ++pos)
76 int MathXArray::x2pos(int targetx) const
81 for ( ; currx < targetx && pos < data_.size(); ++pos) {
85 if (abs(lastx - targetx) < abs(currx - targetx) && pos > 0)
91 int MathXArray::width(int pos) const
93 if (pos >= data_.size())
95 return data_.nextInset(pos)->width();
99 std::ostream & operator<<(std::ostream & os, MathXArray const & ar)