2020-12-06 02:22:38 +03:00
|
|
|
#include "TWB\colors.h"
|
|
|
|
#include "TWB\anchors.h"
|
|
|
|
#include "TWB\parse_tag.h"
|
|
|
|
#include "TWB\special.h"
|
|
|
|
#include "TWB\tag_list.h"
|
2020-12-19 03:50:55 +03:00
|
|
|
#define DEFAULT_BG_COL 0xffEBE8E9;
|
2020-04-04 02:17:28 +03:00
|
|
|
dword link_color_default;
|
2020-03-29 13:57:14 +03:00
|
|
|
dword link_color_active;
|
2020-12-06 02:22:38 +03:00
|
|
|
#include "TWB\links.h"
|
2013-12-27 16:30:42 +04:00
|
|
|
|
2020-04-04 02:17:28 +03:00
|
|
|
#define BODY_MARGIN 6
|
|
|
|
#define BASIC_LINE_H 18
|
2015-08-19 15:48:31 +03:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
CANVAS canvas;
|
2020-04-10 19:19:52 +03:00
|
|
|
char line[500];
|
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
struct STYLE {
|
2020-03-26 03:12:32 +03:00
|
|
|
bool
|
2016-12-12 01:58:11 +03:00
|
|
|
b, u, s, h,
|
2020-06-02 01:18:26 +03:00
|
|
|
font,
|
2015-08-19 15:48:31 +03:00
|
|
|
pre,
|
|
|
|
blq,
|
2020-03-21 17:33:54 +03:00
|
|
|
button,
|
2020-04-04 02:17:28 +03:00
|
|
|
image;
|
|
|
|
LIST tag_list;
|
2020-12-18 02:01:09 +03:00
|
|
|
dword title;
|
2020-12-19 03:50:55 +03:00
|
|
|
dword cur_line_h;
|
2020-12-18 02:01:09 +03:00
|
|
|
void reset();
|
2015-08-19 15:48:31 +03:00
|
|
|
};
|
2013-12-27 16:30:42 +04:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
void STYLE::reset()
|
|
|
|
{
|
|
|
|
b = u = s = h = blq = pre = title = false;
|
|
|
|
font = false;
|
2020-12-19 03:50:55 +03:00
|
|
|
cur_line_h = NULL;
|
2020-12-18 02:01:09 +03:00
|
|
|
tag_list.reset();
|
|
|
|
}
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
struct TWebBrowser {
|
2014-01-28 00:16:33 +04:00
|
|
|
llist list;
|
2020-12-18 02:01:09 +03:00
|
|
|
STYLE style;
|
2020-03-26 03:12:32 +03:00
|
|
|
dword draw_y, stolbec;
|
2016-12-21 13:56:06 +03:00
|
|
|
int zoom;
|
2020-03-26 03:12:32 +03:00
|
|
|
dword o_bufpointer;
|
2020-04-04 02:17:28 +03:00
|
|
|
int cur_encoding, custom_encoding;
|
|
|
|
bool link, t_html, t_body;
|
|
|
|
dword bufpointer;
|
|
|
|
dword bufsize;
|
2020-05-18 13:03:45 +03:00
|
|
|
dword is_html;
|
2020-12-13 23:52:56 +03:00
|
|
|
collection img_url;
|
2020-12-18 02:01:09 +03:00
|
|
|
char header[150];
|
|
|
|
char redirect[URL_SIZE];
|
2020-04-04 02:17:28 +03:00
|
|
|
|
2020-04-10 19:19:52 +03:00
|
|
|
void Paint();
|
2020-03-22 22:50:16 +03:00
|
|
|
void SetPageDefaults();
|
2020-03-26 03:12:32 +03:00
|
|
|
void AddCharToTheLine();
|
|
|
|
void ParseHtml();
|
2015-08-23 13:12:13 +03:00
|
|
|
void SetStyle();
|
2020-03-25 03:18:19 +03:00
|
|
|
bool CheckForLineBreak();
|
2020-04-04 22:13:03 +03:00
|
|
|
void NewLine();
|
|
|
|
void ChangeEncoding();
|
|
|
|
void DrawPage();
|
2020-12-18 02:01:09 +03:00
|
|
|
|
|
|
|
void tag_a();
|
|
|
|
void tag_p();
|
|
|
|
void tag_img();
|
|
|
|
void tag_div();
|
|
|
|
void tag_h1234_caption();
|
|
|
|
void tag_ol_ul_dt();
|
|
|
|
void tag_li();
|
|
|
|
void tag_q();
|
|
|
|
void tag_hr();
|
|
|
|
void tag_code();
|
|
|
|
void tag_meta_xml();
|
|
|
|
void tag_body();
|
|
|
|
void tag_iframe();
|
|
|
|
void tag_title();
|
|
|
|
void tag_font();
|
2020-04-04 02:17:28 +03:00
|
|
|
};
|
2014-03-13 02:56:28 +04:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
#include "TWB\set_style.h"
|
2014-01-18 15:46:58 +04:00
|
|
|
|
2015-08-19 15:54:01 +03:00
|
|
|
//============================================================================================
|
2020-04-10 19:19:52 +03:00
|
|
|
void TWebBrowser::Paint()
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
2016-12-21 13:56:06 +03:00
|
|
|
dword start_x, line_length, stolbec_len;
|
2020-04-04 22:13:03 +03:00
|
|
|
dword text_color__;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
if (style.title)
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
2020-04-04 02:17:28 +03:00
|
|
|
strncpy(#header, #line, sizeof(TWebBrowser.header)-1);
|
|
|
|
strncat(#header, " - ", sizeof(TWebBrowser.header)-1);
|
|
|
|
strncat(#header, #version, sizeof(TWebBrowser.header)-1);
|
2020-03-31 00:29:52 +03:00
|
|
|
line = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (t_html) && (!t_body) {
|
2013-12-27 03:36:17 +04:00
|
|
|
line = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-12-21 13:56:06 +03:00
|
|
|
if (line)
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
2020-04-04 02:17:28 +03:00
|
|
|
start_x = stolbec * list.font_w + BODY_MARGIN + list.x;
|
2016-12-21 13:56:06 +03:00
|
|
|
stolbec_len = strlen(#line) * zoom;
|
2015-08-23 22:59:44 +03:00
|
|
|
line_length = stolbec_len * list.font_w;
|
2020-12-19 03:50:55 +03:00
|
|
|
style.cur_line_h = math.max(style.cur_line_h, list.item_h);
|
2015-08-05 01:21:08 +03:00
|
|
|
|
2020-12-19 03:50:55 +03:00
|
|
|
if (bg_colors.get_last() - bg_colors.get(0)) {
|
|
|
|
canvas.DrawBar(start_x, draw_y, line_length, list.item_h, bg_colors.get_last());
|
2020-03-21 21:49:45 +03:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:33:54 +03:00
|
|
|
if (style.image) {
|
2020-12-18 02:01:09 +03:00
|
|
|
canvas.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xF9DBCB);
|
2020-03-21 17:33:54 +03:00
|
|
|
}
|
|
|
|
if (style.button) {
|
2020-12-18 02:01:09 +03:00
|
|
|
canvas.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc);
|
|
|
|
canvas.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
|
2020-03-21 17:33:54 +03:00
|
|
|
}
|
|
|
|
|
2020-06-02 01:18:26 +03:00
|
|
|
text_color__ = text_colors.get_last();
|
|
|
|
if (link) && (text_color__ == text_colors.get(0)) text_color__ = link_color_default;
|
2020-04-04 22:13:03 +03:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
canvas.WriteText(start_x, draw_y, list.font_type, text_color__, #line, NULL);
|
|
|
|
if (style.b) canvas.WriteText(start_x+1, draw_y, list.font_type, text_color__, #line, NULL);
|
|
|
|
if (style.s) canvas.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_color__);
|
|
|
|
if (style.u) canvas.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_color__);
|
2015-03-16 17:20:32 +03:00
|
|
|
if (link) {
|
2020-03-22 22:54:20 +03:00
|
|
|
if (line[0]==' ') && (line[1]==NULL) {} else {
|
2020-12-18 02:01:09 +03:00
|
|
|
canvas.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2)-1, line_length, zoom, link_color_default);
|
2020-05-23 00:39:04 +03:00
|
|
|
links.add_text(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2)-1, zoom);
|
2020-03-22 22:50:16 +03:00
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
2014-03-30 15:57:13 +04:00
|
|
|
stolbec += stolbec_len;
|
2020-12-18 02:01:09 +03:00
|
|
|
if (debug_mode) debugln(#line);
|
2020-03-25 03:18:19 +03:00
|
|
|
line = NULL;
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
|
|
|
}
|
2015-08-19 15:54:01 +03:00
|
|
|
//============================================================================================
|
2020-03-22 22:50:16 +03:00
|
|
|
void TWebBrowser::SetPageDefaults()
|
|
|
|
{
|
2020-12-18 02:01:09 +03:00
|
|
|
t_html = t_body = link = false;
|
|
|
|
style.reset();
|
2020-04-04 02:17:28 +03:00
|
|
|
link_color_default = 0x0000FF;
|
2014-01-20 02:46:58 +04:00
|
|
|
link_color_active = 0xFF0000;
|
2020-12-19 03:50:55 +03:00
|
|
|
//style.cur_line_h = list.item_h;
|
2020-05-23 00:39:04 +03:00
|
|
|
links.clear();
|
2020-03-26 03:12:32 +03:00
|
|
|
anchors.clear();
|
2020-12-13 23:52:56 +03:00
|
|
|
img_url.drop();
|
2020-06-02 01:18:26 +03:00
|
|
|
text_colors.drop();
|
|
|
|
text_colors.add(0);
|
2020-12-19 03:50:55 +03:00
|
|
|
bg_colors.drop();
|
|
|
|
bg_colors.add(DEFAULT_BG_COL);
|
|
|
|
canvas.Fill(0, DEFAULT_BG_COL);
|
2020-03-31 00:29:52 +03:00
|
|
|
header = NULL;
|
2020-04-04 02:17:28 +03:00
|
|
|
cur_encoding = CH_CP866;
|
|
|
|
draw_y = BODY_MARGIN;
|
2013-12-27 03:36:17 +04:00
|
|
|
stolbec = 0;
|
|
|
|
line = 0;
|
2020-03-26 03:12:32 +03:00
|
|
|
zoom = 1;
|
2020-12-02 17:21:06 +03:00
|
|
|
redirect = '\0';
|
2020-03-29 13:57:14 +03:00
|
|
|
//hold original buffer
|
|
|
|
if (o_bufpointer) o_bufpointer=free(o_bufpointer);
|
|
|
|
o_bufpointer = malloc(bufsize);
|
|
|
|
memmov(o_bufpointer, bufpointer, bufsize);
|
2020-04-04 02:17:28 +03:00
|
|
|
if (custom_encoding != -1) {
|
|
|
|
cur_encoding = custom_encoding;
|
2020-04-13 16:16:55 +03:00
|
|
|
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
|
2020-04-04 02:17:28 +03:00
|
|
|
}
|
2020-03-22 22:50:16 +03:00
|
|
|
}
|
|
|
|
//============================================================================================
|
2020-04-04 02:17:28 +03:00
|
|
|
void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
2020-03-26 03:12:32 +03:00
|
|
|
char unicode_symbol[10];
|
2020-03-22 22:50:16 +03:00
|
|
|
dword j;
|
2020-03-26 03:12:32 +03:00
|
|
|
int tab_len;
|
2020-03-22 22:50:16 +03:00
|
|
|
dword bufpos;
|
2020-04-04 02:17:28 +03:00
|
|
|
bufsize = _bufsize;
|
2020-12-18 02:01:09 +03:00
|
|
|
|
2020-04-10 19:19:52 +03:00
|
|
|
if (bufpointer != _bufpointer) {
|
|
|
|
bufpointer = malloc(bufsize);
|
|
|
|
memmov(bufpointer, _bufpointer, bufsize);
|
|
|
|
} else {
|
|
|
|
custom_encoding = CH_CP866;
|
|
|
|
}
|
2020-03-22 22:50:16 +03:00
|
|
|
SetPageDefaults();
|
2020-05-18 13:03:45 +03:00
|
|
|
is_html = true;
|
|
|
|
if (!strstri(bufpointer, "<body")) {
|
2020-03-23 18:53:56 +03:00
|
|
|
t_body = true;
|
2020-05-27 18:19:19 +03:00
|
|
|
if (!strstri(bufpointer, "<html")) && (!strstr(bufpointer, "<?xml")) && (!strstr(bufpointer, "<xml")) {
|
2020-05-18 13:03:45 +03:00
|
|
|
style.pre = true; //show linebreaks for a plaint text
|
|
|
|
is_html = false;
|
|
|
|
}
|
2020-03-23 18:53:56 +03:00
|
|
|
}
|
2015-08-27 02:45:56 +03:00
|
|
|
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
2020-12-06 02:22:38 +03:00
|
|
|
switch (ESBYTE[bufpos])
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
|
|
|
case 0x0a:
|
2020-03-26 03:12:32 +03:00
|
|
|
if (style.pre) {
|
2020-04-10 19:19:52 +03:00
|
|
|
Paint();
|
2015-09-01 12:36:58 +03:00
|
|
|
NewLine();
|
2020-03-26 03:12:32 +03:00
|
|
|
} else {
|
|
|
|
AddCharToTheLine(0x0a);
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
2020-03-26 03:12:32 +03:00
|
|
|
break;
|
|
|
|
case 0x09:
|
|
|
|
if (style.pre) {
|
|
|
|
tab_len = strlen(#line) + stolbec % 4;
|
|
|
|
if (!tab_len) tab_len = 4; else tab_len = 4 - tab_len;
|
2013-12-27 03:36:17 +04:00
|
|
|
for (j=0; j<tab_len; j++;) chrcat(#line,' ');
|
2020-03-26 03:12:32 +03:00
|
|
|
} else {
|
|
|
|
AddCharToTheLine(0x09);
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
2020-03-26 03:12:32 +03:00
|
|
|
break;
|
2013-12-27 03:36:17 +04:00
|
|
|
case '&': // and so on
|
2020-12-04 14:58:20 +03:00
|
|
|
for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (!__isWhite(ESBYTE[bufpos+j])) && (j<8); j++)
|
2013-12-27 03:36:17 +04:00
|
|
|
{
|
2020-12-15 05:08:04 +03:00
|
|
|
chrcat(#unicode_symbol, ESBYTE[bufpos+j]);
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
2020-04-10 19:19:52 +03:00
|
|
|
if (GetUnicodeSymbol(#line, #unicode_symbol, sizeof(line)-1)) {
|
2020-03-23 18:53:56 +03:00
|
|
|
bufpos += j;
|
2020-03-25 03:18:19 +03:00
|
|
|
CheckForLineBreak();
|
2020-03-23 18:53:56 +03:00
|
|
|
} else {
|
2020-03-26 03:12:32 +03:00
|
|
|
AddCharToTheLine('&');
|
2020-03-23 18:53:56 +03:00
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
break;
|
|
|
|
case '<':
|
2020-12-06 02:22:38 +03:00
|
|
|
if (!is_html) goto _DEFAULT;
|
2015-08-19 18:14:52 +03:00
|
|
|
bufpos++;
|
2020-12-06 02:22:38 +03:00
|
|
|
switch (ESBYTE[bufpos]) {
|
2020-12-18 02:01:09 +03:00
|
|
|
case '!': case '/': case '?':
|
|
|
|
case 'a'...'z': case 'A'...'Z':
|
2020-12-06 02:22:38 +03:00
|
|
|
goto _TAG;
|
|
|
|
default:
|
|
|
|
goto _DEFAULT;
|
|
|
|
}
|
|
|
|
_TAG:
|
2020-12-18 04:47:36 +03:00
|
|
|
if (tag.parse(#bufpos, bufpointer + bufsize)) {
|
2020-03-25 03:18:19 +03:00
|
|
|
CheckForLineBreak();
|
2020-04-10 19:19:52 +03:00
|
|
|
Paint();
|
2020-12-18 02:01:09 +03:00
|
|
|
$push cur_encoding
|
|
|
|
SetStyle();
|
|
|
|
$pop eax
|
|
|
|
// The thing is that UTF if longer than other encodings.
|
|
|
|
// So if encoding was changed from UTF to DOS than $bufpos position got wrong,
|
|
|
|
// and we have to start parse from the very beginning
|
|
|
|
if (EAX != cur_encoding) && (cur_encoding == CH_UTF8) {
|
|
|
|
ParseHtml(bufpointer, bufsize);
|
|
|
|
return;
|
2020-12-14 18:54:00 +03:00
|
|
|
}
|
2020-03-22 22:50:16 +03:00
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
break;
|
|
|
|
default:
|
2020-12-06 02:22:38 +03:00
|
|
|
_DEFAULT:
|
2020-03-26 03:12:32 +03:00
|
|
|
AddCharToTheLine(ESBYTE[bufpos]);
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
|
|
|
}
|
2020-04-10 19:19:52 +03:00
|
|
|
Paint();
|
2014-03-24 02:49:49 +04:00
|
|
|
NewLine();
|
2020-03-26 03:12:32 +03:00
|
|
|
list.count = draw_y;
|
2020-12-16 19:30:39 +03:00
|
|
|
|
2020-12-18 02:01:09 +03:00
|
|
|
canvas.bufh = math.max(list.visible, draw_y);
|
|
|
|
buf_data = realloc(buf_data, canvas.bufh * canvas.bufw * 4 + 8);
|
2020-12-16 19:30:39 +03:00
|
|
|
|
2020-03-27 13:38:54 +03:00
|
|
|
list.CheckDoesValuesOkey();
|
|
|
|
anchors.current = NULL;
|
2020-04-04 02:17:28 +03:00
|
|
|
custom_encoding = -1;
|
2020-03-31 00:29:52 +03:00
|
|
|
if (!header) {
|
2020-04-04 02:17:28 +03:00
|
|
|
strncpy(#header, #version, sizeof(TWebBrowser.header)-1);
|
2020-03-31 00:29:52 +03:00
|
|
|
DrawTitle(#header);
|
|
|
|
}
|
2013-12-27 03:36:17 +04:00
|
|
|
}
|
2015-08-19 15:54:01 +03:00
|
|
|
//============================================================================================
|
2020-12-18 15:55:55 +03:00
|
|
|
void TWebBrowser::AddCharToTheLine(unsigned char _char)
|
|
|
|
{
|
|
|
|
dword line_len;
|
|
|
|
if (_char<=15) _char=' ';
|
|
|
|
line_len = strlen(#line);
|
|
|
|
if (!style.pre) && (_char == ' ')
|
|
|
|
{
|
|
|
|
if (line[line_len-1]==' ') return; //no double spaces
|
|
|
|
if (!stolbec) && (!line) return; //no paces at the beginning of the line
|
|
|
|
if (link) && (line_len==0) return;
|
|
|
|
}
|
|
|
|
if (line_len < sizeof(line)) chrcat(#line, _char);
|
|
|
|
CheckForLineBreak();
|
|
|
|
}
|
|
|
|
//============================================================================================
|
2020-03-25 03:18:19 +03:00
|
|
|
bool TWebBrowser::CheckForLineBreak()
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2020-03-25 03:18:19 +03:00
|
|
|
int line_break_pos;
|
2014-03-30 15:57:13 +04:00
|
|
|
char new_line_text[4096];
|
2020-03-31 00:29:52 +03:00
|
|
|
//Do we need a line break?
|
2020-03-25 03:18:19 +03:00
|
|
|
if (strlen(#line)*zoom + stolbec < list.column_max) return false;
|
2020-03-31 00:29:52 +03:00
|
|
|
//Yes, we do. Lets calculate where...
|
2020-03-25 03:18:19 +03:00
|
|
|
line_break_pos = strrchr(#line, ' ');
|
2020-03-31 00:29:52 +03:00
|
|
|
//Is a new line fits in the current line?
|
2020-03-25 03:18:19 +03:00
|
|
|
if (line_break_pos*zoom + stolbec > list.column_max) {
|
|
|
|
line_break_pos = list.column_max/zoom - stolbec;
|
|
|
|
while(line_break_pos) && (line[line_break_pos]!=' ') line_break_pos--;
|
|
|
|
}
|
2020-03-31 00:29:52 +03:00
|
|
|
//Maybe a new line is too big for the whole new line? Then we have to split it
|
2020-04-04 02:17:28 +03:00
|
|
|
if (!line_break_pos) && (style.tag_list.level*5 + strlen(#line) * zoom >= list.column_max) {
|
2020-03-31 00:29:52 +03:00
|
|
|
line_break_pos = list.column_max/zoom - stolbec;
|
2020-03-21 17:33:54 +03:00
|
|
|
}
|
2020-03-25 03:18:19 +03:00
|
|
|
strcpy(#new_line_text, #line + line_break_pos);
|
2020-03-31 00:29:52 +03:00
|
|
|
line[line_break_pos] = 0x00;
|
|
|
|
|
2020-04-10 19:19:52 +03:00
|
|
|
Paint();
|
2020-03-31 00:29:52 +03:00
|
|
|
|
2014-03-30 15:57:13 +04:00
|
|
|
strcpy(#line, #new_line_text);
|
|
|
|
NewLine();
|
2020-03-25 03:18:19 +03:00
|
|
|
return true;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
2015-08-19 15:54:01 +03:00
|
|
|
//============================================================================================
|
2014-03-24 02:49:49 +04:00
|
|
|
void TWebBrowser::NewLine()
|
2014-01-18 15:46:58 +04:00
|
|
|
{
|
2020-03-21 17:33:54 +03:00
|
|
|
static int empty_line=0;
|
2014-03-24 02:49:49 +04:00
|
|
|
|
2020-04-04 02:17:28 +03:00
|
|
|
if (!stolbec) && (draw_y==BODY_MARGIN) return;
|
2020-03-21 17:33:54 +03:00
|
|
|
|
2020-04-04 02:17:28 +03:00
|
|
|
if (style.tag_list.level) && (stolbec == style.tag_list.level * 5) {
|
2020-03-23 18:53:56 +03:00
|
|
|
if (empty_line<1) empty_line++;
|
|
|
|
else return;
|
|
|
|
} else if (!stolbec) {
|
2020-03-21 17:33:54 +03:00
|
|
|
if (empty_line<1) empty_line++;
|
|
|
|
else return;
|
|
|
|
} else {
|
|
|
|
empty_line=0;
|
|
|
|
}
|
2016-12-12 01:58:11 +03:00
|
|
|
|
2014-03-13 03:30:28 +04:00
|
|
|
if (t_html) && (!t_body) return;
|
2020-12-19 03:50:55 +03:00
|
|
|
draw_y += style.cur_line_h;
|
|
|
|
style.cur_line_h = list.item_h;
|
2015-08-19 15:48:31 +03:00
|
|
|
if (style.blq) stolbec = 6; else stolbec = 0;
|
2020-04-04 02:17:28 +03:00
|
|
|
stolbec += style.tag_list.level * 5;
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
2015-08-19 15:54:01 +03:00
|
|
|
//============================================================================================
|
2020-12-18 15:55:55 +03:00
|
|
|
void TWebBrowser::ChangeEncoding(int _new_encoding)
|
|
|
|
{
|
|
|
|
if (cur_encoding == _new_encoding) return;
|
|
|
|
cur_encoding = _new_encoding;
|
|
|
|
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
|
|
|
|
if (header) {
|
|
|
|
ChangeCharset(cur_encoding, "CP866", #header);
|
|
|
|
DrawTitle(#header);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//============================================================================================
|
2020-12-18 02:01:09 +03:00
|
|
|
scroll_bar scroll_wv =
|
|
|
|
{ 15,NULL,NULL,NULL,0,2,NULL,
|
|
|
|
0,0,0xeeeeee,0xBBBbbb,0xeeeeee};
|
|
|
|
|
2015-08-23 13:12:13 +03:00
|
|
|
void TWebBrowser::DrawPage()
|
|
|
|
{
|
2020-12-18 02:01:09 +03:00
|
|
|
scroll_wv.max_area = list.count;
|
|
|
|
scroll_wv.cur_area = list.visible;
|
|
|
|
scroll_wv.position = list.first;
|
|
|
|
scroll_wv.all_redraw = 0;
|
|
|
|
scroll_wv.start_x = list.x + list.w;
|
|
|
|
scroll_wv.start_y = list.y;
|
|
|
|
scroll_wv.size_y = list.h;
|
|
|
|
scrollbar_v_draw(#scroll_wv);
|
|
|
|
|
|
|
|
canvas.Show(list.first, list.h);
|
2015-08-23 13:12:13 +03:00
|
|
|
}
|