]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.cpp
typo
[lyx.git] / src / buffer_funcs.cpp
index 80992f59e253d675670d1b2f6f488d802ad1a742..72e5a6da182901abe86fc65c58be60ac139c5d95 100644 (file)
@@ -60,7 +60,7 @@ namespace Alert = frontend::Alert;
 Buffer * checkAndLoadLyXFile(FileName const & filename)
 {
        // File already open?
-       Buffer * checkBuffer = theBufferList().getBuffer(filename.absFilename());
+       Buffer * checkBuffer = theBufferList().getBuffer(filename);
        if (checkBuffer) {
                if (checkBuffer->isClean())
                        return checkBuffer;
@@ -153,16 +153,15 @@ Buffer * newUnnamedFile(string const & templatename, FileName const & path)
 {
        static int newfile_number;
 
-       string document_path = path.absFilename();
-       string filename = addName(document_path,
+       FileName filename(path, 
                "newfile" + convert<string>(++newfile_number) + ".lyx");
        while (theBufferList().exists(filename)
-               || FileName(filename).isReadableFile()) {
+               || filename.isReadableFile()) {
                ++newfile_number;
-               filename = addName(document_path,
+               filename.set(path,
                        "newfile" +     convert<string>(newfile_number) + ".lyx");
        }
-       return newFile(filename, templatename, false);
+       return newFile(filename.absFilename(), templatename, false);
 }
 
 
@@ -467,6 +466,7 @@ void updateLabels(Buffer const & buf, ParIterator & parit)
                InsetList::const_iterator end = parit->insetList().end();
                for (; iit != end; ++iit) {
                        parit.pos() = iit->pos;
+                       iit->inset->setBuffer(const_cast<Buffer &>(buf));
                        iit->inset->updateLabels(parit);
                }
        }
@@ -509,6 +509,10 @@ void updateLabels(Buffer const & buf, bool childonly)
        ParIterator parit = par_iterator_begin(buf.inset());
        updateLabels(buf, parit);
 
+       if (master != &buf)
+               // TocBackend update will be done later.
+               return;
+
        cbuf.tocBackend().update();
        if (!childonly)
                cbuf.structureChanged();