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"
23 #include "math_scriptinset.h"
27 int MathInset::workwidth;
30 MathInset::MathInset()
31 : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
35 MathInset::~MathInset()
39 int MathInset::height() const
41 return ascent() + descent();
45 MathStyles MathInset::size() const
51 void MathInset::size(MathStyles s) const
57 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
59 inset.write(os, false);
64 int MathInset::xo() const
70 int MathInset::yo() const
76 void MathInset::xo(int x) const
82 void MathInset::yo(int y) const
88 int MathInset::nargs() const
96 MathXArray & MathInset::xcell(int)
98 lyxerr << "I don't have a cell\n";
103 MathXArray const & MathInset::xcell(int) const
105 lyxerr << "I don't have a cell\n";
110 MathArray & MathInset::cell(int)
112 lyxerr << "I don't have a cell\n";
113 return dummyCell.data_;
117 MathArray const & MathInset::cell(int) const
119 lyxerr << "I don't have a cell\n";
120 return dummyCell.data_;
124 void MathInset::substitute(MathArray & array, MathMacro const &) const
126 array.push_back(clone());
130 bool MathInset::idxNext(int &, int &) const
136 bool MathInset::idxRight(int &, int &) const
142 bool MathInset::idxPrev(int &, int &) const
148 bool MathInset::idxLeft(int &, int &) const
154 bool MathInset::idxUp(int &, int &) const
160 bool MathInset::idxDown(int &, int &) const
166 bool MathInset::idxFirst(int &, int &) const
172 bool MathInset::idxLast(int &, int &) const
178 bool MathInset::idxHome(int &, int &) const
184 bool MathInset::idxEnd(int &, int &) const
190 bool MathInset::idxFirstUp(int &, int &) const
196 bool MathInset::idxFirstDown(int &, int &) const
202 void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
209 void MathInset::idxDeleteRange(int, int)
213 bool MathInset::idxLastUp(int &, int &) const
219 bool MathInset::idxLastDown(int &, int &) const
225 void MathInset::getXY(int & x, int & y) const
233 void MathInset::userSetSize(MathStyles sz)
237 flag = flag & ~LMPF_FIXED_SIZE;
242 void MathInset::writeNormal(std::ostream & os) const
248 void MathInset::dump() const
250 lyxerr << "---------------------------------------------\n";
251 write(lyxerr, false);
252 lyxerr << "\n---------------------------------------------\n";
256 void MathInset::push_back(unsigned char, MathTextCodes)
258 lyxerr << "can't push without a cell\n";
262 void MathInset::push_back(MathInset *)
264 lyxerr << "can't push without a cell\n";
268 bool MathInset::covers(int x, int y) const
272 x <= xo_ + width() &&
273 y >= yo_ - ascent() &&
274 y <= yo_ + descent();
278 void MathInset::validate(LaTeXFeatures &) const
282 std::vector<int> MathInset::idxBetween(int from, int to) const
284 std::vector<int> res;
285 for (int i = from; i <= to; ++i)
291 void MathInset::metrics(MathStyles st) const
293 lyxerr << "MathInset::metrics() called directly!\n";
298 void MathInset::draw(Painter &, int, int) const
300 lyxerr << "MathInset::draw() called directly!\n";
304 void MathInset::write(std::ostream &, bool) const
306 lyxerr << "MathInset::write() called directly!\n";