-int MathInset::workwidth;
-
-
-MathInset::MathInset(int nargs, string const & name)
- : name_(name), width_(0), ascent_(0), descent_(0),
- size_(LM_ST_DISPLAY), code_(LM_TC_MIN), cells_(nargs), xo_(0), yo_(0)
-{}
-
-
-int MathInset::ascent() const
-{
- return ascent_;
-}
-
-
-int MathInset::descent() const
-{
- return descent_;
-}
-
-
-int MathInset::width() const
-{
- return width_;
-}
-
-
-int MathInset::height() const
-{
- return ascent_ + descent_;
-}
-
-
-string const & MathInset::name() const
-{
- return name_;
-}
-
-
-void MathInset::setName(string const & n)
-{
- name_ = n;
-}
-
-
-MathStyles MathInset::size() const
-{
- return size_;
-}
-
-
-void MathInset::size(MathStyles s)
-{
- size_ = s;
-}
-
-
-std::ostream & operator<<(std::ostream & os, MathInset const & inset)
-{
- inset.write(os, false);
- return os;
-}
-
-
-int MathInset::xo() const
-{
- return xo_;
-}
-
-
-int MathInset::yo() const
-{
- return yo_;
-}
-
-
-void MathInset::xo(int x)
-{
- xo_ = x;
-}
-
-
-void MathInset::yo(int y)
-{
- yo_ = y;
-}
-
-
-int MathInset::nargs() const
-{
- return cells_.size();
-}
-
-
-MathXArray & MathInset::xcell(int i)
-{
- return cells_[i];
-}
-
-
-MathXArray const & MathInset::xcell(int i) const
-{
- return cells_[i];
-}
-
-
-MathArray & MathInset::cell(int i)
-{
- return cells_[i].data_;
-}
-
-
-MathArray const & MathInset::cell(int i) const
-{
- return cells_[i].data_;
-}
-
-
-void MathInset::substitute(MathArray & array, MathMacro const & m) const
-{
- MathInset * p = clone();
- for (int i = 0; i < nargs(); ++i)
- p->cell(i).substitute(m);
- array.push_back(p);
-}
-
-
-void MathInset::metrics(MathStyles st)
-{
- size_ = st;
- for (int i = 0; i < nargs(); ++i)
- xcell(i).metrics(st);
-}
-
-
-void MathInset::draw(Painter & pain, int x, int y)
-{
- xo_ = x;
- yo_ = y;
- for (int i = 0; i < nargs(); ++i)
- xcell(i).draw(pain, x + xcell(i).xo(), y + xcell(i).yo());
-}
-
-
-bool MathInset::idxNext(int & idx, int & pos) const
-{
- if (idx + 1 >= nargs())
- return false;
- ++idx;
- pos = 0;
- return true;
-}
-
-
-bool MathInset::idxRight(int & idx, int & pos) const
-{
- return idxNext(idx, pos);
-}
-
-
-bool MathInset::idxPrev(int & idx, int & pos) const
-{
- if (idx == 0)
- return false;
- --idx;
- pos = cell(idx).size();
- return true;
-}
-
-
-bool MathInset::idxLeft(int & idx, int & pos) const
-{
- return idxPrev(idx, pos);
-}
-
-
-bool MathInset::idxUp(int &, int &) const
-{
- return false;
-}
-
-
-bool MathInset::idxDown(int &, int &) const
-{
- return false;
-}
-
-
-bool MathInset::idxFirst(int & i, int & pos) const
-{
- if (nargs() == 0)
- return false;
- i = 0;
- pos = 0;
- return true;
-}