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 "LaTeXFeatures.h"
17 #include "MathStream.h"
18 #include "MathSupport.h"
19 #include "MathParser.h"
20 #include "MetricsInfo.h"
22 #include "frontends/FontMetrics.h"
27 InsetMathDots::InsetMathDots(latexkeys
const * key
)
32 Inset
* InsetMathDots::clone() const
34 return new InsetMathDots(*this);
38 void InsetMathDots::metrics(MetricsInfo
& mi
, Dimension
& dim
) const
40 dim
= theFontMetrics(mi
.base
.font
).dimension('M');
42 if (key_
->name
== "cdots" || key_
->name
== "dotsb"
43 || key_
->name
== "dotsm" || key_
->name
== "dotsi")
45 else if (key_
->name
== "dotsc")
47 else if (key_
->name
== "vdots") {
48 dim
.wid
= (dim
.wid
/ 2) + 1;
51 else if (key_
->name
== "ddots" || key_
->name
== "adots" || key_
->name
== "iddots")
56 void InsetMathDots::draw(PainterInfo
& pain
, int x
, int y
) const
58 Dimension
const dim
= dimension(*pain
.base
.bv
);
59 if (key_
->name
== "adots" || key_
->name
== "iddots")
61 mathed_draw_deco(pain
, x
+ 2, y
- dh_
, dim
.width() - 2, dim
.ascent(),
63 if (key_
->name
== "vdots" || key_
->name
== "ddots" || key_
->name
== "adots" || key_
->name
== "iddots")
65 if (key_
->name
== "adots" || key_
->name
== "iddots")
67 else if (key_
->name
!= "vdots")
69 mathed_draw_deco(pain
, x
+ 2, y
- dh_
, dim
.width() - 2, dim
.ascent(),
71 setPosCache(pain
, x
, y
);
75 docstring
InsetMathDots::name() const
81 void InsetMathDots::validate(LaTeXFeatures
& features
) const
83 if (!key_
->requires
.empty())
84 features
.require(to_utf8(key_
->requires
));