X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferView.C;h=68a19e76b251f04324946ce3636f14c56c201d4e;hb=98c966c64594611e469313314abd1e59524adb4a;hp=a8db202cfa1ee19e03e79b3b51f5c81cdf8558b4;hpb=f2044aeec772031b8e0d5ab5b26b3e810d93b0dd;p=lyx.git diff --git a/src/BufferView.C b/src/BufferView.C index a8db202cfa..68a19e76b2 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -1,11 +1,10 @@ -// -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -18,6 +17,7 @@ #include "BufferView.h" #include "BufferView_pimpl.h" #include "lyxtext.h" +#include "lyxscreen.h" BufferView::BufferView(LyXView * o, int xpos, int ypos, @@ -25,8 +25,6 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos, : pimpl_(new Pimpl(this, o, xpos, ypos, width, height)) { text = 0; - the_locking_inset = 0; - inset_slept = false; } @@ -43,19 +41,19 @@ Buffer * BufferView::buffer() const } -LyXView * BufferView::owner() const +LyXScreen * BufferView::screen() const { - return pimpl_->owner_; + return pimpl_->screen_.get(); } -void BufferView::pushIntoUpdateList(Inset * i) +LyXView * BufferView::owner() const { - pimpl_->updatelist.push(i); + return pimpl_->owner_; } -Painter & BufferView::painter() +Painter & BufferView::painter() { return pimpl_->painter(); } @@ -85,9 +83,9 @@ void BufferView::redraw() } -void BufferView::fitCursor() +bool BufferView::fitCursor() { - pimpl_->fitCursor(); + return pimpl_->fitCursor(); } @@ -103,140 +101,39 @@ void BufferView::updateScrollbar() } -void BufferView::redoCurrentBuffer() -{ - pimpl_->redoCurrentBuffer(); -} - - -int BufferView::resizeCurrentBuffer() -{ - return pimpl_->resizeCurrentBuffer(); -} - - -void BufferView::gotoError() -{ - pimpl_->gotoError(); -} - - -extern "C" { - void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf) - { - BufferView::cursorToggleCB(ob, buf); - } -} - - -// Callback for scrollbar up button -void BufferView::upCB(long time, int button) -{ - if (pimpl_->buffer_ == 0) return; - - switch (button) { - case 3: - pimpl_->scrollUpOnePage(); - break; - case 2: - pimpl_->scrollDownOnePage(); - break; - default: - pimpl_->scrollUp(time); - break; - } -} - - -void BufferView::enterView() -{ - pimpl_->enterView(); -} - - -void BufferView::leaveView() -{ - pimpl_->leaveView(); -} - - -// Callback for scrollbar slider void BufferView::scrollCB(double value) { pimpl_->scrollCB(value); } -// Callback for scrollbar down button -void BufferView::downCB(long time, int button) +Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y) { - pimpl_->downCB(time, button); + return pimpl_->checkInsetHit(text, x, y); } -void BufferView::workAreaMotionNotify(int x, int y, unsigned int state) -{ - pimpl_->workAreaMotionNotify(x, y, state); -} - - -extern int bibitemMaxWidth(Painter &, LyXFont const &); - - -/// Single-click on work area -void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button) -{ - pimpl_->workAreaButtonPress(xpos, ypos, button); -} - - -void BufferView::doubleClick(int x, int y, unsigned int button) -{ - pimpl_->doubleClick(x, y, button); -} - - -void BufferView::tripleClick(int x, int y, unsigned int button) -{ - pimpl_->tripleClick(x, y, button); -} - - -void BufferView::workAreaButtonRelease(int x, int y, unsigned int button) -{ - pimpl_->workAreaButtonRelease(x, y, button); -} - - -void BufferView::workAreaExpose() -{ - pimpl_->workAreaExpose(); -} - - -// // Callback for cursor timer -void BufferView::cursorToggleCB(FL_OBJECT * ob, long ) +void BufferView::redoCurrentBuffer() { - BufferView * view = static_cast(ob->u_vdata); - view->pimpl_->cursorToggle(); + pimpl_->redoCurrentBuffer(); } -void BufferView::workAreaSelectionNotify(Window win, XEvent * event) +int BufferView::resizeCurrentBuffer() { - pimpl_->workAreaSelectionNotify(win, event); + return pimpl_->resizeCurrentBuffer(); } -void BufferView::cursorPrevious() +void BufferView::cursorPrevious(LyXText * text) { - pimpl_->cursorPrevious(); + pimpl_->cursorPrevious(text); } -void BufferView::cursorNext() +void BufferView::cursorNext(LyXText * text) { - pimpl_->cursorNext(); + pimpl_->cursorNext(text); } @@ -246,33 +143,33 @@ bool BufferView::available() const } -void BufferView::beforeChange() +void BufferView::beforeChange(LyXText * text) { - pimpl_->beforeChange(); + pimpl_->beforeChange(text); } -void BufferView::savePosition() +void BufferView::savePosition(unsigned int i) { - pimpl_->savePosition(); + pimpl_->savePosition(i); } -void BufferView::restorePosition() +void BufferView::restorePosition(unsigned int i) { - pimpl_->restorePosition(); + pimpl_->restorePosition(i); } -void BufferView::update(signed char f) +bool BufferView::isSavedPosition(unsigned int i) { - pimpl_->update(f); + return pimpl_->isSavedPosition(i); } -void BufferView::smallUpdate(signed char f) +void BufferView::update(LyXText * text, UpdateCodes f) { - pimpl_->smallUpdate(f); + pimpl_->update(text, f); } @@ -302,29 +199,29 @@ void BufferView::insetUnlock() bool BufferView::focus() const { - return pimpl_->focus(); + return pimpl_->focus(); } void BufferView::focus(bool f) { - pimpl_->focus(f); + pimpl_->focus(f); } bool BufferView::active() const { - return pimpl_->active(); + return pimpl_->active(); } -unsigned short BufferView::paperWidth() const +int BufferView::workWidth() const { - return text->paperWidth(); + return pimpl_->workarea_.workWidth(); } -bool BufferView::belowMouse() const +bool BufferView::belowMouse() const { return pimpl_->belowMouse(); } @@ -354,7 +251,38 @@ void BufferView::toggleToggle() } -void BufferView::center() +void BufferView::center() { pimpl_->center(); } + + +void BufferView::pasteClipboard(bool asPara) +{ + pimpl_->pasteClipboard(asPara); +} + + +string const BufferView::getClipboard() const +{ + return pimpl_->workarea_.getClipboard(); +} + + +void BufferView::stuffClipboard(string const & stuff) const +{ + pimpl_->stuffClipboard(stuff); +} + + +BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1, + BufferView::UpdateCodes uc2) +{ + return static_cast + (static_cast(uc1) | static_cast(uc2)); +} + +bool BufferView::Dispatch(kb_action action, string const & argument) +{ + return pimpl_->Dispatch(action, argument); +}