]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/LyXView.C
Extracted from r14281
[lyx.git] / src / frontends / LyXView.C
index 7f53e0ed5e95fb7ff608ca66ee307def77e773c4..7cf2a058872ab425c93c0f3bdce2a808864eaa4e 100644 (file)
@@ -17,6 +17,7 @@
 #include "Timeout.h"
 #include "Toolbars.h"
 #include "Menubar.h"
+#include "WorkArea.h"
 
 #include "buffer.h"
 #include "bufferparams.h"
@@ -48,6 +49,7 @@
 #endif
 
 using lyx::frontend::Gui;
+using lyx::frontend::WorkArea;
 
 using lyx::support::makeDisplayPath;
 using lyx::support::onlyFilename;
@@ -64,27 +66,35 @@ Gui & LyXView::gui()
        return owner_;
 }
 
+
 LyXView::LyXView(Gui & owner)
-       : owner_(owner),
+       : work_area_(0),
+         owner_(owner),
          toolbars_(new Toolbars(*this)),
          intl_(new Intl),
          autosave_timeout_(new Timeout(5000)),
          lyxfunc_(new LyXFunc(this)),
          dialogs_(new Dialogs(*this)),
-         controlcommand_(new ControlCommandBuffer(*this)),
-         bufferview_(0)
+         controlcommand_(new ControlCommandBuffer(*this))
 {
        lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
 }
 
-void LyXView::setBufferView(BufferView * buffer_view)
+
+LyXView::~LyXView()
 {
-       bufferview_ = buffer_view;
 }
 
 
-LyXView::~LyXView()
+void LyXView::setWorkArea(WorkArea * work_area)
+{
+       work_area_ = work_area;
+}
+
+
+void LyXView::redrawWorkArea()
 {
+       work_area_->redraw();
 }
 
 
@@ -106,13 +116,13 @@ void LyXView::init()
 
 Buffer * LyXView::buffer() const
 {
-       return bufferview_->buffer();
+       return work_area_->bufferView().buffer();
 }
 
 
 BufferView * LyXView::view() const
 {
-       return bufferview_;
+       return &work_area_->bufferView();
 }
 
 
@@ -124,7 +134,7 @@ void LyXView::setLayout(string const & layout)
 
 void LyXView::updateToolbars()
 {
-       bool const math = bufferview_->cursor().inMathed();
+       bool const math = work_area_->bufferView().cursor().inMathed();
        bool const table =
                getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
        toolbars_->update(math, table);
@@ -171,11 +181,11 @@ void LyXView::updateLayoutChoice()
                current_layout = buffer()->params().getLyXTextClass().defaultLayoutName();
        }
 
-       if (bufferview_->cursor().inMathed())
+       if (work_area_->bufferView().cursor().inMathed())
                return;
 
        string const & layout =
-               bufferview_->cursor().paragraph().layout()->name();
+               work_area_->bufferView().cursor().paragraph().layout()->name();
 
        if (layout != current_layout) {
                toolbars_->setLayout(layout);
@@ -221,9 +231,9 @@ Buffer const * const LyXView::updateInset(InsetBase const * inset) const
 {
        Buffer const * buffer_ptr = 0;
        if (inset) {
-               buffer_ptr = bufferview_->buffer();
+               buffer_ptr = work_area_->bufferView().buffer();
                // No FitCursor:
-               bufferview_->update(Update::Force);
+               work_area_->bufferView().update(Update::Force);
        }
        return buffer_ptr;
 }