/programs/network/htmlv/browser/TWB.h |
---|
9,7 → 9,7 |
char download_path[]="/rd/1/.download"; |
char search_path[]="http://nigma.ru/index.php?s="; |
char version[]=" Text-based Browser 0.94e"; |
char version[]=" Text-based Browser 0.94u"; |
struct TWebBrowser { |
30,7 → 30,7 |
link, ignor_text, li_tab, first_line_drawed; |
dword text_colors[30], |
dword text_colors[300], |
text_color_index, |
link_color, |
bg_color; |
39,6 → 39,9 |
stolbec, |
tab_len; |
char anchor[256]; |
int anchor_line_num; |
char line[500], |
tag[100], |
tagparam[10000], |
45,10 → 48,7 |
parametr[1200], |
options[1000]; |
char anchor[256]; |
int anchor_line_num; |
#include "include\history.h" |
#include "include\colors.h" |
#include "include\unicode_tags.h" |
65,7 → 65,7 |
//#1 |
if (URL[0] == '#') |
{ |
strcpy(#anchor, #URL+find_symbol(#URL, '#')); |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
74,10 → 74,10 |
return; |
} |
//liner.ru#1 |
if (find_symbol(#URL, '#')<>-1) |
if (strrchr(#URL, '#')<>-1) |
{ |
strcpy(#anchor, #URL+find_symbol(#URL, '#')); |
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
} |
GetNewUrl(); |
197,15 → 197,15 |
_CUT_ST_LEVEL_MARK: |
if (editURL[find_symbol(#editURL, '/')-2]<>'/') // åñëè íå http://pagename.ua <-- íàõðåíà ýòà ñòðîêà??? |
if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http://pagename.ua <-- íàõðåíà ýòà ñòðîêà??? |
{ |
editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
} |
IF (!strcmp(get_URL_part(3),"../")) //íà óðîâåíü ââåðõ |
{ |
strcpy(#URL,#URL+3); |
editURL[find_symbol(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
editURL[strrchr(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
goto _CUT_ST_LEVEL_MARK; |
} |
318,9 → 318,7 |
if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
#ifdef DEBUG_ON |
debug("Start parsing"); |
#endif |
for ( ; buf+filesize > bword; bword++;) {//ESBYTE[bword] |
bukva = ESBYTE[bword]; |
438,7 → 436,7 |
// |
if (stolbec + strlen(#line) > lines.column_max) |
{ |
perenos_num = find_symbol(#line, ' '); |
perenos_num = strrchr(#line, ' '); |
strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì |
line[perenos_num] = 0x00; |
NEXT_MARK: |
465,9 → 463,7 |
ParseHTML(buf); |
} |
#ifdef DEBUG_ON |
debug("End parsing"); |
#endif |
DrawScroller(); //ðèñóåì ñêðîëë |
} |
568,14 → 564,16 |
{ |
if (rez) |
{ |
text_color_index++; |
text_colors[text_color_index] = text_colors[text_color_index-1]; |
_A_MARK: |
if (!strcmp(#parametr, "href=")) |
{ |
if (stroka - 1 > lines.visible) || (stroka < -2) return; |
if (link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
if (link) && (text_color_index > 0) text_color_index--; //åñëè íå çàêðûò òýã |
link = 1; |
blink++; |
text_color_index++; |
text_colors[text_color_index] = link_color; |
strcat(#page_links, #options); |
strcat(#page_links, "|"); |
602,11 → 600,14 |
///////////////////////// |
if (!chTag("font")) |
{ |
IF (stroka - 1 > lines.visible) return; |
if (rez) |
{ |
text_color_index++; |
text_colors[text_color_index] = text_colors[text_color_index-1]; |
COL_MARK: |
if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
{ |
text_color_index++; |
text_colors[text_color_index] = GetColor(#options); |
} |
IF(tagparam) { |
613,7 → 614,9 |
GetNextParam(); |
GOTO COL_MARK; |
} |
IF(!rez) && (text_color_index > 0) text_color_index--; |
} |
else |
if (text_color_index > 0) text_color_index--; |
return; |
} |
////////////////////////// |
694,18 → 697,18 |
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl() |
{ |
strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû |
temp[find_symbol(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
temp[strrchr(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
strcat(#temp, #options); |
image=load_image(#temp); |
w=DSWORD[image+4]; |
h=DSWORD[image+8]; |
} |
if (!strcmp(#parametr,"alt=")) |
/*if (!strcmp(#parametr,"alt=")) |
{ |
strcpy(#tag, "[Image: "); |
strcat(#tag, #options); |
strcat(#tag, "]"); |
} |
}*/ |
IF(tagparam) |
{ |
758,7 → 761,7 |
META: |
if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) |
{ |
strcpy(#options, #options[find_symbol(#options, '=')]); //ïîèñê â content= |
strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content= |
if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); |
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); |
/programs/network/htmlv/browser/include/colors.h |
---|
317,10 → 317,7 |
ELSE |
FOR (ii=0; color_names[ii]!=0; ii++) |
{ |
IF(!strcmp(color_str, color_names[ii])) |
{ |
return colors[ii]; |
IF(!strcmp(color_str, color_names[ii])) return colors[ii]; |
} |
} |
return text_colors[0]; |
} |
/programs/network/htmlv/browser/include/history.h |
---|
23,6 → 23,7 |
void UrlsHistory::AddUrl() //òóò íóæåí ââîäèìûé ýëåìåíò - äëÿ óíèâåðñàëüíîñòè |
{ |
int i; |
if (history_num>0) && (strcmp(#URL,#history_list[history_current].Item)==0) return; |
if (history_current>=MAX_HISTORY_NUM-1) |
/programs/network/htmlv/browser/include/menu_rmb.h |
---|
4,13 → 4,14 |
#define ITEM_WIDTH 138 |
char *ITEMS_LIST[]={ |
"View in Tinypad F3", |
"View in TextEdit F4", |
"-", |
"KOI-8 Ctrl+K", |
"UTF Ctrl+U", |
"View in Tinypad F3",52, |
"View in TextEdit F4",53, |
"-",0, |
"KOI-8 Ctrl+K",11, |
"UTF Ctrl+U",21, |
0}; |
proc_info MenuForm; |
19,7 → 20,7 |
mouse mm; |
int items_num, items_cur; |
int id1, key; |
int id1, key, i; |
SetEventMask(100111b); |
43,7 → 44,9 |
break; |
case evButton: |
ItemProcess(GetButtonID()); |
id1=GetButtonID()-10; |
WB1.Scan(ITEMS_LIST[id1*2+1]); |
ExitProcess(); |
break; |
case evKey: |
61,12 → 64,13 |
} |
if (key==13) |
{ |
ItemProcess(items_cur+10); |
WB1.Scan(ITEMS_LIST[items_cur*2+1]); |
ExitProcess(); |
} |
break; |
case evReDraw: |
for (items_num=0; ITEMS_LIST[items_num]<>0; items_num++;) {}; |
while (ITEMS_LIST[items_num*2]) items_num++; |
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinWidth()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0,0,0); |
DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê |
73,7 → 77,7 |
_ITEMS_DRAW: |
for (i=0; i<items_num; i++;) |
{ |
if (!strcmp(ITEMS_LIST[i],"-")) |
if (!strcmp(ITEMS_LIST[i*2],"-")) |
{ |
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, 0xFFFFFF); |
DrawBar(1, i*ITEM_HEIGHT+1+9, ITEM_WIDTH-1, 1, 0x999999); |
82,22 → 86,12 |
DefineButton(0, i*ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT, i+10+BT_HIDE, 0xFFFFFF); |
if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE; |
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); |
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i],0); |
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0); |
} |
} |
} |
void ItemProcess(int num_id) |
{ |
if (num_id==10) WB1.Scan(52); |
if (num_id==11) WB1.Scan(53); |
//----------------------- |
if (num_id==13) WB1.Scan(11); //KOI |
if (num_id==14) WB1.Scan(21); //UTF |
ExitProcess(); |
} |
/programs/network/htmlv/browser/include/parce_tag.h |
---|
12,12 → 12,12 |
IF (kavichki) |
{ |
i=find_symbol(#tagparam, kavichki); |
i=strrchr(#tagparam, kavichki); |
strcpy(#options, #tagparam + i); |
} |
ELSE |
{ |
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=find_symbol(#tagparam, '=')+1; |
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1; |
i++; |
strcpy(#options, #tagparam + i); //êîïèðóåì îïöèþ |
/programs/network/htmlv/browser/include/some_code.h |
---|
27,7 → 27,7 |
void GetURLfromPageLinks(int id) |
{ |
int j = 0; |
int i, j = 0; |
for (i = 0; i <= id - 401; i++) |
{ |
do j++; |
34,7 → 34,7 |
while (page_links[j] <>'|'); |
} |
page_links[j] = 0x00; |
strcpy(#URL, #page_links[find_symbol(#page_links, '|')]); |
strcpy(#URL, #page_links[strrchr(#page_links, '|')]); |
} |
49,14 → 49,14 |
dword italic_buf; |
int tile_height=2, //áóäåì âûâîäèòü äâóõïèêñåëüíûìè ïîëîñêàìè |
shift=-2, //ñ äâóõïèêñåëüíûì ñìåùåíèåì |
i; |
i, skin_width; |
italic_buf = mem_Alloc(w*h*3); |
skin_width = GetSkinWidth(); |
CopyScreen(italic_buf, x+Form.left+2, y+Form.top+skin_width, w, h); |
CopyScreen(italic_buf, x+Form.left+2, GetSkinWidth()+y+Form.top, w, h); |
FOR (i=0;i*tile_height<h;i++) |
PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i+1,i*tile_height+y); |
FOR (i=0;i*tile_height<h;i++){ |
PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i+1,i*tile_height+y); |
} |
mem_Free(italic_buf); |
} |
/programs/network/htmlv/browser/include/unicode_tags.h |
---|
2,18 → 2,6 |
byte unicode_chars[] = " ¡¢£¤¥¦§¨©ª«¬®¯àáâãäåæçèéêëìíîïðñh£\243i\105\244\0"; |
/* IF (BL==178) ESBYTE[ESI] = 73; //I |
IF (BL==179) ESBYTE[ESI] = 105; //i |
IF (BL==175) ESBYTE[ESI] = 244; //J |
IF (BL==191) ESBYTE[ESI] = 245; //j |
IF (BL==170) ESBYTE[ESI] = 242; //E |
IF (BL==186) ESBYTE[ESI] = 243; //e |
IF (BL==168) ESBYTE[ESI] = 240; //à |
IF (BL==184) ESBYTE[ESI] = 'e'; //e |
IF (BL==180) ESBYTE[ESI] = 254; //£ |
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34; |
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45; |
*/ |
char *unicode_tags[]={ |
"nbsp", " ", |
74,7 → 62,7 |
"#1031", "\244", |
"#8470", "N", |
"bull", "-", //¢®®¡é¥ §¤¥áì â®çª |
"bull", "-", //âîîáùå çäåñü òî÷êà |
"percnt","%", |
0}; |