]> git.lyx.org Git - lyx.git/blob - src/BufferView.C
a8db202cfa1ee19e03e79b3b51f5c81cdf8558b4
[lyx.git] / src / BufferView.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "BufferView.h"
19 #include "BufferView_pimpl.h"
20 #include "lyxtext.h"
21
22
23 BufferView::BufferView(LyXView * o, int xpos, int ypos,
24                        int width, int height)
25         : pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
26 {
27         text = 0;
28         the_locking_inset = 0;
29         inset_slept = false;
30 }
31
32
33 BufferView::~BufferView()
34 {
35         delete text;
36         delete pimpl_;
37 }
38
39
40 Buffer * BufferView::buffer() const
41 {
42         return pimpl_->buffer_;
43 }
44
45
46 LyXView * BufferView::owner() const
47 {
48         return pimpl_->owner_;
49 }
50
51
52 void BufferView::pushIntoUpdateList(Inset * i)
53 {
54         pimpl_->updatelist.push(i);
55 }
56
57
58 Painter & BufferView::painter() 
59 {
60         return pimpl_->painter();
61 }
62
63
64 void BufferView::buffer(Buffer * b)
65 {
66         pimpl_->buffer(b);
67 }
68
69
70 void BufferView::resize(int xpos, int ypos, int width, int height)
71 {
72         pimpl_->resize(xpos, ypos, width, height);
73 }
74
75
76 void BufferView::resize()
77 {
78         pimpl_->resize();
79 }
80
81
82 void BufferView::redraw()
83 {
84         pimpl_->redraw();
85 }
86
87
88 void BufferView::fitCursor()
89 {
90         pimpl_->fitCursor();
91 }
92
93
94 void BufferView::update()
95 {
96         pimpl_->update();
97 }
98
99
100 void BufferView::updateScrollbar()
101 {
102         pimpl_->updateScrollbar();
103 }
104
105
106 void BufferView::redoCurrentBuffer()
107 {
108         pimpl_->redoCurrentBuffer();
109 }
110
111
112 int BufferView::resizeCurrentBuffer()
113 {
114         return pimpl_->resizeCurrentBuffer();
115 }
116
117
118 void BufferView::gotoError()
119 {
120         pimpl_->gotoError();
121 }
122
123
124 extern "C" {
125         void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
126         {
127                 BufferView::cursorToggleCB(ob, buf);
128         }
129 }
130
131
132 // Callback for scrollbar up button
133 void BufferView::upCB(long time, int button)
134 {
135         if (pimpl_->buffer_ == 0) return;
136
137         switch (button) {
138         case 3:
139                 pimpl_->scrollUpOnePage();
140                 break;
141         case 2:
142                 pimpl_->scrollDownOnePage();
143                 break;
144         default:
145                 pimpl_->scrollUp(time);
146                 break;
147         }
148 }
149
150
151 void BufferView::enterView()
152 {
153         pimpl_->enterView();
154 }
155
156
157 void BufferView::leaveView()
158 {
159         pimpl_->leaveView();
160 }
161
162
163 // Callback for scrollbar slider
164 void BufferView::scrollCB(double value)
165 {
166         pimpl_->scrollCB(value);
167 }
168
169
170 // Callback for scrollbar down button
171 void BufferView::downCB(long time, int button)
172 {
173         pimpl_->downCB(time, button);
174 }
175
176
177 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
178 {
179         pimpl_->workAreaMotionNotify(x, y, state);
180 }
181
182
183 extern int bibitemMaxWidth(Painter &, LyXFont const &);
184
185
186 ///  Single-click on work area
187 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
188 {
189         pimpl_->workAreaButtonPress(xpos, ypos, button);
190 }
191
192
193 void BufferView::doubleClick(int x, int y, unsigned int button) 
194 {
195         pimpl_->doubleClick(x, y, button);
196 }
197
198
199 void BufferView::tripleClick(int x, int y, unsigned int button)
200 {
201         pimpl_->tripleClick(x, y, button);
202 }
203
204
205 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
206 {
207         pimpl_->workAreaButtonRelease(x, y, button);
208 }
209
210
211 void BufferView::workAreaExpose()
212 {
213         pimpl_->workAreaExpose();
214 }
215
216
217 //  // Callback for cursor timer
218 void BufferView::cursorToggleCB(FL_OBJECT * ob, long )
219 {
220         BufferView * view = static_cast<BufferView*>(ob->u_vdata);
221         view->pimpl_->cursorToggle();
222 }
223
224
225 void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
226 {
227         pimpl_->workAreaSelectionNotify(win, event);
228 }
229
230
231 void BufferView::cursorPrevious()
232 {
233         pimpl_->cursorPrevious();
234 }
235
236
237 void BufferView::cursorNext()
238 {
239         pimpl_->cursorNext();
240 }
241
242
243 bool BufferView::available() const
244 {
245         return pimpl_->available();
246 }
247
248
249 void BufferView::beforeChange()
250 {
251         pimpl_->beforeChange();
252 }
253
254
255 void BufferView::savePosition()
256 {
257         pimpl_->savePosition();
258 }
259
260
261 void BufferView::restorePosition()
262 {
263         pimpl_->restorePosition();
264 }
265
266
267 void BufferView::update(signed char f)
268 {
269         pimpl_->update(f);
270 }
271
272
273 void BufferView::smallUpdate(signed char f)
274 {
275         pimpl_->smallUpdate(f);
276 }
277
278
279 void BufferView::setState()
280 {
281         pimpl_->setState();
282 }
283
284
285 void BufferView::insetSleep()
286 {
287         pimpl_->insetSleep();
288 }
289
290
291 void BufferView::insetWakeup()
292 {
293         pimpl_->insetWakeup();
294 }
295
296
297 void BufferView::insetUnlock()
298 {
299         pimpl_->insetUnlock();
300 }
301
302
303 bool BufferView::focus() const
304 {
305         return pimpl_->focus();
306 }
307
308
309 void BufferView::focus(bool f)
310 {
311         pimpl_->focus(f);
312 }
313
314
315 bool BufferView::active() const
316 {
317         return pimpl_->active();
318 }
319
320
321 unsigned short BufferView::paperWidth() const
322 {
323     return text->paperWidth();
324 }
325
326
327 bool BufferView::belowMouse() const 
328 {
329         return pimpl_->belowMouse();
330 }
331
332
333 void BufferView::showCursor()
334 {
335         pimpl_->showCursor();
336 }
337
338
339 void BufferView::hideCursor()
340 {
341         pimpl_->hideCursor();
342 }
343
344
345 void BufferView::toggleSelection(bool b)
346 {
347         pimpl_->toggleSelection(b);
348 }
349
350
351 void BufferView::toggleToggle()
352 {
353         pimpl_->toggleToggle();
354 }
355
356
357 void BufferView::center() 
358 {
359         pimpl_->center();
360 }