Subversion Repositories Kolibri OS

Rev

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