X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbuffer.C;h=5fa662477800cf598057e9cc4304f2b75faef88e;hb=78046794ccfce3a20751e00b35295c290853afd6;hp=3d3fb2c897d82ef602725b993ab4be1232d7d933;hpb=495cd0eea03f9f5471a247e60ce70abfd1114ada;p=lyx.git diff --git a/src/buffer.C b/src/buffer.C index 3d3fb2c897..5fa6624778 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -123,6 +123,7 @@ using std::ofstream; using std::pair; using std::stack; using std::vector; +using std::string; // all these externs should eventually be removed. @@ -185,13 +186,19 @@ struct Buffer::Impl string filepath; boost::scoped_ptr 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) @@ -480,7 +487,7 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit) int Buffer::readParagraph(LyXLex & lex, string const & token, ParagraphList & pars, ParagraphList::iterator & pit, - Paragraph::depth_type & depth) + lyx::depth_type & depth) { static Change current_change; int unknown = 0; @@ -605,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) { @@ -696,6 +709,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, " that it is probably corrupted."), filename)); } + pimpl_->file_fully_loaded = true; return true; } @@ -1482,7 +1496,7 @@ void reset(PAR_TAG & p1, PAR_TAG const & p2) // Handle internal paragraph parsing -- layout already processed. void Buffer::simpleLinuxDocOnePar(ostream & os, ParagraphList::iterator par, - Paragraph::depth_type /*depth*/) const + lyx::depth_type /*depth*/) const { LyXLayout_ptr const & style = par->layout(); @@ -1952,7 +1966,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) void Buffer::simpleDocBookOnePar(ostream & os, ParagraphList::iterator par, int & desc_on, - Paragraph::depth_type depth) const + lyx::depth_type depth) const { bool emph_flag = false;