]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
Add a Buffer::fully_loaded member function, returning true only when
[lyx.git] / src / buffer.C
index d3c34619e572975e8c74b30c94222d6f20c34b50..5fa662477800cf598057e9cc4304f2b75faef88e 100644 (file)
@@ -186,13 +186,19 @@ struct Buffer::Impl
        string filepath;
 
        boost::scoped_ptr<Messages> messages;
+
+       /** set to true only when the file is fully loaded.
+        *  Used to prevent the premature generation of previews
+        *  and by the citation inset.
+        */
+       bool file_fully_loaded;
 };
 
 
 Buffer::Impl::Impl(Buffer & parent, string const & file, bool readonly_)
        : nicefile(true),
          lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
-         filename(file), filepath(OnlyPath(file))
+         filename(file), filepath(OnlyPath(file)), file_fully_loaded(false)
 {
        lyxvc.buffer(&parent);
        if (readonly_ || lyxrc.use_tempdir)
@@ -606,6 +612,12 @@ bool Buffer::readFile(string const & filename, ParagraphList::iterator pit)
 }
 
 
+bool Buffer::fully_loaded() const
+{
+       return pimpl_->file_fully_loaded;
+}
+
+
 bool Buffer::readFile(LyXLex & lex, string const & filename,
                      ParagraphList::iterator pit)
 {
@@ -697,6 +709,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename,
                                       " that it is probably corrupted."),
                                       filename));
        }
+       pimpl_->file_fully_loaded = true;
        return true;
 }