#include "insetbase.h"
#include "buffer.h"
+#include "coordcache.h"
#include "BufferView.h"
#include "LColor.h"
#include "cursor.h"
void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
{
+ cur.needsUpdate();
+ cur.dispatched();
priv_dispatch(cur, cmd);
}
}
-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);
}
{}
-void InsetBase::getCursorPos(CursorSlice const &, int & x, int & y) const
+void InsetBase::getCursorPos(LCursor const &, int & x, int & y) const
{
lyxerr << "InsetBase::getCursorPos called directly" << std::endl;
x = 100;
}
-void InsetBase::metricsMarkers(Dimension & dim, int) const
+void InsetBase::metricsMarkers(Dimension & dim, int framesize) const
{
- dim.wid += 2;
- dim.asc += 1;
+ dim.wid += 2 * framesize;
+ dim.asc += framesize;
}
-void InsetBase::metricsMarkers2(Dimension & dim, int) const
+void InsetBase::metricsMarkers2(Dimension & dim, int framesize) const
{
- dim.wid += 2;
- dim.asc += 1;
- dim.des += 1;
+ dim.wid += 2 * framesize;
+ dim.asc += framesize;
+ dim.des += framesize;
}
}
+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
+ //lyxerr << "InsetBase::covers, x: " << x << " y: " << y
// << " xo: " << xo() << " yo: " << yo()
// << " 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();