Do not start loading a preview each time one is added. This caused LyX to generate LaTeX code of the document over and over again for each math inset. As a consequence, the loading of the User's Guide took ages.

Fixes a bug introduced in r32157 while fixing bug #4360.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32352 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-12-05 00:43:28 +00:00
parent ab267e0f81
commit b56e4c5697
2 changed files with 8 additions and 8 deletions

View File

@ -461,13 +461,13 @@ void InsetMathHull::addPreview(DocIterator const & inset_pos,
graphics::PreviewLoader & /*ploader*/) const
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
reloadPreview(inset_pos);
preparePreview(inset_pos);
}
}
void InsetMathHull::reloadPreview(DocIterator const & pos) const
{
void InsetMathHull::preparePreview(DocIterator const & pos) const
{
Buffer const * buffer = pos.buffer();
// collect macros at this position
@ -484,17 +484,16 @@ void InsetMathHull::reloadPreview(DocIterator const & pos) const
}
}
// start preview
docstring const snippet = macro_preamble.str() + latexString(*this);
LYXERR(Debug::MACROS, "Preview snippet: " << snippet);
preview_->addPreview(snippet, *buffer);
preview_->startLoading(*buffer);
}
bool InsetMathHull::notifyCursorLeaves(Cursor const & old, Cursor & cur)
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
reloadPreview(old);
preparePreview(old);
preview_->startLoading(buffer());
cur.updateFlags(Update::Force);
}
return false;

View File

@ -134,8 +134,9 @@ public:
///
void addPreview(DocIterator const & inset_pos,
graphics::PreviewLoader &) const;
/// Recreate the preview if preview is enabled.
void reloadPreview(DocIterator const & pos) const;
/// Prepare the preview if preview is enabled. A subsequent
/// call to reloadPreview will recreate the preview.
void preparePreview(DocIterator const & pos) const;
///
void initUnicodeMath() const;