Subversion Repositories Kolibri OS

Rev

Rev 4686 | Blame | Last modification | View Log | Download | RSS feed

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