#include "frontends/Painter.h"
#include "support/convert.h"
-#include "support/ExceptionMessage.h"
#include <boost/current_function.hpp>
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),
{}
-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);
}
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);
}
}
+void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
+{
+ mi.base.bv->coordCache().insets().add(this, dim);
+}
+
+
+
/////////////////////////////////////////
bool isEditableInset(Inset const * inset)