Subversion Repositories Kolibri OS

Rev

Rev 4415 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. int     downloader_id;
  3.  
  4. dword
  5.         buf,
  6.         filesize,
  7.         blink;
  8.  
  9. #define URL param
  10.  
  11. int     mouse_twb;
  12. edit_box address_box= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  13. 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};
  14.  
  15. char editURL[sizeof(URL)],
  16.         page_links[12000],
  17.         header[2048];
  18.  
  19.  
  20.  
  21. char download_path[]="/rd/1/.download";
  22.  
  23.  
  24. struct TWebBrowser {
  25.         llist list; //need #include "..\lib\list_box.h"
  26.         void GetNewUrl();
  27.         void ReadHtml(byte);
  28.         void ShowPage();
  29.         void ParseHTML(dword);
  30.         void WhatTextStyle(int left1, top1, width1);
  31.         void DrawPage();
  32.         void DrawScroller();
  33. };     
  34. TWebBrowser WB1;
  35.  
  36. byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text,
  37.         link, ignor_text, li_tab, cur_encoding, text_align;
  38.  
  39. enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
  40.  
  41. dword text_colors[300],
  42.         text_color_index,
  43.         link_color,
  44.         bg_color;
  45.  
  46. int stroka,
  47.         stolbec,
  48.         tab_len,
  49.         anchor_line_num;
  50.        
  51. char line[500],
  52.         tag[100],
  53.         tagparam[10000],
  54.         parametr[1200],
  55.         options[4096],
  56.         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 = 0; //îáíóëÿåì òåãè
  206.         text_align = ALIGN_LEFT;
  207.         link_color = 0x0000FF;
  208.         bg_color = 0xFFFFFF;
  209.         DrawBufFill();
  210.         strcpy(#page_links,"|");
  211.         strcpy(#header, #version);
  212.         stroka = -list.first;
  213.         stolbec = 0;
  214.         line = 0;
  215.  
  216.         if (pre_text<>2)
  217.         {
  218.                 pre_text=0;
  219.                 if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
  220.                 if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
  221.         }
  222.        
  223.         for ( ; buf+filesize > bword; bword++;)
  224.         {
  225.                 bukva = ESBYTE[bword];
  226.                 if (ignor_text) && (bukva<>'<') continue;
  227.                 switch (bukva)
  228.                 {
  229.                 case 0x0a:
  230.                         if (pre_text)
  231.                         {
  232.                                 bukva = temp = NULL;
  233.                                 goto NEXT_MARK;
  234.                         }
  235.                 case '\9':
  236.                         if (pre_text) //èíà÷å èä¸ì íà 0x0d     
  237.                         {
  238.                                 tab_len=strlen(#line)/8;
  239.                                 tab_len=tab_len*8;
  240.                                 tab_len=8+tab_len-strlen(#line);
  241.                                 for (j=0; j<tab_len; j++;) chrcat(#line,' ');
  242.                                 break;
  243.                         }
  244.                         goto DEFAULT_MARK;             
  245.                 case '=': //quoted printable
  246.                         if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
  247.  
  248.                         temp[0] = ESBYTE[bword+1];
  249.                         temp[1] = ESBYTE[bword+2];
  250.                         temp[2] = '\0';
  251.                         if (bukva = Hex2Symb(#temp))
  252.                         {
  253.                                 bword+=2;
  254.                                 goto DEFAULT_MARK;
  255.                         }
  256.                         break;
  257.                        
  258.                 case '&': //&nbsp; and so on
  259.                         bword++;
  260.                         tag=0;
  261.                         for (j=0; (ESBYTE[bword]<>';') && (j<7);   j++, bword++;)
  262.                         {
  263.                                 bukva = ESBYTE[bword];
  264.                                 chrcat(#tag, bukva);
  265.                         }
  266.                         bukva = GetUnicodeSymbol();
  267.                         if (bukva) goto DEFAULT_MARK;
  268.                         break;
  269.                 case '<':
  270.                         bword++; //ïðîìîòàåì ñèìâîë <
  271.                         tag = parametr = tagparam = ignor_param = NULL;
  272.                         if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè <!-- -->, äåðçêî
  273.                         {
  274.                                 bword++;
  275.                                 if (ESBYTE[bword] == '-')
  276.                                 {
  277.                                 HH_:
  278.                                         do
  279.                                         {
  280.                                                 bword++;
  281.                                                 if (buf + filesize <= bword) break 2;
  282.                                         }
  283.                                         while (ESBYTE[bword] <>'-');
  284.                                        
  285.                                         bword++;
  286.                                         if (ESBYTE[bword] <>'-') goto HH_;
  287.                                 }
  288.                         }
  289.                         while (ESBYTE[bword] !='>') && (bword < buf + filesize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
  290.                         {
  291.                                 bukva = ESBYTE[bword];
  292.                                 if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
  293.                                 if (!ignor_param) && (bukva <>' ')
  294.                                 {
  295.                                         if (strlen(#tag)<sizeof(tag)) strcat(#tag, #bukva);
  296.                                 }
  297.                                 else
  298.                                 {
  299.                                         ignor_param = true;
  300.                                         if (!ignor_text) && (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
  301.                                 }
  302.                                 bword++;
  303.                         }
  304.                         strlwr(#tag);
  305.                         strlwr(#tagparam);
  306.  
  307.                         if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
  308.                         if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
  309.  
  310.                         if (stolbec + strlen(#line) > list.column_max) //============the same as NEXT_MARK
  311.                         {
  312.                                 perenos_num = strrchr(#line, ' ');
  313.                                 if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
  314.                                 strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
  315.                                 line[perenos_num] = 0x00;
  316.                                 if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
  317.                                 DrawPage();
  318.                                 strcpy(#line, #temp);                          
  319.                                 TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  320.                         }
  321.                         DrawPage();
  322.                         line=NULL;
  323.  
  324.                         if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ
  325.  
  326.                         tag = parametr = tagparam = ignor_param = NULL;
  327.                         break;
  328.                 default:
  329.                         DEFAULT_MARK:
  330.                         if (bukva<=15) bukva=' ';
  331.                         if (!pre_text) && (bukva == ' ')
  332.                         {
  333.                                 if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä
  334.                                 if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà
  335.                         }
  336.                         if (strlen(#line)<sizeof(line)) chrcat(#line, bukva);
  337.  
  338.                         if (stolbec + strlen(#line) > list.column_max)
  339.                         {
  340.                         NEXT_MARK:
  341.                                 perenos_num = strrchr(#line, ' ');
  342.                                 if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
  343.                                 strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
  344.                                 line[perenos_num] = 0x00;
  345.                                 if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
  346.                                 DrawPage();
  347.                                 strcpy(#line, #temp);                  
  348.                                 TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  349.                         }
  350.                 }
  351.         }
  352.  
  353.         DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
  354.         TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
  355.  
  356.         if (list.visible * 10 + 25 <= list.h)
  357.                 DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
  358.         if (stroka * 10 + 5 <= list.h)
  359.                 DrawBar(list.x, stroka * 10 + list.y + 5, list.w, -stroka * 10 + list.h - 5, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
  360.         if (list.first == 0) list.count = stroka;
  361.         if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
  362.         {
  363.                 anchor=NULL;
  364.                 list.first=anchor_line_num;
  365.                 ParseHTML(buf);
  366.         }
  367.         DrawScroller();
  368. }
  369.  
  370.  
  371.  
  372. char oldtag[100];
  373. void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
  374.         dword hr_color;
  375.  
  376.         //ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ
  377.         if (tag[0] == '/')
  378.         {
  379.                  rez = 0;
  380.                  strcpy(#tag, #tag+1);
  381.         }
  382.         else rez = 1;
  383.                
  384.         if (!chTag("html"))
  385.         {
  386.                 IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
  387.                 return;
  388.         }
  389.  
  390.         if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez;
  391.  
  392.         if(!chTag("title"))
  393.         {
  394.                 if (rez) header=NULL;
  395.                 else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó
  396.                 return;
  397.         }
  398.  
  399.         if (ignor_text) return;
  400.  
  401.  
  402.        
  403.         IF(!chTag("q")) chrcat(#line, '\"');
  404.  
  405.         if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò
  406.         {
  407.                 if (!strcmp(#anchor, #options)) anchor_line_num=list.first+stroka;
  408.         }
  409.        
  410.         if (!chTag("body"))
  411.         {
  412.                 do{
  413.                         if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
  414.                         if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
  415.                         if (!strcmp(#parametr, "bgcolor="))
  416.                         {
  417.                                 bg_color=GetColor(#options);
  418.                                 DrawBufFill();
  419.                         }
  420.                 } while(GetNextParam());
  421.                 return;
  422.         }
  423.  
  424.         if (!chTag("a"))
  425.         {
  426.                 if (rez)
  427.                 {
  428.                         if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
  429.  
  430.                         do{
  431.                                 if (!strcmp(#parametr, "href="))
  432.                                 {
  433.                                         if (stroka - 1 > list.visible) || (stroka < -2) return;
  434.                                        
  435.                                         text_color_index++;
  436.                                         text_colors[text_color_index] = text_colors[text_color_index-1];
  437.                                        
  438.                                         link = 1;
  439.                                         blink++;
  440.                                         text_colors[text_color_index] = link_color;
  441.                                         strcat(#page_links, #options);
  442.                                         strcat(#page_links, "|");
  443.                                 }
  444.                                 if (anchor) && (!strcmp(#parametr, "name="))
  445.                                 {
  446.                                         if (!strcmp(#anchor, #options))
  447.                                         {
  448.                                                 anchor_line_num=list.first+stroka;
  449.                                         }
  450.                                 }
  451.                         } while(GetNextParam());
  452.                 }
  453.                 else {
  454.                         link = 0;
  455.                         IF(text_color_index > 0) text_color_index--;
  456.                 }
  457.                 return;
  458.         }
  459.  
  460.         if (!chTag("font"))
  461.         {
  462.                 if (rez)
  463.                 {
  464.                         text_color_index++;
  465.                         text_colors[text_color_index] = text_colors[text_color_index-1];
  466.                
  467.                         do{
  468.                                 if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
  469.                                 {
  470.                                         text_colors[text_color_index] = GetColor(#options);
  471.                                 }
  472.                         } while(GetNextParam());
  473.                 }
  474.                 else
  475.                         if (text_color_index > 0) text_color_index--;
  476.                 return;
  477.         }
  478.         if(!chTag("tr")) || (!chTag("br")) {
  479.                 TextGoDown(left1, top1, width1);
  480.                 return;
  481.         }
  482.         if (!chTag("div")) {
  483.                 IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
  484.                 return;
  485.         }
  486.         if (!chTag("p")) {
  487.                 IF(oldtag[0] == 'h') return;
  488.                 TextGoDown(left1, top1, width1);
  489.                 IF(rez) TextGoDown(left1, top1 + 10, width1);
  490.                 return;
  491.         }
  492.         if (!chTag("center"))
  493.         {
  494.                 if (rez) text_align = ALIGN_CENTER;
  495.                 if (!rez)
  496.                 {
  497.                         TextGoDown(left1, top1, width1);
  498.                         text_align = ALIGN_LEFT;
  499.                 }
  500.                 return;
  501.         }
  502.         if (!chTag("right"))
  503.         {
  504.                 if (rez) text_align = ALIGN_RIGHT;
  505.                 if (!rez)
  506.                 {
  507.                         TextGoDown(left1, top1, width1);
  508.                         text_align = ALIGN_LEFT;
  509.                 }
  510.                 return;
  511.         }
  512.         if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
  513.                 TextGoDown(left1, top1, width1);
  514.                 if (rez) && (stroka>1) TextGoDown(left1, top1 + 10, width1);
  515.                 strcpy(#oldtag, #tag);
  516.                 if (rez)
  517.                 {
  518.                         if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
  519.                         if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT;
  520.                         b_text = 1;
  521.                 }
  522.                 if (!rez)
  523.                 {
  524.                         text_align = ALIGN_LEFT;
  525.                         b_text = 0;
  526.                 }
  527.                 return;
  528.         }
  529.         else
  530.                 oldtag=NULL;
  531.                
  532.         if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
  533.                 b_text = rez;
  534.                 return;
  535.         }
  536.         if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) {
  537.                 i_text = rez;
  538.                 return;
  539.         }      
  540.         if (!chTag("dt"))
  541.         {
  542.                 li_text = rez;
  543.                 IF(rez == 0) return;
  544.                 TextGoDown(left1, top1, width1);
  545.                 return;
  546.         }
  547.         if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
  548.         {
  549.                 li_text = rez;
  550.                 if (rez)
  551.                 {
  552.                         TextGoDown(left1, top1, width1);
  553.                         if (stroka > -1) && (stroka - 2 < list.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
  554.                 }
  555.                 return;
  556.         }
  557.         if (!chTag("u")) || (!chTag("ins")) u_text = rez;
  558.         if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
  559.         if (!chTag("ul")) || (!chTag("ol")) IF(!rez)
  560.         {
  561.                 li_text = rez;
  562.                 li_tab--;
  563.                 TextGoDown(left1, top1, width1);
  564.         } ELSE li_tab++;
  565.         if (!chTag("dd")) stolbec += 5;
  566.         if (!chTag("blockquote")) blq_text = rez;
  567.         if (!chTag("pre")) pre_text = rez;
  568.         if (!chTag("hr"))
  569.         {
  570.                 if (anchor) || (stroka < -1)
  571.                 {
  572.                         stroka+=2;
  573.                         return;
  574.                 }
  575.                 if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
  576.                 TextGoDown(left1, top1, width1);
  577.                 DrawBufBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color);
  578.                 TextGoDown(left1, top1+WB1.list.line_h, width1);
  579.         }
  580.         if (!chTag("img"))
  581.         {
  582.                 Images( left1, top1, width1);
  583.                 return;
  584.         }
  585.         if (!chTag("meta")) || (!chTag("?xml"))
  586.         {
  587.                 do{
  588.                         if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
  589.                         {
  590.                                 strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
  591.                                 if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
  592.                                 if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
  593.                                 if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
  594.                         }
  595.                 } while(GetNextParam());
  596.                 return;
  597.         }
  598. }
  599.  
  600.  
  601.  
  602. void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå
  603. {
  604.         scroll_wv.max_area = list.count;
  605.         scroll_wv.cur_area = list.visible;
  606.         scroll_wv.position = list.first;
  607.  
  608.         scroll_wv.all_redraw=1;
  609.         scroll_wv.start_x = WB1.list.x + WB1.list.w;
  610.         scroll_wv.size_y=WB1.list.h;
  611.  
  612.         scrollbar_v_draw(#scroll_wv);
  613. }
  614.  
  615.