]> git.lyx.org Git - features.git/commitdiff
Do not start loading a preview each time one is added. This caused LyX to generate...
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 5 Dec 2009 00:43:28 +0000 (00:43 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 5 Dec 2009 00:43:28 +0000 (00:43 +0000)
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
src/mathed/InsetMathHull.h

index 66848ad9f37851550181278cda95393d671f637b..657c593094219c71814e9131b4079deefd18c164 100644 (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;
index 197fd303fbc94f3f94a4dfbe5e44bbebe0010f45..7b2b48ba793189331f9e0f28aa9782ebd47377eb 100644 (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;