Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4413 → Rev 4414

/programs/cmm/TWB/TWB.c
11,9 → 11,11
char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s=";
 
struct lines{
int visible, all, first, column_max;
};
 
struct TWebBrowser {
int left, top, width, height, line_h;
llist list;
void GetNewUrl();
void OpenPage();
73,13 → 75,13
if (stroka >= 0) && (stroka - 2 < lines.visible) && (line) && (!anchor)
{
start_x = stolbec * 6 + left + magrin_left;
start_y = stroka * 10 + top + magrin_left;
start_x = stolbec * 6 + list.x + magrin_left;
start_y = stroka * 10 + list.y + magrin_left;
line_length = strlen(#line) * 6;
 
WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (i_text) DrawBufSkew(start_x, 0, line_length, line_h);
IF (i_text) DrawBufSkew(start_x, 0, line_length, list.line_h);
IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
IF (link) {
202,12 → 204,12
 
if (!filesize)
{
DrawBar(left, top, width+scroll1.size_x+1, height, 0xFFFFFF); //fill all
if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading...");
DrawBar(list.x, list.y, list.w+scroll1.size_x+1, list.h, 0xFFFFFF); //fill all
if (GetProcessSlot(downloader_id)<>0) WriteText(list.x + 10, list.y + 18, 0x80, 0, "Loading...");
else
{
WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
WriteText(list.x + 10, list.y + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
if (!strcmp(get_URL_part(5),"http:"))) WriteText(list.x + 10, list.y + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
}
//return;
}
342,12 → 344,12
if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //óõîäèì...
DrawPage();
strcpy(#line, #temp);
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
}
DrawPage();
line=NULL;
 
if (tag) WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ
if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ
 
tag = parametr = tagparam = ignor_param = NULL;
break;
371,18 → 373,18
if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //óõîäèì...
DrawPage();
strcpy(#line, #temp);
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
}
}
}
 
DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
 
if (lines.visible * 10 + 25 <= height)
DrawBar(left, lines.visible * 10 + top + 25, width, -lines.visible * 10 + height - 25, bg_color);
if (stroka * 10 + 5 <= height)
DrawBar(left, stroka * 10 + top + 5, width, -stroka * 10 + height - 5, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
if (lines.visible * 10 + 25 <= list.h)
DrawBar(list.x, lines.visible * 10 + list.y + 25, list.w, -lines.visible * 10 + list.h - 25, bg_color);
if (stroka * 10 + 5 <= list.h)
DrawBar(list.x, stroka * 10 + list.y + 5, list.w, -stroka * 10 + list.h - 5, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
if (lines.first == 0) lines.all = stroka;
if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
{
576,7 → 578,7
if (rez)
{
TextGoDown(left1, top1, width1);
if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, line_h/2-3, 2, 2, 0x555555);
if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
}
return;
}
600,8 → 602,8
}
if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
TextGoDown(left1, top1, width1);
DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color);
TextGoDown(left1, top1+WB1.line_h, width1);
DrawBufBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color);
TextGoDown(left1, top1+WB1.list.line_h, width1);
}
if (!chTag("img"))
{
632,8 → 634,8
scroll1.position = lines.first;
 
scroll1.all_redraw=1;
scroll1.start_x = WB1.left + WB1.width;
scroll1.size_y=WB1.height;
scroll1.start_x = WB1.list.x + WB1.list.w;
scroll1.size_y=WB1.list.h;
 
scrollbar_v_draw(#scroll1);
}
/programs/cmm/TWB/draw_buf.h
2,14 → 2,14
void DrawBufInit()
{
free(drawbuf);
drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
ESDWORD[drawbuf] = WB1.width;
ESDWORD[drawbuf+4] = WB1.line_h;
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;
}
void DrawBufFill()
{
int i;
for (i=0; i<WB1.width* WB1.line_h +4 * 4; i+=4) ESDWORD[drawbuf+i+8] = bg_color;
for (i=0; i<WB1.list.w* WB1.list.line_h +4 * 4; i+=4) ESDWORD[drawbuf+i+8] = bg_color;
}
void DrawBufBar(dword x, y, w, h, color)
{
16,7 → 16,7
int i, j;
for (j=0; j<h; j++)
{
for (i = y+j*WB1.width+x*4; i<y+j*WB1.width+x+w*4 ; i+=4) ESDWORD[drawbuf+i+8] = color;
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;
}
}
 
27,7 → 27,7
stolbec++;
for (j=0; j<=3; j++)
{
for (i = y+j*WB1.width+x+w+h*4; i>y+j*WB1.width+x+h-12*4 ; i-=4)
for (i = y+j*WB1.list.w+x+w+h*4; i>y+j*WB1.list.w+x+h-12*4 ; i-=4)
ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
}
}
64,12 → 64,12
 
void TextGoDown(int left1, top1, width1)
{
if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10) && (!anchor)
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)
{
if (text_align == ALIGN_CENTER) DrawBufAlignCenter(left1,top1,WB1.width,WB1.line_h);
if (text_align == ALIGN_RIGHT) DrawBufAlignRight(left1,top1,WB1.width,WB1.line_h);
PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0);
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);
DrawBufFill();
}
stroka++;
/programs/cmm/TWB/img_cache.h
42,9 → 42,14
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
img_path[strrchr(#img_path, '/')] = '\0'; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
//get path: absolute or relative
if (options[0]=='/')
strcpy(#img_path, #options);
else
{
img_path[strrchr(#img_path, '/')] = '\0';
strcat(#img_path, #options);
}
cur_pic=GetOrSetPicNum(#img_path);
if (!pics[cur_pic].path)
{
72,23 → 77,23
h = DSWORD[pics[cur_pic].image+8];
if (w > width1) w = width1;
if (stroka==0) DrawBar(WB1.left, WB1.top, WB1.width-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
stroka+=h/10;
if (top1+h<WB1.top) || (top1>WB1.top+WB1.height-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
if (top1<WB1.top) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
if (top1+h<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
if (top1<WB1.list.y) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
{
img_lines_first=WB1.top-top1;
img_lines_first=WB1.list.y-top1;
h=h-img_lines_first;
top1=WB1.top;
top1=WB1.list.y;
}
if (top1>WB1.top+WB1.height-h-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó
if (top1>WB1.list.y+WB1.list.h-h-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó
{
h=WB1.top+WB1.height-top1-5;
h=WB1.list.y+WB1.list.h-top1-5;
}
if (h<=0) return;
if (anchor) return;
img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first);
DrawBar(left1+w - 5, top1, WB1.width-w, h, bg_color);
DrawBar(left1+w - 5, top1, WB1.list.w-w, h, bg_color);
IF (link) UnsafeDefineButton(left1 - 5, top1, w, h-1, blink + BT_HIDE, 0xB5BFC9);
}