]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
Add In nsetOld * argument to updateInset to rebreak the correct par.
[lyx.git] / src / mathed / math_dotsinset.C
1 /**
2  * \file math_dotsinset.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 "math_dotsinset.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "math_support.h"
18 #include "math_parser.h"
19
20 using std::auto_ptr;
21
22
23 MathDotsInset::MathDotsInset(latexkeys const * key)
24         : key_(key)
25 {}
26
27
28 auto_ptr<InsetBase> MathDotsInset::clone() const
29 {
30         return auto_ptr<InsetBase>(new MathDotsInset(*this));
31 }
32
33
34 void MathDotsInset::metrics(MetricsInfo & mi, Dimension & dim) const
35 {
36         mathed_char_dim(mi.base.font, 'M', dim_);
37         dh_ = 0;
38         if (key_->name == "cdots" || key_->name == "dotsb"
39                         || key_->name == "dotsm" || key_->name == "dotsi")
40                 dh_ = dim_.asc / 2;
41         else if (key_->name == "dotsc")
42                 dh_ = dim_.asc / 4;
43         else if (key_->name == "vdots") {
44                 dim_.wid = (dim_.wid / 2) + 1;
45                 dh_ = dim_.asc;
46         }
47         else if (key_->name == "ddots")
48                 dh_ = dim_.asc;
49         dim = dim_;
50 }
51
52
53 void MathDotsInset::draw(PainterInfo & pain, int x, int y) const
54 {
55         mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
56                 key_->name);
57         if (key_->name == "vdots" || key_->name == "ddots")
58                 ++x;
59         if (key_->name != "vdots")
60                 --y;
61         mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
62                 key_->name);
63 }
64
65
66 string MathDotsInset::name() const
67 {
68         return key_->name;
69 }