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()
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();
202 void BufferView::cursorPrevious(LyXText * text)
204 pimpl_->cursorPrevious(text);
208 void BufferView::cursorNext(LyXText * text)
210 pimpl_->cursorNext(text);
214 bool BufferView::available() const
216 return pimpl_->available();
220 void BufferView::beforeChange()
222 pimpl_->beforeChange();
226 void BufferView::savePosition()
228 pimpl_->savePosition();
232 void BufferView::restorePosition()
234 pimpl_->restorePosition();
238 bool BufferView::NoSavedPositions()
240 return pimpl_->NoSavedPositions();
244 void BufferView::update(UpdateCodes f)
250 void BufferView::setState()
256 void BufferView::insetSleep()
258 pimpl_->insetSleep();
262 void BufferView::insetWakeup()
264 pimpl_->insetWakeup();
268 void BufferView::insetUnlock()
270 pimpl_->insetUnlock();
274 bool BufferView::focus() const
276 return pimpl_->focus();
280 void BufferView::focus(bool f)
286 bool BufferView::active() const
288 return pimpl_->active();
292 int BufferView::workWidth() const
294 return pimpl_->workarea_->workWidth();
298 bool BufferView::belowMouse() const
300 return pimpl_->belowMouse();
304 void BufferView::showCursor()
306 pimpl_->showCursor();
310 void BufferView::hideCursor()
312 pimpl_->hideCursor();
316 void BufferView::toggleSelection(bool b)
318 pimpl_->toggleSelection(b);
322 void BufferView::toggleToggle()
324 pimpl_->toggleToggle();
328 void BufferView::center()
334 void BufferView::pasteClipboard(bool asPara)
336 pimpl_->pasteClipboard(asPara);
340 void BufferView::stuffClipboard(string const & stuff) const
342 pimpl_->stuffClipboard(stuff);
346 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
347 BufferView::UpdateCodes uc2)
349 return static_cast<BufferView::UpdateCodes>
350 (static_cast<int>(uc1) | static_cast<int>(uc2));