Subversion Repositories Kolibri OS

Rev

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