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"
24 BufferView::BufferView(LyXView * o, int xpos, int ypos,
25 int width, int height)
26 : pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
29 the_locking_inset = 0;
34 BufferView::~BufferView()
41 Buffer * BufferView::buffer() const
43 return pimpl_->buffer_;
47 LyXView * BufferView::owner() const
49 return pimpl_->owner_;
53 void BufferView::pushIntoUpdateList(Inset * i)
55 pimpl_->updatelist.push(i);
59 Painter & BufferView::painter()
61 return pimpl_->painter();
65 void BufferView::buffer(Buffer * b)
71 void BufferView::resize(int xpos, int ypos, int width, int height)
73 pimpl_->resize(xpos, ypos, width, height);
77 void BufferView::resize()
83 void BufferView::redraw()
89 void BufferView::fitCursor()
95 void BufferView::update()
101 void BufferView::updateScrollbar()
103 pimpl_->updateScrollbar();
107 void BufferView::redoCurrentBuffer()
109 pimpl_->redoCurrentBuffer();
113 int BufferView::resizeCurrentBuffer()
115 return pimpl_->resizeCurrentBuffer();
119 void BufferView::gotoError()
125 void BufferView::enterView()
131 void BufferView::leaveView()
137 // Callback for scrollbar slider
138 void BufferView::scrollCB(double value)
140 pimpl_->scrollCB(value);
144 void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
146 pimpl_->workAreaMotionNotify(x, y, state);
150 /// Single-click on work area
151 void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
153 pimpl_->workAreaButtonPress(xpos, ypos, button);
157 void BufferView::doubleClick(int x, int y, unsigned int button)
159 pimpl_->doubleClick(x, y, button);
163 void BufferView::tripleClick(int x, int y, unsigned int button)
165 pimpl_->tripleClick(x, y, button);
169 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
171 pimpl_->workAreaButtonRelease(x, y, button);
175 void BufferView::workAreaExpose()
177 pimpl_->workAreaExpose();
181 // // Callback for cursor timer
182 void BufferView::cursorToggleCB(void * ob)
184 BufferView * view = static_cast<BufferView*>(ob);
185 view->pimpl_->cursorToggle();
189 void BufferView::cursorPrevious()
191 pimpl_->cursorPrevious();
195 void BufferView::cursorNext()
197 pimpl_->cursorNext();
201 bool BufferView::available() const
203 return pimpl_->available();
207 void BufferView::beforeChange()
209 pimpl_->beforeChange();
213 void BufferView::savePosition()
215 pimpl_->savePosition();
219 void BufferView::restorePosition()
221 pimpl_->restorePosition();
225 bool BufferView::NoSavedPositions()
227 return pimpl_->NoSavedPositions();
231 void BufferView::update(UpdateCodes f)
237 void BufferView::setState()
243 void BufferView::insetSleep()
245 pimpl_->insetSleep();
249 void BufferView::insetWakeup()
251 pimpl_->insetWakeup();
255 void BufferView::insetUnlock()
257 pimpl_->insetUnlock();
261 bool BufferView::focus() const
263 return pimpl_->focus();
267 void BufferView::focus(bool f)
273 bool BufferView::active() const
275 return pimpl_->active();
279 int BufferView::workWidth() const
281 return pimpl_->workarea_->workWidth();
285 bool BufferView::belowMouse() const
287 return pimpl_->belowMouse();
291 void BufferView::showCursor()
293 pimpl_->showCursor();
297 void BufferView::hideCursor()
299 pimpl_->hideCursor();
303 void BufferView::toggleSelection(bool b)
305 pimpl_->toggleSelection(b);
309 void BufferView::toggleToggle()
311 pimpl_->toggleToggle();
315 void BufferView::center()
321 void BufferView::pasteClipboard(bool asPara)
323 pimpl_->pasteClipboard(asPara);
327 void BufferView::stuffClipboard(string const & stuff) const
329 pimpl_->stuffClipboard(stuff);
333 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
334 BufferView::UpdateCodes uc2)
336 return static_cast<BufferView::UpdateCodes>
337 (static_cast<int>(uc1) | static_cast<int>(uc2));