PIPeer important fix!
git-svn-id: svn://db.shs.com.ru/pip@110 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -507,6 +507,9 @@ void PIScreen::run() {
|
||||
tile_dialog->width = sw;
|
||||
tile_dialog->height = sh;
|
||||
tile_dialog->layout();
|
||||
int dx = tile_dialog->x - 1, dy = tile_dialog->y - 1, dw = tile_dialog->width, dh = tile_dialog->height;
|
||||
drawer_.drawFrame(dx, dy, dx + dw + 1, dy + dh + 1, (Color)tile_dialog->back_format.color_char,
|
||||
(Color)tile_dialog->back_format.color_back, (CharFlags)tile_dialog->back_format.flags);
|
||||
tile_dialog->drawEventInternal(&drawer_);
|
||||
}
|
||||
console.print();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,19 +29,25 @@
|
||||
class PIP_EXPORT PIScreenDrawer
|
||||
{
|
||||
friend class PIScreen;
|
||||
PIScreenDrawer(PIVector<PIVector<PIScreenTypes::Cell> > & c): cells(c) {}
|
||||
PIScreenDrawer(PIVector<PIVector<PIScreenTypes::Cell> > & c);
|
||||
public:
|
||||
enum ArtChar {LineVertical = 1, LineHorizontal, Cross, CornerTopLeft, CornerTopRight, CornerBottomLeft, CornerBottomRight};
|
||||
|
||||
void clear();
|
||||
void clearRect(int x0, int y0, int x1, int y1) {fillRect(x0, y0, x1, y1, ' ');}
|
||||
void drawPixel(int x, int y, const PIChar & c, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void drawLine(int x0, int y0, int x1, int y1, const PIChar & c, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void drawRect(int x0, int y0, int x1, int y1, const PIChar & c, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void drawFrame(int x0, int y0, int x1, int y1, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void drawText(int x, int y, const PIString & s, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Transparent, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void fillRect(int x0, int y0, int x1, int y1, const PIChar & c, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
|
||||
PIChar artChar(const ArtChar type) const {return arts_.value(type, PIChar(' '));}
|
||||
|
||||
private:
|
||||
PIVector<PIVector<PIScreenTypes::Cell> > & cells;
|
||||
int width, height;
|
||||
PIMap<ArtChar, PIChar> arts_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -88,7 +88,6 @@ TileList::TileList(const PIString & n): PIScreenTile(n) {
|
||||
focus_flags = CanHasFocus | NextByArrowsHorizontal | NextByTab;
|
||||
lhei = offset = cur = 0;
|
||||
selection_mode = NoSelection;
|
||||
vert_line = PIChar::fromUTF8("│");
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +100,7 @@ void TileList::sizeHint(int & w, int & h) const {
|
||||
|
||||
|
||||
void TileList::drawEvent(PIScreenDrawer * d) {
|
||||
vert_line = d->artChar(PIScreenDrawer::LineVertical);
|
||||
lhei = height - 2;
|
||||
//int osp = piMini(3, lhei / 4);
|
||||
int is = piClampi(offset, 0, piMaxi(0, content.size_s() - 1)), ie = piClampi(offset + lhei, 0, content.size_s());
|
||||
|
||||
Reference in New Issue
Block a user