]> git.lyx.org Git - lyx.git/blobdiff - src/insets/Inset.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / Inset.cpp
index 40c3c52bd3e39ce1c9cbbd61038f9c9b3b0ba554..0814a5042305557114a8d06bd40ef7b960544b3f 100644 (file)
@@ -36,7 +36,6 @@
 #include "frontends/Painter.h"
 
 #include "support/convert.h"
-#include "support/ExceptionMessage.h"
 
 #include <boost/current_function.hpp>
 
@@ -89,8 +88,8 @@ static TranslatorMap const build_translator()
                InsetName("external", Inset::EXTERNAL_CODE),
                InsetName("caption", Inset::CAPTION_CODE),
                InsetName("mathmacro", Inset::MATHMACRO_CODE),
-               InsetName("cite", Inset::CITE_CODE),
-               InsetName("float_list", Inset::FLOAT_LIST_CODE),
+               InsetName("citation", Inset::CITE_CODE),
+               InsetName("floatlist", Inset::FLOAT_LIST_CODE),
                InsetName("index_print", Inset::INDEX_PRINT_CODE),
                InsetName("nomencl_print", Inset::NOMENCL_PRINT_CODE),
                InsetName("optarg", Inset::OPTARG_CODE),
@@ -123,11 +122,9 @@ Inset::Inset()
 {}
 
 
-Dimension const Inset::dimension(BufferView const &) const
+Dimension const Inset::dimension(BufferView const & bv) const
 {
-       docstring const id = convert<docstring>(int(lyxCode())) + " " + name();
-       throw support::ExceptionMessage(support::ErrorException,
-               _("Inset::dimension(): unimplemented method"), id);
+       return bv.coordCache().getInsets().dim(this);
 }
 
 
@@ -336,19 +333,7 @@ int Inset::yo(BufferView const & bv) const
 
 bool Inset::covers(BufferView const & bv, int x, int y) const
 {
-       //lyxerr << "Inset::covers, x: " << x << " y: " << y
-       //      << " xo: " << xo(bv) << " yo: " << yo()
-       //      << " x1: " << xo(bv) << " x2: " << xo() + width()
-       //      << " y1: " << yo(bv) - ascent() << " y2: " << yo() + descent()
-       //      << std::endl;
-
-       Dimension const dim = dimension(bv);
-
-       return bv.coordCache().getInsets().has(this)
-                       && x >= xo(bv)
-                       && x <= xo(bv) + dim.width()
-                       && y >= yo(bv) - dim.ascent()
-                       && y <= yo(bv) + dim.descent();
+       return bv.coordCache().getInsets().covers(this, x, y);
 }
 
 
@@ -378,6 +363,13 @@ void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
 }
 
 
+void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
+{
+       mi.base.bv->coordCache().insets().add(this, dim);
+}
+
+
+
 /////////////////////////////////////////
 
 bool isEditableInset(Inset const * inset)