]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
small stuff
[lyx.git] / src / mathed / math_inset.C
1 /*
2  *  File:        math_inset.C
3  *  Purpose:     Implementation of insets for mathed
4  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
5  *  Created:     January 1996
6  *  Description: 
7  *
8  *  Dependencies: Xlib, XForms
9  *
10  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
11  *
12  *   Version: 0.8beta.
13  *
14  *   You are free to use and modify this code under the terms of
15  *   the GNU General Public Licence version 2 or later.
16  */
17
18 #ifdef __GNUG__
19 #pragma implementation
20 #endif
21
22 #include "math_inset.h"
23 #include "debug.h"
24
25
26 int MathInset::workwidth;
27
28
29 MathInset::MathInset()
30         : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
31 {}
32
33
34 int MathInset::height() const
35 {
36         return ascent() + descent();
37 }
38
39
40 MathStyles MathInset::size() const
41 {
42         return size_;
43 }
44
45
46 void MathInset::size(MathStyles s) const
47 {
48         size_ = s;
49 }
50
51
52 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
53 {
54         inset.write(os, false);
55         return os;
56 }
57
58
59 int MathInset::xo() const
60 {
61         return xo_;
62 }
63
64
65 int MathInset::yo() const
66 {
67         return yo_;
68 }
69
70
71 void MathInset::xo(int x) const
72 {
73         xo_ = x;
74 }
75
76
77 void MathInset::yo(int y) const
78 {
79         yo_ = y;
80 }
81
82
83 int MathInset::nargs() const
84 {
85         return 0;
86 }
87
88
89 MathXArray dummyCell;
90
91 MathXArray & MathInset::xcell(int)
92 {
93         lyxerr << "I don't have a cell\n";
94         return dummyCell;
95 }
96
97
98 MathXArray const & MathInset::xcell(int) const
99 {
100         lyxerr << "I don't have a cell\n";
101         return dummyCell;
102 }
103
104
105 MathArray & MathInset::cell(int)
106 {
107         lyxerr << "I don't have a cell\n";
108         return dummyCell.data_;
109 }
110
111
112 MathArray const & MathInset::cell(int) const
113 {
114         lyxerr << "I don't have a cell\n";
115         return dummyCell.data_;
116 }
117
118
119 void MathInset::substitute(MathArray & array, MathMacro const &) const
120 {
121         array.push_back(clone());
122 }
123
124
125 bool MathInset::idxNext(int &, int &) const
126 {
127         return false;
128 }
129
130
131 bool MathInset::idxRight(int &, int &) const
132 {
133         return false;
134 }
135
136
137 bool MathInset::idxPrev(int &, int &) const
138 {
139         return false;
140 }
141
142
143 bool MathInset::idxLeft(int &, int &) const
144 {
145         return false;
146 }
147
148
149 bool MathInset::idxUp(int &, int &) const
150 {
151         return false;
152 }
153
154
155 bool MathInset::idxDown(int &, int &) const
156 {
157         return false;
158 }
159
160
161 bool MathInset::idxFirst(int &, int &) const
162 {
163         return false;
164 }
165
166
167 bool MathInset::idxLast(int &, int &) const
168 {
169         return false;
170 }
171
172
173 bool MathInset::idxHome(int &, int &) const
174 {
175         return false;
176 }
177
178
179 bool MathInset::idxEnd(int &, int &) const
180 {
181         return false;
182 }
183
184
185 bool MathInset::idxFirstUp(int &, int &) const
186 {
187         return false;
188 }
189
190
191 bool MathInset::idxFirstDown(int &, int &) const
192 {
193         return false;
194 }
195
196
197 void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
198 {
199         popit    = false;
200         deleteit = false;
201 }
202
203
204 void MathInset::idxDeleteRange(int, int)
205 {}
206
207
208 bool MathInset::idxLastUp(int &, int &) const
209 {
210         return false;
211 }
212
213
214 bool MathInset::idxLastDown(int &, int &) const
215 {
216         return false;
217 }
218
219
220 void MathInset::getXY(int & x, int & y) const
221 {
222    x = xo();
223    y = yo();
224 }
225
226
227 /*
228 void MathInset::userSetSize(MathStyles sz)
229 {
230         if (sz >= 0) {
231                 size_ = sz;      
232                 flag = flag & ~LMPF_FIXED_SIZE;
233         }
234 }
235 */
236
237 void MathInset::writeNormal(std::ostream & os) const
238 {
239         os << "[unknown] ";
240 }
241
242
243 void MathInset::dump() const
244 {
245         lyxerr << "---------------------------------------------\n";
246         write(lyxerr, false);
247         lyxerr << "\n---------------------------------------------\n";
248 }
249
250
251 void MathInset::push_back(unsigned char, MathTextCodes)
252 {
253         lyxerr << "can't push without a cell\n";
254 }
255
256
257 void MathInset::push_back(MathInset *)
258 {
259         lyxerr << "can't push without a cell\n";
260 }
261
262
263 bool MathInset::covers(int x, int y) const
264 {
265         return
266                 x >= xo_ &&
267                 x <= xo_ + width() &&
268                 y >= yo_ - ascent() &&
269                 y <= yo_ + descent();
270 }
271
272
273 void MathInset::validate(LaTeXFeatures &) const
274 {}
275
276
277 std::vector<int> MathInset::idxBetween(int from, int to) const
278 {
279         std::vector<int> res;
280         for (int i = from; i <= to; ++i)
281                 res.push_back(i);
282         return res;
283 }
284
285
286 void MathInset::metrics(MathStyles st) const
287 {
288         lyxerr << "MathInset::metrics() called directly!\n";
289         size_ = st;
290 }
291
292
293 void MathInset::draw(Painter &, int, int) const
294 {
295         lyxerr << "MathInset::draw() called directly!\n";
296 }
297
298
299 void MathInset::write(std::ostream &, bool) const
300 {
301         lyxerr << "MathInset::write() called directly!\n";
302 }