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 void BufferView::cursorPrevious(LyXText * text)
127 pimpl_->cursorPrevious(text);
131 void BufferView::cursorNext(LyXText * text)
133 pimpl_->cursorNext(text);
137 bool BufferView::available() const
139 return pimpl_->available();
143 void BufferView::beforeChange(LyXText * text)
145 pimpl_->beforeChange(text);
149 void BufferView::finishChange(bool fitcur)
151 pimpl_->finishChange(fitcur);
155 void BufferView::savePosition(unsigned int i)
157 pimpl_->savePosition(i);
161 void BufferView::restorePosition(unsigned int i)
163 pimpl_->restorePosition(i);
167 bool BufferView::isSavedPosition(unsigned int i)
169 return pimpl_->isSavedPosition(i);
173 void BufferView::update(LyXText * text, UpdateCodes f)
175 pimpl_->update(text, f);
179 void BufferView::switchKeyMap()
181 pimpl_->switchKeyMap();
185 void BufferView::insetUnlock()
187 pimpl_->insetUnlock();
191 int BufferView::workWidth() const
193 return pimpl_->workarea().workWidth();
197 void BufferView::showCursor()
199 pimpl_->showCursor();
203 void BufferView::hideCursor()
205 pimpl_->hideCursor();
209 void BufferView::toggleSelection(bool b)
211 pimpl_->toggleSelection(b);
215 void BufferView::toggleToggle()
217 pimpl_->toggleToggle();
221 void BufferView::center()
227 void BufferView::pasteClipboard(bool asPara)
229 pimpl_->pasteClipboard(asPara);
233 string const BufferView::getClipboard() const
235 return pimpl_->workarea().getClipboard();
239 void BufferView::stuffClipboard(string const & stuff) const
241 pimpl_->stuffClipboard(stuff);
245 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
246 BufferView::UpdateCodes uc2)
248 return static_cast<BufferView::UpdateCodes>
249 (static_cast<int>(uc1) | static_cast<int>(uc2));
253 bool BufferView::dispatch(FuncRequest const & ev)
255 return pimpl_->dispatch(ev);
259 void BufferView::moveCursorUpdate(bool selecting, bool fitcur = true)
261 pimpl_->moveCursorUpdate(selecting, fitcur);
265 void BufferView::message(string const & msg) const
267 owner()->message(msg);