Subversion Repositories Kolibri OS

Rev

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