Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4717 → Rev 4718

/programs/cmm/TWB/TWB.c
17,6 → 17,8
void DrawPage();
void DrawScroller();
void NewLine();
void Perenos();
byte end_parsing;
} WB1;
 
byte b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab,
54,13 → 56,12
#include "..\TWB\table.h"
 
 
 
//=======================================================================
 
 
void TWebBrowser::DrawPage()
{
int start_x, start_y, line_length, magrin_left=5;
int start_x, start_y, line_length, stolbec_len, magrin_left=5;
if (!header)
{
75,8 → 76,9
if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
{
start_x = stolbec * 6 + list.x + magrin_left;
start_y = stroka * 10 + list.y + magrin_left;
line_length = strlen(#line) * 6;
start_y = stroka * list.line_h + list.y + magrin_left;
stolbec_len = strlen(#line);
line_length = stolbec_len * 6;
 
WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data);
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data);
84,11 → 86,11
IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
IF (link) {
UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
UnsafeDefineButton(start_x-2, start_y-1, line_length + 3, 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE);
}
stolbec += strlen(#line);
stolbec += stolbec_len;
}
}
//=======================================================================
121,7 → 123,7
 
void TWebBrowser::Parse(){
word bukva[2];
int j, perenos_num;
int j;
byte ignor_param;
char temp[768];
dword bufpos = bufpointer;
129,6 → 131,7
b_text = i_text = u_text = s_text = blq_text = t_html = t_body =
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab =
condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè
end_parsing = false;
condition_max = 255;
text_align = ALIGN_LEFT;
link_color_inactive = 0x0000FF;
148,8 → 151,9
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
}
for ( ; bufpointer+bufsize > bufpos; bufpos++;)
for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;)
{
if (end_parsing) break;
bukva = ESBYTE[bufpos];
if (ignor_text) && (bukva!='<') continue;
if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue;
160,7 → 164,7
{
chrcat(#line, ' ');
bukva = temp = NULL;
goto NEXT_MARK;
Perenos();
}
case '\9':
if (pre_text) //èíà÷å èä¸ì íà 0x0d
239,18 → 243,8
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
 
if (stolbec + strlen(#line) > list.column_max) //============the same as NEXT_MARK
{
perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
line[perenos_num] = 0x00;
if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
if (stolbec + strlen(#line) > list.column_max) Perenos();
DrawPage();
strcpy(#line, #temp);
NewLine(); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
}
DrawPage();
line = NULL;
if (tag) SetTextStyle(list.x + 5, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ
tag = parametr = tagparam = ignor_param = NULL;
264,22 → 258,9
if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà
}
if (strlen(#line)<sizeof(line)) chrcat(#line, bukva);
 
if (stolbec + strlen(#line) > list.column_max)
{
NEXT_MARK:
perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
strcpy(#temp, #line + perenos_num);
line[perenos_num] = 0x00;
if (stroka-1 > list.visible) && (list.first <>0) break 1;
DrawPage();
strcpy(#line, #temp);
NewLine();
if (stolbec + strlen(#line) > list.column_max) Perenos();
}
}
}
 
DrawPage();
NewLine();
DrawBar(list.x, stroka * list.line_h + list.y + 5, list.w, -stroka * list.line_h + list.h - 5, bg_color);
294,6 → 275,19
DrawScroller();
}
 
void TWebBrowser::Perenos()
{
int perenos_num;
char new_line_text[4096];
perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
strcpy(#new_line_text, #line + perenos_num);
line[perenos_num] = 0x00;
if (stroka-1 > list.visible) && (list.first <>0) end_parsing=true;
DrawPage();
strcpy(#line, #new_line_text);
NewLine();
}
 
 
char oldtag[100];
384,7 → 378,7
link = 1;
text_colors[text_color_index] = link_color_inactive;
PageLinks.AddLink(#options, stolbec*6+left1, top1);
PageLinks.AddLink(#options, stolbec*6+left1, top1-2);
}
if (anchor) && (!strcmp(#parametr, "name="))
{
547,7 → 541,7
if (opened)
{
NewLine();
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-2, 2, 2, 0x555555);
}
return;
}
/programs/cmm/TWB/history.h
1,5 → 1,6
struct path_string {
char Item[4096];
char Item[sizeof(URL)];
int was_first;
};
 
#define MAX_HISTORY_NUM 40
10,6 → 11,7
int current;
dword CurrentUrl();
dword GetUrl();
dword GetFirstLine();
void AddUrl();
byte GoBack();
byte GoForward();
23,6 → 25,10
return #history_list[id].Item;
}
 
dword UrlsHistory::GetFirstLine(int id) {
return history_list[id].was_first;
}
 
void UrlsHistory::AddUrl() {
int i;
if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return;
32,11 → 38,12
current/=2;
for (i=0; i<current; i++;)
{
strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(history_list[0].Item));
strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(URL));
}
}
current++;
strlcpy(#history_list[current].Item, #URL, sizeof(history_list[0].Item));
// history_list[i].was_first = WB1.list.first;
strlcpy(#history_list[current].Item, #URL, sizeof(URL));
links_count=current;
}
 
45,6 → 52,7
if (current<=1) return 0;
current--;
strlcpy(#URL, #history_list[current].Item, sizeof(URL));
// stroka = history_list[current].was_first;
return 1;
}
 
/programs/cmm/TWB/img_cache.h
44,20 → 44,10
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{
if (http_transfer<>0) strcpy(#img_path, #history_list[BrowserHistory.current-1].Item); else
strcpy(#img_path, BrowserHistory.CurrentUrl());
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
//get path: absolute or relative
if (options[0]=='/')
strcpy(#img_path, #options);
else
{
img_path[strrchr(#img_path, '/')] = '\0';
strcat(#img_path, #options);
}
PageLinks.GetAbsoluteURL(#img_path);
cur_pic = GetImageNumber(#img_path);
}
}
if (!strcmp(#parametr,"alt="))
{
strcpy(#alt, "[");
78,7 → 68,8
if (imgw > width1) imgw = width1;
if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
stroka += imgh/10;
stroka += imgh / WB1.list.line_h;
if (imgh % WB1.list.line_h) stroka++;
if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
if (top1<WB1.list.y) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
{
95,6 → 86,7
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.line_h + WB1.list.line_h, bg_color);
IF (link)
{
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
/programs/cmm/TWB/links.h
76,13 → 76,13
{
if (active==i) return;
CursorPointer.Set();
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
if (links[i].underline) DrawBar(links[i].x,links[i].y+8,links[i].w,1, bg_col);
if (links[active].underline) DrawBar(links[active].x,links[active].y+10,links[active].w,1, link_col_in);
if (links[i].underline) DrawBar(links[i].x,links[i].y+10,links[i].w,1, bg_col);
active = i;
DrawBar(progress_bar.left+progress_bar.width+10, progress_bar.top+2, Form.cwidth-progress_bar.left-progress_bar.width-10, 9, col_bg);
status_text.start_x = progress_bar.left+progress_bar.width+10;
status_text.start_y = progress_bar.top+2;
status_text.area_size_x = Form.cwidth-progress_bar.left-progress_bar.width-10;
status_text.start_y = Form.cheight-STATUSBAR_H+3;
status_text.area_size_x = Form.cwidth - status_text.start_x -3;
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
status_text.text_pointer = links[active].link;
PathShow_prepare stdcall(#status_text);
PathShow_draw stdcall(#status_text);
92,8 → 92,8
if (active!=-1)
{
CursorPointer.Restore();
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
DrawBar(progress_bar.left+progress_bar.width+10, progress_bar.top+2, Form.cwidth-progress_bar.left-progress_bar.width-10, 9, col_bg);
if (links[active].underline) DrawBar(links[active].x,links[active].y+10,links[active].w,1, link_col_in);
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
active = -1;
}
}