From 00c0baf02262fdbbc1110ce1df7ba987ff952f09 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 23 Jul 2002 14:47:31 +0000 Subject: [PATCH] Regenerate a preview only when leaving a math inset with depth 1. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4763 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 3 +++ src/mathed/math_nestinset.C | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 3da70dd673..306f2f372d 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -3,6 +3,9 @@ * formula.C (descent): add an arbitrary 12 pixels to the descent when previewing a display mode equation, analogous to André's code elsewhere. + * math_nestinset.C (notifyCursorLeaves): generate the preview only + when leaving an inset with depth() == 1. + 2002-07-22 Jean-Marc Lasgouttes * math_support.C (mathed_draw_deco): fix rounding bug for rotated diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 520474d197..7cc4da7c80 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -277,12 +277,16 @@ MathArray MathNestInset::glue() const void MathNestInset::notifyCursorLeaves() { - //lyxerr << "leaving " << *this << "\n"; - if (!mathcursor || !grfx::Previews::activated()) + // Generate a preview only if previews are active and we are leaving + // the InsetFormula itself + if (!grfx::Previews::activated() || + !mathcursor || mathcursor->depth() != 1) return; InsetFormulaBase * inset = mathcursor->formula(); BufferView * bufferview = inset->view(); + + // Paranoia check if (!bufferview || !bufferview->buffer()) return;