#include "mathed/MathSupport.h"
#include "frontends/alert.h"
+#include "frontends/Delegates.h"
+#include "frontends/WorkAreaManager.h"
#include "graphics/Previews.h"
/// 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);
// 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;
}
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;
}
// 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_;
+ }
+ delete pimpl_;
+}
+
+
+void Buffer::changed() const
+{
+ if (pimpl_->wa_)
+ pimpl_->wa_->redrawAll();
+}
+
+
+frontend::WorkAreaManager & Buffer::workAreaManager() const
+{
+ BOOST_ASSERT(pimpl_->wa_);
+ return *pimpl_->wa_;
}
}
+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