>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Maybe even

Georg>         PainterInfo pinop(pi); pinop.pain = nop;

Georg> ?

Indeed. So the patch below is what I propose to apply.

People, please test. I want that in 1.4.0.

Georg> Yesterday I was not sure whether drawing with the null painter
Georg> really fills the coord cache correctly, but now I am: The
Georg> insets determine their coordinates from the given base point
Georg> and metrics information only. Both have nothing to do with the
Georg> painter, the painter only receives the positions for drawing,
Georg> so it is safe to use the null painter.

Yes, it is the whole point of the null painter.

JMarc

Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.542
diff -u -p -r1.542 ChangeLog
--- src/mathed/ChangeLog	24 Jan 2006 11:04:30 -0000	1.542
+++ src/mathed/ChangeLog	27 Jan 2006 09:55:44 -0000
@@ -1,3 +1,9 @@
+2006-01-27  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* 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  <[EMAIL PROTECTED]>
 
 	* math_factory.C (initMath): set initialized to true early to
Index: src/mathed/math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.180
diff -u -p -r1.180 math_nestinset.C
--- src/mathed/math_nestinset.C	11 Jan 2006 17:08:50 -0000	1.180
+++ src/mathed/math_nestinset.C	27 Jan 2006 09:55:44 -0000
@@ -51,6 +51,7 @@
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
+#include "frontends/nullpainter.h"
 
 #include <sstream>
 
@@ -219,15 +220,18 @@ void MathNestInset::draw(PainterInfo & p
 
 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())
 		return;
 	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();

Reply via email to