]> git.lyx.org Git - lyx.git/blob - src/insets/insetline.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetline.C
1 /**
2  * \file insetline.C
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 "insetline.h"
14
15 #include "debug.h"
16 #include "LColor.h"
17 #include "lyxtext.h"
18 #include "metricsinfo.h"
19 #include "LaTeXFeatures.h"
20 #include "outputparams.h"
21
22 #include "frontends/Painter.h"
23
24 using std::endl;
25 using std::ostream;
26
27
28 void InsetLine::read(Buffer const &, LyXLex &)
29 {
30         /* Nothing to read */
31 }
32
33
34 void InsetLine::write(Buffer const &, ostream & os) const
35 {
36         os << "\n\\lyxline\n";
37 }
38
39
40 void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
41 {
42         dim.asc = 3;
43         dim.des = 3;
44         dim.wid = mi.base.textwidth;
45         dim_ = dim;
46 }
47
48
49 void InsetLine::draw(PainterInfo & pi, int x, int y) const
50 {
51         pi.pain.line(x, y, x + dim_.wid, y, LColor::topline, Painter::line_solid,
52                         Painter::line_thick);
53 }
54
55
56 int InsetLine::latex(Buffer const &, ostream & os,
57                         OutputParams const & runparams) const
58 {
59         os << "\\lyxline{\\" << runparams.local_font->latexSize() << '}';
60         return 0;
61 }
62
63
64 int InsetLine::plaintext(Buffer const &, ostream & os,
65                      OutputParams const &) const
66 {
67         os << "-------------------------------------------";
68         return 0;
69 }
70
71
72 int InsetLine::linuxdoc(Buffer const &, std::ostream & os,
73                         OutputParams const &) const
74 {
75         os << '\n';
76         return 0;
77 }
78
79
80 int InsetLine::docbook(Buffer const &, std::ostream & os,
81                        OutputParams const &) const
82 {
83         os << '\n';
84         return 0;
85 }
86
87
88 void InsetLine::validate(LaTeXFeatures & features) const
89 {
90         features.require("lyxline");
91 }