Subversion Repositories Kolibri OS

Rev

Rev 7755 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7752 leency 1
#include "..\TWB\colors.h"
2
#include "..\TWB\anchors.h"
3
#include "..\TWB\parce_tag.h"
4
#include "..\TWB\absolute_url.h"
5
char line[500];
6
#include "..\TWB\unicode_tags.h"
4411 leency 7
 
5746 leency 8
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
4416 leency 9
 
5746 leency 10
struct _style {
7752 leency 11
	bool
6794 leency 12
	b, u, s, h,
5746 leency 13
	pre,
14
	blq,
15
	li,
16
	li_tab,
7742 leency 17
	button,
18
	image,
5746 leency 19
	align;
7752 leency 20
	dword bg_color;
5746 leency 21
};
22
 
4411 leency 23
struct TWebBrowser {
4540 leency 24
	llist list;
5746 leency 25
	_style style;
4475 leency 26
	DrawBufer DrawBuf;
7752 leency 27
	dword draw_y, stolbec;
6803 leency 28
	int zoom;
7752 leency 29
	dword o_bufpointer;
7746 leency 30
	void SetPageDefaults();
7752 leency 31
	void AddCharToTheLine();
32
	void ParseHtml();
5766 leency 33
	void SetStyle();
34
	void DrawStyle();
4411 leency 35
	void DrawPage();
36
	void DrawScroller();
4650 leency 37
	void NewLine();
7750 leency 38
	bool CheckForLineBreak();
5749 leency 39
	void BufEncode();
4686 leency 40
} WB1;
4486 leency 41
 
7756 leency 42
dword page_bg;
43
#include "..\TWB\img_cache.h"
44
 
7752 leency 45
dword link_color_inactive;
46
dword link_color_active;
5746 leency 47
 
7756 leency 48
bool link, cur_encoding, t_html, t_body;
5746 leency 49
 
7752 leency 50
#include "..\TWB\links.h"
51
 
5781 leency 52
dword bufpointer=0;
53
dword bufsize=0;
4411 leency 54
 
7756 leency 55
char header[150];
56
 
7752 leency 57
int body_magrin=6;
6794 leency 58
int basic_line_h=22;
59
 
7756 leency 60
scroll_bar scroll_wv = { 15,NULL,NULL,NULL,0,2,NULL,15,0,0xeeeeee,0xBBBbbb,0xeeeeee};
4411 leency 61
 
5747 leency 62
//============================================================================================
5766 leency 63
void TWebBrowser::DrawStyle()
4411 leency 64
{
6803 leency 65
	dword start_x, line_length, stolbec_len;
4411 leency 66
 
67
	if (!header)
68
	{
7752 leency 69
		strncpy(#header, #line, sizeof(header)-1);
4411 leency 70
		line = 0;
71
		return;
72
	}
4637 leency 73
	if (t_html) && (!t_body) return;
4411 leency 74
 
6803 leency 75
	if (line)
4411 leency 76
	{
6794 leency 77
		start_x = stolbec * list.font_w + body_magrin + list.x;
6803 leency 78
		stolbec_len = strlen(#line) * zoom;
5768 leency 79
		line_length = stolbec_len * list.font_w;
4411 leency 80
 
7749 leency 81
		if (debug_mode) {
7750 leency 82
			DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, 0xDDDddd);
7749 leency 83
		}
84
 
7743 leency 85
		if (style.bg_color!=page_bg) {
7750 leency 86
			DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, style.bg_color);
7743 leency 87
		}
88
 
7742 leency 89
		if (style.image) {
7743 leency 90
			DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xF9DBCB);
7742 leency 91
		}
92
		if (style.button) {
93
			DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc);
94
			DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
95
		}
96
 
7738 leency 97
		DrawBuf.WriteText(start_x, draw_y, list.font_type, text_colors[text_color_index], #line);
98
		if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_colors[text_color_index], #line);
6803 leency 99
		if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
100
		if (style.u) DrawBuf.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
5519 leency 101
		if (link) {
7747 leency 102
			if (line[0]==' ') && (line[1]==NULL) {} else {
7750 leency 103
				DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, link_color_inactive);
7746 leency 104
				PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom);
105
			}
4411 leency 106
		}
4718 leency 107
		stolbec += stolbec_len;
7750 leency 108
		if (debug_mode) debug(#line);
109
		line = NULL;
4411 leency 110
	}
111
}
5747 leency 112
//============================================================================================
7746 leency 113
void TWebBrowser::SetPageDefaults()
114
{
115
	style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
116
	style.li = link = text_color_index = text_colors[0] = style.li_tab = false;
5746 leency 117
	style.align = ALIGN_LEFT;
4491 leency 118
	link_color_inactive = 0x0000FF;
119
	link_color_active = 0xFF0000;
7743 leency 120
	page_bg = 0xFFFFFF;
121
	style.bg_color = page_bg;
122
	DrawBuf.Fill(0, page_bg);
4504 leency 123
	PageLinks.Clear();
7752 leency 124
	anchors.clear();
125
	strncpy(#header, #version, sizeof(header)-1);
7746 leency 126
	cur_encoding = CH_NULL;
6794 leency 127
	draw_y = body_magrin;
4411 leency 128
	stolbec = 0;
129
	line = 0;
7752 leency 130
	zoom = 1;
131
	if (o_bufpointer) free(o_bufpointer);
132
	o_bufpointer = 0;
7746 leency 133
}
134
//============================================================================================
7752 leency 135
void TWebBrowser::AddCharToTheLine(unsigned char _char)
136
{
137
	dword line_len;
138
	if (_char<=15) _char=' ';
139
	line_len = strlen(#line);
140
	if (!style.pre) && (_char == ' ')
141
	{
142
		if (line[line_len-1]==' ') return; //no double spaces
143
		if (!stolbec) && (!line) return; //no paces at the beginning of the line
144
	}
145
	if (line_len < sizeof(line)) chrcat(#line, _char);
146
	CheckForLineBreak();
147
}
148
//============================================================================================
149
void TWebBrowser::ParseHtml(){
7746 leency 150
	word bukva[2];
7752 leency 151
	char unicode_symbol[10];
152
	dword unicode_symbol_result;
7746 leency 153
	dword j;
7752 leency 154
	bool ignor_param=false;
155
	int tab_len;
7746 leency 156
	dword bufpos;
157
	SetPageDefaults();
7749 leency 158
	if (strstri(bufpointer, "
159
		t_body = true;
160
		if (strstri(bufpointer, "
161
	}
5773 leency 162
	for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
4411 leency 163
	{
4508 leency 164
		bukva = ESBYTE[bufpos];
4411 leency 165
		switch (bukva)
166
		{
167
		case 0x0a:
7752 leency 168
			if (style.pre) {
5781 leency 169
				DrawStyle();
170
				NewLine();
7752 leency 171
			} else {
172
				AddCharToTheLine(0x0a);
4411 leency 173
			}
7752 leency 174
			break;
175
		case 0x09:
176
			if (style.pre) {
177
				tab_len = strlen(#line) + stolbec % 4;
178
				if (!tab_len) tab_len = 4; else tab_len = 4 - tab_len;
4411 leency 179
				for (j=0; j
7752 leency 180
			} else {
181
				AddCharToTheLine(0x09);
4411 leency 182
			}
7752 leency 183
			break;
4411 leency 184
		case '&': //  and so on
7752 leency 185
			for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (j<8); j++)
4411 leency 186
			{
7749 leency 187
				bukva = ESBYTE[bufpos+j];
7752 leency 188
				chrcat(#unicode_symbol, bukva);
4411 leency 189
			}
7752 leency 190
			if (bukva = GetUnicodeSymbol(#unicode_symbol)) {
7749 leency 191
				bufpos += j;
7750 leency 192
				CheckForLineBreak();
7749 leency 193
			} else {
7752 leency 194
				AddCharToTheLine('&');
7749 leency 195
			}
4411 leency 196
			break;
197
		case '<':
5749 leency 198
			bufpos++;
5768 leency 199
			if (!strncmp(bufpos,"!--",3))
4411 leency 200
			{
6986 leency 201
				bufpos+=3;
202
				while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize)
203
				{
204
					bufpos++;
205
				}
7746 leency 206
				bufpos+=2;
6986 leency 207
				break;
4411 leency 208
			}
7752 leency 209
			tag.reset();
210
			if (ESBYTE[bufpos] == '/') {
211
				tag.opened = false;
212
				bufpos++;
213
			}
214
 
215
			ignor_param=false;
6735 leency 216
			while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
4411 leency 217
			{
4508 leency 218
				bukva = ESBYTE[bufpos];
4411 leency 219
				if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
220
				if (!ignor_param) && (bukva <>' ')
221
				{
7752 leency 222
					if (strlen(#tag.name)+1
4411 leency 223
				}
224
				else
225
				{
226
					ignor_param = true;
7752 leency 227
					if (strlen(#tag.params)+1
228
					//	chrncat(#tag.params, bukva, sizeof(tag.params)-1);
4411 leency 229
				}
4508 leency 230
				bufpos++;
4411 leency 231
			}
7752 leency 232
			strlwr(#tag.name);
4411 leency 233
 
7746 leency 234
			// ignore text inside the next tags
7752 leency 235
			if (tag.is("script")) || (tag.is("style")) || (tag.is("binary")) || (tag.is("select"))  {
236
				sprintf(#tag.params, "", #tag.name);
237
				j = strstri(bufpos, #tag.params);
238
				if (j!=-1) bufpos = j-1;
7746 leency 239
				break;
240
			}
241
 
7752 leency 242
			if (tag.name[strlen(#tag.name)-1]=='/') tag.name[strlen(#tag.name)-1]=NULL; //for br/ !!!!!!!!
243
			if (tag.params) tag.parse_params();
7746 leency 244
 
7752 leency 245
			if (tag.name) && (!tag.is("i")) && (!tag.is("svg")) {
7750 leency 246
				CheckForLineBreak();
7746 leency 247
				DrawStyle();
7752 leency 248
				if (tag.name) SetStyle();
7746 leency 249
			}
4411 leency 250
			break;
251
		default:
7752 leency 252
			AddCharToTheLine(ESBYTE[bufpos]);
4411 leency 253
		}
254
	}
5766 leency 255
	DrawStyle();
256
	NewLine();
7752 leency 257
	list.count = draw_y;
7755 leency 258
	list.CheckDoesValuesOkey();
259
	anchors.current = NULL;
4411 leency 260
}
5747 leency 261
//============================================================================================
7750 leency 262
bool TWebBrowser::CheckForLineBreak()
4718 leency 263
{
7750 leency 264
	int line_break_pos;
4718 leency 265
	char new_line_text[4096];
7750 leency 266
	if (strlen(#line)*zoom + stolbec < list.column_max) return false;
267
	line_break_pos = strrchr(#line, ' ');
268
	if (line_break_pos*zoom + stolbec > list.column_max) {
269
		line_break_pos = list.column_max/zoom - stolbec;
270
		while(line_break_pos) && (line[line_break_pos]!=' ') line_break_pos--;
271
	}
272
	if (!line_break_pos) && (strlen(#line)*zoom>list.column_max) {
273
		line_break_pos=list.column_max/zoom;
7742 leency 274
		if (!stolbec)&&(style.pre) draw_y-=list.item_h; //hack to fix https://prnt.sc/rk3kyt
275
	}
7750 leency 276
	strcpy(#new_line_text, #line + line_break_pos);
277
	line[line_break_pos] = 0x00;
5766 leency 278
	DrawStyle();
4718 leency 279
	strcpy(#line, #new_line_text);
280
	NewLine();
7750 leency 281
	//if (strlen(#line)*zoom + stolbec > list.column_max)CheckForLineBreak();
282
	return true;
4718 leency 283
}
5747 leency 284
//============================================================================================
5773 leency 285
void TWebBrowser::SetStyle() {
7749 leency 286
	char img_path[4096]=0;
7742 leency 287
	int meta_encoding;
7752 leency 288
 
289
	dword value;
290
 
7755 leency 291
	if (value = tag.get_value_of("name=")) || (value = tag.get_value_of("id=")) {
292
		anchors.add(value, draw_y);
293
		if (anchors.current) && (streq(value, #anchors.current+1)) {
294
			list.first = draw_y;
295
			anchors.current = NULL;
296
		}
297
	}
298
 
7752 leency 299
	if (tag.is("html")) {
300
		t_html = tag.opened;
4411 leency 301
		return;
302
	}
7752 leency 303
	if(tag.is("title")) {
304
		if (tag.opened) header=NULL;
4411 leency 305
		return;
306
	}
307
 
7752 leency 308
	IF(tag.is("q"))
4491 leency 309
	{
7752 leency 310
		if (tag.opened)	{
7750 leency 311
			meta_encoding = strlen(#line);
312
			if (line[meta_encoding-1] != ' ') chrcat(#line, ' ');
313
			chrcat(#line, '\"');
314
		}
7752 leency 315
		if (!tag.opened) strcat(#line, "\" ");
5749 leency 316
		return;
4491 leency 317
	}
7752 leency 318
	if (tag.is("body")) {
319
		t_body = tag.opened;
320
		if (value = tag.get_value_of("link="))  link_color_inactive = GetColor(value);
321
		if (value = tag.get_value_of("alink=")) link_color_active = GetColor(value);
322
		if (value = tag.get_value_of("text="))  text_colors[0]=GetColor(value);
323
		if (value = tag.get_value_of("bgcolor=")) {
324
			style.bg_color = page_bg = GetColor(value);
325
			DrawBuf.Fill(0, page_bg);
326
		}
327
		if (tag.opened) {
328
			if (cur_encoding==CH_NULL) {
329
				cur_encoding = CH_CP866;
330
				//BufEncode(CH_UTF8);
331
				debugln("Document has no information about encoding!");
4411 leency 332
			}
7752 leency 333
			if (!streq(#header, #version)) {
7056 leency 334
				ChangeCharset(charsets[cur_encoding], "CP866", #header);
7752 leency 335
				strncat(#header, " - ", sizeof(header)-1);
336
				strncat(#header, #version, sizeof(header)-1);
7056 leency 337
			}
7032 leency 338
			DrawTitle(#header);
339
		}
4411 leency 340
		return;
341
	}
7752 leency 342
	if (tag.is("a")) {
343
		if (tag.opened)
4411 leency 344
		{
6735 leency 345
			if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
7752 leency 346
			if (value = tag.get_value_of("href=")) && (!strstr(value,"javascript:"))
347
			{
348
				text_color_index++;
349
				text_colors[text_color_index] = text_colors[text_color_index-1];
350
				link = 1;
351
				text_colors[text_color_index] = link_color_inactive;
352
				PageLinks.AddLink(value);
353
			}
354
		} else {
4411 leency 355
			link = 0;
356
			IF(text_color_index > 0) text_color_index--;
357
		}
358
		return;
359
	}
7752 leency 360
	if (tag.is("font")) {
7743 leency 361
		style.bg_color = page_bg;
7752 leency 362
		if (tag.opened)
4411 leency 363
		{
364
			text_color_index++;
365
			text_colors[text_color_index] = text_colors[text_color_index-1];
7752 leency 366
			if (value = tag.get_value_of("color=")) text_colors[text_color_index] = GetColor(value);
367
			if (value = tag.get_value_of("bg=")) style.bg_color = GetColor(value);
4411 leency 368
		}
5749 leency 369
		else if (text_color_index > 0) text_color_index--;
4411 leency 370
		return;
371
	}
7752 leency 372
	if (tag.is("div")) {
7756 leency 373
		if (streq(#tag.prior,"div")) && (tag.opened) return;
7746 leency 374
		NewLine();
4411 leency 375
		return;
376
	}
7752 leency 377
	if (tag.is("header")) || (tag.is("article")) || (tag.is("footer")) || (tag.is("figure")) {
7746 leency 378
		NewLine();
379
		return;
380
	}
7752 leency 381
	if (tag.is("p")) {
7756 leency 382
		IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
4692 leency 383
		NewLine();
4411 leency 384
		return;
385
	}
7752 leency 386
	if (tag.is("br")) { NewLine(); return; }
387
	if (tag.is("tr")) { if (tag.opened) NewLine(); return; }
388
	if (tag.is("b")) || (tag.is("strong")) || (tag.is("big")) { style.b = tag.opened; return; }
389
	if (tag.is("button")) { style.button = tag.opened; stolbec++; return; }
390
	if (tag.is("u")) || (tag.is("ins")) { style.u=tag.opened; return;}
391
	if (tag.is("s")) || (tag.is("strike")) || (tag.is("del")) { style.s=tag.opened; return; }
392
	if (tag.is("dd")) { stolbec += 5; return; }
393
	if (tag.is("blockquote")) { style.blq = tag.opened; return; }
394
	if (tag.is("pre")) || (tag.is("code")) { style.pre = tag.opened; return; }
395
	if (tag.is("img")) {
396
		if (value = tag.get_value_of("src=")) strlcpy(#img_path, value, sizeof(img_path)-1);
397
		if (value = tag.get_value_of("title=")) && (strlen(value)
398
		if (value = tag.get_value_of("alt=")) && (strlen(value)
7750 leency 399
		if (!img_path) { line=0; return; }
7742 leency 400
		style.image = true;
401
		text_color_index++;
402
		text_colors[text_color_index] = 0x9A6F29;
403
		if (!line) {
404
			if (!strncmp(#img_path, "data:", 5)) img_path=0;
7749 leency 405
			replace_char(#img_path, '?', NULL, strlen(#img_path));
7742 leency 406
			sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/'));
407
			line[50]= NULL;
408
		}
7750 leency 409
		while (CheckForLineBreak()) {};
7742 leency 410
		DrawStyle();
411
		text_color_index--;
412
		style.image = false;
7752 leency 413
		//ImgCache.Images( list.x, draw_y, WB1.list.w);
7742 leency 414
		return;
415
	}
7752 leency 416
	if (tag.is("h1")) || (tag.is("h2")) || (tag.is("h3")) || (tag.is("caption")) {
417
		style.h = tag.opened;
418
		if (tag.opened)
4411 leency 419
		{
6794 leency 420
			NewLine();
421
			draw_y += 10;
6803 leency 422
			WB1.zoom=2;
6045 leency 423
			WB1.list.font_type |= 10011001b;
7752 leency 424
			if (value = tag.get_value_of("align=")) {
425
				if (streq(value, "center")) style.align = ALIGN_CENTER;
426
				if (streq(value, "right")) style.align = ALIGN_RIGHT;
427
			}
6794 leency 428
			list.item_h = basic_line_h * 2;
7752 leency 429
			if (tag.is("h1")) style.b = true;
4411 leency 430
		}
5768 leency 431
		else
4411 leency 432
		{
7752 leency 433
			if (tag.is("h1")) style.b = false;
6794 leency 434
			NewLine();
6803 leency 435
			WB1.zoom=1;
6045 leency 436
			WB1.list.font_type = 10011000b;
5746 leency 437
			style.align = ALIGN_LEFT;
6794 leency 438
			list.item_h = basic_line_h;
4411 leency 439
		}
440
		return;
441
	}
7752 leency 442
	if (tag.is("dt")) {
443
		style.li = tag.opened;
444
		if (tag.opened) NewLine();
4411 leency 445
		return;
446
	}
7752 leency 447
	if (tag.is("li")) || (tag.is("dt"))
4411 leency 448
	{
7752 leency 449
		style.li = tag.opened;
450
		if (tag.opened)
4411 leency 451
		{
4692 leency 452
			NewLine();
7743 leency 453
			stolbec = style.li_tab * 5 - 2;
7742 leency 454
			strcpy(#line, "\31 ");
7743 leency 455
			//stolbec-=2;
4411 leency 456
		}
457
		return;
458
	}
7752 leency 459
	if (tag.is("ul")) || (tag.is("ol")) {
460
		if (!tag.opened)
5749 leency 461
		{
7752 leency 462
			style.li = tag.opened;
5749 leency 463
			style.li_tab--;
464
			NewLine();
465
		}
466
		else style.li_tab++;
467
	}
7752 leency 468
	if (tag.is("hr")) {
469
		if (value = tag.get_value_of("color=")) EDI = GetColor(value); else EDI = 0x999999;
5773 leency 470
		$push edi;
4692 leency 471
		NewLine();
5773 leency 472
		$pop edi;
7746 leency 473
		draw_y += 10;
6794 leency 474
		DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI);
4692 leency 475
		NewLine();
7746 leency 476
		draw_y += 10;
5773 leency 477
		return;
4411 leency 478
	}
7752 leency 479
	if (tag.is("meta")) || (tag.is("?xml")) {
6045 leency 480
		meta_encoding = CH_NULL;
7752 leency 481
		if (value = tag.get_value_of("charset=")) || (value = tag.get_value_of("content=")) || (value = tag.get_value_of("encoding="))
482
		{
483
			value += strrchr(value, '='); //search in content=
484
			strlwr(value);
485
			if      (streq(value,"utf-8"))        || (streq(value,"utf8"))        meta_encoding = CH_UTF8;
486
			else if (streq(value,"windows-1251")) || (streq(value,"windows1251")) meta_encoding = CH_CP1251;
487
			else if (streq(value,"dos"))          || (streq(value,"cp-866"))      meta_encoding = CH_CP866;
488
			else if (streq(value,"iso-8859-5"))   || (streq(value,"iso8859-5"))   meta_encoding = CH_ISO8859_5;
489
			else if (streq(value,"koi8-r"))       || (streq(value,"koi8-u"))      meta_encoding = CH_KOI8;
490
		}
6045 leency 491
		if (meta_encoding!=CH_NULL) BufEncode(meta_encoding);
4411 leency 492
		return;
493
	}
494
}
7746 leency 495
//============================================================================================
6803 leency 496
void TWebBrowser::BufEncode(dword set_new_encoding)
5704 leency 497
{
7032 leency 498
	if (cur_encoding == set_new_encoding) return;
7752 leency 499
	if (o_bufpointer==0) {
5704 leency 500
		o_bufpointer = malloc(bufsize);
501
		strcpy(o_bufpointer, bufpointer);
7752 leency 502
	} else {
5704 leency 503
		strcpy(bufpointer, o_bufpointer);
504
	}
7742 leency 505
	//debugval("cur_encoding    ", cur_encoding);
506
	//debugval("set_new_encoding", set_new_encoding);
7032 leency 507
	cur_encoding = set_new_encoding;
508
	bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
5704 leency 509
}
5747 leency 510
//============================================================================================
4674 leency 511
void TWebBrowser::DrawScroller()
4411 leency 512
{
4416 leency 513
	scroll_wv.max_area = list.count;
514
	scroll_wv.cur_area = list.visible;
515
	scroll_wv.position = list.first;
5519 leency 516
	scroll_wv.all_redraw = 0;
4486 leency 517
	scroll_wv.start_x = list.x + list.w;
4508 leency 518
	scroll_wv.start_y = list.y;
5678 leency 519
	scroll_wv.size_y = list.h;
4416 leency 520
	scrollbar_v_draw(#scroll_wv);
4411 leency 521
}
5747 leency 522
//============================================================================================
4692 leency 523
void TWebBrowser::NewLine()
4475 leency 524
{
6803 leency 525
	dword onleft, ontop;
7742 leency 526
	static int empty_line=0;
4692 leency 527
 
6794 leency 528
	if (!stolbec) && (draw_y==body_magrin) return;
7742 leency 529
 
7749 leency 530
	if (style.li) && (stolbec == style.li_tab * 5) {
7742 leency 531
		if (empty_line<1) empty_line++;
532
		else return;
7749 leency 533
	} else if (!stolbec) {
534
		if (empty_line<1) empty_line++;
535
		else return;
7742 leency 536
	} else {
537
		empty_line=0;
538
	}
6794 leency 539
 
540
	onleft = list.x + body_magrin;
541
	ontop = draw_y + list.y;
4637 leency 542
	if (t_html) && (!t_body) return;
6794 leency 543
	draw_y += list.item_h;
5746 leency 544
	if (style.blq) stolbec = 6; else stolbec = 0;
545
	if (style.li) stolbec = style.li_tab * 5;
7750 leency 546
	if (debug_mode) debugln(NULL);
4488 leency 547
}
5747 leency 548
//============================================================================================
5766 leency 549
void TWebBrowser::DrawPage()
550
{
6794 leency 551
	PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
5766 leency 552
	DrawScroller();
553
}