Attached. Can this go in (trunk)?

- Martin

Index: insettext.C
===================================================================
--- insettext.C	(revision 15358)
+++ insettext.C	(working copy)
@@ -16,6 +16,7 @@
 #include "buffer.h"
 #include "bufferparams.h"
 #include "BufferView.h"
+#include "coordcache.h"
 #include "CutAndPaste.h"
 #include "cursor.h"
 #include "debug.h"
@@ -218,6 +219,16 @@
 }
 
 
+bool InsetText::covers(BufferView & bv, int x, int y) const
+{
+	return bv.coordCache().getInsets().has(this)
+			&& x >= xo(bv)
+			&& x <= xo(bv) + width() + (Wide() ? text_.maxwidth_ : 0)
+			&& y >= yo(bv) - ascent()
+			&& y <= yo(bv) + descent();
+}
+
+
 docstring const InsetText::editMessage() const
 {
 	return _("Opened Text Inset");
Index: insettext.h
===================================================================
--- insettext.h	(revision 15358)
+++ insettext.h	(working copy)
@@ -52,6 +52,8 @@
 	void draw(PainterInfo & pi, int x, int y) const;
 	/// draw inset selection
 	void drawSelection(PainterInfo & pi, int x, int y) const;
+	/// are we inside the area covered by the inset?
+	virtual bool covers(BufferView & bv, int x, int y) const;
 	///
 	virtual lyx::docstring const editMessage() const;
 	///

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to