3 * Purpose: Implementation of insets for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
19 #pragma implementation
22 #include "math_inset.h"
26 int MathInset::workwidth;
29 MathInset::MathInset(string const & name)
30 : name_(name), width_(0), ascent_(0), descent_(0),
31 size_(LM_ST_DISPLAY), code_(LM_TC_MIN), xo_(0), yo_(0)
35 int MathInset::ascent() const
41 int MathInset::descent() const
47 int MathInset::width() const
53 int MathInset::height() const
55 return ascent_ + descent_;
59 string const & MathInset::name() const
65 void MathInset::setName(string const & n)
71 MathStyles MathInset::size() const
77 void MathInset::size(MathStyles s)
83 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
85 inset.write(os, false);
90 int MathInset::xo() const
96 int MathInset::yo() const
102 void MathInset::xo(int x)
108 void MathInset::yo(int y)
114 int MathInset::nargs() const
120 MathXArray dummyCell;
122 MathXArray & MathInset::xcell(int)
124 lyxerr << "I don't have a cell\n";
129 MathXArray const & MathInset::xcell(int) const
131 lyxerr << "I don't have a cell\n";
136 MathArray & MathInset::cell(int)
138 lyxerr << "I don't have a cell\n";
139 return dummyCell.data_;
143 MathArray const & MathInset::cell(int) const
145 lyxerr << "I don't have a cell\n";
146 return dummyCell.data_;
150 void MathInset::substitute(MathArray & array, MathMacro const &) const
152 array.push_back(clone());
156 bool MathInset::idxNext(int &, int &) const
162 bool MathInset::idxRight(int &, int &) const
168 bool MathInset::idxPrev(int &, int &) const
174 bool MathInset::idxLeft(int &, int &) const
180 bool MathInset::idxUp(int &, int &) const
186 bool MathInset::idxDown(int &, int &) const
192 bool MathInset::idxFirst(int &, int &) const
198 bool MathInset::idxLast(int &, int &) const
204 bool MathInset::idxHome(int &, int &) const
210 bool MathInset::idxEnd(int &, int &) const
216 bool MathInset::idxFirstUp(int &, int &) const
222 bool MathInset::idxFirstDown(int &, int &) const
228 void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
235 void MathInset::idxDeleteRange(int, int)
239 bool MathInset::idxLastUp(int &, int &) const
245 bool MathInset::idxLastDown(int &, int &) const
251 void MathInset::getXY(int & x, int & y) const
259 void MathInset::userSetSize(MathStyles sz)
263 flag = flag & ~LMPF_FIXED_SIZE;
268 void MathInset::writeNormal(std::ostream & os) const
270 os << "[" << name_ << "] ";
274 void MathInset::dump() const
276 lyxerr << "---------------------------------------------\n";
277 write(lyxerr, false);
278 lyxerr << "\n---------------------------------------------\n";
282 void MathInset::push_back(unsigned char, MathTextCodes)
284 lyxerr << "can't push without a cell\n";
288 void MathInset::push_back(MathInset * p)
290 lyxerr << "can't push without a cell\n";
294 bool MathInset::covers(int x, int y) const
299 y >= yo_ - ascent_ &&
304 void MathInset::validate(LaTeXFeatures &) const
308 std::vector<int> MathInset::idxBetween(int from, int to) const
310 std::vector<int> res;
311 for (int i = from; i <= to; ++i)
317 MathTextCodes MathInset::code() const
323 void MathInset::code(MathTextCodes t)