8 #include "math_inset.h"
9 #include "mathed/support.h"
10 #include "math_defs.h"
15 MathXArray::MathXArray()
16 : width_(0), ascent_(0), descent_(0), xo_(0), yo_(0), style_(LM_ST_TEXT)
20 void MathXArray::metrics(MathStyles st) const
23 mathed_char_dim(LM_TC_VAR, st, 'I', ascent_, descent_, width_);
28 math_font_max_dim(LM_TC_TEXTRM, LM_ST_TEXT, ascent_, descent_);
31 //lyxerr << "MathXArray::metrics(): '" << data_ << "'\n";
32 for (int pos = 0; pos < data_.size(); ++pos) {
33 MathAtom const * p = data_.at(pos);
35 ascent_ = std::max(ascent_, p->ascent());
36 descent_ = std::max(descent_, p->descent());
42 void MathXArray::draw(Painter & pain, int x, int y) const
48 pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
52 for (int pos = 0; pos < data_.size(); ++pos) {
53 MathAtom const * p = data_.at(pos);
60 int MathXArray::pos2x(int targetpos) const
63 targetpos = std::min(targetpos, data_.size());
64 for (int pos = 0; pos < targetpos; ++pos)
70 int MathXArray::x2pos(int targetx) const
75 for ( ; currx < targetx && pos < data_.size(); ++pos) {
79 if (abs(lastx - targetx) < abs(currx - targetx) && pos > 0)
85 int MathXArray::width(int pos) const
87 MathAtom const * t = data_.at(pos);
88 return t ? t->width() : 0;
92 std::ostream & operator<<(std::ostream & os, MathXArray const & ar)