]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
small simplification
[lyx.git] / src / Buffer.cpp
index c7dd9cdebed5e4e1e07438a025cf2bd3e3e00958..26d171c6b88c81747468fb7386e10c180a340b99 100644 (file)
@@ -68,6 +68,7 @@
 #include "mathed/MathSupport.h"
 
 #include "frontends/alert.h"
+#include "frontends/Delegates.h"
 #include "frontends/WorkAreaManager.h"
 
 #include "graphics/Previews.h"
@@ -233,7 +234,7 @@ Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_)
 
 
 Buffer::Buffer(string const & file, bool readonly)
-       : pimpl_(new Impl(*this, FileName(file), readonly))
+       : pimpl_(new Impl(*this, FileName(file), readonly)), gui_(0)
 {
        LYXERR(Debug::INFO) << "Buffer::Buffer()" << endl;
 }
@@ -269,18 +270,20 @@ Buffer::~Buffer()
 }
 
 
-void Buffer::changed()
+void Buffer::changed() const
 {
        if (pimpl_->wa_)
                pimpl_->wa_->redrawAll();
 }
 
 
-frontend::WorkAreaManager * Buffer::workAreaManager() const
+frontend::WorkAreaManager & Buffer::workAreaManager() const
 {
-       return pimpl_->wa_;
+       BOOST_ASSERT(pimpl_->wa_);
+       return *pimpl_->wa_;
 }
 
+
 Text & Buffer::text() const
 {
        return const_cast<Text &>(pimpl_->inset.text_);
@@ -1917,4 +1920,65 @@ ErrorList & Buffer::errorList(string const & type)
 }
 
 
+void Buffer::structureChanged() const
+{
+       if (gui_)
+               gui_->structureChanged();
+}
+
+
+void Buffer::embeddingChanged() const
+{
+       if (gui_)
+               gui_->embeddingChanged();
+}
+
+
+void Buffer::errors(std::string const & err) const
+{
+       if (gui_)
+               gui_->errors(err);
+}
+
+
+void Buffer::message(docstring const & msg) const
+{
+       if (gui_)
+               gui_->message(msg);
+}
+
+
+void Buffer::busy(bool on) const
+{
+       if (gui_)
+               gui_->busy(on);
+}
+
+
+void Buffer::readonly(bool on) const
+{
+       if (gui_)
+               gui_->readonly(on);
+}
+
+
+void Buffer::updateTitles() const
+{
+       if (gui_)
+               gui_->updateTitles();
+}
+
+
+void Buffer::resetAutosaveTimers() const
+{
+       if (gui_)
+               gui_->resetAutosaveTimers();
+}
+
+
+void Buffer::setGuiDelegate(frontend::GuiBufferDelegate * gui)
+{
+       gui_ = gui;
+}
+
 } // namespace lyx