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);
133 // Callback for scrollbar up button
134 void BufferView::upCB(long time, int button)
136 if (pimpl_->buffer_ == 0) return;
140 pimpl_->scrollUpOnePage();
143 pimpl_->scrollDownOnePage();
146 pimpl_->scrollUp(time);
153 void BufferView::enterView()
159 void BufferView::leaveView()
165 // Callback for scrollbar slider
166 void BufferView::scrollCB(double value)
168 pimpl_->scrollCB(value);
173 // Callback for scrollbar down button
174 void BufferView::downCB(long time, int button)
176 pimpl_->downCB(time, button);
181 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
183 pimpl_->workAreaMotionNotify(x, y, state);
187 extern int bibitemMaxWidth(Painter &, LyXFont const &);
190 /// Single-click on work area
191 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
193 pimpl_->workAreaButtonPress(xpos, ypos, button);
197 void BufferView::doubleClick(int x, int y, unsigned int button)
199 pimpl_->doubleClick(x, y, button);
203 void BufferView::tripleClick(int x, int y, unsigned int button)
205 pimpl_->tripleClick(x, y, button);
209 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
211 pimpl_->workAreaButtonRelease(x, y, button);
215 void BufferView::workAreaExpose()
217 pimpl_->workAreaExpose();
221 // // Callback for cursor timer
222 void BufferView::cursorToggleCB(FL_OBJECT * ob, long )
224 BufferView * view = static_cast<BufferView*>(ob->u_vdata);
225 view->pimpl_->cursorToggle();
229 void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
231 pimpl_->workAreaSelectionNotify(win, event);
235 void BufferView::cursorPrevious()
237 pimpl_->cursorPrevious();
241 void BufferView::cursorNext()
243 pimpl_->cursorNext();
247 bool BufferView::available() const
249 return pimpl_->available();
253 void BufferView::beforeChange()
255 pimpl_->beforeChange();
259 void BufferView::savePosition()
261 pimpl_->savePosition();
265 void BufferView::restorePosition()
267 pimpl_->restorePosition();
271 void BufferView::update(signed char f)
278 void BufferView::smallUpdate(signed char f)
280 pimpl_->smallUpdate(f);
285 void BufferView::setState()
291 void BufferView::insetSleep()
293 pimpl_->insetSleep();
297 void BufferView::insetWakeup()
299 pimpl_->insetWakeup();
303 void BufferView::insetUnlock()
305 pimpl_->insetUnlock();
309 bool BufferView::focus() const
311 return pimpl_->focus();
315 void BufferView::focus(bool f)
321 bool BufferView::active() const
323 return pimpl_->active();
327 unsigned short BufferView::paperWidth() const
329 return text->paperWidth();
333 bool BufferView::belowMouse() const
335 return pimpl_->belowMouse();
339 void BufferView::showCursor()
341 pimpl_->showCursor();
345 void BufferView::hideCursor()
347 pimpl_->hideCursor();
351 void BufferView::toggleSelection(bool b)
353 pimpl_->toggleSelection(b);
357 void BufferView::toggleToggle()
359 pimpl_->toggleToggle();
363 void BufferView::center()