diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index a05eb4321c..7d2f81cce1 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -245,6 +245,8 @@ private: PreviewLoader & parent_; /// Buffer const & buffer_; + /// + mutable int font_scaling_factor_; /// We don't own this static lyx::Converter const * pconverter_; @@ -389,6 +391,9 @@ namespace graphics { PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b) : parent_(p), buffer_(b) { + font_scaling_factor_ = buffer_.isExporting() + ? int(75.0 * buffer_.params().html_math_img_scale) + : int(0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor); if (!pconverter_) pconverter_ = setConverter("lyxpreview"); } @@ -407,6 +412,17 @@ PreviewLoader::Impl::~Impl() PreviewImage const * PreviewLoader::Impl::preview(string const & latex_snippet) const { + int fs = buffer_.isExporting() + ? int(75.0 * buffer_.params().html_math_img_scale) + : int(0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor); + if (font_scaling_factor_ != fs) { + font_scaling_factor_ = fs; + Cache::const_iterator cit = cache_.begin(); + Cache::const_iterator cend = cache_.end(); + 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(); } @@ -577,16 +593,12 @@ void PreviewLoader::Impl::startLoading(bool wait) << "File was not closed properly."); return; } - - double const font_scaling_factor = - buffer_.isExporting() ? 75.0 * buffer_.params().html_math_img_scale - : 0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor; // The conversion command. ostringstream cs; cs << pconverter_->command << " " << quoteName(latexfile.toFilesystemEncoding()) - << " --dpi " << int(font_scaling_factor); + << " --dpi " << font_scaling_factor_; if (lyxerr.debugging(Debug::GRAPHICS)) { cs << " --verbose"; } diff --git a/status.21x b/status.21x index 331624a0af..011d3331a1 100644 --- a/status.21x +++ b/status.21x @@ -74,6 +74,8 @@ What's new - Clarify the function of Tools > Preferences > Look & Feel > Save Documents Compressed by Default (bug 7822). +- Update instant previews when modifying the screen zoom factor (bug 8258). + * DOCUMENTATION AND LOCALIZATION