]> git.lyx.org Git - features.git/commitdiff
Regenerate previews after zoom (#11919)
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 20 Nov 2022 17:18:59 +0000 (18:18 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 20 Nov 2022 17:18:59 +0000 (18:18 +0100)
src/Buffer.cpp
src/Buffer.h
src/frontends/WorkAreaManager.cpp
src/frontends/WorkAreaManager.h
src/frontends/qt/GuiView.cpp
src/graphics/PreviewLoader.cpp

index 9826b51f7fd3b0bf068a8961be5bf141c878083c..34291542e89191be1a1d6f5ec63079cced7358de 100644 (file)
@@ -4253,6 +4253,13 @@ void Buffer::updateTitles() const
 }
 
 
+void Buffer::scheduleRedrawWorkAreas() const
+{
+       if (d->wa_)
+               d->wa_->scheduleRedraw();
+}
+
+
 void Buffer::resetAutosaveTimers() const
 {
        if (d->gui_)
index fb7236c3f4a8b3cb841ce35cacd47b8328832aea..8f4474d311d4fef7b3342cd8a15a8e2891488937 100644 (file)
@@ -666,6 +666,8 @@ public:
        void setBusy(bool on) const;
        /// Update window titles of all users.
        void updateTitles() const;
+       /// Schedule redraw of work areas
+       void scheduleRedrawWorkAreas() const;
        /// Reset autosave timers for all users.
        void resetAutosaveTimers() const;
        ///
index 0d1d189cf28f9b4e5a24774e248afd95efd73619..8d32c6b6d8101a2dab686c01df1c64f9a821f3e2 100644 (file)
@@ -62,6 +62,13 @@ void WorkAreaManager::updateTitles()
 }
 
 
+void WorkAreaManager::scheduleRedraw()
+{
+       for (WorkArea * wa : work_areas_)
+               wa->scheduleRedraw(true);
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
index cd716fc087d35ea2b07ec5882b1dfffc0a14f2c3..94c528b3a69858da58c3ed1e40090603b678f218 100644 (file)
@@ -44,6 +44,8 @@ public:
        /// Update window titles of all users and the external modifications
        /// warning.
        void updateTitles();
+       /// Schedule redraw of work areas
+       void scheduleRedraw();
        /// If there is no work area, create a new one in the current view using the
        /// buffer buf. Returns false if not possible.
        bool unhide(Buffer * buf) const;
index 24d6703e30741621fd2d330c271aa9b579925b50..d51dcc61430f9eac8fa5464a8c87b08c51478686 100644 (file)
@@ -69,6 +69,8 @@
 #include "Toolbars.h"
 #include "version.h"
 
+#include "graphics/PreviewLoader.h"
+
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
@@ -4891,6 +4893,10 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                                              lyxrc.currentZoom, lyxrc.defaultZoom));
 
                        guiApp->fontLoader().update();
+                       // Regenerate instant previews
+                       if (lyxrc.preview != LyXRC::PREVIEW_OFF
+                           && doc_buffer && doc_buffer->loader())
+                               doc_buffer->loader()->refreshPreviews();
                        dr.screenUpdate(Update::ForceAll | Update::FitCursor);
                        break;
                }
index 1c8d12ff0e21008bd0bd571d0b9fbda20c58ab4e..f6ca607e4687128b982aead7f3e28bbc5e11ffc7 100644 (file)
@@ -799,6 +799,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
                imageReady(*nit->get());
        }
        finished_generating_ = true;
+       buffer_.scheduleRedrawWorkAreas();
 }