Subversion Repositories Kolibri OS

Rev

Rev 4416 | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. int     downloader_id;
  3.  
  4. dword buf;
  5. dword filesize;
  6. dword blink;
  7.  
  8. #define URL param
  9.  
  10. int     mouse_twb;
  11. edit_box address_box= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  12. scroll_bar scroll_wv = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
  13.  
  14. char editURL[sizeof(URL)];
  15. char page_links[12000];
  16. char header[2048];
  17.  
  18.  
  19.  
  20. char download_path[]="/rd/1/.download";
  21.  
  22.  
  23. struct TWebBrowser {
  24.         llist list; //need #include "..\lib\list_box.h"
  25.         void GetNewUrl();
  26.         void ReadHtml(byte);
  27.         void ShowPage();
  28.         void ParseHTML(dword);
  29.         void WhatTextStyle(int left1, top1, width1);
  30.         void DrawPage();
  31.         void DrawScroller();
  32. };     
  33. TWebBrowser WB1;
  34.  
  35. byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab,
  36.         link, ignor_text, cur_encoding, text_align;
  37. byte condition_text_active, condition_text_val, condition_href, condition_max;
  38.  
  39. enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
  40.  
  41. dword text_colors[300];
  42. dword text_color_index;
  43. dword link_color;
  44. dword bg_color;
  45.  
  46. int stroka;
  47. int stolbec;
  48. int tab_len;
  49. int anchor_line_num;
  50.        
  51. char line[500];
  52. char tag[100];
  53. char tagparam[10000];
  54. char parametr[1200];
  55. char options[4096];
  56. char anchor[256];
  57.  
  58. #include "..\TWB\history.h"
  59. #include "..\TWB\colors.h"
  60. #include "..\TWB\unicode_tags.h"
  61. #include "..\TWB\img_cache.h"
  62. #include "..\TWB\some_code.h"
  63. #include "..\TWB\parce_tag.h"
  64. #include "..\TWB\draw_buf.h"
  65.  
  66. //=======================================================================
  67.  
  68.  
  69. void TWebBrowser::DrawPage()
  70. {
  71.         int start_x, start_y, line_length, magrin_left=5;
  72.        
  73.         if (!header)
  74.         {
  75.                 strcpy(#header, #line);
  76.                 strcat(#header, " -");
  77.                 strcat(#header, #version);
  78.                 line = 0;
  79.                 return;
  80.         }
  81.        
  82.         if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
  83.         {
  84.                 start_x = stolbec * 6 + list.x + magrin_left;
  85.                 start_y = stroka * 10 + list.y + magrin_left;
  86.                 line_length = strlen(#line) * 6;
  87.  
  88.                 WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
  89.                 IF (b_text)     WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
  90.                 IF (i_text) DrawBufSkew(start_x, 0, line_length, list.line_h);
  91.                 IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
  92.                 IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
  93.                 IF (link) {
  94.                         UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9);
  95.                         DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
  96.                 }
  97.                 stolbec += strlen(#line);
  98.         }
  99. }
  100. //=======================================================================
  101.  
  102.  
  103.  
  104. char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0};
  105. //dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){
  106. void TWebBrowser::GetNewUrl(){
  107.         int i, len;
  108.        
  109.         for (i=0; ABSOLUTE_LINKS[i]; i++)
  110.         {
  111.                 len=strlen(ABSOLUTE_LINKS[i]);
  112.                 if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return;
  113.         }
  114.                
  115.         IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); //èãíîðèì :)
  116.         strcpy(#editURL, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
  117.  
  118.         if (URL[0] == '/')
  119.         {
  120.                 i = strchr(#editURL+8, '/');
  121.                 editURL[i+7]=0;
  122.                 strcpy(#URL, #URL+1);
  123.         }
  124.                
  125.         _CUT_ST_LEVEL_MARK:
  126.                
  127.                 if (editURL[strrchr(#editURL, '/')-2]<>'/')  // åñëè íå http://
  128.                 {
  129.                         editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
  130.                 }
  131.                
  132.                 IF (!strcmp(get_URL_part(3),"../")) //íà óðîâåíü ââåðõ
  133.                 {
  134.                         strcpy(#URL,#URL+3);
  135.                         editURL[strrchr(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
  136.                         goto _CUT_ST_LEVEL_MARK;
  137.                 }
  138.                
  139.                 if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/");
  140.                
  141.                 strcat(#editURL, #URL); //êëåèì íîâûé àäðåñ
  142.                 strcpy(#URL, #editURL);
  143. }
  144.  
  145.  
  146.        
  147. void TWebBrowser::ReadHtml(byte encoding)
  148. {
  149.         if (!strcmp(get_URL_part(5),"http:")))
  150.                 file_size stdcall (#download_path);
  151.         else
  152.                 file_size stdcall (#URL);
  153.        
  154.         filesize = EBX;
  155.         if (!filesize) return;
  156.        
  157.         mem_Free(buf);
  158.         buf = mem_Alloc(filesize);
  159.         if (!strcmp(get_URL_part(5),"http:")))
  160.                 ReadFile(0, filesize, buf, #download_path);
  161.         else
  162.                 ReadFile(0, filesize, buf, #URL);
  163.                
  164.         cur_encoding = encoding;
  165.         if (encoding==_WIN) wintodos(buf);
  166.         if (encoding==_UTF) utf8rutodos(buf);
  167.         if (encoding==_KOI) koitodos(buf);
  168. }
  169.  
  170.  
  171. void TWebBrowser::ShowPage()
  172. {
  173.         address_box.size = address_box.pos = strlen(#editURL);
  174.         address_box.offset=0;
  175.         edit_box_draw stdcall(#address_box);
  176.  
  177.         if (!filesize)
  178.         {
  179.                 DrawBar(list.x, list.y, list.w+scroll_wv.size_x+1, list.h, 0xFFFFFF); //fill all
  180.                 if (GetProcessSlot(downloader_id)<>0) WriteText(list.x + 10, list.y + 18, 0x80, 0, "Loading...");
  181.                 else
  182.                 {
  183.                         WriteText(list.x + 10, list.y + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
  184.                         if (!strcmp(get_URL_part(5),"http:"))) WriteText(list.x + 10, list.y + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
  185.                 }
  186.                 //return;
  187.         }
  188.         else
  189.                 ParseHTML(buf);
  190.  
  191.         if (!header) strcpy(#header, #version);
  192.         if (!strcmp(#version, #header)) DrawTitle(#header);
  193. }
  194.  
  195.  
  196.  
  197. void TWebBrowser::ParseHTML(dword bword){
  198.         word bukva[2];
  199.         int j, perenos_num;
  200.         byte ignor_param;
  201.         char temp[768];
  202.        
  203.         if (blink<400) blink=400; else for ( ; blink>400; blink--;) DeleteButton(blink);
  204.         b_text = i_text = u_text = s_text = blq_text =
  205.         li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab =
  206.         condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè
  207.         condition_max = 10;
  208.         text_align = ALIGN_LEFT;
  209.         link_color = 0x0000FF;
  210.         bg_color = 0xFFFFFF;
  211.         DrawBufFill();
  212.         strcpy(#page_links,"|");
  213.         strcpy(#header, #version);
  214.         stroka = -list.first;
  215.         stolbec = 0;
  216.         line = 0;
  217.  
  218.         if (pre_text<>2)
  219.         {
  220.                 pre_text=0;
  221.                 if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
  222.                 if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
  223.         }
  224.        
  225.         for ( ; buf+filesize > bword; bword++;)
  226.         {
  227.                 bukva = ESBYTE[bword];
  228.                 if (ignor_text) && (bukva!='<') continue;
  229.                 if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue;
  230.                 switch (bukva)
  231.                 {
  232.                 case 0x0a:
  233.                         if (pre_text)
  234.                         {
  235.                                 bukva = temp = NULL;
  236.                                 goto NEXT_MARK;
  237.                         }
  238.                 case '\9':
  239.                         if (pre_text) //èíà÷å èä¸ì íà 0x0d     
  240.                         {
  241.                                 tab_len=strlen(#line)/8;
  242.                                 tab_len=tab_len*8;
  243.                                 tab_len=8+tab_len-strlen(#line);
  244.                                 for (j=0; j<tab_len; j++;) chrcat(#line,' ');
  245.                                 break;
  246.                         }
  247.                         goto DEFAULT_MARK;             
  248.                 case '=': //quoted printable
  249.                         if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
  250.  
  251.                         temp[0] = ESBYTE[bword+1];
  252.                         temp[1] = ESBYTE[bword+2];
  253.                         temp[2] = '\0';
  254.                         if (bukva = Hex2Symb(#temp))
  255.                         {
  256.                                 bword+=2;
  257.                                 goto DEFAULT_MARK;
  258.                         }
  259.                         break;
  260.                        
  261.                 case '&': //&nbsp; and so on
  262.                         bword++;
  263.                         tag=0;
  264.                         for (j=0; (ESBYTE[bword]<>';') && (j<7);   j++, bword++;)
  265.                         {
  266.                                 bukva = ESBYTE[bword];
  267.                                 chrcat(#tag, bukva);
  268.                         }
  269.                         if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK;
  270.                         break;
  271.                 case '<':
  272.                         bword++; //ïðîìîòàåì ñèìâîë <
  273.                         tag = parametr = tagparam = ignor_param = NULL;
  274.                         if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè <!-- -->, äåðçêî
  275.                         {
  276.                                 bword++;
  277.                                 if (ESBYTE[bword] == '-')
  278.                                 {
  279.                                 HH_:
  280.                                         do
  281.                                         {
  282.                                                 bword++;
  283.                                                 if (buf + filesize <= bword) break 2;
  284.                                         }
  285.                                         while (ESBYTE[bword] <>'-');
  286.                                        
  287.                                         bword++;
  288.                                         if (ESBYTE[bword] <>'-') goto HH_;
  289.                                 }
  290.                         }
  291.                         while (ESBYTE[bword] !='>') && (bword < buf + filesize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
  292.                         {
  293.                                 bukva = ESBYTE[bword];
  294.                                 if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
  295.                                 if (!ignor_param) && (bukva <>' ')
  296.                                 {
  297.                                         if (strlen(#tag)<sizeof(tag)) strcat(#tag, #bukva);
  298.                                 }
  299.                                 else
  300.                                 {
  301.                                         ignor_param = true;
  302.                                         if (!ignor_text) && (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
  303.                                 }
  304.                                 bword++;
  305.                         }
  306.                         strlwr(#tag);
  307.                         strlwr(#tagparam);
  308.  
  309.                         if (condition_text_active) && (condition_text_val != condition_href)
  310.                         {
  311.                                 if (strcmp(#tag, "/condition")!=0) break;
  312.                         }
  313.                         if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
  314.                         if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
  315.  
  316.                         if (stolbec + strlen(#line) > list.column_max) //============the same as NEXT_MARK
  317.                         {
  318.                                 perenos_num = strrchr(#line, ' ');
  319.                                 if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
  320.                                 strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
  321.                                 line[perenos_num] = 0x00;
  322.                                 if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
  323.                                 DrawPage();
  324.                                 strcpy(#line, #temp);                          
  325.                                 TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  326.                         }
  327.                         DrawPage();
  328.                         line=NULL;
  329.  
  330.                         if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ
  331.  
  332.                         tag = parametr = tagparam = ignor_param = NULL;
  333.                         break;
  334.                 default:
  335.                         DEFAULT_MARK:
  336.                         if (bukva<=15) bukva=' ';
  337.                         if (!pre_text) && (bukva == ' ')
  338.                         {
  339.                                 if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä
  340.                                 if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà
  341.                         }
  342.                         if (strlen(#line)<sizeof(line)) chrcat(#line, bukva);
  343.  
  344.                         if (stolbec + strlen(#line) > list.column_max)
  345.                         {
  346.                         NEXT_MARK:
  347.                                 perenos_num = strrchr(#line, ' ');
  348.                                 if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
  349.                                 strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
  350.                                 line[perenos_num] = 0x00;
  351.                                 if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
  352.                                 DrawPage();
  353.                                 strcpy(#line, #temp);                  
  354.                                 TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  355.                         }
  356.                 }
  357.         }
  358.  
  359.         DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
  360.         TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  361.  
  362.         if (list.visible * 10 + 25 <= list.h)
  363.                 DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
  364.         if (stroka * 10 + 5 <= list.h)
  365.                 DrawBar(list.x, stroka * 10 + list.y + 5, list.w, -stroka * 10 + list.h - 5, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
  366.         if (list.first == 0) list.count = stroka;
  367.         if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
  368.         {
  369.                 anchor=NULL;
  370.                 list.first=anchor_line_num;
  371.                 ParseHTML(buf);
  372.         }
  373.         DrawScroller();
  374. }
  375.  
  376.  
  377.  
  378. char oldtag[100];
  379. void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
  380.         dword hr_color;
  381.  
  382.         //ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ
  383.         if (tag[0] == '/')
  384.         {
  385.                  rez = 0;
  386.                  strcpy(#tag, #tag+1);
  387.         }
  388.         else rez = 1;
  389.                
  390.         if (!chTag("html"))
  391.         {
  392.                 IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
  393.                 return;
  394.         }
  395.  
  396.         if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez;
  397.  
  398.         if(!chTag("title"))
  399.         {
  400.                 if (rez) header=NULL;
  401.                 else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó
  402.                 return;
  403.         }
  404.  
  405.         if (ignor_text) return;
  406.  
  407.  
  408.        
  409.         IF(!chTag("q")) chrcat(#line, '\"');
  410.  
  411.         if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò
  412.         {
  413.                 if (!strcmp(#anchor, #options)) anchor_line_num=list.first+stroka;
  414.         }
  415.        
  416.         if (!chTag("body"))
  417.         {
  418.                 do{
  419.                         if (!strcmp(#parametr, "condition_max=")) { condition_max = options[0]-'0'; debugi(condition_max); }
  420.                         if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
  421.                         if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
  422.                         if (!strcmp(#parametr, "bgcolor="))
  423.                         {
  424.                                 bg_color=GetColor(#options);
  425.                                 DrawBufFill();
  426.                         }
  427.                 } while(GetNextParam());
  428.                 return;
  429.         }
  430.  
  431.         if (!chTag("a"))
  432.         {
  433.                 if (rez)
  434.                 {
  435.                         if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
  436.  
  437.                         do{
  438.                                 if (!strcmp(#parametr, "href="))
  439.                                 {
  440.                                         if (stroka - 1 > list.visible) || (stroka < -2) return;
  441.                                        
  442.                                         text_color_index++;
  443.                                         text_colors[text_color_index] = text_colors[text_color_index-1];
  444.                                        
  445.                                         link = 1;
  446.                                         blink++;
  447.                                         text_colors[text_color_index] = link_color;
  448.                                         strcat(#page_links, #options);
  449.                                         strcat(#page_links, "|");
  450.                                 }
  451.                                 if (anchor) && (!strcmp(#parametr, "name="))
  452.                                 {
  453.                                         if (!strcmp(#anchor, #options))
  454.                                         {
  455.                                                 anchor_line_num=list.first+stroka;
  456.                                         }
  457.                                 }
  458.                         } while(GetNextParam());
  459.                 }
  460.                 else {
  461.                         link = 0;
  462.                         IF(text_color_index > 0) text_color_index--;
  463.                 }
  464.                 return;
  465.         }
  466.  
  467.         if (!chTag("font"))
  468.         {
  469.                 if (rez)
  470.                 {
  471.                         text_color_index++;
  472.                         text_colors[text_color_index] = text_colors[text_color_index-1];
  473.                
  474.                         do{
  475.                                 if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
  476.                                 {
  477.                                         text_colors[text_color_index] = GetColor(#options);
  478.                                 }
  479.                         } while(GetNextParam());
  480.                 }
  481.                 else
  482.                         if (text_color_index > 0) text_color_index--;
  483.                 return;
  484.         }
  485.         if(!chTag("tr")) || (!chTag("br")) {
  486.                 TextGoDown(left1, top1, width1);
  487.                 return;
  488.         }
  489.         if (!chTag("div")) {
  490.                 IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
  491.                 return;
  492.         }
  493.         if (!chTag("p")) {
  494.                 IF(oldtag[0] == 'h') return;
  495.                 TextGoDown(left1, top1, width1);
  496.                 IF(rez) TextGoDown(left1, top1 + 10, width1);
  497.                 return;
  498.         }
  499.         if (!chTag("center"))
  500.         {
  501.                 if (rez) text_align = ALIGN_CENTER;
  502.                 if (!rez)
  503.                 {
  504.                         TextGoDown(left1, top1, width1);
  505.                         text_align = ALIGN_LEFT;
  506.                 }
  507.                 return;
  508.         }
  509.         if (!chTag("right"))
  510.         {
  511.                 if (rez) text_align = ALIGN_RIGHT;
  512.                 if (!rez)
  513.                 {
  514.                         TextGoDown(left1, top1, width1);
  515.                         text_align = ALIGN_LEFT;
  516.                 }
  517.                 return;
  518.         }
  519.         if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
  520.                 TextGoDown(left1, top1, width1);
  521.                 if (rez) && (stroka>1) TextGoDown(left1, top1 + 10, width1);
  522.                 strcpy(#oldtag, #tag);
  523.                 if (rez)
  524.                 {
  525.                         if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
  526.                         if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT;
  527.                         b_text = 1;
  528.                 }
  529.                 if (!rez)
  530.                 {
  531.                         text_align = ALIGN_LEFT;
  532.                         b_text = 0;
  533.                 }
  534.                 return;
  535.         }
  536.         else
  537.                 oldtag=NULL;
  538.                
  539.         if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
  540.                 b_text = rez;
  541.                 return;
  542.         }
  543.         if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) {
  544.                 i_text = rez;
  545.                 return;
  546.         }      
  547.         if (!chTag("dt"))
  548.         {
  549.                 li_text = rez;
  550.                 IF(rez == 0) return;
  551.                 TextGoDown(left1, top1, width1);
  552.                 return;
  553.         }
  554.         if (!chTag("condition"))
  555.         {
  556.                 condition_text_active = rez;
  557.                 if (rez) && (!strcmp(#parametr, "show_if=")) condition_text_val = atoi(#options);
  558.                 return;
  559.         }
  560.         if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
  561.         {
  562.                 li_text = rez;
  563.                 if (rez)
  564.                 {
  565.                         TextGoDown(left1, top1, width1);
  566.                         if (stroka > -1) && (stroka - 2 < list.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
  567.                 }
  568.                 return;
  569.         }
  570.         if (!chTag("u")) || (!chTag("ins")) u_text = rez;
  571.         if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
  572.         if (!chTag("ul")) || (!chTag("ol")) IF(!rez)
  573.         {
  574.                 li_text = rez;
  575.                 li_tab--;
  576.                 TextGoDown(left1, top1, width1);
  577.         } ELSE li_tab++;
  578.         if (!chTag("dd")) stolbec += 5;
  579.         if (!chTag("blockquote")) blq_text = rez;
  580.         if (!chTag("pre")) pre_text = rez;
  581.         if (!chTag("hr"))
  582.         {
  583.                 if (anchor) || (stroka < -1)
  584.                 {
  585.                         stroka+=2;
  586.                         return;
  587.                 }
  588.                 if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
  589.                 TextGoDown(left1, top1, width1);
  590.                 DrawBufBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color);
  591.                 TextGoDown(left1, top1+WB1.list.line_h, width1);
  592.         }
  593.         if (!chTag("img"))
  594.         {
  595.                 Images( left1, top1, width1);
  596.                 return;
  597.         }
  598.         if (!chTag("meta")) || (!chTag("?xml"))
  599.         {
  600.                 do{
  601.                         if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
  602.                         {
  603.                                 strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
  604.                                 if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
  605.                                 if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
  606.                                 if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
  607.                         }
  608.                 } while(GetNextParam());
  609.                 return;
  610.         }
  611. }
  612.  
  613.  
  614.  
  615. void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå
  616. {
  617.         scroll_wv.max_area = list.count;
  618.         scroll_wv.cur_area = list.visible;
  619.         scroll_wv.position = list.first;
  620.  
  621.         scroll_wv.all_redraw=1;
  622.         scroll_wv.start_x = WB1.list.x + WB1.list.w;
  623.         scroll_wv.size_y=WB1.list.h;
  624.  
  625.         scrollbar_v_draw(#scroll_wv);
  626. }
  627.  
  628.