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 MathInset::size_type MathInset::nargs() const
96 MathXArray & MathInset::xcell(idx_type)
98 lyxerr << "I don't have a cell\n";
103 MathXArray const & MathInset::xcell(idx_type) const
105 lyxerr << "I don't have a cell\n";
110 MathArray & MathInset::cell(idx_type)
112 lyxerr << "I don't have a cell\n";
113 return dummyCell.data_;
117 MathArray const & MathInset::cell(idx_type) const
119 lyxerr << "I don't have a cell\n";
120 return dummyCell.data_;
124 void MathInset::substitute(MathMacro const &)
128 bool MathInset::idxNext(idx_type &, pos_type &) const
134 bool MathInset::idxRight(idx_type &, pos_type &) const
140 bool MathInset::idxPrev(idx_type &, pos_type &) const
146 bool MathInset::idxLeft(idx_type &, pos_type &) const
152 bool MathInset::idxUp(idx_type &, pos_type &) const
158 bool MathInset::idxDown(idx_type &, pos_type &) const
164 bool MathInset::idxFirst(idx_type &, pos_type &) const
170 bool MathInset::idxLast(idx_type &, pos_type &) const
176 bool MathInset::idxHome(idx_type &, pos_type &) const
182 bool MathInset::idxEnd(idx_type &, pos_type &) const
188 void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
195 void MathInset::idxDeleteRange(idx_type, idx_type)
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
224 void MathInset::dump() const
226 lyxerr << "---------------------------------------------\n";
227 write(lyxerr, false);
228 lyxerr << "\n---------------------------------------------\n";
232 void MathInset::push_back(unsigned char, MathTextCodes)
234 lyxerr << "can't push without a cell\n";
238 void MathInset::push_back(MathInset *)
240 lyxerr << "can't push without a cell\n";
244 bool MathInset::covers(int x, int y) const
246 //lyxerr << "cover? p: " << this << " x: " << x << " y: " << y
247 // << " xo_: " << xo_ << " yo_: " << yo_ << endl;
250 x <= xo_ + width() &&
251 y >= yo_ - ascent() &&
252 y <= yo_ + descent();
256 void MathInset::validate(LaTeXFeatures &) const
260 std::vector<MathInset::idx_type>
261 MathInset::idxBetween(idx_type from, idx_type to) const
263 std::vector<idx_type> res;
264 for (idx_type i = from; i <= to; ++i)
270 void MathInset::metrics(MathStyles st) const
272 lyxerr << "MathInset::metrics() called directly!\n";
277 void MathInset::draw(Painter &, int, int) const
279 lyxerr << "MathInset::draw() called directly!\n";
283 void MathInset::write(std::ostream &, bool) const
285 lyxerr << "MathInset::write() called directly!\n";