]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
SCons: msvc does not need this /TP option any more after we rename .C => .cpp. Also...
[lyx.git] / src / Buffer.cpp
index 2b0286a16ca699385143186f1bf335da1a6e0348..5f73e27f6bec1f9ce4eb07510839b996138d3ad4 100644 (file)
@@ -13,7 +13,7 @@
 #include "Buffer.h"
 
 #include "Author.h"
-#include "Biblio.h"
+#include "BiblioInfo.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "BufferList.h"
@@ -22,6 +22,7 @@
 #include "Bullet.h"
 #include "Chktex.h"
 #include "debug.h"
+#include "DocIterator.h"
 #include "Encoding.h"
 #include "ErrorList.h"
 #include "Exporter.h"
@@ -137,7 +138,7 @@ namespace fs = boost::filesystem;
 
 namespace {
 
-int const LYX_FORMAT = 279;
+int const LYX_FORMAT = 280;
 
 } // namespace anon
 
@@ -227,7 +228,12 @@ Buffer::~Buffer()
        // here the buffer should take care that it is
        // saved properly, before it goes into the void.
 
-       closing();
+       Buffer * master = getMasterBuffer();
+       if (master != this && use_gui)
+               // We are closing buf which was a child document so we
+               // must update the labels and section numbering of its master
+               // Buffer.
+               updateLabels(*master);
 
        if (!temppath().empty() && !destroyDir(FileName(temppath()))) {
                Alert::warning(_("Could not remove temporary directory"),
@@ -237,6 +243,8 @@ Buffer::~Buffer()
 
        // Remove any previewed LaTeX snippets associated with this buffer.
        graphics::Previews::get().removeLoader(*this);
+
+       closing(this);
 }
 
 
@@ -1359,14 +1367,6 @@ void Buffer::getLabelList(vector<docstring> & list) const
 }
 
 
-// This is also a buffer property (ale)
-void Buffer::fillWithBibKeys(biblio::BibKeyList & keys)
-       const
-{
-       biblio::fillWithBibKeys(this, keys);
-}
-
-
 void Buffer::updateBibfilesCache()
 {
        // if this is a child document and the parent is already loaded
@@ -1715,13 +1715,6 @@ void Buffer::buildMacros()
 }
 
 
-void Buffer::saveCursor(StableDocIterator cur, StableDocIterator anc)
-{
-       cursor_ = cur;
-       anchor_ = anc;
-}
-
-
 void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        Inset::Code code)
 {
@@ -1731,14 +1724,14 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        vector<docstring> labels;
 
        if (code == Inset::CITE_CODE) {
-               biblio::BibKeyList keys;
-               fillWithBibKeys(keys);
-               biblio::BibKeyList::const_iterator bit  = keys.begin();
-               biblio::BibKeyList::const_iterator bend = keys.end();
+               BiblioInfo keys;
+               keys.fillWithBibKeys(this);
+               BiblioInfo::const_iterator bit  = keys.begin();
+               BiblioInfo::const_iterator bend = keys.end();
 
                for (; bit != bend; ++bit)
                        // FIXME UNICODE
-                       labels.push_back(from_utf8(bit->first));
+                       labels.push_back(bit->first);
        } else
                getLabelList(labels);