Rev 4417 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4417 | Rev 4475 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #include "..\lib\draw_buf.h" |
|
Line 1... | Line 2... | ||
1 | int downloader_id; |
2 | |
Line 2... | Line 3... | ||
2 | 3 | int downloader_id; |
|
3 | dword buf; |
4 | |
Line 17... | Line 18... | ||
17 | 18 | ||
Line 18... | Line -... | ||
18 | - | ||
19 | char download_path[]="/rd/1/.download"; |
19 | |
20 | 20 | ||
- | 21 | char download_path[]="/rd/1/.download"; |
|
21 | 22 | ||
22 | struct TWebBrowser { |
23 | struct TWebBrowser { |
23 | llist list; //need #include "..\lib\list_box.h" |
24 | llist list; //need #include "..\lib\list_box.h" |
24 | void GetNewUrl(); |
25 | DrawBufer DrawBuf; |
25 | void ReadHtml(byte); |
26 | void GetNewUrl(); |
26 | void ShowPage(); |
27 | void ReadHtml(); |
27 | void ParseHTML(dword); |
28 | void ShowPage(); |
- | 29 | void ParseHTML(); |
|
28 | void WhatTextStyle(int left1, top1, width1); |
30 | void WhatTextStyle(); |
29 | void DrawPage(); |
31 | void DrawPage(); |
Line 30... | Line 32... | ||
30 | void DrawScroller(); |
32 | void DrawScroller(); |
31 | }; |
33 | void TextGoDown(); |
32 | TWebBrowser WB1; |
34 | }; |
Line -... | Line 35... | ||
- | 35 | TWebBrowser WB1; |
|
33 | 36 | ||
Line 34... | Line 37... | ||
34 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab, |
37 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab, |
35 | link, ignor_text, cur_encoding, text_align; |
38 | link, ignor_text, cur_encoding, text_align; |
36 | byte condition_text_active, condition_text_val, condition_href, condition_max; |
39 | byte condition_text_active, condition_text_val, condition_href, condition_max; |
Line 59... | Line 62... | ||
59 | #include "..\TWB\unicode_tags.h" |
62 | #include "..\TWB\colors.h" |
60 | #include "..\TWB\img_cache.h" |
63 | #include "..\TWB\unicode_tags.h" |
61 | #include "..\TWB\some_code.h" |
64 | #include "..\TWB\img_cache.h" |
62 | #include "..\TWB\parce_tag.h" |
65 | #include "..\TWB\some_code.h" |
63 | #include "..\TWB\draw_buf.h" |
66 | #include "..\TWB\parce_tag.h" |
64 | - | ||
- | 67 | ||
- | 68 | ||
Line 65... | Line 69... | ||
65 | //======================================================================= |
69 | |
Line 66... | Line 70... | ||
66 | 70 | //======================================================================= |
|
Line 83... | Line 87... | ||
83 | start_x = stolbec * 6 + list.x + magrin_left; |
87 | { |
84 | start_y = stroka * 10 + list.y + magrin_left; |
88 | start_x = stolbec * 6 + list.x + magrin_left; |
85 | line_length = strlen(#line) * 6; |
89 | start_y = stroka * 10 + list.y + magrin_left; |
86 | 90 | line_length = strlen(#line) * 6; |
|
Line 87... | Line 91... | ||
87 | WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf); |
91 | |
88 | IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf); |
92 | WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
89 | IF (i_text) DrawBufSkew(start_x, 0, line_length, list.line_h); |
93 | IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
90 | IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
94 | IF (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } |
91 | IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
95 | IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
92 | IF (link) { |
96 | IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
93 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); |
97 | IF (link) { |
94 | DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
98 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); |
95 | } |
99 | DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
96 | stolbec += strlen(#line); |
100 | } |
97 | } |
101 | stolbec += strlen(#line); |
98 | } |
102 | } |
99 | //======================================================================= |
103 | } |
Line 202... | Line 206... | ||
202 | if (blink<400) blink=400; else for ( ; blink>400; blink--;) DeleteButton(blink); |
206 | |
203 | b_text = i_text = u_text = s_text = blq_text = |
207 | if (blink<400) blink=400; else for ( ; blink>400; blink--;) DeleteButton(blink); |
204 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = |
208 | b_text = i_text = u_text = s_text = blq_text = |
205 | condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè |
209 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = |
206 | condition_max = 10; |
210 | condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè |
207 | text_align = ALIGN_LEFT; |
211 | condition_max = 255; |
208 | link_color = 0x0000FF; |
212 | text_align = ALIGN_LEFT; |
209 | bg_color = 0xFFFFFF; |
213 | link_color = 0x0000FF; |
210 | DrawBufFill(); |
214 | bg_color = 0xFFFFFF; |
211 | strcpy(#page_links,"|"); |
215 | DrawBuf.Fill(bg_color); |
212 | strcpy(#header, #version); |
216 | strcpy(#page_links,"|"); |
213 | stroka = -list.first; |
217 | strcpy(#header, #version); |
214 | stolbec = 0; |
218 | stroka = -list.first; |
215 | line = 0; |
219 | stolbec = 0; |
Line 414... | Line 418... | ||
414 | 418 | } |
|
Line 415... | Line 419... | ||
415 | if (!chTag("body")) |
419 | |
416 | { |
420 | if (!chTag("body")) |
417 | do{ |
421 | { |
418 | if (!strcmp(#parametr, "condition_max=")) { condition_max = options[0]-'0'; debugi(condition_max); } |
422 | do{ |
419 | if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); |
423 | if (!strcmp(#parametr, "condition_max=")) { condition_max = atoi(#options); debugi(condition_max); } |
420 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
424 | if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); |
421 | if (!strcmp(#parametr, "bgcolor=")) |
425 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
422 | { |
426 | if (!strcmp(#parametr, "bgcolor=")) |
423 | bg_color=GetColor(#options); |
427 | { |
424 | DrawBufFill(); |
428 | bg_color=GetColor(#options); |
425 | } |
429 | DrawBuf.Fill(bg_color); |
426 | } while(GetNextParam()); |
430 | } |
427 | return; |
431 | } while(GetNextParam()); |
428 | } |
432 | return; |
Line 494... | Line 498... | ||
494 | TextGoDown(left1, top1, width1); |
498 | IF(oldtag[0] == 'h') return; |
495 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
499 | TextGoDown(left1, top1, width1); |
496 | return; |
500 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
497 | } |
501 | return; |
498 | if (!chTag("center")) |
502 | } |
- | 503 | /* |
|
499 | { |
504 | if (!chTag("center")) |
500 | if (rez) text_align = ALIGN_CENTER; |
505 | { |
501 | if (!rez) |
506 | if (rez) text_align = ALIGN_CENTER; |
502 | { |
507 | if (!rez) |
503 | TextGoDown(left1, top1, width1); |
508 | { |
Line 514... | Line 519... | ||
514 | text_align = ALIGN_LEFT; |
519 | TextGoDown(left1, top1, width1); |
515 | } |
520 | text_align = ALIGN_LEFT; |
516 | return; |
521 | } |
517 | } |
522 | return; |
518 | if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { |
523 | } |
- | 524 | */ |
|
519 | TextGoDown(left1, top1, width1); |
525 | if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { |
520 | if (rez) && (stroka>1) TextGoDown(left1, top1 + 10, width1); |
526 | TextGoDown(left1, top1, width1); |
521 | strcpy(#oldtag, #tag); |
527 | if (rez) && (stroka>1) TextGoDown(left1, top1 + 10, width1); |
522 | if (rez) |
528 | strcpy(#oldtag, #tag); |
523 | { |
529 | if (rez) |
Line 561... | Line 567... | ||
561 | li_text = rez; |
567 | { |
562 | if (rez) |
568 | li_text = rez; |
563 | { |
569 | if (rez) |
564 | TextGoDown(left1, top1, width1); |
570 | { |
565 | if (stroka > -1) && (stroka - 2 < list.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555); |
571 | TextGoDown(left1, top1, width1); |
566 | } |
572 | if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555); |
567 | return; |
573 | } |
568 | } |
574 | return; |
569 | if (!chTag("u")) || (!chTag("ins")) u_text = rez; |
575 | } |
570 | if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; |
576 | if (!chTag("u")) || (!chTag("ins")) u_text = rez; |
571 | if (!chTag("ul")) || (!chTag("ol")) IF(!rez) |
577 | if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; |
Line 585... | Line 591... | ||
585 | return; |
591 | stroka+=2; |
586 | } |
592 | return; |
587 | if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999; |
593 | } |
588 | TextGoDown(left1, top1, width1); |
594 | if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999; |
589 | DrawBufBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color); |
595 | TextGoDown(left1, top1, width1); |
590 | TextGoDown(left1, top1+WB1.list.line_h, width1); |
596 | DrawBuf.DrawBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color); |
591 | } |
597 | TextGoDown(left1, top1+WB1.list.line_h, width1); |
592 | if (!chTag("img")) |
598 | } |
593 | { |
599 | if (!chTag("img")) |
594 | Images( left1, top1, width1); |
600 | { |
595 | return; |
601 | Images( left1, top1, width1); |
Line 609... | Line 615... | ||
609 | } |
615 | return; |
610 | } |
616 | } |
611 | 617 | } |
|
Line 612... | Line -... | ||
612 | - | ||
613 | 618 | ||
614 | void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå |
619 | |
615 | { |
620 | void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå |
616 | scroll_wv.max_area = list.count; |
621 | { |
617 | scroll_wv.cur_area = list.visible; |
622 | scroll_wv.max_area = list.count; |
Line 623... | Line 628... | ||
623 | 628 | scroll_wv.size_y=WB1.list.h; |
|
Line 624... | Line 629... | ||
624 | scrollbar_v_draw(#scroll_wv); |
629 | |
625 | }>>>>=>=>>=15)>>>>>>>=>!--> |
630 | scrollbar_v_draw(#scroll_wv); |
Line -... | Line 631... | ||
- | 631 | } |
|
- | 632 | ||
- | 633 | ||
- | 634 | void TWebBrowser::TextGoDown(int left1, top1, width1) |
|
- | 635 | { |
|
- | 636 | if (!stroka) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé |
|
- | 637 | if (top1>=WB1.list.y) && ( top1 < WB1.list.h+WB1.list.y-10) && (!anchor) |
|
- | 638 | { |
|
- | 639 | if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,WB1.list.w,WB1.list.line_h,stolbec * 6); |
|
- | 640 | if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,WB1.list.w,WB1.list.line_h,stolbec * 6); |
|
- | 641 | PutPaletteImage(buf_data+8, WB1.list.w, WB1.list.line_h, left1-5, top1, 32,0); |
|
- | 642 | DrawBuf.Fill(bg_color); |
|
- | 643 | } |
|
- | 644 | stroka++; |
|
- | 645 | if (blq_text) stolbec = 8; else stolbec = 0; |
|
626 | >': |
646 | if (li_text) stolbec = li_tab * 5; |