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 void BufferView::redoCurrentBuffer()
122 pimpl_->redoCurrentBuffer();
126 int BufferView::resizeCurrentBuffer()
128 return pimpl_->resizeCurrentBuffer();
132 void BufferView::gotoError()
138 void BufferView::enterView()
144 void BufferView::leaveView()
150 // Callback for scrollbar slider
151 void BufferView::scrollCB(double value)
153 pimpl_->scrollCB(value);
157 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
159 pimpl_->workAreaMotionNotify(x, y, state);
163 /// Single-click on work area
164 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
166 pimpl_->workAreaButtonPress(xpos, ypos, button);
170 void BufferView::doubleClick(int x, int y, unsigned int button)
172 pimpl_->doubleClick(x, y, button);
176 void BufferView::tripleClick(int x, int y, unsigned int button)
178 pimpl_->tripleClick(x, y, button);
182 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
184 pimpl_->workAreaButtonRelease(x, y, button);
188 void BufferView::workAreaExpose()
190 pimpl_->workAreaExpose();
194 void BufferView::cursorPrevious()
196 pimpl_->cursorPrevious();
200 void BufferView::cursorNext()
202 pimpl_->cursorNext();
206 bool BufferView::available() const
208 return pimpl_->available();
212 void BufferView::beforeChange()
214 pimpl_->beforeChange();
218 void BufferView::savePosition()
220 pimpl_->savePosition();
224 void BufferView::restorePosition()
226 pimpl_->restorePosition();
230 bool BufferView::NoSavedPositions()
232 return pimpl_->NoSavedPositions();
236 void BufferView::update(UpdateCodes f)
242 void BufferView::setState()
248 void BufferView::insetSleep()
250 pimpl_->insetSleep();
254 void BufferView::insetWakeup()
256 pimpl_->insetWakeup();
260 void BufferView::insetUnlock()
262 pimpl_->insetUnlock();
266 bool BufferView::focus() const
268 return pimpl_->focus();
272 void BufferView::focus(bool f)
278 bool BufferView::active() const
280 return pimpl_->active();
284 int BufferView::workWidth() const
286 return pimpl_->workarea_->workWidth();
290 bool BufferView::belowMouse() const
292 return pimpl_->belowMouse();
296 void BufferView::showCursor()
298 pimpl_->showCursor();
302 void BufferView::hideCursor()
304 pimpl_->hideCursor();
308 void BufferView::toggleSelection(bool b)
310 pimpl_->toggleSelection(b);
314 void BufferView::toggleToggle()
316 pimpl_->toggleToggle();
320 void BufferView::center()
326 void BufferView::pasteClipboard(bool asPara)
328 pimpl_->pasteClipboard(asPara);
332 void BufferView::stuffClipboard(string const & stuff) const
334 pimpl_->stuffClipboard(stuff);
338 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
339 BufferView::UpdateCodes uc2)
341 return static_cast<BufferView::UpdateCodes>
342 (static_cast<int>(uc1) | static_cast<int>(uc2));