#include "insetbase.h"
#include "buffer.h"
+#include "coordcache.h"
#include "BufferView.h"
#include "LColor.h"
#include "cursor.h"
}
-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);
}
}
+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
// << " 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();