From b56e4c5697305776476fae2e39540abd2a9bad98 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sat, 5 Dec 2009 00:43:28 +0000 Subject: [PATCH] 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 --- src/mathed/InsetMathHull.cpp | 11 +++++------ src/mathed/InsetMathHull.h | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 66848ad9f3..657c593094 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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; diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 197fd303fb..7b2b48ba79 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -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; -- 2.39.2