]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbase.C
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insetbase.C
index bc27fb0968c30c269178fbe996808b73767dec06..f40b4d52a777b35d0c5266c63ffb2ad3654af1a8 100644 (file)
@@ -13,6 +13,7 @@
 #include "insetbase.h"
 
 #include "buffer.h"
+#include "coordcache.h"
 #include "BufferView.h"
 #include "LColor.h"
 #include "cursor.h"
@@ -138,10 +139,10 @@ void InsetBase::edit(LCursor &, bool)
 }
 
 
-InsetBase * InsetBase::editXY(LCursor &, int x, int y)
+InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
 {
        lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
-       return this;
+       return const_cast<InsetBase*>(this);
 }
 
 
@@ -287,6 +288,18 @@ bool InsetBase::editing(BufferView * bv) const
 }
 
 
+int InsetBase::xo() const
+{
+       return theCoords.insets_.x(this);
+}
+
+
+int InsetBase::yo() const
+{
+       return theCoords.insets_.y(this);
+}
+
+
 bool InsetBase::covers(int x, int y) const
 {
        //lyxerr << "InsetBase::covers, x: " << x << " y: " << y
@@ -294,7 +307,8 @@ bool InsetBase::covers(int x, int y) const
        //      << " x1: " << xo() << " x2: " << xo() + width()
        //      << " y1: " << yo() - ascent() << " y2: " << yo() + descent()
        //      << std::endl;
-       return x >= xo()
+       return theCoords.insets_.has(this)
+                       && x >= xo()
                        && x <= xo() + width()
                        && y >= yo() - ascent()
                        && y <= yo() + descent();