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 LyXView * BufferView::owner() const
56 return pimpl_->owner_;
60 void BufferView::pushIntoUpdateList(Inset * i)
62 pimpl_->updatelist.push(i);
66 Painter & BufferView::painter()
68 return pimpl_->painter();
72 void BufferView::buffer(Buffer * b)
78 void BufferView::resize(int xpos, int ypos, int width, int height)
80 pimpl_->resize(xpos, ypos, width, height);
84 void BufferView::resize()
90 void BufferView::redraw()
96 void BufferView::fitCursor()
102 void BufferView::update()
108 void BufferView::updateScrollbar()
110 pimpl_->updateScrollbar();
114 void BufferView::redoCurrentBuffer()
116 pimpl_->redoCurrentBuffer();
120 int BufferView::resizeCurrentBuffer()
122 return pimpl_->resizeCurrentBuffer();
126 void BufferView::gotoError()
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 /// Single-click on work area
158 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
160 pimpl_->workAreaButtonPress(xpos, ypos, button);
164 void BufferView::doubleClick(int x, int y, unsigned int button)
166 pimpl_->doubleClick(x, y, button);
170 void BufferView::tripleClick(int x, int y, unsigned int button)
172 pimpl_->tripleClick(x, y, button);
176 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
178 pimpl_->workAreaButtonRelease(x, y, button);
182 void BufferView::workAreaExpose()
184 pimpl_->workAreaExpose();
188 void BufferView::cursorPrevious()
190 pimpl_->cursorPrevious();
194 void BufferView::cursorNext()
196 pimpl_->cursorNext();
200 bool BufferView::available() const
202 return pimpl_->available();
206 void BufferView::beforeChange()
208 pimpl_->beforeChange();
212 void BufferView::savePosition()
214 pimpl_->savePosition();
218 void BufferView::restorePosition()
220 pimpl_->restorePosition();
224 bool BufferView::NoSavedPositions()
226 return pimpl_->NoSavedPositions();
230 void BufferView::update(UpdateCodes f)
236 void BufferView::setState()
242 void BufferView::insetSleep()
244 pimpl_->insetSleep();
248 void BufferView::insetWakeup()
250 pimpl_->insetWakeup();
254 void BufferView::insetUnlock()
256 pimpl_->insetUnlock();
260 bool BufferView::focus() const
262 return pimpl_->focus();
266 void BufferView::focus(bool f)
272 bool BufferView::active() const
274 return pimpl_->active();
278 int BufferView::workWidth() const
280 return pimpl_->workarea_->workWidth();
284 bool BufferView::belowMouse() const
286 return pimpl_->belowMouse();
290 void BufferView::showCursor()
292 pimpl_->showCursor();
296 void BufferView::hideCursor()
298 pimpl_->hideCursor();
302 void BufferView::toggleSelection(bool b)
304 pimpl_->toggleSelection(b);
308 void BufferView::toggleToggle()
310 pimpl_->toggleToggle();
314 void BufferView::center()
320 void BufferView::pasteClipboard(bool asPara)
322 pimpl_->pasteClipboard(asPara);
326 void BufferView::stuffClipboard(string const & stuff) const
328 pimpl_->stuffClipboard(stuff);
332 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
333 BufferView::UpdateCodes uc2)
335 return static_cast<BufferView::UpdateCodes>
336 (static_cast<int>(uc1) | static_cast<int>(uc2));