2013-12-27 00:36:17 +01:00
|
|
|
dword drawbuf;
|
|
|
|
void DrawBufInit()
|
|
|
|
{
|
|
|
|
free(drawbuf);
|
2013-12-27 02:08:50 +01:00
|
|
|
drawbuf = malloc(WB1.list.w * WB1.list.line_h +4 * 4 + 8); //+1 for good luck
|
|
|
|
ESDWORD[drawbuf] = WB1.list.w;
|
|
|
|
ESDWORD[drawbuf+4] = WB1.list.line_h;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
void DrawBufFill()
|
|
|
|
{
|
|
|
|
int i;
|
2013-12-27 02:08:50 +01:00
|
|
|
for (i=0; i<WB1.list.w* WB1.list.line_h +4 * 4; i+=4) ESDWORD[drawbuf+i+8] = bg_color;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
void DrawBufBar(dword x, y, w, h, color)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
for (j=0; j<h; j++)
|
|
|
|
{
|
2013-12-27 02:08:50 +01:00
|
|
|
for (i = y+j*WB1.list.w+x*4; i<y+j*WB1.list.w+x+w*4 ; i+=4) ESDWORD[drawbuf+i+8] = color;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char shift[]={8,8,4,4};
|
|
|
|
void DrawBufSkew(dword x, y, w, h)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
stolbec++;
|
|
|
|
for (j=0; j<=3; j++)
|
|
|
|
{
|
2013-12-27 02:08:50 +01:00
|
|
|
for (i = y+j*WB1.list.w+x+w+h*4; i>y+j*WB1.list.w+x+h-12*4 ; i-=4)
|
2013-12-27 00:36:17 +01:00
|
|
|
ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawBufAlignRight(dword x,y,w,h)
|
|
|
|
{
|
|
|
|
int i, j, l;
|
|
|
|
int content_width = stolbec * 6;
|
|
|
|
int content_left = w - content_width / 2;
|
|
|
|
for (j=0; j<h; j++)
|
|
|
|
{
|
|
|
|
for (i=j*w+w-x*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
|
|
|
{
|
|
|
|
ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawBufAlignCenter(dword x,y,w,h)
|
|
|
|
{
|
|
|
|
int i, j, l;
|
|
|
|
int content_width = stolbec * 6;
|
|
|
|
int content_left = w - content_width / 2;
|
|
|
|
for (j=0; j<h; j++)
|
|
|
|
{
|
|
|
|
for (i=j*w+content_width+content_left*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
|
|
|
{
|
|
|
|
ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TextGoDown(int left1, top1, width1)
|
|
|
|
{
|
2013-12-27 02:08:50 +01:00
|
|
|
if (!stroka) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
|
|
|
|
if (top1>=WB1.list.y) && ( top1 < WB1.list.h+WB1.list.y-10) && (!anchor)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2013-12-27 02:08:50 +01:00
|
|
|
if (text_align == ALIGN_CENTER) DrawBufAlignCenter(left1,top1,WB1.list.w,WB1.list.line_h);
|
|
|
|
if (text_align == ALIGN_RIGHT) DrawBufAlignRight(left1,top1,WB1.list.w,WB1.list.line_h);
|
|
|
|
PutPaletteImage(drawbuf+8, WB1.list.w, WB1.list.line_h, left1-5, top1, 32,0);
|
2013-12-27 00:36:17 +01:00
|
|
|
DrawBufFill();
|
|
|
|
}
|
|
|
|
stroka++;
|
|
|
|
if (blq_text) stolbec = 8; else stolbec = 0;
|
|
|
|
if (li_text) stolbec = li_tab * 5;
|
|
|
|
}
|