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_.get();
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 void BufferView::scrollCB(double value)
121 pimpl_->scrollCB(value);
125 Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y,
128 return pimpl_->checkInsetHit(text, x, y, button);
132 void BufferView::redoCurrentBuffer()
134 pimpl_->redoCurrentBuffer();
138 int BufferView::resizeCurrentBuffer()
140 return pimpl_->resizeCurrentBuffer();
144 void BufferView::cursorPrevious(LyXText * text)
146 pimpl_->cursorPrevious(text);
150 void BufferView::cursorNext(LyXText * text)
152 pimpl_->cursorNext(text);
156 bool BufferView::available() const
158 return pimpl_->available();
162 void BufferView::beforeChange(LyXText * text)
164 pimpl_->beforeChange(text);
168 void BufferView::savePosition(unsigned int i)
170 pimpl_->savePosition(i);
174 void BufferView::restorePosition(unsigned int i)
176 pimpl_->restorePosition(i);
180 bool BufferView::isSavedPosition(unsigned int i)
182 return pimpl_->isSavedPosition(i);
186 void BufferView::update(LyXText * text, UpdateCodes f)
188 pimpl_->update(text, f);
192 void BufferView::setState()
198 void BufferView::insetSleep()
200 pimpl_->insetSleep();
204 void BufferView::insetWakeup()
206 pimpl_->insetWakeup();
210 void BufferView::insetUnlock()
212 pimpl_->insetUnlock();
216 bool BufferView::focus() const
218 return pimpl_->focus();
222 void BufferView::focus(bool f)
228 bool BufferView::active() const
230 return pimpl_->active();
234 int BufferView::workWidth() const
236 return pimpl_->workarea_.workWidth();
240 bool BufferView::belowMouse() const
242 return pimpl_->belowMouse();
246 void BufferView::showCursor()
248 pimpl_->showCursor();
252 void BufferView::hideCursor()
254 pimpl_->hideCursor();
258 void BufferView::toggleSelection(bool b)
260 pimpl_->toggleSelection(b);
264 void BufferView::toggleToggle()
266 pimpl_->toggleToggle();
270 void BufferView::center()
276 void BufferView::pasteClipboard(bool asPara)
278 pimpl_->pasteClipboard(asPara);
282 void BufferView::stuffClipboard(string const & stuff) const
284 pimpl_->stuffClipboard(stuff);
288 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
289 BufferView::UpdateCodes uc2)
291 return static_cast<BufferView::UpdateCodes>
292 (static_cast<int>(uc1) | static_cast<int>(uc2));
295 bool BufferView::Dispatch(kb_action action, string const & argument)
297 return pimpl_->Dispatch(action, argument);