Subversion Repositories Kolibri OS

Rev

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