]> git.lyx.org Git - features.git/commitdiff
Fix for 2550.
authorMartin Vermeer <martin.vermeer@hut.fi>
Thu, 19 Oct 2006 19:26:43 +0000 (19:26 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Thu, 19 Oct 2006 19:26:43 +0000 (19:26 +0000)
* insettext.[Ch]
(InsetText::covers): added to allow the click-sensitive area to grow
with the Wide() condition.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15384 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insettext.C
src/insets/insettext.h

index 7ade80ae4c8493620d3b6153be687dd15af5d349..36b7b036e70b649b7cadbf4acfc54352c15744ca 100644 (file)
@@ -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"
@@ -220,6 +221,16 @@ void InsetText::drawSelection(PainterInfo & pi, int x, int y) const
 }
 
 
+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 578109343f2f206c7836626f6dc053a4dc8e7f66..6eef99eac4597b773bf4f9244c2cf6f3e0cde6bc 100644 (file)
@@ -52,6 +52,8 @@ public:
        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;
        ///