3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #include "BufferView.h"
15 #include "paragraph.h"
17 #include "insetnewline.h"
18 #include "support/LOstream.h"
19 #include "frontends/Painter.h"
20 #include "frontends/font_metrics.h"
27 InsetNewline::InsetNewline()
32 void InsetNewline::read(Buffer const *, LyXLex &)
38 void InsetNewline::write(Buffer const *, ostream & os) const
40 os << "\n\\newline \n";
44 int InsetNewline::ascent(BufferView *, LyXFont const & font) const
46 return font_metrics::maxAscent(font);
50 int InsetNewline::descent(BufferView *, LyXFont const & font) const
52 return font_metrics::maxDescent(font);
56 int InsetNewline::width(BufferView *, LyXFont const & font) const
58 return font_metrics::width('n', font);
62 int InsetNewline::latex(Buffer const *, ostream &, bool, bool) const
64 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
69 int InsetNewline::ascii(Buffer const *, ostream & os, int) const
76 int InsetNewline::linuxdoc(Buffer const *, std::ostream &) const
83 int InsetNewline::docbook(Buffer const *, std::ostream &, bool) const
90 void InsetNewline::draw(BufferView * bv, LyXFont const & font,
91 int baseline, float & x) const
93 Painter & pain(bv->painter());
95 int const wid = font_metrics::width('n', font);
96 int const asc = font_metrics::maxAscent(font);
97 int const y = baseline;
99 // hack, and highly dubious
100 lyx::pos_type pos = parOwner()->getPositionOfInset(this);
101 bool const ltr_pos = (bv->text->bidi_level(pos) % 2 == 0);
106 yp[0] = int(y - 0.875 * asc * 0.75);
107 yp[1] = int(y - 0.500 * asc * 0.75);
108 yp[2] = int(y - 0.125 * asc * 0.75);
111 xp[0] = int(x + wid * 0.375);
113 xp[2] = int(x + wid * 0.375);
115 xp[0] = int(x + wid * 0.625);
116 xp[1] = int(x + wid);
117 xp[2] = int(x + wid * 0.625);
120 pain.lines(xp, yp, 3, LColor::eolmarker);
122 yp[0] = int(y - 0.500 * asc * 0.75);
123 yp[1] = int(y - 0.500 * asc * 0.75);
124 yp[2] = int(y - asc * 0.75);
128 xp[1] = int(x + wid);
129 xp[2] = int(x + wid);
131 xp[0] = int(x + wid);
136 pain.lines(xp, yp, 3, LColor::eolmarker);