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