Subversion Repositories Kolibri OS

Rev

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

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