Subversion Repositories Kolibri OS

Rev

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