Subversion Repositories Kolibri OS

Rev

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