2 * \file InsetMathDots.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
14 #include "InsetMathDots.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
18 #include "MathParser.h"
19 #include "MetricsInfo.h"
21 #include "frontends/FontMetrics.h"
26 InsetMathDots::InsetMathDots(latexkeys const * key)
31 Inset * InsetMathDots::clone() const
33 return new InsetMathDots(*this);
37 void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
39 dim = theFontMetrics(mi.base.font).dimension('M');
41 if (key_->name == "cdots" || key_->name == "dotsb"
42 || key_->name == "dotsm" || key_->name == "dotsi")
44 else if (key_->name == "dotsc")
46 else if (key_->name == "vdots") {
47 dim.wid = (dim.wid / 2) + 1;
50 else if (key_->name == "ddots")
55 void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
57 Dimension const dim = dimension(*pain.base.bv);
58 mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
60 if (key_->name == "vdots" || key_->name == "ddots")
62 if (key_->name != "vdots")
64 mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
66 setPosCache(pain, x, y);
70 docstring InsetMathDots::name() const