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()
30 : size_(LM_ST_DISPLAY), code_(LM_TC_MIN), xo_(0), yo_(0)
34 int MathInset::height() const
36 return ascent() + descent();
40 MathStyles MathInset::size() const
46 void MathInset::size(MathStyles s) const
52 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
54 inset.write(os, false);
59 int MathInset::xo() const
65 int MathInset::yo() const
71 void MathInset::xo(int x) const
77 void MathInset::yo(int y) const
83 int MathInset::nargs() const
91 MathXArray & MathInset::xcell(int)
93 lyxerr << "I don't have a cell\n";
98 MathXArray const & MathInset::xcell(int) const
100 lyxerr << "I don't have a cell\n";
105 MathArray & MathInset::cell(int)
107 lyxerr << "I don't have a cell\n";
108 return dummyCell.data_;
112 MathArray const & MathInset::cell(int) const
114 lyxerr << "I don't have a cell\n";
115 return dummyCell.data_;
119 void MathInset::substitute(MathArray & array, MathMacro const &) const
121 array.push_back(clone());
125 bool MathInset::idxNext(int &, int &) const
131 bool MathInset::idxRight(int &, int &) const
137 bool MathInset::idxPrev(int &, int &) const
143 bool MathInset::idxLeft(int &, int &) const
149 bool MathInset::idxUp(int &, int &) const
155 bool MathInset::idxDown(int &, int &) const
161 bool MathInset::idxFirst(int &, int &) const
167 bool MathInset::idxLast(int &, int &) const
173 bool MathInset::idxHome(int &, int &) const
179 bool MathInset::idxEnd(int &, int &) const
185 bool MathInset::idxFirstUp(int &, int &) const
191 bool MathInset::idxFirstDown(int &, int &) const
197 void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
204 void MathInset::idxDeleteRange(int, int)
208 bool MathInset::idxLastUp(int &, int &) const
214 bool MathInset::idxLastDown(int &, int &) const
220 void MathInset::getXY(int & x, int & y) const
228 void MathInset::userSetSize(MathStyles sz)
232 flag = flag & ~LMPF_FIXED_SIZE;
237 void MathInset::writeNormal(std::ostream & os) const
243 void MathInset::dump() const
245 lyxerr << "---------------------------------------------\n";
246 write(lyxerr, false);
247 lyxerr << "\n---------------------------------------------\n";
251 void MathInset::push_back(unsigned char, MathTextCodes)
253 lyxerr << "can't push without a cell\n";
257 void MathInset::push_back(MathInset *)
259 lyxerr << "can't push without a cell\n";
263 bool MathInset::covers(int x, int y) const
267 x <= xo_ + width() &&
268 y >= yo_ - ascent() &&
269 y <= yo_ + descent();
273 void MathInset::validate(LaTeXFeatures &) const
277 std::vector<int> MathInset::idxBetween(int from, int to) const
279 std::vector<int> res;
280 for (int i = from; i <= to; ++i)
286 MathTextCodes MathInset::code() const
292 void MathInset::code(MathTextCodes t)
298 void MathInset::metrics(MathStyles st) const
300 lyxerr << "MathInset::metrics() called directly!\n";
305 void MathInset::draw(Painter &, int, int) const
307 lyxerr << "MathInset::draw() called directly!\n";
311 void MathInset::write(std::ostream &, bool) const
313 lyxerr << "MathInset::write() called directly!\n";