Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3067 leency 1
 
2
3
 
4
	buf,
5
	filesize,
6
	blink;
7
8
 
9
char search_path[]="http://nigma.ru/index.php?s=";
10
char version[]=" Text-based Browser 0.99.05";
3990 leency 11
3067 leency 12
 
13
 
14
	int left, top, width, height, line_h;
3464 leency 15
	void Scan(int);
3067 leency 16
	void GetNewUrl();
17
	void OpenPage();
18
	void ReadHtml(byte);
19
	void ShowPage();
20
	void ParseHTML(dword);
21
	void WhatTextStyle(int left1, top1, width1);
22
	void DrawPage();
23
	void DrawScroller();
24
};
3466 leency 25
TWebBrowser WB1;
26
3067 leency 27
 
3128 leency 28
	link, ignor_text, li_tab, cur_encoding;
3466 leency 29
3067 leency 30
 
31
	text_color_index,
32
	link_color,
33
	bg_color;
34
35
 
36
	stolbec,
37
	tab_len,
3466 leency 38
	anchor_line_num;
39
3067 leency 40
 
41
	tag[100],
42
	tagparam[10000],
43
	parametr[1200],
44
	options[4096],
3466 leency 45
	anchor[256];
46
3067 leency 47
 
48
#include "include\colors.h"
49
#include "include\unicode_tags.h"
50
#include "include\img_cache.h"
3466 leency 51
#include "include\some_code.h"
3067 leency 52
#include "include\parce_tag.h"
53
54
 
3466 leency 55
dword drawbuf;
56
void DrawBufInit()
57
{
58
	free(drawbuf);
59
	drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
60
	ESDWORD[drawbuf] = WB1.width;
61
	ESDWORD[drawbuf+4] = WB1.line_h;
62
}
63
void DrawBufFill()
64
{
65
	int i;
66
	for (i=0; i
67
}
68
void DrawBufBar(dword x, y, w, h, color)
69
{
70
	int i, j;
71
	for (j=0; j
72
	{
73
		for (i = y+j*WB1.width+x*4; i
74
	}
75
}
76
3067 leency 77
 
3466 leency 78
void DrawBufSkew(dword x, y, w, h)
79
{
80
	int i, j;
81
	stolbec++;
82
	for (j=0; j<=3; j++)
83
	{
84
		for (i = y+j*WB1.width+x+w+h*4; i>y+j*WB1.width+x+h-12*4 ; i-=4)
85
								ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
86
	}
87
}
88
89
 
90
{
91
	if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //закрашиваем фон над первой строкой
92
	stroka++;
93
	if (blq_text) stolbec = 8; else stolbec = 0;
94
	if (li_text) stolbec = li_tab * 5;
95
	if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10)  && (!anchor)
96
	{
97
		PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0);
98
		DrawBufFill();
99
	}
100
}
101
102
 
103
{
104
	int start_x, start_y, line_length, magrin_left=5;
105
106
 
107
	{
108
		strcpy(#header, #line);
109
		strcat(#header, " -");
110
		strcat(#header, #version);
111
		line = 0;
112
		return;
113
	}
114
115
 
116
	{
117
		start_x = stolbec * 6 + left + magrin_left;
118
		start_y = stroka * 10 + top + magrin_left;
119
		line_length = strlen(#line) * 6;
120
121
 
122
		{
123
			//line_length =  get_length stdcall (#line,-1,16,line_length);
124
			text_out stdcall (#line, #fontlol, 17, text_colors[text_color_index], start_x, start_y-3);
125
		}
126
		else
127
		{
128
			WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
129
		}
130
		IF (b_text)	WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
131
		IF (i_text) DrawBufSkew(start_x, 0, line_length, line_h);
132
		IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
133
		IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
134
		IF (link) {
135
			UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9);
136
			DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
137
		}
138
		stolbec += strlen(#line);
139
	}
140
}
141
//=======================================================================
142
143
 
3067 leency 144
{
145
	if (id >= 400)
146
	{
147
		GetURLfromPageLinks(id);
148
149
 
150
		if (URL[0] == '#')
151
		{
152
			strcpy(#anchor, #URL+strrchr(#URL, '#'));
153
154
 
155
156
 
157
			ShowPage();
158
			return;
159
		}
160
		//liner.ru#1
161
		if (strrchr(#URL, '#')<>-1)
162
		{
163
			strcpy(#anchor, #URL+strrchr(#URL, '#'));
164
			URL[strrchr(#URL, '#')-1] = 0x00; //заглушка
165
		}
166
167
 
168
169
 
170
		{
171
			//if (strstr(#URL,"http:"))
172
			RunProgram("/sys/media/kiv", #URL);
173
			strcpy(#editURL, BrowserHistory.CurrentUrl());
174
			strcpy(#URL, BrowserHistory.CurrentUrl());
175
			return;
176
		}
177
		if (!strcmpn(#URL,"mailto:", 7))
178
		{
179
			RunProgram("@notify", #URL);
180
			strcpy(#editURL, BrowserHistory.CurrentUrl());
181
			strcpy(#URL, BrowserHistory.CurrentUrl());
182
			return;
183
		}
184
185
 
186
		return;
187
	}
188
189
 
190
	{ CASE 183: CASE 184: CASE 180: CASE 181: return; }
191
192
 
193
	{
194
		case 011: //Ctrk+K
195
			ReadHtml(_KOI);
196
			break;
197
		case 021: //Ctrl+U
198
			ReadHtml(_UTF);
199
			break;
200
		case 004: //Ctrl+D
201
			ReadHtml(_DOS);
202
			break;
203
		case 002: //free img cache
3468 leency 204
			FreeImgCache();
205
			break;
206
		case 003:
207
			if (!pre_text) pre_text=2;
3067 leency 208
				else pre_text=0;
209
			break;
210
		case 005: //truetype
211
			if (use_truetype == 2)
212
			{
213
				RunProgram("@notify", "Library does not exists /rd/1/lib/truetype.obj"w);
214
				return;
215
			}
216
			if (use_truetype == 1) use_truetype=0; else use_truetype=1;
217
			break;
218
		case BACK:
219
			if (!BrowserHistory.GoBack()) return;
220
			OpenPage();
221
			return;
222
		case FORWARD:
223
			if (!BrowserHistory.GoForward()) return;
224
			OpenPage();
225
			return;
226
		case 052:  //F3
3466 leency 227
			if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path);
3067 leency 228
			return;
229
		case 054: //F5
230
			IF(address_box.flags & 0b10) break;
3466 leency 231
		case REFRESH:
3067 leency 232
			if (GetProcessSlot(downloader_id)<>0)
233
			{
234
				KillProcess(downloader_id);
235
				pause(20);
3078 leency 236
				Draw_Window();
3067 leency 237
				return;
238
			}
239
			anchor_line_num=lines.first; //весёлый костыль :Р
240
			anchor[0]='|';
241
			OpenPage();
242
			return;
243
		case 014: //Ctrl+N новое окно
244
		case 020: //Ctrl+T новая вкладка
245
		case NEWTAB:
246
			MoveSize(190,80,OLD,OLD);
247
			RunProgram(#program_path, #URL);
248
			return;
249
250
 
251
			strcpy(#editURL, "http://kolibrios.org/en/index.htm");
3987 leency 252
		case GOTOURL:
3067 leency 253
		case 0x0D: //enter
254
			//почему ttp://? Господа, отличный вопрос. Дело в том, что это хак.
3986 leency 255
			//strstr() если не нашло возвращает 0 и в случае успеха возвращает 0. Так что это хак.
256
			if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0;
257
			strcat(#URL, #editURL);
258
			OpenPage();
3067 leency 259
			return;
260
		case SEARCHWEB:
261
			strcpy(#URL, #search_path);
262
			strcat(#URL, #editURL);
263
			OpenPage();
264
			return;
265
266
 
267
			IF(lines.first <= 0) return;
268
			lines.first--;
269
			break;
270
		case ID2: //мотаем вниз
271
			IF(lines.visible + lines.first >= lines.all) return;
272
			lines.first++;
273
			break;
274
		case 183: //PgDown
275
			IF(lines.first == lines.all - lines.visible) return;
276
			lines.first += lines.visible + 2;
277
			IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible;
278
			break;
279
		case 184: //PgUp
280
			IF(lines.first == 0) return;
281
			lines.first -= lines.visible - 2;
282
			IF(lines.first < 0) lines.first = 0;
283
			break;
284
		case 180: //home
285
			IF(lines.first == 0) return;
286
			lines.first = 0;
287
			break;
288
		case 181: //end
289
			IF (lines.first == lines.all - lines.visible) return;
290
			lines.first = lines.all - lines.visible;
291
			break;
292
		default:
293
			return;
294
	}
295
	ParseHTML(buf);
296
}
297
298
 
299
 
3990 leency 300
//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){
3067 leency 301
void TWebBrowser::GetNewUrl(){
302
	int i, len;
303
304
 
305
	{
306
		len=strlen(ABSOLUTE_LINKS[i]);
307
		if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return;
308
	}
309
310
 
311
	strcpy(#editURL, BrowserHistory.CurrentUrl()); //достаём адрес текущей страницы
3987 leency 312
3067 leency 313
 
3987 leency 314
	{
315
		i = strchr(#editURL+8, '/');
316
		editURL[i+7]=0;
317
		strcpy(#URL, #URL+1);
318
	}
319
3067 leency 320
 
321
322
 
323
		{
324
			editURL[strrchr(#editURL, '/')] = 0x00; //обрезаем её урл до последнего /
325
		}
326
327
 
328
		{
329
			strcpy(#URL,#URL+3);
330
			editURL[strrchr(#editURL, '/')-1] = 0x00; //обрезаем её урл до последнего /
331
			goto _CUT_ST_LEVEL_MARK;
332
		}
333
334
 
335
336
 
337
		strcpy(#URL, #editURL);
338
}
339
340
 
341
 
342
 
343
{
344
	if (!strcmp(get_URL_part(5),"http:")))
345
		file_size stdcall (#download_path);
346
	else
347
		file_size stdcall (#URL);
348
349
 
350
	if (!filesize) return;
351
352
 
353
	buf = mem_Alloc(filesize);
354
	if (!strcmp(get_URL_part(5),"http:")))
355
		ReadFile(0, filesize, buf, #download_path);
356
	else
357
		ReadFile(0, filesize, buf, #URL);
358
359
 
360
	if (encoding==_WIN) wintodos(buf);
361
	if (encoding==_UTF) utf8rutodos(buf);
362
	if (encoding==_KOI) koitodos(buf);
363
}
364
365
 
366
 
367
{
368
	if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
369
	KillProcess(downloader_id);
370
	strcpy(#editURL, #URL);
371
	BrowserHistory.AddUrl();
372
	strcpy(#header, #version);
373
	pre_text =0;
374
	if (!strcmp(get_URL_part(5),"http:")))
375
	{
376
		KillProcess(downloader_id); //убиваем старый процесс
377
		DeleteFile(#download_path);
378
		IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL;
379
		downloader_id = RunProgram("/sys/network/downloader", #URL);
380
		//Browser Hack v2.0
381
		/*
3649 leency 382
		pause(60);
3079 leency 383
		if (GetProcessSlot(downloader_id)<>0)
3067 leency 384
		{
385
			debug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
386
			KillProcess(downloader_id); //убиваем старый процесс
387
			downloader_id = RunProgram("/sys/network/downloader", #URL);
388
		}
389
		*/
3649 leency 390
		IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
3067 leency 391
		Draw_Window();
392
		return;
393
	}
394
	lines.first = lines.all =0;
395
	ReadHtml(_WIN);
396
	WB1.ShowPage();
397
}
398
399
 
400
 
401
{
402
	address_box.size = address_box.pos = strlen(#editURL);
3466 leency 403
	address_box.offset=0;
404
	edit_box_draw stdcall(#address_box);
405
3128 leency 406
 
3067 leency 407
	{
408
		DrawBar(left, top, width+scroll1.size_x+1, height, 0xFFFFFF); //fill all
3466 leency 409
		if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading...");
3107 leency 410
		else
3067 leency 411
		{
412
			WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
3107 leency 413
			if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
414
		}
3067 leency 415
		//return;
416
	}
417
	else
418
		ParseHTML(buf);
419
420
 
421
	if (!strcmp(#version, #header)) DrawTitle(#header);
422
}
423
424
 
425
 
426
 
427
	word bukva[2];
428
	int j, perenos_num;
429
	byte ignor_param;
430
	char temp[768];
431
432
 
3468 leency 433
	b_text = i_text = u_text = s_text = blq_text =
3466 leency 434
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //обнуляем теги
3067 leency 435
	link_color = 0x0000FF;
436
	bg_color = 0xFFFFFF;
437
	DrawBufFill();
3468 leency 438
	line = NULL;
3067 leency 439
	strcpy(#page_links,"|");
440
	strcpy(#header, #version);
441
	stroka = -lines.first;
3468 leency 442
	stolbec = 0;
443
3067 leency 444
 
445
	{
446
		pre_text=0;
447
		if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
448
		if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
449
	}
450
451
 
452
	{
453
		bukva = ESBYTE[bword];
454
		if (ignor_text) && (bukva<>'<') continue;
455
		switch (bukva)
456
		{
457
		case 0x0a:
458
			if (pre_text)
459
			{
460
				bukva = temp = NULL;
461
				goto NEXT_MARK;
462
			}
463
		case '\9':
464
			if (pre_text) //иначе идём на 0x0d
465
			{
466
				tab_len=strlen(#line)/8;
467
				tab_len=tab_len*8;
468
				tab_len=8+tab_len-strlen(#line);
469
				for (j=0; j
3468 leency 470
				break;
3067 leency 471
			}
3468 leency 472
			goto DEFAULT_MARK;
473
		case '=': //quoted printable
474
			if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
3067 leency 475
476
 
3468 leency 477
			temp[1] = ESBYTE[bword+2];
478
			temp[2] = '\0';
479
			if (bukva = Hex2Symb(#temp))
480
			{
481
				bword+=2;
482
				goto DEFAULT_MARK;
483
			}
484
			break;
3067 leency 485
486
 
487
			bword++;
488
			tag=0;
489
			for (j=0; (ESBYTE[bword]<>';') && (j<7);   j++, bword++;)
490
			{
491
				bukva = ESBYTE[bword];
492
				chrcat(#tag, bukva);
3468 leency 493
			}
3067 leency 494
495
 
496
			if (bukva) goto DEFAULT_MARK;
497
			break;
498
		case '<':
499
			bword++; //промотаем символ <
500
			tag = parametr = tagparam = ignor_param = NULL;
501
			if (ESBYTE[bword] == '!') //фильтрация внутри , дерзко
502
			{
503
				bword++;
504
				if (ESBYTE[bword] == '-')
505
				{
506
				HH_:
507
					do
508
					{
509
						bword++;
510
						if (buf + filesize <= bword) break 2;
511
					}
512
					while (ESBYTE[bword] <>'-');
513
514
 
515
					if (ESBYTE[bword] <>'-') goto HH_;
516
				}
517
			}
518
			while (ESBYTE[bword] !='>') && (bword < buf + filesize) //получаем тег и его параметры
519
			{
520
				bukva = ESBYTE[bword];
521
				if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
522
				if (!ignor_param) && (bukva <>' ')
523
				{
524
					if (strlen(#tag)
525
				}
526
				else
527
				{
528
					ignor_param = true;
529
					if (!ignor_text) && (strlen(#tagparam)+1
530
				}
531
				bword++;
532
			}
533
			strlwr(#tag);
534
			strlwr(#tagparam);
535
536
 
537
			if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
538
539
 
3466 leency 540
			{
3067 leency 541
				perenos_num = strrchr(#line, ' ');
542
				if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max;
543
				strcpy(#temp, #line + perenos_num); //перенос по словам
544
				line[perenos_num] = 0x00;
545
				if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим...
3466 leency 546
				DrawPage();
3067 leency 547
				strcpy(#line, #temp);
3466 leency 548
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3067 leency 549
			}
550
			DrawPage();
551
			line=NULL;
552
553
 
554
555
 
556
			break;
557
		default:
558
			DEFAULT_MARK:
559
			if (bukva<=15) bukva=' ';
3468 leency 560
			if (!pre_text) && (bukva == ' ')
3067 leency 561
			{
562
				if (line[strlen(#line)-1]==' ') break; //убрать 2 пробела подряд
563
				if (!stolbec) && (!line) break; //строка не может начинаться с пробела
564
			}
565
			if (strlen(#line)
3363 leency 566
3067 leency 567
 
568
			{
569
			NEXT_MARK:
570
				perenos_num = strrchr(#line, ' ');
571
				if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max;
572
				strcpy(#temp, #line + perenos_num); //перенос по словам
573
				line[perenos_num] = 0x00;
574
				if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим...
3466 leency 575
				DrawPage();
3067 leency 576
				strcpy(#line, #temp);
3466 leency 577
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3067 leency 578
			}
579
		}
580
	}
581
582
 
583
	TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3466 leency 584
585
 
3067 leency 586
		DrawBar(left, lines.visible * 10 + top + 25, width, -lines.visible * 10 + height - 25, bg_color);
3466 leency 587
	if (stroka * 10 + 5 <= height)
588
		DrawBar(left, stroka * 10 + top + 5, width, -stroka * 10 + height - 5, bg_color); //закрашиваем всё до конца
589
	if (lines.first == 0) lines.all = stroka;
3067 leency 590
	if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл
591
	{
592
		anchor=NULL;
593
		lines.first=anchor_line_num;
594
		ParseHTML(buf);
595
	}
596
	DrawScroller();
597
}
598
599
 
3464 leency 600
 
601
 
3067 leency 602
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
603
	dword hr_color;
604
605
 
606
	if (tag[0] == '/')
607
	{
608
		 rez = 0;
609
		 strcpy(#tag, #tag+1);
610
	}
611
	else rez = 1;
612
613
 
614
	{
615
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
616
		return;
617
	}
618
619
 
620
621
 
622
	{
623
		if (rez) header=NULL;
624
		else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку
625
		return;
626
	}
627
628
 
629
630
 
631
 
632
 
633
634
 
635
	{
636
		if (!strcmp(#anchor, #options))	anchor_line_num=lines.first+stroka;
637
	}
638
639
 
640
	{
641
		do{
642
			if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
643
			if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
644
			if (!strcmp(#parametr, "bgcolor="))
3466 leency 645
			{
646
				bg_color=GetColor(#options);
647
				DrawBufFill();
648
			}
649
		} while(GetNextParam());
3067 leency 650
		return;
651
	}
652
653
 
654
	{
655
		if (rez)
656
		{
657
			if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт
658
659
 
660
				if (!strcmp(#parametr, "href="))
661
				{
662
					if (stroka - 1 > lines.visible) || (stroka < -2) return;
663
664
 
665
					text_colors[text_color_index] = text_colors[text_color_index-1];
666
667
 
668
					blink++;
669
					text_colors[text_color_index] = link_color;
670
					strcat(#page_links, #options);
671
					strcat(#page_links, "|");
672
				}
673
				if (anchor) && (!strcmp(#parametr, "name="))
674
				{
675
					if (!strcmp(#anchor, #options))
676
					{
677
						anchor_line_num=lines.first+stroka;
678
					}
679
				}
680
			} while(GetNextParam());
681
		}
682
		else {
683
			link = 0;
684
			IF(text_color_index > 0) text_color_index--;
685
		}
686
		return;
687
	}
688
689
 
690
	{
691
		if (rez)
692
		{
693
			text_color_index++;
694
			text_colors[text_color_index] = text_colors[text_color_index-1];
695
696
 
697
				if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
698
				{
699
					text_colors[text_color_index] = GetColor(#options);
700
				}
701
			} while(GetNextParam());
702
		}
703
		else
704
			if (text_color_index > 0) text_color_index--;
705
		return;
706
	}
707
	if(!chTag("tr")) || (!chTag("br")) {
708
		TextGoDown(left1, top1, width1);
709
		return;
710
	}
711
	if (!chTag("div")) {
712
		IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
713
		return;
714
	}
715
	if (!chTag("p")) {
716
		IF(oldtag[0] == 'h') return;
717
		TextGoDown(left1, top1, width1);
718
		IF(rez) TextGoDown(left1, top1 + 10, width1);
719
		return;
720
	}
721
	if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
722
		TextGoDown(left1, top1, width1);
723
		IF(rez) TextGoDown(left1, top1 + 10, width1);
724
		b_text = rez;
725
		strcpy(#oldtag, #tag);
726
		return;
727
	}
728
	else
729
		oldtag=NULL;
730
731
 
732
		b_text = rez;
733
		return;
734
	}
735
	if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) {
736
		i_text = rez;
737
		return;
738
	}
739
	if (!chTag("dt"))
740
	{
741
		li_text = rez;
742
		IF(rez == 0) return;
743
		TextGoDown(left1, top1, width1);
744
		return;
745
	}
746
	if(!chTag("li")) || (!chTag("dt")) //надо сделать вложенные списки
747
	{
748
		li_text = rez;
749
		if (rez)
3466 leency 750
		{
751
			TextGoDown(left1, top1, width1);
752
			if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, line_h/2-3, 2, 2, 0x555555);
753
		}
754
		return;
3067 leency 755
	}
756
	if (!chTag("u")) || (!chTag("ins")) u_text = rez;
757
	if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
758
	if (!chTag("ul")) || (!chTag("ol")) IF(!rez)
759
	{
760
		li_text = rez;
761
		li_tab--;
762
		TextGoDown(left1, top1, width1);
763
	} ELSE li_tab++;
764
	if (!chTag("dd")) stolbec += 5;
765
	if (!chTag("blockquote")) blq_text = rez;
766
	if (!chTag("pre")) pre_text = rez;
767
	if (!chTag("hr"))
768
	{
769
		if (anchor) || (stroka < -1)
3466 leency 770
		{
771
			stroka+=2;
772
			return;
773
		}
774
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
775
		TextGoDown(left1, top1, width1);
3067 leency 776
		DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color);
3466 leency 777
		TextGoDown(left1, top1+WB1.line_h, width1);
778
	}
3067 leency 779
	/*
3466 leency 780
	if (!chTag("input"))
3129 leency 781
	{
782
		do{
783
			if (!strcmp(#parametr, "type="))
3466 leency 784
			{
3129 leency 785
				if ((!strcmp(#options, "radio")) || (!strcmp(#options, "checkbox")))
3466 leency 786
				{
787
					if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,10,10, 0, "\0", 0x888888, text_colors[text_color_index], 0);
788
					stolbec+=2;
789
				}
790
				if ((!strcmp(#options, "text")) || (!strcmp(#options, "password")))
791
				{
792
					if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,90,10, 0, "\0", 0x555555, 0, 0);
793
					stolbec+=16;
794
				}
795
				if ((!strcmp(#options, "button")) || (!strcmp(#options, "file")) || (!strcmp(#options, "submit")))
796
				{
797
					if (!anchor) && (stroka > 0) DrawCaptButton(stolbec*6 + left1,top1-2,60,10, 0, 0xCCCccc, 0, "Button");
798
					stolbec+=21;
799
				}
800
			}
3129 leency 801
		} while(GetNextParam());
802
	}
803
	*/
3466 leency 804
	if (!chTag("img"))
3067 leency 805
	{
806
		Images( left1, top1, width1);
807
		return;
808
	}
809
	if (!chTag("meta")) || (!chTag("?xml"))
810
	{
811
		do{
812
			if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
813
			{
814
				strcpy(#options, #options[strrchr(#options, '=')]); //поиск в content=
815
				if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
816
				if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
817
				if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
818
			}
819
		} while(GetNextParam());
820
		return;
821
	}
822
}
823
824
 
825
 
826
 
827
{
828
	scroll1.max_area = lines.all;
829
	scroll1.cur_area = lines.visible;
830
	scroll1.position = lines.first;
831
832
 
833
	scroll1.start_x = WB1.left + WB1.width;
3466 leency 834
	scroll1.size_y=WB1.height;
3067 leency 835
836
 
837
}
838
>
3466 leency 839