Subversion Repositories Kolibri OS

Rev

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

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