5 #include "math_nestinset.h"
9 MathNestInset::MathNestInset(idx_type nargs)
10 : MathDimInset(), cells_(nargs)
14 MathInset::idx_type MathNestInset::nargs() const
20 MathXArray & MathNestInset::xcell(idx_type i)
26 MathXArray const & MathNestInset::xcell(idx_type i) const
32 MathArray & MathNestInset::cell(idx_type i)
34 return cells_[i].data_;
38 MathArray const & MathNestInset::cell(idx_type i) const
40 return cells_[i].data_;
44 void MathNestInset::substitute(MathMacro const & m)
46 for (idx_type i = 0; i < nargs(); ++i)
47 cell(i).substitute(m);
51 void MathNestInset::metrics(MathMetricsInfo const & mi) const
53 for (idx_type i = 0; i < nargs(); ++i)
58 void MathNestInset::draw(Painter & pain, int x, int y) const
62 for (idx_type i = 0; i < nargs(); ++i)
63 xcell(i).draw(pain, x + xcell(i).xo(), y + xcell(i).yo());
67 bool MathNestInset::idxNext(idx_type & idx, pos_type & pos) const
69 if (idx + 1 >= nargs())
77 bool MathNestInset::idxRight(idx_type & idx, pos_type & pos) const
79 return idxNext(idx, pos);
83 bool MathNestInset::idxPrev(idx_type & idx, pos_type & pos) const
88 pos = cell(idx).size();
93 bool MathNestInset::idxLeft(idx_type & idx, pos_type & pos) const
95 return idxPrev(idx, pos);
99 bool MathNestInset::idxFirst(idx_type & i, pos_type & pos) const
109 bool MathNestInset::idxLast(idx_type & i, pos_type & pos) const
114 pos = cell(i).size();
119 bool MathNestInset::idxHome(idx_type & /* idx */, pos_type & pos) const
128 bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
130 pos_type n = cell(idx).size();
139 void MathNestInset::dump() const
141 MathWriteInfo os(lyxerr);
142 os << "---------------------------------------------\n";
145 for (idx_type i = 0; i < nargs(); ++i)
146 os << cell(i) << "\n";
147 os << "---------------------------------------------\n";
151 void MathNestInset::push_back(MathAtom const & t)
154 cells_.back().data_.push_back(t);
156 lyxerr << "can't push without a cell\n";
160 void MathNestInset::validate(LaTeXFeatures & features) const
162 for (idx_type i = 0; i < nargs(); ++i)
163 cell(i).validate(features);