2014-01-18 15:46:58 +04:00
|
|
|
|
#include "..\lib\draw_buf.h"
|
2014-01-20 00:06:42 +04:00
|
|
|
|
#include "..\lib\list_box.h"
|
2014-01-21 03:42:18 +04:00
|
|
|
|
#include "..\lib\cursor.h"
|
2014-01-20 02:46:58 +04:00
|
|
|
|
#include "..\TWB\links.h"
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
int downloader_id;
|
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
dword buf;
|
|
|
|
|
dword filesize;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-27 16:30:42 +04:00
|
|
|
|
#define URL param
|
|
|
|
|
|
|
|
|
|
int mouse_twb;
|
|
|
|
|
edit_box address_box= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
|
|
|
|
|
scroll_bar scroll_wv = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
char editURL[sizeof(URL)];
|
|
|
|
|
char header[2048];
|
2013-12-27 16:30:42 +04:00
|
|
|
|
|
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
|
char download_path[]="/rd/1/.download";
|
|
|
|
|
|
|
|
|
|
struct TWebBrowser {
|
2013-12-27 15:15:17 +04:00
|
|
|
|
llist list; //need #include "..\lib\list_box.h"
|
2014-01-18 15:46:58 +04:00
|
|
|
|
DrawBufer DrawBuf;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
void GetNewUrl();
|
2014-01-18 15:46:58 +04:00
|
|
|
|
void ReadHtml();
|
2013-12-27 03:36:17 +04:00
|
|
|
|
void ShowPage();
|
2014-01-18 15:46:58 +04:00
|
|
|
|
void ParseHTML();
|
|
|
|
|
void WhatTextStyle();
|
2013-12-27 03:36:17 +04:00
|
|
|
|
void DrawPage();
|
|
|
|
|
void DrawScroller();
|
2014-01-18 15:46:58 +04:00
|
|
|
|
void TextGoDown();
|
2014-01-19 21:12:45 +04:00
|
|
|
|
};
|
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
|
TWebBrowser WB1;
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
byte b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab,
|
2013-12-29 16:48:06 +04:00
|
|
|
|
link, ignor_text, cur_encoding, text_align;
|
|
|
|
|
byte condition_text_active, condition_text_val, condition_href, condition_max;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
enum { _WIN, _DOS, _KOI, _UTF };
|
2014-01-18 15:46:58 +04:00
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
|
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
|
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
dword text_colors[300];
|
|
|
|
|
dword text_color_index;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
dword link_color_inactive;
|
|
|
|
|
dword link_color_active;
|
2013-12-29 16:48:06 +04:00
|
|
|
|
dword bg_color;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
int stroka;
|
|
|
|
|
int stolbec;
|
|
|
|
|
int tab_len;
|
|
|
|
|
int anchor_line_num;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
char line[500];
|
|
|
|
|
char tag[100];
|
|
|
|
|
char tagparam[10000];
|
|
|
|
|
char parametr[1200];
|
|
|
|
|
char options[4096];
|
|
|
|
|
char anchor[256];
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-27 16:30:42 +04:00
|
|
|
|
#include "..\TWB\history.h"
|
2013-12-27 03:36:17 +04:00
|
|
|
|
#include "..\TWB\colors.h"
|
|
|
|
|
#include "..\TWB\unicode_tags.h"
|
|
|
|
|
#include "..\TWB\img_cache.h"
|
|
|
|
|
#include "..\TWB\parce_tag.h"
|
2014-01-18 15:46:58 +04:00
|
|
|
|
|
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TWebBrowser::DrawPage()
|
|
|
|
|
{
|
|
|
|
|
int start_x, start_y, line_length, magrin_left=5;
|
|
|
|
|
|
|
|
|
|
if (!header)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#header, #line);
|
|
|
|
|
strcat(#header, " -");
|
|
|
|
|
strcat(#header, #version);
|
|
|
|
|
line = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2013-12-27 05:08:50 +04:00
|
|
|
|
start_x = stolbec * 6 + list.x + magrin_left;
|
|
|
|
|
start_y = stroka * 10 + list.y + magrin_left;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
line_length = strlen(#line) * 6;
|
|
|
|
|
|
2014-01-18 15:46:58 +04:00
|
|
|
|
WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data);
|
|
|
|
|
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data);
|
|
|
|
|
IF (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); }
|
|
|
|
|
IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
|
|
|
|
|
IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
IF (link) {
|
2014-01-20 03:48:36 +04:00
|
|
|
|
UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
|
2014-01-18 15:46:58 +04:00
|
|
|
|
DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
|
2014-01-20 03:48:36 +04:00
|
|
|
|
PageLinks.AddText(#line, line_length, list.line_h);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
stolbec += strlen(#line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0};
|
|
|
|
|
//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){
|
|
|
|
|
void TWebBrowser::GetNewUrl(){
|
|
|
|
|
int i, len;
|
|
|
|
|
|
|
|
|
|
for (i=0; ABSOLUTE_LINKS[i]; i++)
|
|
|
|
|
{
|
|
|
|
|
len=strlen(ABSOLUTE_LINKS[i]);
|
|
|
|
|
if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :)
|
|
|
|
|
strcpy(#editURL, BrowserHistory.CurrentUrl()); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
if (URL[0] == '/')
|
|
|
|
|
{
|
|
|
|
|
i = strchr(#editURL+8, '/');
|
|
|
|
|
editURL[i+7]=0;
|
|
|
|
|
strcpy(#URL, #URL+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_CUT_ST_LEVEL_MARK:
|
|
|
|
|
|
|
|
|
|
if (editURL[strrchr(#editURL, '/')-2]<>'/') // <20><><EFBFBD><EFBFBD> <20><> http://
|
|
|
|
|
{
|
|
|
|
|
editURL[strrchr(#editURL, '/')] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
IF (!strncmp(#URL,"../",3)) //<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#URL,#URL+3);
|
|
|
|
|
editURL[strrchr(#editURL, '/')-1] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /
|
|
|
|
|
goto _CUT_ST_LEVEL_MARK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/");
|
|
|
|
|
|
|
|
|
|
strcat(#editURL, #URL); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
strcpy(#URL, #editURL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TWebBrowser::ReadHtml(byte encoding)
|
|
|
|
|
{
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (!strncmp(#URL,"http:",5))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
file_size stdcall (#download_path);
|
|
|
|
|
else
|
|
|
|
|
file_size stdcall (#URL);
|
|
|
|
|
|
|
|
|
|
filesize = EBX;
|
|
|
|
|
if (!filesize) return;
|
|
|
|
|
|
|
|
|
|
mem_Free(buf);
|
|
|
|
|
buf = mem_Alloc(filesize);
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (!strncmp(#URL,"http:",5))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
ReadFile(0, filesize, buf, #download_path);
|
|
|
|
|
else
|
|
|
|
|
ReadFile(0, filesize, buf, #URL);
|
|
|
|
|
|
|
|
|
|
cur_encoding = encoding;
|
|
|
|
|
if (encoding==_WIN) wintodos(buf);
|
|
|
|
|
if (encoding==_UTF) utf8rutodos(buf);
|
|
|
|
|
if (encoding==_KOI) koitodos(buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TWebBrowser::ShowPage()
|
|
|
|
|
{
|
|
|
|
|
address_box.size = address_box.pos = strlen(#editURL);
|
|
|
|
|
address_box.offset=0;
|
|
|
|
|
edit_box_draw stdcall(#address_box);
|
2014-01-20 03:48:36 +04:00
|
|
|
|
PageLinks.Clear();
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
if (!filesize)
|
|
|
|
|
{
|
2013-12-27 16:30:42 +04:00
|
|
|
|
DrawBar(list.x, list.y, list.w+scroll_wv.size_x+1, list.h, 0xFFFFFF); //fill all
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (GetProcessSlot(downloader_id)<>0) WriteText(list.x + 10, list.y + 18, 0x80, 0, "Loading...");
|
2013-12-27 03:36:17 +04:00
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-27 05:08:50 +04:00
|
|
|
|
WriteText(list.x + 10, list.y + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (!strncmp(#URL,"http:",5)) WriteText(list.x + 10, list.y + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ParseHTML(buf);
|
|
|
|
|
|
|
|
|
|
if (!header) strcpy(#header, #version);
|
|
|
|
|
if (!strcmp(#version, #header)) DrawTitle(#header);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TWebBrowser::ParseHTML(dword bword){
|
|
|
|
|
word bukva[2];
|
|
|
|
|
int j, perenos_num;
|
|
|
|
|
byte ignor_param;
|
|
|
|
|
char temp[768];
|
|
|
|
|
|
|
|
|
|
b_text = i_text = u_text = s_text = blq_text =
|
2013-12-29 16:48:06 +04:00
|
|
|
|
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab =
|
|
|
|
|
condition_text_val = condition_text_active = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
2014-01-18 15:46:58 +04:00
|
|
|
|
condition_max = 255;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
text_align = ALIGN_LEFT;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
link_color_inactive = 0x0000FF;
|
|
|
|
|
link_color_active = 0xFF0000;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
bg_color = 0xFFFFFF;
|
2014-01-18 15:46:58 +04:00
|
|
|
|
DrawBuf.Fill(bg_color);
|
2014-01-21 23:22:03 +04:00
|
|
|
|
PageLinks.Clear();
|
2013-12-27 03:36:17 +04:00
|
|
|
|
strcpy(#header, #version);
|
2013-12-27 15:15:17 +04:00
|
|
|
|
stroka = -list.first;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
stolbec = 0;
|
|
|
|
|
line = 0;
|
|
|
|
|
|
|
|
|
|
if (pre_text<>2)
|
|
|
|
|
{
|
|
|
|
|
pre_text=0;
|
|
|
|
|
if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
|
|
|
|
|
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( ; buf+filesize > bword; bword++;)
|
|
|
|
|
{
|
|
|
|
|
bukva = ESBYTE[bword];
|
2013-12-29 16:48:06 +04:00
|
|
|
|
if (ignor_text) && (bukva!='<') continue;
|
|
|
|
|
if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
switch (bukva)
|
|
|
|
|
{
|
|
|
|
|
case 0x0a:
|
|
|
|
|
if (pre_text)
|
|
|
|
|
{
|
|
|
|
|
bukva = temp = NULL;
|
|
|
|
|
goto NEXT_MARK;
|
|
|
|
|
}
|
|
|
|
|
case '\9':
|
|
|
|
|
if (pre_text) //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> 0x0d
|
|
|
|
|
{
|
|
|
|
|
tab_len=strlen(#line)/8;
|
|
|
|
|
tab_len=tab_len*8;
|
|
|
|
|
tab_len=8+tab_len-strlen(#line);
|
|
|
|
|
for (j=0; j<tab_len; j++;) chrcat(#line,' ');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
goto DEFAULT_MARK;
|
|
|
|
|
case '=': //quoted printable
|
|
|
|
|
if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
|
|
|
|
|
|
|
|
|
|
temp[0] = ESBYTE[bword+1];
|
|
|
|
|
temp[1] = ESBYTE[bword+2];
|
|
|
|
|
temp[2] = '\0';
|
|
|
|
|
if (bukva = Hex2Symb(#temp))
|
|
|
|
|
{
|
|
|
|
|
bword+=2;
|
|
|
|
|
goto DEFAULT_MARK;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '&': // and so on
|
|
|
|
|
bword++;
|
|
|
|
|
tag=0;
|
|
|
|
|
for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;)
|
|
|
|
|
{
|
|
|
|
|
bukva = ESBYTE[bword];
|
|
|
|
|
chrcat(#tag, bukva);
|
|
|
|
|
}
|
2013-12-29 16:48:06 +04:00
|
|
|
|
if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
break;
|
|
|
|
|
case '<':
|
|
|
|
|
bword++; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <
|
|
|
|
|
tag = parametr = tagparam = ignor_param = NULL;
|
|
|
|
|
if (ESBYTE[bword] == '!') //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <!-- -->, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
bword++;
|
|
|
|
|
if (ESBYTE[bword] == '-')
|
|
|
|
|
{
|
|
|
|
|
HH_:
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
bword++;
|
|
|
|
|
if (buf + filesize <= bword) break 2;
|
|
|
|
|
}
|
|
|
|
|
while (ESBYTE[bword] <>'-');
|
|
|
|
|
|
|
|
|
|
bword++;
|
|
|
|
|
if (ESBYTE[bword] <>'-') goto HH_;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (ESBYTE[bword] !='>') && (bword < buf + filesize) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
bukva = ESBYTE[bword];
|
|
|
|
|
if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
|
|
|
|
|
if (!ignor_param) && (bukva <>' ')
|
|
|
|
|
{
|
|
|
|
|
if (strlen(#tag)<sizeof(tag)) strcat(#tag, #bukva);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ignor_param = true;
|
|
|
|
|
if (!ignor_text) && (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
|
|
|
|
|
}
|
|
|
|
|
bword++;
|
|
|
|
|
}
|
|
|
|
|
strlwr(#tag);
|
|
|
|
|
strlwr(#tagparam);
|
|
|
|
|
|
2013-12-29 16:48:06 +04:00
|
|
|
|
if (condition_text_active) && (condition_text_val != condition_href)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(#tag, "/condition")!=0) break;
|
|
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
|
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
|
|
|
|
|
if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
|
|
|
|
|
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stolbec + strlen(#line) > list.column_max) //============the same as NEXT_MARK
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
perenos_num = strrchr(#line, ' ');
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
strcpy(#temp, #line + perenos_num); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
line[perenos_num] = 0x00;
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stroka-1 > list.visible) && (list.first <>0) break 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
|
2013-12-27 03:36:17 +04:00
|
|
|
|
DrawPage();
|
|
|
|
|
strcpy(#line, #temp);
|
2013-12-27 05:08:50 +04:00
|
|
|
|
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
DrawPage();
|
|
|
|
|
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2014-01-20 02:46:58 +04:00
|
|
|
|
line=NULL;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
tag = parametr = tagparam = ignor_param = NULL;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
DEFAULT_MARK:
|
|
|
|
|
if (bukva<=15) bukva=' ';
|
|
|
|
|
if (!pre_text) && (bukva == ' ')
|
|
|
|
|
{
|
|
|
|
|
if (line[strlen(#line)-1]==' ') break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (!stolbec) && (!line) break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
if (strlen(#line)<sizeof(line)) chrcat(#line, bukva);
|
|
|
|
|
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stolbec + strlen(#line) > list.column_max)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
NEXT_MARK:
|
|
|
|
|
perenos_num = strrchr(#line, ' ');
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
strcpy(#temp, #line + perenos_num); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
line[perenos_num] = 0x00;
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stroka-1 > list.visible) && (list.first <>0) break 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
|
2013-12-27 03:36:17 +04:00
|
|
|
|
DrawPage();
|
|
|
|
|
strcpy(#line, #temp);
|
2013-12-27 05:08:50 +04:00
|
|
|
|
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPage(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
2013-12-27 05:08:50 +04:00
|
|
|
|
TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (list.visible * 10 + 25 <= list.h)
|
|
|
|
|
DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (stroka * 10 + 5 <= list.h)
|
|
|
|
|
DrawBar(list.x, stroka * 10 + list.y + 5, list.w, -stroka * 10 + list.h - 5, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (list.first == 0) list.count = stroka;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
if (anchor) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
anchor=NULL;
|
2013-12-27 15:15:17 +04:00
|
|
|
|
list.first=anchor_line_num;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
ParseHTML(buf);
|
|
|
|
|
}
|
|
|
|
|
DrawScroller();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char oldtag[100];
|
|
|
|
|
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
|
|
|
|
|
dword hr_color;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
byte opened;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (tag[0] == '/')
|
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
opened = 0;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
strcpy(#tag, #tag+1);
|
|
|
|
|
}
|
2014-01-20 02:46:58 +04:00
|
|
|
|
else opened = 1;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("html"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (opened==0) ignor_text = 1; ELSE ignor_text = 0;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (isTag("script")) || (isTag("style")) || (isTag("binary")) ignor_text = opened;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if(isTag("title"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened) header=NULL;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
else if (!stroka) DrawTitle(#header); //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ignor_text) return;
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
IF(isTag("q"))
|
|
|
|
|
{
|
|
|
|
|
if (opened)
|
|
|
|
|
{
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
strcat(#line, ' \"');
|
|
|
|
|
}
|
|
|
|
|
if (!opened)
|
|
|
|
|
{
|
|
|
|
|
chrcat(#line, '\"');
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
if (anchor) && (!strcmp(#parametr, "id=")) //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>!!! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (!strcmp(#anchor, #options)) anchor_line_num=list.first+stroka;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("body"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
do{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (!strcmp(#parametr, "condition_max=")) condition_max = atoi(#options);
|
|
|
|
|
if (!strcmp(#parametr, "link=")) link_color_inactive = GetColor(#options);
|
|
|
|
|
if (!strcmp(#parametr, "alink=")) link_color_active = GetColor(#options);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
|
|
|
|
|
if (!strcmp(#parametr, "bgcolor="))
|
|
|
|
|
{
|
|
|
|
|
bg_color=GetColor(#options);
|
2014-01-18 15:46:58 +04:00
|
|
|
|
DrawBuf.Fill(bg_color);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
} while(GetNextParam());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("a"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
if (link) IF(text_color_index > 0) text_color_index--; //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
do{
|
|
|
|
|
if (!strcmp(#parametr, "href="))
|
|
|
|
|
{
|
2013-12-27 15:15:17 +04:00
|
|
|
|
if (stroka - 1 > list.visible) || (stroka < -2) return;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
text_color_index++;
|
|
|
|
|
text_colors[text_color_index] = text_colors[text_color_index-1];
|
|
|
|
|
|
|
|
|
|
link = 1;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
text_colors[text_color_index] = link_color_inactive;
|
|
|
|
|
PageLinks.AddLink(#options, stolbec*6+left1, top1);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
if (anchor) && (!strcmp(#parametr, "name="))
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(#anchor, #options))
|
|
|
|
|
{
|
2013-12-27 15:15:17 +04:00
|
|
|
|
anchor_line_num=list.first+stroka;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while(GetNextParam());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
link = 0;
|
|
|
|
|
IF(text_color_index > 0) text_color_index--;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("font"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
text_color_index++;
|
|
|
|
|
text_colors[text_color_index] = text_colors[text_color_index-1];
|
|
|
|
|
|
|
|
|
|
do{
|
|
|
|
|
if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
|
|
|
|
|
{
|
|
|
|
|
text_colors[text_color_index] = GetColor(#options);
|
|
|
|
|
}
|
|
|
|
|
} while(GetNextParam());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (text_color_index > 0) text_color_index--;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if(isTag("tr")) || (isTag("br")) {
|
2013-12-27 03:36:17 +04:00
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("div")) {
|
2013-12-27 03:36:17 +04:00
|
|
|
|
IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("p")) {
|
2013-12-27 03:36:17 +04:00
|
|
|
|
IF(oldtag[0] == 'h') return;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
2014-01-20 02:46:58 +04:00
|
|
|
|
IF(opened) TextGoDown(left1, top1 + 10, width1);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-18 15:46:58 +04:00
|
|
|
|
/*
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("center"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened) text_align = ALIGN_CENTER;
|
|
|
|
|
if (!opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
text_align = ALIGN_LEFT;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("right"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened) text_align = ALIGN_RIGHT;
|
|
|
|
|
if (!opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
text_align = ALIGN_LEFT;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-18 15:46:58 +04:00
|
|
|
|
*/
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) {
|
2013-12-27 03:36:17 +04:00
|
|
|
|
TextGoDown(left1, top1, width1);
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened) && (stroka>1) TextGoDown(left1, top1 + 10, width1);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
strcpy(#oldtag, #tag);
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
|
|
|
|
|
if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT;
|
|
|
|
|
b_text = 1;
|
|
|
|
|
}
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (!opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
text_align = ALIGN_LEFT;
|
|
|
|
|
b_text = 0;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
oldtag=NULL;
|
|
|
|
|
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("b")) || (isTag("strong")) || (isTag("big")) {
|
2014-01-20 02:46:58 +04:00
|
|
|
|
b_text = opened;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if(isTag("i")) || (isTag("em")) || (isTag("subtitle")) {
|
2014-01-20 02:46:58 +04:00
|
|
|
|
i_text = opened;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("dt"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
li_text = opened;
|
|
|
|
|
IF(opened == 0) return;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("condition"))
|
2013-12-29 16:48:06 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
condition_text_active = opened;
|
|
|
|
|
if (opened) && (!strcmp(#parametr, "show_if=")) condition_text_val = atoi(#options);
|
2013-12-29 16:48:06 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("li")) || (isTag("dt")) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
li_text = opened;
|
|
|
|
|
if (opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
2014-01-18 15:46:58 +04:00
|
|
|
|
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (isTag("u")) || (isTag("ins")) u_text = opened;
|
|
|
|
|
if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
|
|
|
|
|
if (isTag("ul")) || (isTag("ol")) IF(!opened)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
li_text = opened;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
li_tab--;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
} ELSE li_tab++;
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("dd")) stolbec += 5;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
if (isTag("blockquote")) blq_text = opened;
|
2014-01-21 03:42:18 +04:00
|
|
|
|
if (isTag("pre")) || (isTag("code")) pre_text = opened;
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("hr"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
if (anchor) || (stroka < -1)
|
|
|
|
|
{
|
|
|
|
|
stroka+=2;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
2014-01-19 21:12:45 +04:00
|
|
|
|
DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color);
|
|
|
|
|
TextGoDown(left1, top1+list.line_h, width1);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("img"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
|
ImgCache.Images( left1, top1, width1);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
|
if (isTag("meta")) || (isTag("?xml"))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
do{
|
|
|
|
|
if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
|
|
|
|
|
{
|
|
|
|
|
strcpy(#options, #options[strrchr(#options, '=')]); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20> content=
|
2014-01-18 15:46:58 +04:00
|
|
|
|
if (!strcmp(#options, "utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI);
|
|
|
|
|
if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS);
|
|
|
|
|
}
|
|
|
|
|
} while(GetNextParam());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
/*
|
|
|
|
|
char *encodings = {
|
|
|
|
|
"utf-8", _UTF,
|
|
|
|
|
"utf8", _UTF,
|
|
|
|
|
"koi8-r", _KOI,
|
|
|
|
|
"koi8-u", _KOI,
|
|
|
|
|
"dos", _DOS,
|
|
|
|
|
"cp-866", _DOS
|
|
|
|
|
};
|
|
|
|
|
*/
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
|
|
|
|
void TWebBrowser::DrawScroller() //<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
2013-12-27 16:30:42 +04:00
|
|
|
|
scroll_wv.max_area = list.count;
|
|
|
|
|
scroll_wv.cur_area = list.visible;
|
|
|
|
|
scroll_wv.position = list.first;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-27 16:30:42 +04:00
|
|
|
|
scroll_wv.all_redraw=1;
|
2014-01-19 21:12:45 +04:00
|
|
|
|
scroll_wv.start_x = list.x + list.w;
|
|
|
|
|
scroll_wv.size_y=list.h;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
|
2013-12-27 16:30:42 +04:00
|
|
|
|
scrollbar_v_draw(#scroll_wv);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-18 15:46:58 +04:00
|
|
|
|
|
|
|
|
|
void TWebBrowser::TextGoDown(int left1, top1, width1)
|
|
|
|
|
{
|
2014-01-19 21:12:45 +04:00
|
|
|
|
if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (top1>=list.y) && ( top1 < list.h+list.y-10) && (!anchor)
|
2014-01-18 15:46:58 +04:00
|
|
|
|
{
|
2014-01-19 21:12:45 +04:00
|
|
|
|
if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,list.w,list.line_h,stolbec * 6);
|
|
|
|
|
if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,list.w,list.line_h,stolbec * 6);
|
|
|
|
|
PutPaletteImage(buf_data+8, list.w, list.line_h, left1-5, top1, 32,0);
|
2014-01-18 15:46:58 +04:00
|
|
|
|
DrawBuf.Fill(bg_color);
|
|
|
|
|
}
|
|
|
|
|
stroka++;
|
|
|
|
|
if (blq_text) stolbec = 8; else stolbec = 0;
|
|
|
|
|
if (li_text) stolbec = li_tab * 5;
|
2014-01-20 00:06:42 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int isTag(dword text)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(#tag,text)) return 1; else return 0;
|
|
|
|
|
}
|