Subversion Repositories Kolibri OS

Rev

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