]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
further code uglification to make Jean-Marc's compiler happy
[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 "math_scriptinset.h"
24 #include "debug.h"
25
26
27 int MathInset::workwidth;
28
29
30 MathInset::MathInset()
31         : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
32 {}
33
34
35 MathInset::~MathInset()
36 {}
37
38
39 int MathInset::height() const
40 {
41         return ascent() + descent();
42 }
43
44
45 MathStyles MathInset::size() const
46 {
47         return size_;
48 }
49
50
51 void MathInset::size(MathStyles s) const
52 {
53         size_ = s;
54 }
55
56
57 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
58 {
59         inset.write(os, false);
60         return os;
61 }
62
63
64 int MathInset::xo() const
65 {
66         return xo_;
67 }
68
69
70 int MathInset::yo() const
71 {
72         return yo_;
73 }
74
75
76 void MathInset::xo(int x) const
77 {
78         xo_ = x;
79 }
80
81
82 void MathInset::yo(int y) const
83 {
84         yo_ = y;
85 }
86
87
88 unsigned int MathInset::nargs() const
89 {
90         return 0;
91 }
92
93
94 MathXArray dummyCell;
95
96 MathXArray & MathInset::xcell(unsigned int)
97 {
98         lyxerr << "I don't have a cell\n";
99         return dummyCell;
100 }
101
102
103 MathXArray const & MathInset::xcell(unsigned int) const
104 {
105         lyxerr << "I don't have a cell\n";
106         return dummyCell;
107 }
108
109
110 MathArray & MathInset::cell(unsigned int)
111 {
112         lyxerr << "I don't have a cell\n";
113         return dummyCell.data_;
114 }
115
116
117 MathArray const & MathInset::cell(unsigned int) const
118 {
119         lyxerr << "I don't have a cell\n";
120         return dummyCell.data_;
121 }
122
123
124 void MathInset::substitute(MathMacro const &)
125 {}
126
127
128 bool MathInset::idxNext(unsigned int &, unsigned int &) const
129 {
130         return false;
131 }
132
133
134 bool MathInset::idxRight(unsigned int &, unsigned int &) const
135 {
136         return false;
137 }
138
139
140 bool MathInset::idxPrev(unsigned int &, unsigned int &) const
141 {
142         return false;
143 }
144
145
146 bool MathInset::idxLeft(unsigned int &, unsigned int &) const
147 {
148         return false;
149 }
150
151
152 bool MathInset::idxUp(unsigned int &, unsigned int &) const
153 {
154         return false;
155 }
156
157
158 bool MathInset::idxDown(unsigned int &, unsigned int &) const
159 {
160         return false;
161 }
162
163
164 bool MathInset::idxFirst(unsigned int &, unsigned int &) const
165 {
166         return false;
167 }
168
169
170 bool MathInset::idxLast(unsigned int &, unsigned int &) const
171 {
172         return false;
173 }
174
175
176 bool MathInset::idxHome(unsigned int &, unsigned int &) const
177 {
178         return false;
179 }
180
181
182 bool MathInset::idxEnd(unsigned int &, unsigned int &) const
183 {
184         return false;
185 }
186
187
188 void MathInset::idxDelete(unsigned int &, bool & popit, bool & deleteit)
189 {
190         popit    = false;
191         deleteit = false;
192 }
193
194
195 void MathInset::idxDeleteRange(unsigned int, unsigned int)
196 {}
197
198
199 void MathInset::getXY(int & x, int & y) const
200 {
201    x = xo();
202    y = yo();
203 }
204
205
206 /*
207 void MathInset::userSetSize(MathStyles sz)
208 {
209         if (sz >= 0) {
210                 size_ = sz;      
211                 flag = flag & ~LMPF_FIXED_SIZE;
212         }
213 }
214 */
215
216 void MathInset::writeNormal(std::ostream & os) const
217 {
218         os << "[unknown] ";
219 }
220
221
222 void MathInset::dump() const
223 {
224         lyxerr << "---------------------------------------------\n";
225         write(lyxerr, false);
226         lyxerr << "\n---------------------------------------------\n";
227 }
228
229
230 void MathInset::push_back(unsigned char, MathTextCodes)
231 {
232         lyxerr << "can't push without a cell\n";
233 }
234
235
236 void MathInset::push_back(MathInset *)
237 {
238         lyxerr << "can't push without a cell\n";
239 }
240
241
242 bool MathInset::covers(int x, int y) const
243 {
244         //lyxerr << "cover? p: " << this << " x: " << x << " y: " <<  y
245         //      << " xo_: " << xo_ << " yo_: " << yo_  << endl;
246         return
247                 x >= xo_ &&
248                 x <= xo_ + width() &&
249                 y >= yo_ - ascent() &&
250                 y <= yo_ + descent();
251 }
252
253
254 void MathInset::validate(LaTeXFeatures &) const
255 {}
256
257
258 std::vector<unsigned int>
259         MathInset::idxBetween(unsigned int from, unsigned int to) const
260 {
261         std::vector<unsigned int> res;
262         for (unsigned int i = from; i <= to; ++i)
263                 res.push_back(i);
264         return res;
265 }
266
267
268 void MathInset::metrics(MathStyles st) const
269 {
270         lyxerr << "MathInset::metrics() called directly!\n";
271         size_ = st;
272 }
273
274
275 void MathInset::draw(Painter &, int, int) const
276 {
277         lyxerr << "MathInset::draw() called directly!\n";
278 }
279
280
281 void MathInset::write(std::ostream &, bool) const
282 {
283         lyxerr << "MathInset::write() called directly!\n";
284 }