]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFontOld.cpp
* the old cursor is stored before dispatch and then used after moving
[lyx.git] / src / mathed / InsetMathFontOld.cpp
1 /**
2  * \file InsetMathFontOld.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathFontOld.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "MathParser.h"
17 #include "MathStream.h"
18 #include "support/std_ostream.h"
19
20
21 namespace lyx {
22
23 using std::auto_ptr;
24
25
26 InsetMathFontOld::InsetMathFontOld(latexkeys const * key)
27         : InsetMathNest(1), key_(key)
28 {
29         //lock(true);
30 }
31
32
33 auto_ptr<Inset> InsetMathFontOld::doClone() const
34 {
35         return auto_ptr<Inset>(new InsetMathFontOld(*this));
36 }
37
38
39 bool InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
40 {
41         FontSetChanger dummy(mi.base, key_->name.c_str());
42         cell(0).metrics(mi, dim);
43         metricsMarkers(dim);
44         if (dim_ == dim)
45                 return false;
46         dim_ = dim;
47         return true;
48 }
49
50
51 void InsetMathFontOld::draw(PainterInfo & pi, int x, int y) const
52 {
53         FontSetChanger dummy(pi.base, key_->name.c_str());
54         cell(0).draw(pi, x + 1, y);
55         drawMarkers(pi, x, y);
56 }
57
58
59 void InsetMathFontOld::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
60 {
61         cell(0).metricsT(mi, dim);
62 }
63
64
65 void InsetMathFontOld::drawT(TextPainter & pain, int x, int y) const
66 {
67         cell(0).drawT(pain, x, y);
68 }
69
70
71 void InsetMathFontOld::write(WriteStream & os) const
72 {
73         os << "{\\" << key_->name << ' ' << cell(0) << '}';
74 }
75
76
77 void InsetMathFontOld::normalize(NormalStream & os) const
78 {
79         os << "[font " << key_->name << ' ' << cell(0) << ']';
80 }
81
82
83 void InsetMathFontOld::infoize(odocstream & os) const
84 {
85         os << "Font: " << key_->name;
86 }
87
88
89 } // namespace lyx