]> git.lyx.org Git - features.git/commitdiff
fix bug 1934
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 27 Jan 2006 22:24:37 +0000 (22:24 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 27 Jan 2006 22:24:37 +0000 (22:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10781 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_nestinset.C

index 85505be24162cd8ddcc90676249c2670954cbb63..7b85a48cf0642f755a8b80b0237a953f522cc2ea 100644 (file)
@@ -1,3 +1,9 @@
+2006-01-27  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * math_nestinset.C (drawSelection): do not draw anything when
+       there is no selection; when drawing, do it with the null painter,
+       since only the metrics matter (fixes bug1934).
+
 2006-01-18  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * math_factory.C (initMath): set initialized to true early to
index e5b88bab5e2b61266bb6a5b412391100277d32cb..de62936601702401259899b335b18d98212dbcba 100644 (file)
@@ -51,6 +51,7 @@
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
+#include "frontends/nullpainter.h"
 
 #include <sstream>
 
@@ -219,9 +220,6 @@ void MathNestInset::draw(PainterInfo & pi, int x, int y) const
 
 void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
 {
-       // FIXME: hack to get position cache warm
-       draw(pi, x, y);
-
        // this should use the x/y values given, not the cached values
        LCursor & cur = pi.base.bv->cursor();
        if (!cur.selection())
@@ -229,6 +227,12 @@ void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
        if (!ptr_cmp(&cur.inset(), this))
                return;
 
+       // FIXME: hack to get position cache warm
+       static NullPainter nop;
+       PainterInfo pinop(pi);
+       pinop.pain = nop;
+       draw(pinop, x, y);
+
        CursorSlice s1 = cur.selBegin();
        CursorSlice s2 = cur.selEnd();
        //lyxerr << "MathNestInset::drawing selection: "