]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbase.C
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insetbase.C
index cf7e3604c36016d77a0d007750fcda869c3ada8d..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"
@@ -113,6 +114,8 @@ InsetBase::Code InsetBase::translate(std::string const & name)
 
 void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
 {
+       cur.needsUpdate();
+       cur.dispatched();
        priv_dispatch(cur, cmd);
 }
 
@@ -136,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);
 }
 
 
@@ -235,18 +238,18 @@ void InsetBase::getCursorPos(LCursor const &, int & x, int & y) const
 }
 
 
-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;
 }
 
 
@@ -285,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
@@ -292,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();