]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
* remove various xforms relicts, in particular:
[lyx.git] / src / BufferView.C
index 5009b2961d6d336541f9a8c1bbfd65498368432c..f1c1834b1c24523ccbe437d3d69c161b1e5c78b2 100644 (file)
 #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 "frontends/Gui.h"
 
 #include "insets/insetcommand.h" // ChangeRefs
-#include "insets/updatableinset.h"
 #include "insets/insettext.h"
 
+
 using lyx::support::bformat;
 
 using lyx::cap::setSelectionRange;
@@ -55,15 +56,14 @@ using lyx::cap::setSelectionRange;
 using std::distance;
 using std::find;
 using std::string;
-using std::swap;
 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))
 {}
 
 
@@ -85,24 +85,12 @@ 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);
@@ -154,6 +142,12 @@ void BufferView::updateScrollbar()
 }
 
 
+ScrollbarParameters const & BufferView::scrollbarParameters() const
+{
+       return pimpl_->scrollbarParameters();
+}
+
+
 void BufferView::scrollDocView(int value)
 {
        pimpl_->scrollDocView(value);
@@ -189,6 +183,10 @@ bool BufferView::isSavedPosition(unsigned int i)
        return pimpl_->isSavedPosition(i);
 }
 
+void BufferView::saveSavedPositions()
+{
+       return pimpl_->saveSavedPositions();
+}
 
 void BufferView::switchKeyMap()
 {
@@ -198,7 +196,7 @@ void BufferView::switchKeyMap()
 
 int BufferView::workWidth() const
 {
-       return pimpl_->workarea().workWidth();
+       return pimpl_->width();
 }
 
 
@@ -208,27 +206,45 @@ void BufferView::center()
 }
 
 
-string const BufferView::getClipboard() const
+FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 {
-       return pimpl_->workarea().getClipboard();
+       return pimpl_->getStatus(cmd);
 }
 
 
-void BufferView::stuffClipboard(string const & stuff) const
+bool BufferView::dispatch(FuncRequest const & ev)
 {
-       pimpl_->stuffClipboard(stuff);
+       return pimpl_->dispatch(ev);
 }
 
 
-FuncStatus BufferView::getStatus(FuncRequest const & cmd)
+void BufferView::selectionRequested()
 {
-       return pimpl_->getStatus(cmd);
+       pimpl_->selectionRequested();
 }
 
 
-bool BufferView::dispatch(FuncRequest const & ev)
+void BufferView::selectionLost()
 {
-       return pimpl_->dispatch(ev);
+       pimpl_->selectionLost();
+}
+
+
+void BufferView::workAreaResize(int width, int height)
+{
+       pimpl_->workAreaResize(width, height);
+}
+
+
+void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state)
+{
+       pimpl_->workAreaKeyPress(key, state);
+}
+
+
+bool BufferView::workAreaDispatch(FuncRequest const & ev)
+{
+       return pimpl_->workAreaDispatch(ev);
 }
 
 
@@ -285,7 +301,7 @@ void BufferView::gotoLabel(string const & label)
 
 void BufferView::hideCursor()
 {
-       screen().hideCursor();
+       pimpl_->gui().guiCursor().hide();
 }
 
 LyXText * BufferView::getLyXText()
@@ -304,15 +320,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();
 }
 
 
@@ -333,6 +343,26 @@ void BufferView::setCursor(DocIterator const & dit)
 }
 
 
+void BufferView::mouseSetCursor(LCursor & cur)
+{
+       BOOST_ASSERT(&cur.bv() == this);
+
+       // Has the cursor just left the inset?
+       if (&cursor().inset() != &cur.inset())
+               cursor().inset().notifyCursorLeaves(cursor());
+
+       // do the dEPM magic if needed
+       if (cursor().inTexted())
+               cursor().text()->deleteEmptyParagraphMechanism(cur, cursor());
+
+       cursor() = cur;
+       cursor().clearSelection();
+       cursor().setTargetX();
+       finishUndo();
+
+}
+
+
 void BufferView::putSelectionAt(DocIterator const & cur,
                                int length, bool backwards)
 {
@@ -372,3 +402,9 @@ int BufferView::offset_ref() const
 {
        return pimpl_->offset_ref_;
 }
+
+
+ViewMetricsInfo const & BufferView::viewMetricsInfo()
+{
+       return pimpl_->viewMetricsInfo();
+}