]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Cosmetics.
[lyx.git] / src / Buffer.cpp
index edf225bb3f6d40d804aa6ab0db6792a143e28a0e..f229bcac9bbdbb0d2429d5390420e58259a87ded 100644 (file)
@@ -33,6 +33,7 @@
 #include "Language.h"
 #include "LaTeX.h"
 #include "LaTeXFeatures.h"
+#include "Layout.h"
 #include "LyXAction.h"
 #include "Lexer.h"
 #include "Text.h"
@@ -67,6 +68,7 @@
 #include "mathed/MathSupport.h"
 
 #include "frontends/alert.h"
+#include "frontends/WorkAreaManager.h"
 
 #include "graphics/Previews.h"
 
@@ -143,7 +145,7 @@ namespace fs = boost::filesystem;
 
 namespace {
 
-int const LYX_FORMAT = 286;
+int const LYX_FORMAT = 288; //RGH, command insets
 
 } // namespace anon
 
@@ -205,13 +207,17 @@ public:
        /// modified. (Used to properly enable 'File->Revert to saved', bug 4114).
        time_t timestamp_;
        unsigned long checksum_;
+
+       ///
+       frontend::WorkAreaManager * wa_;
 };
 
 
 Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_)
        : lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
          filename(file), file_fully_loaded(false), inset(params),
-         toc_backend(&parent), embedded_files(&parent), timestamp_(0), checksum_(0)
+         toc_backend(&parent), embedded_files(&parent), timestamp_(0),
+         checksum_(0), wa_(0)
 {
        inset.setAutoBreakRows(true);
        lyxvc.buffer(&parent);
@@ -220,6 +226,9 @@ Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_)
        // FIXME: And now do something if temppath == string(), because we
        // assume from now on that temppath points to a valid temp dir.
        // See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg67406.html
+
+       if (use_gui)
+               wa_ = new frontend::WorkAreaManager;
 }
 
 
@@ -252,10 +261,25 @@ Buffer::~Buffer()
        // Remove any previewed LaTeX snippets associated with this buffer.
        graphics::Previews::get().removeLoader(*this);
 
-       closing(this);
+       if (pimpl_->wa_) {
+               pimpl_->wa_->closeAll();
+               delete pimpl_->wa_;
+       }
 }
 
 
+void Buffer::changed()
+{
+       if (pimpl_->wa_)
+               pimpl_->wa_->redrawAll();
+}
+
+
+frontend::WorkAreaManager * Buffer::workAreaManager() const
+{
+       return pimpl_->wa_;
+}
+
 Text & Buffer::text() const
 {
        return const_cast<Text &>(pimpl_->inset.text_);