2002-06-12 02:54:19 +00:00
|
|
|
/**
|
|
|
|
* \file BufferView.C
|
|
|
|
* Copyright 1995-2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2002-06-12 02:54:19 +00:00
|
|
|
* \author unknown
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "BufferView.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
#include "BufferView_pimpl.h"
|
2000-04-09 22:48:51 +00:00
|
|
|
#include "lyxtext.h"
|
2002-05-23 15:43:25 +00:00
|
|
|
#include "frontends/screen.h"
|
2002-06-11 22:38:49 +00:00
|
|
|
#include "frontends/WorkArea.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
1999-12-13 00:05:34 +00:00
|
|
|
BufferView::BufferView(LyXView * o, int xpos, int ypos,
|
1999-09-27 18:44:28 +00:00
|
|
|
int width, int height)
|
2000-04-08 17:02:02 +00:00
|
|
|
: pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
1999-12-10 00:07:59 +00:00
|
|
|
text = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-10 00:07:59 +00:00
|
|
|
BufferView::~BufferView()
|
|
|
|
{
|
|
|
|
delete text;
|
2000-04-08 17:02:02 +00:00
|
|
|
delete pimpl_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Buffer * BufferView::buffer() const
|
|
|
|
{
|
|
|
|
return pimpl_->buffer_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
LyXScreen & BufferView::screen() const
|
2000-06-19 15:33:58 +00:00
|
|
|
{
|
2002-06-11 23:47:58 +00:00
|
|
|
return pimpl_->screen();
|
2000-06-19 15:33:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
LyXView * BufferView::owner() const
|
|
|
|
{
|
|
|
|
return pimpl_->owner_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
Painter & BufferView::painter() const
|
2000-02-10 17:53:36 +00:00
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
return pimpl_->painter();
|
2000-02-10 17:53:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-13 00:05:34 +00:00
|
|
|
void BufferView::buffer(Buffer * b)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->buffer(b);
|
2000-02-10 17:53:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
void BufferView::resize()
|
|
|
|
{
|
2002-06-20 20:37:42 +00:00
|
|
|
pimpl_->resizeCurrentBuffer();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::redraw()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->redraw();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-29 15:49:45 +00:00
|
|
|
bool BufferView::fitCursor()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2002-03-29 15:49:45 +00:00
|
|
|
return pimpl_->fitCursor();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::update()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->update();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::updateScrollbar()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->updateScrollbar();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
void BufferView::scrollDocView(int value)
|
2001-02-19 16:01:31 +00:00
|
|
|
{
|
2002-06-12 15:01:32 +00:00
|
|
|
pimpl_->scrollDocView(value);
|
2001-02-19 16:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-17 14:25:04 +00:00
|
|
|
Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y)
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
2001-12-17 14:25:04 +00:00
|
|
|
return pimpl_->checkInsetHit(text, x, y);
|
2000-07-04 11:30:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
void BufferView::redoCurrentBuffer()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->redoCurrentBuffer();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-10 10:38:11 +00:00
|
|
|
void BufferView::cursorPrevious(LyXText * text)
|
2000-02-10 17:53:36 +00:00
|
|
|
{
|
2000-10-10 10:38:11 +00:00
|
|
|
pimpl_->cursorPrevious(text);
|
2000-02-10 17:53:36 +00:00
|
|
|
}
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
|
2000-10-10 10:38:11 +00:00
|
|
|
void BufferView::cursorNext(LyXText * text)
|
2000-02-10 17:53:36 +00:00
|
|
|
{
|
2000-10-10 10:38:11 +00:00
|
|
|
pimpl_->cursorNext(text);
|
2000-02-10 17:53:36 +00:00
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool BufferView::available() const
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
return pimpl_->available();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 10:11:22 +00:00
|
|
|
void BufferView::beforeChange(LyXText * text)
|
2000-01-07 03:42:16 +00:00
|
|
|
{
|
2001-02-14 10:11:22 +00:00
|
|
|
pimpl_->beforeChange(text);
|
2000-01-07 03:42:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-28 18:31:36 +00:00
|
|
|
void BufferView::savePosition(unsigned int i)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2001-01-28 18:31:36 +00:00
|
|
|
pimpl_->savePosition(i);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-28 18:31:36 +00:00
|
|
|
void BufferView::restorePosition(unsigned int i)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2001-01-28 18:31:36 +00:00
|
|
|
pimpl_->restorePosition(i);
|
2000-04-09 22:48:51 +00:00
|
|
|
}
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
|
2001-01-28 18:31:36 +00:00
|
|
|
bool BufferView::isSavedPosition(unsigned int i)
|
2000-06-05 15:12:09 +00:00
|
|
|
{
|
2001-01-28 18:31:36 +00:00
|
|
|
return pimpl_->isSavedPosition(i);
|
2000-06-05 15:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 08:38:21 +00:00
|
|
|
void BufferView::update(LyXText * text, UpdateCodes f)
|
1999-12-10 00:07:59 +00:00
|
|
|
{
|
2001-02-14 08:38:21 +00:00
|
|
|
pimpl_->update(text, f);
|
1999-12-10 00:07:59 +00:00
|
|
|
}
|
2000-01-06 02:44:26 +00:00
|
|
|
|
|
|
|
|
2000-02-17 19:59:08 +00:00
|
|
|
void BufferView::setState()
|
2000-02-04 09:38:32 +00:00
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->setState();
|
2000-02-03 19:51:27 +00:00
|
|
|
}
|
2000-01-07 03:42:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
void BufferView::insetUnlock()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->insetUnlock();
|
2000-01-07 03:42:16 +00:00
|
|
|
}
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int BufferView::workWidth() const
|
2000-02-25 12:06:15 +00:00
|
|
|
{
|
2002-06-11 22:38:49 +00:00
|
|
|
return pimpl_->workarea().workWidth();
|
2000-02-23 16:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-17 19:59:08 +00:00
|
|
|
void BufferView::showCursor()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->showCursor();
|
2000-02-17 19:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::hideCursor()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->hideCursor();
|
2000-02-17 19:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::toggleSelection(bool b)
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->toggleSelection(b);
|
2000-02-17 19:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BufferView::toggleToggle()
|
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->toggleToggle();
|
2000-02-17 19:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
void BufferView::center()
|
2000-02-17 19:59:08 +00:00
|
|
|
{
|
2000-04-09 22:48:51 +00:00
|
|
|
pimpl_->center();
|
2000-02-17 19:59:08 +00:00
|
|
|
}
|
2000-05-20 01:38:25 +00:00
|
|
|
|
|
|
|
|
2000-05-20 21:37:05 +00:00
|
|
|
void BufferView::pasteClipboard(bool asPara)
|
2000-05-20 01:38:25 +00:00
|
|
|
{
|
2000-05-20 21:37:05 +00:00
|
|
|
pimpl_->pasteClipboard(asPara);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-03 15:38:24 +00:00
|
|
|
string const BufferView::getClipboard() const
|
|
|
|
{
|
2002-06-11 22:38:49 +00:00
|
|
|
return pimpl_->workarea().getClipboard();
|
2001-05-03 15:38:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-20 21:37:05 +00:00
|
|
|
void BufferView::stuffClipboard(string const & stuff) const
|
|
|
|
{
|
|
|
|
pimpl_->stuffClipboard(stuff);
|
2000-05-20 01:38:25 +00:00
|
|
|
}
|
2000-06-12 11:27:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
|
|
|
|
BufferView::UpdateCodes uc2)
|
|
|
|
{
|
|
|
|
return static_cast<BufferView::UpdateCodes>
|
|
|
|
(static_cast<int>(uc1) | static_cast<int>(uc2));
|
|
|
|
}
|
2001-02-23 16:10:03 +00:00
|
|
|
|
|
|
|
bool BufferView::Dispatch(kb_action action, string const & argument)
|
|
|
|
{
|
2001-04-17 13:43:57 +00:00
|
|
|
return pimpl_->Dispatch(action, argument);
|
2001-02-23 16:10:03 +00:00
|
|
|
}
|