]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
minimal effort implementation of:
[lyx.git] / src / BufferView.C
index cbe6a33ef94acb1eb22a09c23d2499694a77b7cd..6c8f4bce793a55d69841219884feb0b52f52100a 100644 (file)
@@ -20,7 +20,6 @@
 #include "bufferlist.h"
 #include "bufferparams.h"
 #include "BufferView_pimpl.h"
-#include "CutAndPaste.h"
 #include "coordcache.h"
 #include "debug.h"
 #include "funcrequest.h"
 #include "texrow.h"
 #include "undo.h"
 #include "WordLangTuple.h"
+#include "metricsinfo.h"
 
 #include "frontends/Alert.h"
+#include "frontends/Clipboard.h"
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
-#include "frontends/screen.h"
-#include "frontends/WorkArea.h"
 
 #include "insets/insetcommand.h" // ChangeRefs
 #include "insets/insettext.h"
 
-using lyx::support::bformat;
 
-using lyx::cap::setSelectionRange;
+using lyx::support::bformat;
 
 using std::distance;
 using std::find;
@@ -60,8 +58,8 @@ using std::vector;
 extern BufferList bufferlist;
 
 
-BufferView::BufferView(LyXView * owner, int width, int height)
-       : pimpl_(new Pimpl(*this, owner, width, height))
+BufferView::BufferView(LyXView * owner)
+       : pimpl_(new Pimpl(*this, owner))
 {}
 
 
@@ -83,36 +81,18 @@ Buffer * BufferView::buffer() const
 }
 
 
-LyXScreen & BufferView::screen() const
-{
-       return pimpl_->screen();
-}
-
-
 LyXView * BufferView::owner() const
 {
        return pimpl_->owner_;
 }
 
 
-Painter & BufferView::painter() const
-{
-       return pimpl_->painter();
-}
-
-
 void BufferView::setBuffer(Buffer * b)
 {
        pimpl_->setBuffer(b);
 }
 
 
-void BufferView::newFile(string const & fn, string const & tn, bool named)
-{
-       pimpl_->newFile(fn, tn, named);
-}
-
-
 bool BufferView::loadLyXFile(string const & fn, bool tl)
 {
        return pimpl_->loadLyXFile(fn, tl);
@@ -140,9 +120,9 @@ bool BufferView::fitCursor()
 }
 
 
-void BufferView::update(Update::flags flags)
+bool BufferView::update(Update::flags flags)
 {
-       pimpl_->update(flags);
+       return pimpl_->update(flags);
 }
 
 
@@ -152,12 +132,24 @@ void BufferView::updateScrollbar()
 }
 
 
+ScrollbarParameters const & BufferView::scrollbarParameters() const
+{
+       return pimpl_->scrollbarParameters();
+}
+
+
 void BufferView::scrollDocView(int value)
 {
        pimpl_->scrollDocView(value);
 }
 
 
+void BufferView::setCursorFromScrollbar()
+{
+       pimpl_->setCursorFromScrollbar();
+}
+
+
 bool BufferView::available() const
 {
        return pimpl_->available();
@@ -200,7 +192,7 @@ void BufferView::switchKeyMap()
 
 int BufferView::workWidth() const
 {
-       return pimpl_->workarea().workWidth();
+       return pimpl_->width();
 }
 
 
@@ -210,18 +202,6 @@ void BufferView::center()
 }
 
 
-string const BufferView::getClipboard() const
-{
-       return pimpl_->workarea().getClipboard();
-}
-
-
-void BufferView::stuffClipboard(string const & stuff) const
-{
-       pimpl_->stuffClipboard(stuff);
-}
-
-
 FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 {
        return pimpl_->getStatus(cmd);
@@ -236,31 +216,25 @@ bool BufferView::dispatch(FuncRequest const & ev)
 
 void BufferView::selectionRequested()
 {
-        pimpl_->selectionRequested();
+       pimpl_->selectionRequested();
 }
 
 
 void BufferView::selectionLost()
 {
-        pimpl_->selectionLost();
-}
-
-
-void BufferView::workAreaResize()
-{
-        pimpl_->workAreaResize();
+       pimpl_->selectionLost();
 }
 
 
-void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state)
+void BufferView::workAreaResize(int width, int height)
 {
-        pimpl_->workAreaKeyPress(key, state);
+       pimpl_->workAreaResize(width, height);
 }
 
 
 bool BufferView::workAreaDispatch(FuncRequest const & ev)
 {
-        return pimpl_->workAreaDispatch(ev);
+       return pimpl_->workAreaDispatch(ev);
 }
 
 
@@ -270,23 +244,6 @@ void BufferView::scroll(int lines)
 }
 
 
-void BufferView::showErrorList(string const & action) const
-{
-       if (getErrorList().size()) {
-               string const title = bformat(_("%1$s Errors (%2$s)"),
-                       action, buffer()->fileName());
-               owner()->getDialogs().show("errorlist", title);
-               pimpl_->errorlist_.clear();
-       }
-}
-
-
-ErrorList const & BufferView::getErrorList() const
-{
-       return pimpl_->errorlist_;
-}
-
-
 void BufferView::setCursorFromRow(int row)
 {
        int tmpid = -1;
@@ -315,11 +272,6 @@ void BufferView::gotoLabel(string const & label)
 }
 
 
-void BufferView::hideCursor()
-{
-       screen().hideCursor();
-}
-
 LyXText * BufferView::getLyXText()
 {
        LyXText * text = cursor().innerText();
@@ -336,15 +288,9 @@ LyXText const * BufferView::getLyXText() const
 }
 
 
-void BufferView::haveSelection(bool sel)
-{
-       pimpl_->workarea().haveSelection(sel);
-}
-
-
 int BufferView::workHeight() const
 {
-       return pimpl_->workarea().workHeight();
+       return pimpl_->height();
 }
 
 
@@ -370,11 +316,13 @@ void BufferView::mouseSetCursor(LCursor & cur)
        BOOST_ASSERT(&cur.bv() == this);
 
        // Has the cursor just left the inset?
+       bool badcursor = false;
        if (&cursor().inset() != &cur.inset())
-               cursor().inset().notifyCursorLeaves(cursor());
+               badcursor = cursor().inset().notifyCursorLeaves(cursor());
 
        // do the dEPM magic if needed
-       if (cursor().inTexted())
+       // FIXME: move this to InsetText::notifyCursorLeaves?
+       if (!badcursor && cursor().inTexted())
                cursor().text()->deleteEmptyParagraphMechanism(cur, cursor());
 
        cursor() = cur;
@@ -402,18 +350,6 @@ void BufferView::putSelectionAt(DocIterator const & cur,
 }
 
 
-bool const BufferView::repaintAll() const
-{
-       return pimpl_->repaintAll();
-}
-
-
-void const BufferView::repaintAll(bool r) const
-{
-       pimpl_->repaintAll(r);
-}
-
-
 LCursor & BufferView::cursor()
 {
        return pimpl_->cursor_;
@@ -436,3 +372,15 @@ int BufferView::offset_ref() const
 {
        return pimpl_->offset_ref_;
 }
+
+
+ViewMetricsInfo const & BufferView::viewMetricsInfo()
+{
+       return pimpl_->viewMetricsInfo();
+}
+
+
+void BufferView::updateMetrics(bool singlepar)
+{
+       pimpl_->updateMetrics(singlepar);
+}