commit e26a60edef3eae39c2e8379f395febedc5ba7efa
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Nov 20 18:18:59 2022 +0100
Regenerate previews after zoom (#11919)
---
src/Buffer.cpp | 7 +++++++
src/Buffer.h | 2 ++
src/frontends/WorkAreaManager.cpp | 7 +++++++
src/frontends/WorkAreaManager.h | 2 ++
src/frontends/qt/GuiView.cpp | 6 ++++++
src/graphics/PreviewLoader.cpp | 1 +
6 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 9826b51..3429154 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -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_)
diff --git a/src/Buffer.h b/src/Buffer.h
index fb7236c..8f4474d 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -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;
///
diff --git a/src/frontends/WorkAreaManager.cpp
b/src/frontends/WorkAreaManager.cpp
index 0d1d189..8d32c6b 100644
--- a/src/frontends/WorkAreaManager.cpp
+++ b/src/frontends/WorkAreaManager.cpp
@@ -62,6 +62,13 @@ void WorkAreaManager::updateTitles()
}
+void WorkAreaManager::scheduleRedraw()
+{
+ for (WorkArea * wa : work_areas_)
+ wa->scheduleRedraw(true);
+}
+
+
} // namespace frontend
} // namespace lyx
diff --git a/src/frontends/WorkAreaManager.h b/src/frontends/WorkAreaManager.h
index cd716fc..94c528b 100644
--- a/src/frontends/WorkAreaManager.h
+++ b/src/frontends/WorkAreaManager.h
@@ -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;
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 24d6703..d51dcc6 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -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;
}
diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index 1c8d12f..f6ca607 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -799,6 +799,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int
retval)
imageReady(*nit->get());
}
finished_generating_ = true;
+ buffer_.scheduleRedrawWorkAreas();
}
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs