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"
22 #include "lyxscreen.h"
25 BufferView::BufferView(LyXView * o, int xpos, int ypos,
26 int width, int height)
27 : pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
30 the_locking_inset = 0;
35 BufferView::~BufferView()
42 Buffer * BufferView::buffer() const
44 return pimpl_->buffer_;
48 LyXScreen * BufferView::screen() const
50 return pimpl_->screen_;
54 WorkArea * BufferView::workarea() const
56 return pimpl_->workarea_;
60 LyXView * BufferView::owner() const
62 return pimpl_->owner_;
66 void BufferView::pushIntoUpdateList(Inset * i)
68 pimpl_->updatelist.push(i);
72 Painter & BufferView::painter()
74 return pimpl_->painter();
78 void BufferView::buffer(Buffer * b)
84 void BufferView::resize(int xpos, int ypos, int width, int height)
86 pimpl_->resize(xpos, ypos, width, height);
90 void BufferView::resize()
96 void BufferView::redraw()
102 void BufferView::fitCursor()
108 void BufferView::update()
114 void BufferView::updateScrollbar()
116 pimpl_->updateScrollbar();
120 Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y,
123 return pimpl_->checkInsetHit(text, x, y, button);
127 void BufferView::redoCurrentBuffer()
129 pimpl_->redoCurrentBuffer();
133 int BufferView::resizeCurrentBuffer()
135 return pimpl_->resizeCurrentBuffer();
139 void BufferView::gotoError()
145 void BufferView::enterView()
151 void BufferView::leaveView()
157 // Callback for scrollbar slider
158 void BufferView::scrollCB(double value)
160 pimpl_->scrollCB(value);
164 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
166 pimpl_->workAreaMotionNotify(x, y, state);
170 /// Single-click on work area
171 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
173 pimpl_->workAreaButtonPress(xpos, ypos, button);
177 void BufferView::doubleClick(int x, int y, unsigned int button)
179 pimpl_->doubleClick(x, y, button);
183 void BufferView::tripleClick(int x, int y, unsigned int button)
185 pimpl_->tripleClick(x, y, button);
189 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
191 pimpl_->workAreaButtonRelease(x, y, button);
195 void BufferView::workAreaExpose()
197 pimpl_->workAreaExpose();
201 void BufferView::cursorPrevious()
203 pimpl_->cursorPrevious();
207 void BufferView::cursorNext()
209 pimpl_->cursorNext();
213 bool BufferView::available() const
215 return pimpl_->available();
219 void BufferView::beforeChange()
221 pimpl_->beforeChange();
225 void BufferView::savePosition()
227 pimpl_->savePosition();
231 void BufferView::restorePosition()
233 pimpl_->restorePosition();
237 bool BufferView::NoSavedPositions()
239 return pimpl_->NoSavedPositions();
243 void BufferView::update(UpdateCodes f)
249 void BufferView::setState()
255 void BufferView::insetSleep()
257 pimpl_->insetSleep();
261 void BufferView::insetWakeup()
263 pimpl_->insetWakeup();
267 void BufferView::insetUnlock()
269 pimpl_->insetUnlock();
273 bool BufferView::focus() const
275 return pimpl_->focus();
279 void BufferView::focus(bool f)
285 bool BufferView::active() const
287 return pimpl_->active();
291 int BufferView::workWidth() const
293 return pimpl_->workarea_->workWidth();
297 bool BufferView::belowMouse() const
299 return pimpl_->belowMouse();
303 void BufferView::showCursor()
305 pimpl_->showCursor();
309 void BufferView::hideCursor()
311 pimpl_->hideCursor();
315 void BufferView::toggleSelection(bool b)
317 pimpl_->toggleSelection(b);
321 void BufferView::toggleToggle()
323 pimpl_->toggleToggle();
327 void BufferView::center()
333 void BufferView::pasteClipboard(bool asPara)
335 pimpl_->pasteClipboard(asPara);
339 void BufferView::stuffClipboard(string const & stuff) const
341 pimpl_->stuffClipboard(stuff);
345 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
346 BufferView::UpdateCodes uc2)
348 return static_cast<BufferView::UpdateCodes>
349 (static_cast<int>(uc1) | static_cast<int>(uc2));