2 * \file TextPainter.cpp
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.
13 #include "TextPainter.h"
19 TextPainter::TextPainter(int xmax
, int ymax
)
20 : xmax_(xmax
), ymax_(ymax
), data_(xmax_
* (ymax_
+ 1), ' ')
24 char_type
& TextPainter::at(int x
, int y
)
26 return data_
[y
* xmax_
+ x
];
30 char_type
TextPainter::at(int x
, int y
) const
32 return data_
[y
* xmax_
+ x
];
36 void TextPainter::draw(int x
, int y
, char_type
const * str
)
38 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
39 for (int i
= 0; *str
&& x
+ i
< xmax_
; ++i
, ++str
)
45 void TextPainter::horizontalLine(int x
, int y
, int n
, char_type c
)
47 for (int i
= 0; i
< n
&& i
+ x
< xmax_
; ++i
)
52 void TextPainter::verticalLine(int x
, int y
, int n
, char_type c
)
54 for (int i
= 0; i
< n
&& i
+ y
< ymax_
; ++i
)
59 void TextPainter::draw(int x
, int y
, char_type c
)
61 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
67 void TextPainter::show(odocstream
& os
, int offset
) const
70 for (int j
= 0; j
<= ymax_
; ++j
) {
71 for (int i
= 0; i
< offset
; ++i
)
73 for (int i
= 0; i
< xmax_
; ++i
)