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))
34 BufferView::~BufferView()
41 Buffer * BufferView::buffer() const
43 return pimpl_->buffer_;
47 LyXScreen * BufferView::screen() const
49 return pimpl_->screen_;
53 WorkArea * BufferView::workarea() const
55 return pimpl_->workarea_;
59 LyXView * BufferView::owner() const
61 return pimpl_->owner_;
65 void BufferView::pushIntoUpdateList(Inset * i)
67 pimpl_->updatelist.push(i);
71 Painter & BufferView::painter()
73 return pimpl_->painter();
77 void BufferView::buffer(Buffer * b)
83 void BufferView::resize(int xpos, int ypos, int width, int height)
85 pimpl_->resize(xpos, ypos, width, height);
89 void BufferView::resize()
95 void BufferView::redraw()
101 void BufferView::fitCursor(LyXText * text)
103 pimpl_->fitCursor(text);
107 void BufferView::update()
113 void BufferView::updateScrollbar()
115 pimpl_->updateScrollbar();
119 Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y,
122 return pimpl_->checkInsetHit(text, x, y, button);
126 void BufferView::redoCurrentBuffer()
128 pimpl_->redoCurrentBuffer();
132 int BufferView::resizeCurrentBuffer()
134 return pimpl_->resizeCurrentBuffer();
138 void BufferView::gotoError()
144 void BufferView::enterView()
150 void BufferView::leaveView()
156 // Callback for scrollbar slider
157 void BufferView::scrollCB(double value)
159 pimpl_->scrollCB(value);
163 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
165 pimpl_->workAreaMotionNotify(x, y, state);
169 /// Single-click on work area
170 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
172 pimpl_->workAreaButtonPress(xpos, ypos, button);
176 void BufferView::doubleClick(int x, int y, unsigned int button)
178 pimpl_->doubleClick(x, y, button);
182 void BufferView::tripleClick(int x, int y, unsigned int button)
184 pimpl_->tripleClick(x, y, button);
188 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
190 pimpl_->workAreaButtonRelease(x, y, button);
194 void BufferView::workAreaExpose()
196 pimpl_->workAreaExpose();
200 void BufferView::cursorPrevious(LyXText * text)
202 pimpl_->cursorPrevious(text);
206 void BufferView::cursorNext(LyXText * text)
208 pimpl_->cursorNext(text);
212 bool BufferView::available() const
214 return pimpl_->available();
218 void BufferView::beforeChange()
220 pimpl_->beforeChange();
224 void BufferView::savePosition()
226 pimpl_->savePosition();
230 void BufferView::restorePosition()
232 pimpl_->restorePosition();
236 bool BufferView::NoSavedPositions()
238 return pimpl_->NoSavedPositions();
242 void BufferView::update(UpdateCodes f)
248 void BufferView::setState()
254 void BufferView::insetSleep()
256 pimpl_->insetSleep();
260 void BufferView::insetWakeup()
262 pimpl_->insetWakeup();
266 void BufferView::insetUnlock()
268 pimpl_->insetUnlock();
272 bool BufferView::focus() const
274 return pimpl_->focus();
278 void BufferView::focus(bool f)
284 bool BufferView::active() const
286 return pimpl_->active();
290 int BufferView::workWidth() const
292 return pimpl_->workarea_->workWidth();
296 bool BufferView::belowMouse() const
298 return pimpl_->belowMouse();
302 void BufferView::showCursor()
304 pimpl_->showCursor();
308 void BufferView::hideCursor()
310 pimpl_->hideCursor();
314 void BufferView::toggleSelection(bool b)
316 pimpl_->toggleSelection(b);
320 void BufferView::toggleToggle()
322 pimpl_->toggleToggle();
326 void BufferView::center()
332 void BufferView::pasteClipboard(bool asPara)
334 pimpl_->pasteClipboard(asPara);
338 void BufferView::stuffClipboard(string const & stuff) const
340 pimpl_->stuffClipboard(stuff);
344 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
345 BufferView::UpdateCodes uc2)
347 return static_cast<BufferView::UpdateCodes>
348 (static_cast<int>(uc1) | static_cast<int>(uc2));