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()
35 MathInset::~MathInset()
39 int MathInset::height() const
41 return ascent() + descent();
45 MathStyles MathInset::size() const
51 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
53 MathWriteInfo wi(0, 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 MathInset::size_type MathInset::nargs() const
91 MathXArray & MathInset::xcell(idx_type)
93 lyxerr << "I don't have a cell\n";
98 MathXArray const & MathInset::xcell(idx_type) const
100 lyxerr << "I don't have a cell\n";
105 MathArray & MathInset::cell(idx_type)
107 lyxerr << "I don't have a cell\n";
108 return dummyCell.data_;
112 MathArray const & MathInset::cell(idx_type) const
114 lyxerr << "I don't have a cell\n";
115 return dummyCell.data_;
119 void MathInset::substitute(MathMacro const &)
123 bool MathInset::idxNext(idx_type &, pos_type &) const
129 bool MathInset::idxRight(idx_type &, pos_type &) const
135 bool MathInset::idxPrev(idx_type &, pos_type &) const
141 bool MathInset::idxLeft(idx_type &, pos_type &) const
147 bool MathInset::idxUp(idx_type &, pos_type &) const
153 bool MathInset::idxDown(idx_type &, pos_type &) const
159 bool MathInset::idxFirst(idx_type &, pos_type &) const
165 bool MathInset::idxLast(idx_type &, pos_type &) const
171 bool MathInset::idxHome(idx_type &, pos_type &) const
177 bool MathInset::idxEnd(idx_type &, pos_type &) const
183 void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
190 void MathInset::idxDeleteRange(idx_type, idx_type)
194 void MathInset::getXY(int & x, int & y) const
202 void MathInset::userSetSize(MathStyles sz)
206 flag = flag & ~LMPF_FIXED_SIZE;
211 void MathInset::writeNormal(std::ostream & os) const
214 MathWriteInfo wi(0, os, false);
220 void MathInset::dump() const
222 lyxerr << "---------------------------------------------\n";
223 MathWriteInfo wi(0, lyxerr, false);
225 lyxerr << "\n---------------------------------------------\n";
229 void MathInset::push_back(unsigned char, MathTextCodes)
231 lyxerr << "can't push without a cell\n";
235 void MathInset::push_back(MathInset *)
237 lyxerr << "can't push without a cell\n";
241 bool MathInset::covers(int x, int y) const
243 //lyxerr << "cover? p: " << this << " x: " << x << " y: " << y
244 // << " xo_: " << xo_ << " yo_: " << yo_ << endl;
247 x <= xo_ + width() &&
248 y >= yo_ - ascent() &&
249 y <= yo_ + descent();
253 void MathInset::validate(LaTeXFeatures &) const
257 std::vector<MathInset::idx_type>
258 MathInset::idxBetween(idx_type from, idx_type to) const
260 std::vector<idx_type> res;
261 for (idx_type i = from; i <= to; ++i)
267 void MathInset::metrics(MathMetricsInfo const & 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(MathWriteInfo &) const
282 lyxerr << "MathInset::write() called directly!\n";