PIPeer important fix!

git-svn-id: svn://db.shs.com.ru/pip@110 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-19 19:01:46 +00:00
parent 929338a4d7
commit 476958706f
12 changed files with 147 additions and 18 deletions

View File

@@ -46,6 +46,58 @@
using namespace PIScreenTypes;
PIScreenDrawer::PIScreenDrawer(PIVector<PIVector<Cell> > & c): cells(c) {
arts_[LineVertical] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('|');
#endif
arts_[LineHorizontal] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('-');
#endif
arts_[Cross] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('+');
#endif
arts_[CornerTopLeft] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('+');
#endif
arts_[CornerTopRight] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('+');
#endif
arts_[CornerBottomLeft] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('+');
#endif
arts_[CornerBottomRight] =
#ifdef PIP_ICU
PIChar::fromUTF8("");
#else
PIChar('+');
#endif
}
void PIScreenDrawer::clear() {
for (int i = 0; i < cells.size_s(); ++i)
cells[i].fill(Cell());
@@ -129,6 +181,44 @@ void PIScreenDrawer::drawRect(int x0, int y0, int x1, int y1, const PIChar & c,
}
void PIScreenDrawer::drawFrame(int x0, int y0, int x1, int y1, Color col_char, Color col_back, CharFlags flags_char) {
if (x0 == x1 && y0 == y1) return;
Cell cc;
cc.format.color_char = col_char;
cc.format.color_back = col_back;
cc.format.flags = flags_char;
int dx = x0 < x1 ? 1 : -1;
int dy = y0 < y1 ? 1 : -1;
int xs[2] = {x0, x1};
int ys[2] = {y0, y1};
for (int k = 0; k < 2; ++k) {
int j = ys[k];
if (j >= 0 && j < height) {
PIVector<Cell> & cv(cells[j]);
cc.symbol = artChar(LineHorizontal);
for (int i = x0 + 1; i != x1; i += dx)
if (i >= 0 && i < width)
cv[i] = cc;
}
j = xs[k];
if (j >= 0 && j < width) {
cc.symbol = artChar(LineVertical);
for (int i = y0 + 1; i != y1; i += dy)
if (i >= 0 && i < height)
cells[i][j] = cc;
}
}
int i = x0, j = y0; cc.symbol = artChar(CornerTopLeft);
if (i >= 0 && i < width && j >= 0 && j < height) cells[j][i] = cc;
i = x1, j = y0; cc.symbol = artChar(CornerTopRight);
if (i >= 0 && i < width && j >= 0 && j < height) cells[j][i] = cc;
i = x0, j = y1; cc.symbol = artChar(CornerBottomLeft);
if (i >= 0 && i < width && j >= 0 && j < height) cells[j][i] = cc;
i = x1, j = y1; cc.symbol = artChar(CornerBottomRight);
if (i >= 0 && i < width && j >= 0 && j < height) cells[j][i] = cc;
}
void PIScreenDrawer::fillRect(int x0, int y0, int x1, int y1, const PIChar & c, Color col_char, Color col_back, CharFlags flags_char) {
if (x0 == x1 && y0 == y1) drawPixel(x0, y0, c, col_char, col_back, flags_char);
Cell cc;