]> git.lyx.org Git - lyx.git/blob - src/insets/InsetTheorem.cpp
Splitup Font in saner bits:
[lyx.git] / src / insets / InsetTheorem.cpp
1 #if 0
2 /**
3  * \file InsetTheorem.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetTheorem.h"
15 #include "insets/InsetText.h"
16
17 #include "debug.h"
18 #include "gettext.h"
19 #include "FontInfo.h"
20 #include "Text.h"
21 #include "MetricsInfo.h"
22
23 #include "support/std_ostream.h"
24
25
26 namespace lyx {
27
28 using std::endl;
29 using std::ostream;
30
31
32 /*
33   The intention is to be able to create arbitrary theorem like environments
34    sing this class and some helper/container classes. It should be possible
35    to create these theorems both from layout file and interactively by the
36    user.
37 */
38
39 Inset.heorem::InsetTheorem()
40         : InsetCollapsable()
41 {
42         setLabel(_("theorem"));
43         FontInfo font = sane_font;
44         font.decSize();
45         font.decSize();
46         font.setColor(Color_collapsable);
47         setLabelFont(font);
48 #if 0
49         setAutoCollapse(false);
50 #endif
51         setInsetName("Theorem");
52 }
53
54
55 void Inset.heorem::write(Buffer const * buf, ostream & os) const
56 {
57         os << name() << "\n";
58         InsetCollapsable::write(buf, os);
59 }
60
61
62 Inset * InsetTheorem::clone() const
63 {
64         // FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
65         InsetTheorem * result = new InsetTheorem;
66         result->setCollapsed(!isOpen());
67         return result;
68 }
69
70
71 void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
72 {
73         InsetCollapsable::metrics(mi, dim);
74         center_indent_ = (mi.base.textwidth - dim.wid) / 2;
75         dim.wid = mi.base.textwidth;
76 }
77
78
79 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
80 {
81         InsetCollapsable::draw(pi, x + center_indent_, y);
82 }
83
84
85 string const Inset.heorem::editMessage() const
86 {
87         return _("Opened Theorem Inset");
88 }
89
90
91 int Inset.heorem::latex(Buffer const * buf, odocstream & os,
92                         OutputParams const & runparams) const
93 {
94         os << "\\begin{theorem}%\n";
95
96         int i = inset.latex(buf, os, runparams);
97         os << "\\end{theorem}%\n";
98
99         return i + 2;
100 }
101
102
103 } // namespace lyx
104
105 #endif