3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
7 * \author John Levon <moz@compsoc.man.ac.uk>
13 #pragma implementation
16 #include "BufferView.h"
17 #include "BufferView_pimpl.h"
19 #include "frontends/screen.h"
20 #include "frontends/WorkArea.h"
21 #include "frontends/LyXView.h"
24 BufferView::BufferView(LyXView * owner, int xpos, int ypos,
25 int width, int height)
26 : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height))
32 BufferView::~BufferView()
39 Buffer * BufferView::buffer() const
41 return pimpl_->buffer_;
45 LyXScreen & BufferView::screen() const
47 return pimpl_->screen();
51 WorkArea & BufferView::workarea() const
53 return pimpl_->workarea();
57 LyXView * BufferView::owner() const
59 return pimpl_->owner_;
63 Painter & BufferView::painter() const
65 return pimpl_->painter();
69 void BufferView::buffer(Buffer * b)
75 void BufferView::resize()
77 if (pimpl_->buffer_) {
78 pimpl_->resizeCurrentBuffer();
83 void BufferView::repaint()
89 bool BufferView::fitCursor()
91 return pimpl_->fitCursor();
95 void BufferView::update()
101 void BufferView::updateScrollbar()
103 pimpl_->updateScrollbar();
107 void BufferView::scrollDocView(int value)
109 pimpl_->scrollDocView(value);
113 Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y)
115 return pimpl_->checkInsetHit(text, x, y);
119 void BufferView::redoCurrentBuffer()
121 pimpl_->redoCurrentBuffer();
125 bool BufferView::available() const
127 return pimpl_->available();
131 void BufferView::beforeChange(LyXText * text)
133 pimpl_->beforeChange(text);
137 void BufferView::savePosition(unsigned int i)
139 pimpl_->savePosition(i);
143 void BufferView::restorePosition(unsigned int i)
145 pimpl_->restorePosition(i);
149 bool BufferView::isSavedPosition(unsigned int i)
151 return pimpl_->isSavedPosition(i);
155 void BufferView::update(LyXText * text, UpdateCodes f)
157 pimpl_->update(text, f);
161 void BufferView::switchKeyMap()
163 pimpl_->switchKeyMap();
167 void BufferView::insetUnlock()
169 pimpl_->insetUnlock();
173 int BufferView::workWidth() const
175 return pimpl_->workarea().workWidth();
179 void BufferView::showCursor()
181 pimpl_->showCursor();
185 void BufferView::hideCursor()
187 pimpl_->hideCursor();
191 void BufferView::toggleSelection(bool b)
193 pimpl_->toggleSelection(b);
197 void BufferView::toggleToggle()
199 pimpl_->toggleToggle();
203 void BufferView::center()
209 string const BufferView::getClipboard() const
211 return pimpl_->workarea().getClipboard();
215 void BufferView::stuffClipboard(string const & stuff) const
217 pimpl_->stuffClipboard(stuff);
221 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
222 BufferView::UpdateCodes uc2)
224 return static_cast<BufferView::UpdateCodes>
225 (static_cast<int>(uc1) | static_cast<int>(uc2));
229 bool BufferView::dispatch(FuncRequest const & ev)
231 return pimpl_->dispatch(ev);
235 void BufferView::moveCursorUpdate(bool selecting, bool fitcur)
237 pimpl_->moveCursorUpdate(selecting, fitcur);