#include <config.h>
#include "InsetMathDots.h"
+
#include "MathStream.h"
#include "MathSupport.h"
#include "MathParser.h"
+#include "MetricsInfo.h"
#include "frontends/FontMetrics.h"
-namespace lyx {
-
-
-using std::string;
-using std::auto_ptr;
+namespace lyx {
InsetMathDots::InsetMathDots(latexkeys const * key)
: key_(key)
{}
-auto_ptr<InsetBase> InsetMathDots::doClone() const
+Inset * InsetMathDots::clone() const
{
- return auto_ptr<InsetBase>(new InsetMathDots(*this));
+ return new InsetMathDots(*this);
}
-bool InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
{
dim = theFontMetrics(mi.base.font).dimension('M');
dh_ = 0;
}
else if (key_->name == "ddots")
dh_ = dim.asc;
- if (dim_ == dim)
- return false;
- dim_ = dim;
- return true;
}
void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
{
- mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
+ Dimension const dim = dimension(*pain.base.bv);
+ mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
key_->name);
if (key_->name == "vdots" || key_->name == "ddots")
++x;
if (key_->name != "vdots")
--y;
- mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
+ mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
key_->name);
setPosCache(pain, x, y);
}