]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathDiagram.cpp
6b12949b9ee9dbf0001f0506781bcf40aecbfdf4
[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         Changer dummy2 = mi.base.changeEnsureMath();
52         FontInfo & f = mi.base.font;
53         Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
54                 : Changer();
55         InsetMathGrid::metrics(mi, dim);
56 }
57
58
59 void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
60 {
61         setPosCache(pi, x, y);
62         Changer dummy2 = pi.base.changeEnsureMath();
63         FontInfo & f = pi.base.font;
64         Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
65                 : Changer();
66         InsetMathGrid::draw(pi, x, y);
67 }
68
69
70 void InsetMathDiagram::write(WriteStream & os) const
71 {
72         MathEnsurer ensurer(os);
73         os << "\\Diagram";
74         bool open = os.startOuterRow();
75         os << '{';
76         InsetMathGrid::write(os);
77         os << "}\n";
78         if (open)
79                 os.startOuterRow();
80 }
81
82
83 void InsetMathDiagram::infoize(odocstream & os) const
84 {
85         os << "Diagram ";
86         InsetMathGrid::infoize(os);
87 }
88
89
90 void InsetMathDiagram::normalize(NormalStream & os) const
91 {
92         os << "[Diagram ";
93         InsetMathGrid::normalize(os);
94         os << ']';
95 }
96
97
98 void InsetMathDiagram::maple(MapleStream & os) const
99 {
100         os << "Diagram(";
101         InsetMathGrid::maple(os);
102         os << ')';
103 }
104
105
106 void InsetMathDiagram::validate(LaTeXFeatures & features) const
107 {
108         features.require("feyn");
109         InsetMathGrid::validate(features);
110 }
111
112
113 } // namespace lyx