]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
fix "cursor moving out of visible area" in large formulas
[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 <config.h>
23
24 #include "Lsstream.h"
25 #include "math_inset.h"
26 #include "math_scriptinset.h"
27 #include "math_mathmlstream.h"
28 #include "debug.h"
29
30
31 int MathInset::height() const
32 {
33         return ascent() + descent();
34 }
35
36
37 std::ostream & operator<<(std::ostream & os, MathInset const & inset)
38 {
39         WriteStream wi(os, false);
40         inset.write(wi);
41         return os;
42 }
43
44
45 MathInset::size_type MathInset::nargs() const
46 {
47         return 0;
48 }
49
50
51 MathXArray dummyCell;
52
53 MathXArray & MathInset::xcell(idx_type)
54 {
55         lyxerr << "I don't have a cell 1\n";
56         return dummyCell;
57 }
58
59
60 MathXArray const & MathInset::xcell(idx_type) const
61 {
62         lyxerr << "I don't have a cell 2\n";
63         return dummyCell;
64 }
65
66
67 MathArray & MathInset::cell(idx_type)
68 {
69         lyxerr << "I don't have a cell 3\n";
70         return dummyCell.data_;
71 }
72
73
74 MathArray const & MathInset::cell(idx_type) const
75 {
76         lyxerr << "I don't have a cell 4\n";
77         return dummyCell.data_;
78 }
79
80
81 void MathInset::substitute(MathMacro const &)
82 {}
83
84
85 bool MathInset::idxNext(idx_type &, pos_type &) const
86 {
87         return false;
88 }
89
90
91 bool MathInset::idxRight(idx_type &, pos_type &) const
92 {
93         return false;
94 }
95
96
97 bool MathInset::idxPrev(idx_type &, pos_type &) const
98 {
99         return false;
100 }
101
102
103 bool MathInset::idxLeft(idx_type &, pos_type &) const
104 {
105         return false;
106 }
107
108
109 bool MathInset::idxUp(idx_type &) const
110 {
111         return false;
112 }
113
114
115 bool MathInset::idxDown(idx_type &) const
116 {
117         return false;
118 }
119
120
121 bool MathInset::idxFirst(idx_type &, pos_type &) const
122 {
123         return false;
124 }
125
126
127 bool MathInset::idxLast(idx_type &, pos_type &) const
128 {
129         return false;
130 }
131
132
133 bool MathInset::idxHome(idx_type &, pos_type &) const
134 {
135         return false;
136 }
137
138
139 bool MathInset::idxEnd(idx_type &, pos_type &) const
140 {
141         return false;
142 }
143
144
145 void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
146 {
147         popit    = false;
148         deleteit = false;
149 }
150
151
152 void MathInset::idxDeleteRange(idx_type, idx_type)
153 {}
154
155
156 void MathInset::normalize(NormalStream & os) const
157 {
158         os << "[unknown ";
159         WriteStream wi(os.os(), false);
160         write(wi);
161         os << "] ";
162 }
163
164
165 void MathInset::dump() const
166 {
167         lyxerr << "---------------------------------------------\n";
168         WriteStream wi(lyxerr, false);
169         write(wi);
170         lyxerr << "\n---------------------------------------------\n";
171 }
172
173
174 void MathInset::validate(LaTeXFeatures &) const
175 {}
176
177
178 std::vector<MathInset::idx_type>
179         MathInset::idxBetween(idx_type from, idx_type to) const
180 {
181         std::vector<idx_type> res;
182         for (idx_type i = from; i <= to; ++i)
183                 res.push_back(i);
184         return res;
185 }
186
187
188 void MathInset::metrics(MathMetricsInfo const &) const
189 {
190         lyxerr << "MathInset::metrics() called directly!\n";
191 }
192
193
194 void MathInset::draw(Painter &, int, int) const
195 {
196         lyxerr << "MathInset::draw() called directly!\n";
197 }
198
199
200 void MathInset::write(WriteStream &) const
201 {
202         lyxerr << "MathInset::write() called directly!\n";
203 }
204
205
206 void MathInset::octavize(OctaveStream & os) const
207 {
208         NormalStream ns(os.os());
209         normalize(ns);
210 }
211
212
213 void MathInset::maplize(MapleStream & os) const
214 {
215         NormalStream ns(os.os());
216         normalize(ns);
217 }
218
219
220 void MathInset::mathmlize(MathMLStream & os) const
221 {
222         NormalStream ns(os.os());
223         normalize(ns);
224 }