]> git.lyx.org Git - features.git/commitdiff
Preserve numbering of previewed math formulas on zoom
authorEnrico Forestieri <forenr@lyx.org>
Tue, 28 Apr 2015 20:06:58 +0000 (22:06 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Tue, 28 Apr 2015 20:06:58 +0000 (22:06 +0200)
The preview snippets are cached in a seemingly random order, such
that, when regenerating them on zoom, the math previews would be
numbered accordingly. Hence, we have to go through the insets to
get the correct order. This is a bit slower but unavoidable.

src/graphics/PreviewLoader.cpp

index 6dfec9b438745e2fc98ee9b4a8cac23c88afa49e..7d1cb5466c46878940e4fe609f7bf931eab39015 100644 (file)
@@ -417,12 +417,9 @@ PreviewLoader::Impl::preview(string const & latex_snippet) const
                font_scaling_factor_ = fs;
                Cache::const_iterator cit = cache_.begin();
                Cache::const_iterator cend = cache_.end();
-               while (cit != cend) {
-                       string const snippet = (cit++)->first;
-                       parent_.remove(snippet);
-                       parent_.add(snippet);
-               }
-               parent_.startLoading(false);
+               while (cit != cend)
+                       parent_.remove((cit++)->first);
+               buffer_.updatePreviews();
        }
        Cache::const_iterator it = cache_.find(latex_snippet);
        return (it == cache_.end()) ? 0 : it->second.get();