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 // Callback for scrollbar up button
133 void BufferView::upCB(long time, int button)
135 if (pimpl_->buffer_ == 0) return;
139 pimpl_->scrollUpOnePage();
142 pimpl_->scrollDownOnePage();
145 pimpl_->scrollUp(time);
151 // Callback for scrollbar slider
152 void BufferView::scrollCB(double value)
154 pimpl_->scrollCB(value);
158 // Callback for scrollbar down button
159 void BufferView::downCB(long time, int button)
161 pimpl_->downCB(time, button);
165 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
167 pimpl_->workAreaMotionNotify(x, y, state);
171 extern int bibitemMaxWidth(Painter &, LyXFont const &);
174 /// Single-click on work area
175 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
177 pimpl_->workAreaButtonPress(xpos, ypos, button);
181 void BufferView::doubleClick(int x, int y, unsigned int button)
183 pimpl_->doubleClick(x, y, button);
187 void BufferView::tripleClick(int x, int y, unsigned int button)
189 pimpl_->tripleClick(x, y, button);
193 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
195 pimpl_->workAreaButtonRelease(x, y, button);
199 void BufferView::workAreaExpose()
201 pimpl_->workAreaExpose();
205 // // Callback for cursor timer
206 void BufferView::cursorToggleCB(FL_OBJECT * ob, long )
208 BufferView * view = static_cast<BufferView*>(ob->u_vdata);
209 view->pimpl_->cursorToggle();
213 void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
215 pimpl_->workAreaSelectionNotify(win, event);
219 void BufferView::cursorPrevious()
221 pimpl_->cursorPrevious();
225 void BufferView::cursorNext()
227 pimpl_->cursorNext();
231 bool BufferView::available() const
233 return pimpl_->available();
237 void BufferView::beforeChange()
239 pimpl_->beforeChange();
243 void BufferView::savePosition()
245 pimpl_->savePosition();
249 void BufferView::restorePosition()
251 pimpl_->restorePosition();
255 void BufferView::update(signed char f)
261 void BufferView::smallUpdate(signed char f)
263 pimpl_->smallUpdate(f);
267 void BufferView::setState()
273 void BufferView::insetSleep()
275 pimpl_->insetSleep();
279 void BufferView::insetWakeup()
281 pimpl_->insetWakeup();
285 void BufferView::insetUnlock()
287 pimpl_->insetUnlock();
291 bool BufferView::focus() const
293 return pimpl_->focus();
297 void BufferView::focus(bool f)
303 bool BufferView::active() const
305 return pimpl_->active();
309 unsigned short BufferView::paperWidth() const
311 return text->paperWidth();
315 bool BufferView::belowMouse() const
317 return pimpl_->belowMouse();
321 void BufferView::showCursor()
323 pimpl_->showCursor();
327 void BufferView::hideCursor()
329 pimpl_->hideCursor();
333 void BufferView::toggleSelection(bool b)
335 pimpl_->toggleSelection(b);
339 void BufferView::toggleToggle()
341 pimpl_->toggleToggle();
345 void BufferView::center()