2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ====================================================== */
15 #pragma implementation
18 #include "BufferView.h"
19 #include "BufferView_pimpl.h"
23 BufferView::BufferView(LyXView * o, int xpos, int ypos,
24 int width, int height)
25 : pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
28 the_locking_inset = 0;
33 BufferView::~BufferView()
40 Buffer * BufferView::buffer() const
42 return pimpl_->buffer_;
46 LyXView * BufferView::owner() const
48 return pimpl_->owner_;
52 void BufferView::pushIntoUpdateList(Inset * i)
54 pimpl_->updatelist.push(i);
58 Painter & BufferView::painter()
60 return pimpl_->painter();
64 void BufferView::buffer(Buffer * b)
70 void BufferView::resize(int xpos, int ypos, int width, int height)
72 pimpl_->resize(xpos, ypos, width, height);
76 void BufferView::resize()
82 void BufferView::redraw()
88 void BufferView::fitCursor()
94 void BufferView::update()
100 void BufferView::updateScrollbar()
102 pimpl_->updateScrollbar();
106 void BufferView::redoCurrentBuffer()
108 pimpl_->redoCurrentBuffer();
112 int BufferView::resizeCurrentBuffer()
114 return pimpl_->resizeCurrentBuffer();
118 void BufferView::gotoError()
125 void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
127 BufferView::cursorToggleCB(ob, buf);
132 void BufferView::enterView()
138 void BufferView::leaveView()
144 // Callback for scrollbar slider
145 void BufferView::scrollCB(double value)
147 pimpl_->scrollCB(value);
151 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
153 pimpl_->workAreaMotionNotify(x, y, state);
157 /// Single-click on work area
158 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
160 pimpl_->workAreaButtonPress(xpos, ypos, button);
164 void BufferView::doubleClick(int x, int y, unsigned int button)
166 pimpl_->doubleClick(x, y, button);
170 void BufferView::tripleClick(int x, int y, unsigned int button)
172 pimpl_->tripleClick(x, y, button);
176 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
178 pimpl_->workAreaButtonRelease(x, y, button);
182 void BufferView::workAreaExpose()
184 pimpl_->workAreaExpose();
188 // // Callback for cursor timer
189 void BufferView::cursorToggleCB(FL_OBJECT * ob, long )
191 BufferView * view = static_cast<BufferView*>(ob->u_vdata);
192 view->pimpl_->cursorToggle();
196 #ifndef XFORMS_CLIPBOARD
197 void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
199 pimpl_->workAreaSelectionNotify(win, event);
204 void BufferView::cursorPrevious()
206 pimpl_->cursorPrevious();
210 void BufferView::cursorNext()
212 pimpl_->cursorNext();
216 bool BufferView::available() const
218 return pimpl_->available();
222 void BufferView::beforeChange()
224 pimpl_->beforeChange();
228 void BufferView::savePosition()
230 pimpl_->savePosition();
234 void BufferView::restorePosition()
236 pimpl_->restorePosition();
240 bool BufferView::NoSavedPositions()
242 return pimpl_->NoSavedPositions();
246 void BufferView::update(signed char f)
252 void BufferView::setState()
258 void BufferView::insetSleep()
260 pimpl_->insetSleep();
264 void BufferView::insetWakeup()
266 pimpl_->insetWakeup();
270 void BufferView::insetUnlock()
272 pimpl_->insetUnlock();
276 bool BufferView::focus() const
278 return pimpl_->focus();
282 void BufferView::focus(bool f)
288 bool BufferView::active() const
290 return pimpl_->active();
294 unsigned short BufferView::paperWidth() const
296 return text->paperWidth();
300 bool BufferView::belowMouse() const
302 return pimpl_->belowMouse();
306 void BufferView::showCursor()
308 pimpl_->showCursor();
312 void BufferView::hideCursor()
314 pimpl_->hideCursor();
318 void BufferView::toggleSelection(bool b)
320 pimpl_->toggleSelection(b);
324 void BufferView::toggleToggle()
326 pimpl_->toggleToggle();
330 void BufferView::center()
336 #ifdef XFORMS_CLIPBOARD
337 void BufferView::pasteClipboard(bool asPara)
339 pimpl_->pasteClipboard(asPara);
343 void BufferView::stuffClipboard(string const & stuff) const
345 pimpl_->stuffClipboard(stuff);