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 MathInset::MathInset()
32 MathInset::~MathInset()
36 int MathInset::height() const
38 return ascent() + descent();
42 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
44 MathWriteInfo wi(0, os, false);
50 int MathInset::xo() const
56 int MathInset::yo() const
62 void MathInset::xo(int x) const
68 void MathInset::yo(int y) const
74 MathInset::size_type MathInset::nargs() const
82 MathXArray & MathInset::xcell(idx_type)
84 lyxerr << "I don't have a cell\n";
89 MathXArray const & MathInset::xcell(idx_type) const
91 lyxerr << "I don't have a cell\n";
96 MathArray & MathInset::cell(idx_type)
98 lyxerr << "I don't have a cell\n";
99 return dummyCell.data_;
103 MathArray const & MathInset::cell(idx_type) const
105 lyxerr << "I don't have a cell\n";
106 return dummyCell.data_;
110 void MathInset::substitute(MathMacro const &)
114 bool MathInset::idxNext(idx_type &, pos_type &) const
120 bool MathInset::idxRight(idx_type &, pos_type &) const
126 bool MathInset::idxPrev(idx_type &, pos_type &) const
132 bool MathInset::idxLeft(idx_type &, pos_type &) const
138 bool MathInset::idxUp(idx_type &, pos_type &) const
144 bool MathInset::idxDown(idx_type &, pos_type &) const
150 bool MathInset::idxFirst(idx_type &, pos_type &) const
156 bool MathInset::idxLast(idx_type &, pos_type &) const
162 bool MathInset::idxHome(idx_type &, pos_type &) const
168 bool MathInset::idxEnd(idx_type &, pos_type &) const
174 void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
181 void MathInset::idxDeleteRange(idx_type, idx_type)
185 void MathInset::getXY(int & x, int & y) const
192 void MathInset::writeNormal(std::ostream & os) const
195 MathWriteInfo wi(0, os, false);
201 void MathInset::dump() const
203 lyxerr << "---------------------------------------------\n";
204 MathWriteInfo wi(0, lyxerr, false);
206 lyxerr << "\n---------------------------------------------\n";
210 bool MathInset::covers(int x, int y) const
212 //lyxerr << "cover? p: " << this << " x: " << x << " y: " << y
213 // << " xo_: " << xo_ << " yo_: " << yo_ << endl;
216 x <= xo_ + width() &&
217 y >= yo_ - ascent() &&
218 y <= yo_ + descent();
222 void MathInset::validate(LaTeXFeatures &) const
226 std::vector<MathInset::idx_type>
227 MathInset::idxBetween(idx_type from, idx_type to) const
229 std::vector<idx_type> res;
230 for (idx_type i = from; i <= to; ++i)
236 void MathInset::metrics(MathMetricsInfo const &) const
238 lyxerr << "MathInset::metrics() called directly!\n";
242 void MathInset::draw(Painter &, int, int) const
244 lyxerr << "MathInset::draw() called directly!\n";
248 void MathInset::write(MathWriteInfo &) const
250 lyxerr << "MathInset::write() called directly!\n";