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(MathMacro const &)
128 bool MathInset::idxNext(int &, int &) const
134 bool MathInset::idxRight(int &, int &) const
140 bool MathInset::idxPrev(int &, int &) const
146 bool MathInset::idxLeft(int &, int &) const
152 bool MathInset::idxUp(int &, int &) const
158 bool MathInset::idxDown(int &, int &) const
164 bool MathInset::idxFirst(int &, int &) const
170 bool MathInset::idxLast(int &, int &) const
176 bool MathInset::idxHome(int &, int &) const
182 bool MathInset::idxEnd(int &, int &) const
188 void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
195 void MathInset::idxDeleteRange(int, int)
199 void MathInset::getXY(int & x, int & y) const
207 void MathInset::userSetSize(MathStyles sz)
211 flag = flag & ~LMPF_FIXED_SIZE;
216 void MathInset::writeNormal(std::ostream & os) const
222 void MathInset::dump() const
224 lyxerr << "---------------------------------------------\n";
225 write(lyxerr, false);
226 lyxerr << "\n---------------------------------------------\n";
230 void MathInset::push_back(unsigned char, MathTextCodes)
232 lyxerr << "can't push without a cell\n";
236 void MathInset::push_back(MathInset *)
238 lyxerr << "can't push without a cell\n";
242 bool MathInset::covers(int x, int y) const
244 //lyxerr << "cover? p: " << this << " x: " << x << " y: " << y
245 // << " xo_: " << xo_ << " yo_: " << yo_ << endl;
248 x <= xo_ + width() &&
249 y >= yo_ - ascent() &&
250 y <= yo_ + descent();
254 void MathInset::validate(LaTeXFeatures &) const
258 std::vector<int> MathInset::idxBetween(int from, int to) const
260 std::vector<int> res;
261 for (int i = from; i <= to; ++i)
267 void MathInset::metrics(MathStyles st) const
269 lyxerr << "MathInset::metrics() called directly!\n";
274 void MathInset::draw(Painter &, int, int) const
276 lyxerr << "MathInset::draw() called directly!\n";
280 void MathInset::write(std::ostream &, bool) const
282 lyxerr << "MathInset::write() called directly!\n";