]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
remove unused declaration
[lyx.git] / src / Buffer.cpp
index f540360f2fa69fb3e2d26663dad9557921796216..e24d3e38578409937ac37cc9c8ac0e65f74497ce 100644 (file)
 #include "support/textutils.h"
 #include "support/convert.h"
 
+#if !defined (HAVE_FORK)
+# define fork() -1
+#endif
+
 #include <boost/bind.hpp>
 #include <boost/filesystem/exception.hpp>
 #include <boost/filesystem/operations.hpp>
@@ -115,7 +119,6 @@ using std::vector;
 using std::string;
 using std::time_t;
 
-
 namespace lyx {
 
 using support::addName;
@@ -151,7 +154,7 @@ namespace fs = boost::filesystem;
 
 namespace {
 
-int const LYX_FORMAT = 289; //MV, index collapsable
+int const LYX_FORMAT = 295; //Uwe: htmlurl, href
 
 } // namespace anon
 
@@ -162,9 +165,7 @@ class Buffer::Impl
 {
 public:
        Impl(Buffer & parent, FileName const & file, bool readonly);
-
-       limited_stack<Undo> undostack;
-       limited_stack<Undo> redostack;
+       
        BufferParams params;
        LyXVC lyxvc;
        string temppath;
@@ -216,6 +217,9 @@ public:
 
        ///
        frontend::WorkAreaManager * wa_;
+
+       ///
+       Undo undo_;
 };
 
 
@@ -223,7 +227,7 @@ 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), wa_(0)
+         checksum_(0), wa_(0), undo_(parent)
 {
        inset.setAutoBreakRows(true);
        lyxvc.buffer(&parent);
@@ -301,30 +305,6 @@ Inset & Buffer::inset() const
 }
 
 
-limited_stack<Undo> & Buffer::undostack()
-{
-       return pimpl_->undostack;
-}
-
-
-limited_stack<Undo> const & Buffer::undostack() const
-{
-       return pimpl_->undostack;
-}
-
-
-limited_stack<Undo> & Buffer::redostack()
-{
-       return pimpl_->redostack;
-}
-
-
-limited_stack<Undo> const & Buffer::redostack() const
-{
-       return pimpl_->redostack;
-}
-
-
 BufferParams & Buffer::params()
 {
        return pimpl_->params;
@@ -402,6 +382,12 @@ EmbeddedFiles const & Buffer::embeddedFiles() const
        return pimpl_->embedded_files;
 }
 
+Undo & Buffer::undo()
+{
+       return pimpl_->undo_;
+}
+
+
 
 string const Buffer::getLatexName(bool const no_path) const
 {
@@ -747,7 +733,7 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
        }
 
        lex.next();
-       string const token(lex.getString());
+       string const token = lex.getString();
 
        if (!lex) {
                Alert::error(_("Document could not be read"),
@@ -1482,14 +1468,14 @@ void Buffer::updateBibfilesCache()
 
        bibfilesCache_.clear();
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
-               if (it->lyxCode() == Inset::BIBTEX_CODE) {
+               if (it->lyxCode() == BIBTEX_CODE) {
                        InsetBibtex const & inset =
                                static_cast<InsetBibtex const &>(*it);
                        vector<FileName> const bibfiles = inset.getFiles(*this);
                        bibfilesCache_.insert(bibfilesCache_.end(),
                                bibfiles.begin(),
                                bibfiles.end());
-               } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
+               } else if (it->lyxCode() == INCLUDE_CODE) {
                        InsetInclude & inset =
                                static_cast<InsetInclude &>(*it);
                        inset.updateBibfilesCache(*this);
@@ -1820,7 +1806,7 @@ void Buffer::buildMacros()
                InsetList::const_iterator end = insets.end();
                for ( ; it != end; ++it) {
                        //lyxerr << "found inset code " << it->inset->lyxCode() << std::endl;
-                       if (it->inset->lyxCode() == Inset::MATHMACRO_CODE) {
+                       if (it->inset->lyxCode() == MATHMACRO_CODE) {
                                MathMacroTemplate const & mac
                                        = static_cast<MathMacroTemplate const &>(*it->inset);
                                insertMacro(mac.name(), mac.asMacroData());
@@ -1831,14 +1817,14 @@ void Buffer::buildMacros()
 
 
 void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
-       Inset::Code code)
+       InsetCode code)
 {
        //FIXME: This does not work for child documents yet.
-       BOOST_ASSERT(code == Inset::CITE_CODE || code == Inset::REF_CODE);
+       BOOST_ASSERT(code == CITE_CODE || code == REF_CODE);
        // Check if the label 'from' appears more than once
        vector<docstring> labels;
 
-       if (code == Inset::CITE_CODE) {
+       if (code == CITE_CODE) {
                BiblioInfo keys;
                keys.fillWithBibKeys(this);
                BiblioInfo::const_iterator bit  = keys.begin();
@@ -2016,13 +2002,17 @@ private:
 };
 
 
+#if !defined (HAVE_FORK)
+# define fork() -1
+#endif
+
 int AutoSaveBuffer::generateChild()
 {
        // tmp_ret will be located (usually) in /tmp
        // will that be a problem?
-       pid_t const pid = fork(); // If you want to debug the autosave
-       // you should set pid to -1, and comment out the
-       // fork.
+       pid_t const pid = fork();
+       // If you want to debug the autosave
+       // you should set pid to -1, and comment out the fork.
        if (pid == 0 || pid == -1) {
                // pid = -1 signifies that lyx was unable
                // to fork. But we will do the save