]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathDiagram.cpp
Correct computation of math font size
[lyx.git] / src / mathed / InsetMathDiagram.cpp
1 /**
2  * \file InsetMathDiagram.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  * \author Ronen Abravanel
8 *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMathDiagram.h"
15
16 #include "MathStream.h"
17
18 #include "LaTeXFeatures.h"
19 #include "MetricsInfo.h"
20
21 #include <ostream>
22
23 namespace lyx {
24
25
26 InsetMathDiagram::InsetMathDiagram(Buffer * buf) : InsetMathGrid(buf, 1, 1)
27 {
28 }
29
30
31 Inset * InsetMathDiagram::clone() const
32 {
33         return new InsetMathDiagram(*this);
34 }
35
36
37 int InsetMathDiagram::colsep() const
38 {
39         return 10;
40 }
41
42
43 int InsetMathDiagram::rowsep() const
44 {
45         return 10;
46 }
47
48
49 void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
50 {
51         FontInfo & f = mi.base.font;
52         Changer dummy = f.changeStyle(LM_ST_TEXT, f.style() == LM_ST_DISPLAY);
53         InsetMathGrid::metrics(mi, dim);
54 }
55
56
57 void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
58 {
59         setPosCache(pi, x, y);
60         FontInfo & f = pi.base.font;
61         Changer dummy = f.changeStyle(LM_ST_TEXT, f.style() == LM_ST_DISPLAY);
62         InsetMathGrid::draw(pi, x, y);
63 }
64
65
66 void InsetMathDiagram::write(WriteStream & os) const
67 {
68         MathEnsurer ensurer(os);
69         os << "\\Diagram";
70         bool open = os.startOuterRow();
71         os << '{';
72         InsetMathGrid::write(os);
73         os << "}\n";
74         if (open)
75                 os.startOuterRow();
76 }
77
78
79 void InsetMathDiagram::infoize(odocstream & os) const
80 {
81         os << "Diagram ";
82         InsetMathGrid::infoize(os);
83 }
84
85
86 void InsetMathDiagram::normalize(NormalStream & os) const
87 {
88         os << "[Diagram ";
89         InsetMathGrid::normalize(os);
90         os << ']';
91 }
92
93
94 void InsetMathDiagram::maple(MapleStream & os) const
95 {
96         os << "Diagram(";
97         InsetMathGrid::maple(os);
98         os << ')';
99 }
100
101
102 void InsetMathDiagram::validate(LaTeXFeatures & features) const
103 {
104         features.require("feyn");
105         InsetMathGrid::validate(features);
106 }
107
108
109 } // namespace lyx