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 extern int bibitemMaxWidth(Painter &, LyXFont const &);
160 /// Single-click on work area
161 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
163 pimpl_->workAreaButtonPress(xpos, ypos, button);
167 void BufferView::doubleClick(int x, int y, unsigned int button)
169 pimpl_->doubleClick(x, y, button);
173 void BufferView::tripleClick(int x, int y, unsigned int button)
175 pimpl_->tripleClick(x, y, button);
179 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
181 pimpl_->workAreaButtonRelease(x, y, button);
185 void BufferView::workAreaExpose()
187 pimpl_->workAreaExpose();
191 // // Callback for cursor timer
192 void BufferView::cursorToggleCB(FL_OBJECT * ob, long )
194 BufferView * view = static_cast<BufferView*>(ob->u_vdata);
195 view->pimpl_->cursorToggle();
199 void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
201 pimpl_->workAreaSelectionNotify(win, event);
205 void BufferView::cursorPrevious()
207 pimpl_->cursorPrevious();
211 void BufferView::cursorNext()
213 pimpl_->cursorNext();
217 bool BufferView::available() const
219 return pimpl_->available();
223 void BufferView::beforeChange()
225 pimpl_->beforeChange();
229 void BufferView::savePosition()
231 pimpl_->savePosition();
235 void BufferView::restorePosition()
237 pimpl_->restorePosition();
241 void BufferView::update(signed char f)
247 void BufferView::setState()
253 void BufferView::insetSleep()
255 pimpl_->insetSleep();
259 void BufferView::insetWakeup()
261 pimpl_->insetWakeup();
265 void BufferView::insetUnlock()
267 pimpl_->insetUnlock();
271 bool BufferView::focus() const
273 return pimpl_->focus();
277 void BufferView::focus(bool f)
283 bool BufferView::active() const
285 return pimpl_->active();
289 unsigned short BufferView::paperWidth() const
291 return text->paperWidth();
295 bool BufferView::belowMouse() const
297 return pimpl_->belowMouse();
301 void BufferView::showCursor()
303 pimpl_->showCursor();
307 void BufferView::hideCursor()
309 pimpl_->hideCursor();
313 void BufferView::toggleSelection(bool b)
315 pimpl_->toggleSelection(b);
319 void BufferView::toggleToggle()
321 pimpl_->toggleToggle();
325 void BufferView::center()