Subversion Repositories Kolibri OS

Rev

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