Subversion Repositories Kolibri OS

Rev

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

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