Rev 2764 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2764 | Rev 2793 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | int i; |
7 | int i; |
8 | 8 | ||
Line 9... | Line 9... | ||
9 | char download_path[]="/rd/1/.download"; |
9 | char download_path[]="/rd/1/.download"; |
10 | char search_path[]="http://nigma.ru/index.php?s="; |
10 | char search_path[]="http://nigma.ru/index.php?s="; |
11 | char version[]=" Text-based Browser 0.92"; |
11 | char version[]=" Text-based Browser 0.93"; |
- | 12 | ||
- | 13 | char tinypad_path[]="/sys/tinypad"; |
|
- | 14 | char t_edit_path[]="/sys/develop/t_edit"; |
|
Line 12... | Line 15... | ||
12 | 15 | ||
13 | 16 | ||
14 | struct TWebBrowser { |
17 | struct TWebBrowser { |
15 | int left, top, width, height; |
18 | int left, top, width, height; |
16 | void DrawScroller(); |
19 | void DrawScroller(); |
17 | void ShowPage(); |
20 | void ShowPage(); |
18 | void ParseHTML(dword, dword); |
21 | void ParseHTML(dword, dword); |
19 | void Scan(dword); |
22 | void Scan(int); |
Line 20... | Line 23... | ||
20 | void WhatTextStyle(int left1, top1, width1); |
23 | void WhatTextStyle(int left1, top1, width1); |
Line 21... | Line 24... | ||
21 | }; |
24 | }; |
Line 22... | Line 25... | ||
22 | 25 | ||
23 | TWebBrowser WB1; |
26 | TWebBrowser WB1; |
24 | 27 | ||
25 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, link, ignor_text, li_tab, body_present; |
28 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, link, ignor_text, li_tab, body_present; |
Line 26... | Line 29... | ||
26 | 29 | ||
Line 39... | Line 42... | ||
39 | tagparam[10000], |
42 | tagparam[10000], |
40 | parametr[1200], |
43 | parametr[1200], |
41 | options[1000]; |
44 | options[1000]; |
42 | 45 | ||
Line -... | Line 46... | ||
- | 46 | char anchor[256]; |
|
- | 47 | int anchor_line_num; |
|
- | 48 | ||
Line 43... | Line 49... | ||
43 | 49 | ||
44 | #include "include\history.h" |
50 | #include "include\history.h" |
45 | #include "include\colors.h" |
51 | #include "include\colors.h" |
46 | #include "include\unicode_tags.h" |
52 | #include "include\unicode_tags.h" |
Line 47... | Line 53... | ||
47 | #include "include\some_code.h" |
53 | #include "include\some_code.h" |
48 | 54 | ||
49 | 55 | ||
50 | void TWebBrowser::Scan(dword id) { |
56 | void TWebBrowser::Scan(int id) { |
51 | if (id > 399) |
- | |
52 | { |
- | |
- | 57 | if (id > 399) |
|
- | 58 | { |
|
53 | GetURLfromPageLinks(id); |
59 | GetURLfromPageLinks(id); |
- | 60 | ||
54 | //ýòó âñþ õðåíü íóæíî â GetNewUrl() ïåðåìåñòèòü |
61 | //#1 |
- | 62 | if (URL[0] == '#') |
|
55 | if (URL[0] == '#') { //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî... |
63 | { |
- | 64 | copystr(#URL+find_symbol(#URL, '#'), #anchor); |
|
- | 65 | ||
- | 66 | copystr(BrowserHistory.CurrentUrl(), #URL); |
|
- | 67 | //copystr(#editURL, #URL + strlen(#URL)); |
|
56 | copystr(BrowserHistory.CurrentUrl(), #editURL); |
68 | //copystr(#URL, #editURL); |
57 | copystr(#URL, #editURL + strlen(#editURL)); |
69 | |
58 | copystr(BrowserHistory.CurrentUrl(), #URL); |
70 | za_kadrom=count-max_kolvo_strok; |
- | 71 | ShowPage(#URL); |
|
- | 72 | return; |
|
- | 73 | } |
|
- | 74 | //liner.ru#1 |
|
59 | ShowPage(#URL); |
75 | if (find_symbol(#URL, '#')<>-1) |
- | 76 | { |
|
Line 60... | Line 77... | ||
60 | return; |
77 | copystr(#URL+find_symbol(#URL, '#'), #anchor); |
Line 61... | Line 78... | ||
61 | } |
78 | URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà |
62 | URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, íî ýòî íå ñîâñåì ïðàâèëüíî - â åäèòóðë äîëæíî îñòàâàòüñÿ |
79 | } |
Line 115... | Line 132... | ||
115 | RunProgram(#program_path, #URL); |
132 | RunProgram(#program_path, #URL); |
116 | return; |
133 | return; |
117 | case 052: //Íàæàòà F3 |
134 | case 052: //Íàæàòà F3 |
118 | IF(edit1.flags <> 66) |
135 | IF(edit1.flags <> 66) |
119 | IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path); |
136 | IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#tinypad_path, #download_path); ELSE RunProgram(#tinypad_path, #URL); |
120 | return; |
137 | return; |
- | 138 | case 053: //Íàæàòà F4 |
|
- | 139 | IF(edit1.flags <> 66) |
|
- | 140 | IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#t_edit_path, #download_path); ELSE RunProgram(#t_edit_path, #URL); |
|
- | 141 | return; |
|
121 | 142 | ||
Line 122... | Line 143... | ||
122 | case HOME: |
143 | case HOME: |
123 | copystr("http://kolibri-os.narod.ru", #editURL); |
144 | copystr("http://kolibri-os.narod.ru", #editURL); |
124 | case GOTOURL: |
145 | case GOTOURL: |
Line 347... | Line 368... | ||
347 | IF(strlen(#tagparam) > 0) && (strlen(#tagparam) < 4000) GetNextParam(); |
368 | IF(strlen(#tagparam) > 0) && (strlen(#tagparam) < 4000) GetNextParam(); |
348 | WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ |
369 | WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ |
349 | 370 | ||
Line 350... | Line 371... | ||
350 | line = tag = parametr = tagparam = ignor_param = 0; //âñ¸ îáíóëÿåì |
371 | line = tag = parametr = tagparam = ignor_param = 0; //âñ¸ îáíóëÿåì |
- | 372 | ||
351 | break; |
373 | break; |
352 | case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 |
374 | case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 |
353 | IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
375 | IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
Line 354... | Line 376... | ||
354 | 376 | ||
Line 418... | Line 440... | ||
418 | DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, bg_color); |
440 | DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, bg_color); |
419 | if (stroka * 10 + 15 <= height) |
441 | if (stroka * 10 + 15 <= height) |
420 | DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà |
442 | DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà |
421 | if (za_kadrom == 0) count = stroka; |
443 | if (za_kadrom == 0) count = stroka; |
422 | DrawScroller(); //ðèñóåì ñêðîëë |
444 | |
- | 445 | if (anchor) |
|
- | 446 | { |
|
- | 447 | anchor[0]=''; |
|
- | 448 | za_kadrom=anchor_line_num; |
|
- | 449 | ParseHTML(buf, filesize); |
|
- | 450 | } |
|
- | 451 | ||
- | 452 | DrawScroller(); //ðèñóåì ñêðîëë |
|
423 | } |
453 | } |
424 | 454 | ||
Line 425... | Line 455... | ||
425 | 455 | ||
Line 520... | Line 550... | ||
520 | // |
550 | // |
521 | IF(!tag) return; |
551 | IF(!tag) return; |
522 | stolbec += strlen(#line); |
552 | stolbec += strlen(#line); |
523 | 553 | ||
Line -... | Line 554... | ||
- | 554 | if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
|
- | 555 | { |
|
- | 556 | if (!strcmp(#anchor, #options)) |
|
- | 557 | { |
|
- | 558 | anchor_line_num=za_kadrom+stroka; |
|
- | 559 | } |
|
- | 560 | } |
|
- | 561 | ||
524 | if (!chTag("body")) |
562 | if (!chTag("body")) |
525 | { |
563 | { |
526 | BODY_MARK: |
564 | BODY_MARK: |
Line 527... | Line 565... | ||
527 | 565 | ||
Line 548... | Line 586... | ||
548 | if (rez) DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
586 | if (rez) DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
549 | return; |
587 | return; |
550 | } |
588 | } |
551 | ////////////////////////// |
589 | ////////////////////////// |
552 | if (!chTag("a")) { |
590 | if (!chTag("a")) |
553 | IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return; |
- | |
- | 591 | { |
|
554 | if (rez) { |
592 | if (rez) |
- | 593 | { |
|
- | 594 | _A_MARK: |
|
555 | HREF: IF(strcmp(#parametr, "href=") == 0) { |
595 | if (!strcmp(#parametr, "href=")) |
- | 596 | { |
|
- | 597 | if (stroka - 1 > max_kolvo_strok) || (stroka < -2) return; |
|
556 | IF(link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
598 | if (link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
557 | link = 1; |
599 | link = 1; |
558 | blink++; |
600 | blink++; |
559 | text_color_index++; |
601 | text_color_index++; |
560 | text_colors[text_color_index] = link_color; |
602 | text_colors[text_color_index] = link_color; |
561 | copystr(#options, #page_links + strlen(#page_links)); |
603 | copystr(#options, #page_links + strlen(#page_links)); |
562 | copystr("|", #page_links + strlen(#page_links)); |
604 | copystr("|", #page_links + strlen(#page_links)); |
563 | } |
605 | } |
- | 606 | if (anchor) && (!strcmp(#parametr, "name=")) |
|
- | 607 | { |
|
- | 608 | if (!strcmp(#anchor, #options)) |
|
- | 609 | { |
|
- | 610 | anchor_line_num=za_kadrom+stroka; |
|
- | 611 | } |
|
- | 612 | } |
|
564 | IF(tagparam) { |
613 | if (tagparam) |
- | 614 | { |
|
565 | GetNextParam(); |
615 | GetNextParam(); |
566 | GOTO HREF; |
616 | GOTO _A_MARK; |
567 | } |
617 | } |
568 | } |
618 | } |
569 | ELSE { |
619 | ELSE { |
570 | link = 0; |
620 | link = 0; |
571 | IF(text_color_index > 0) text_color_index--; |
621 | IF(text_color_index > 0) text_color_index--; |