]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathDots.C
fix reading UTF8 encoded symbol file
[lyx.git] / src / mathed / InsetMathDots.C
1 /**
2  * \file InsetMathDots.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMathDots.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
17 #include "MathParser.h"
18
19
20 namespace lyx {
21
22
23 using std::string;
24 using std::auto_ptr;
25
26
27 InsetMathDots::InsetMathDots(latexkeys const * key)
28         : key_(key)
29 {}
30
31
32 auto_ptr<InsetBase> InsetMathDots::doClone() const
33 {
34         return auto_ptr<InsetBase>(new InsetMathDots(*this));
35 }
36
37
38 void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
39 {
40         mathed_char_dim(mi.base.font, 'M', dim);
41         dh_ = 0;
42         if (key_->name == "cdots" || key_->name == "dotsb"
43                         || key_->name == "dotsm" || key_->name == "dotsi")
44                 dh_ = dim.asc / 2;
45         else if (key_->name == "dotsc")
46                 dh_ = dim.asc / 4;
47         else if (key_->name == "vdots") {
48                 dim.wid = (dim.wid / 2) + 1;
49                 dh_ = dim.asc;
50         }
51         else if (key_->name == "ddots")
52                 dh_ = dim.asc;
53         dim_ = dim;
54 }
55
56
57 void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
58 {
59         mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
60                 key_->name);
61         if (key_->name == "vdots" || key_->name == "ddots")
62                 ++x;
63         if (key_->name != "vdots")
64                 --y;
65         mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
66                 key_->name);
67         setPosCache(pain, x, y);
68 }
69
70
71 docstring InsetMathDots::name() const
72 {
73         return key_->name;
74 }
75
76
77 } // namespace lyx