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"
21 TextPainter::TextPainter(int xmax, int ymax)
22 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
26 char_type & TextPainter::at(int x, int y)
28 return data_[y * xmax_ + x];
32 char_type TextPainter::at(int x, int y) const
34 return data_[y * xmax_ + x];
38 void TextPainter::draw(int x, int y, char_type const * str)
40 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
41 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
47 void TextPainter::horizontalLine(int x, int y, int n, char_type c)
49 for (int i = 0; i < n && i + x < xmax_; ++i)
54 void TextPainter::verticalLine(int x, int y, int n, char_type c)
56 for (int i = 0; i < n && i + y < ymax_; ++i)
61 void TextPainter::draw(int x, int y, char_type c)
63 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
69 void TextPainter::show(odocstream & os, int offset) const
72 for (int j = 0; j <= ymax_; ++j) {
73 for (int i = 0; i < offset; ++i)
75 for (int i = 0; i < xmax_; ++i)