Subversion Repositories Kolibri OS

Rev

Rev 3986 | 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.04";
3987 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 173:	//ctrl+enter
261
		case SEARCHWEB:
262
			strcpy(#URL, #search_path);
263
			strcat(#URL, #editURL);
264
			OpenPage();
265
			return;
266
267
 
268
			IF(lines.first <= 0) return;
269
			lines.first--;
270
			break;
271
		case ID2: //мотаем вниз
272
			IF(lines.visible + lines.first >= lines.all) return;
273
			lines.first++;
274
			break;
275
		case 183: //PgDown
276
			IF(lines.first == lines.all - lines.visible) return;
277
			lines.first += lines.visible + 2;
278
			IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible;
279
			break;
280
		case 184: //PgUp
281
			IF(lines.first == 0) return;
282
			lines.first -= lines.visible - 2;
283
			IF(lines.first < 0) lines.first = 0;
284
			break;
285
		case 180: //home
286
			IF(lines.first == 0) return;
287
			lines.first = 0;
288
			break;
289
		case 181: //end
290
			IF (lines.first == lines.all - lines.visible) return;
291
			lines.first = lines.all - lines.visible;
292
			break;
293
		default:
294
			return;
295
	}
296
	ParseHTML(buf);
297
}
298
299
 
300
 
301
//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){
302
void TWebBrowser::GetNewUrl(){
303
	int i, len;
304
305
 
306
	{
307
		len=strlen(ABSOLUTE_LINKS[i]);
308
		if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return;
309
	}
310
311
 
312
	strcpy(#editURL, BrowserHistory.CurrentUrl()); //достаём адрес текущей страницы
3987 leency 313
3067 leency 314
 
3987 leency 315
	{
316
		i = strchr(#editURL+8, '/');
317
		editURL[i+7]=0;
318
		strcpy(#URL, #URL+1);
319
	}
320
3067 leency 321
 
322
323
 
324
		{
325
			editURL[strrchr(#editURL, '/')] = 0x00; //обрезаем её урл до последнего /
326
		}
327
328
 
329
		{
330
			strcpy(#URL,#URL+3);
331
			editURL[strrchr(#editURL, '/')-1] = 0x00; //обрезаем её урл до последнего /
332
			goto _CUT_ST_LEVEL_MARK;
333
		}
334
335
 
336
337
 
338
		strcpy(#URL, #editURL);
339
}
340
341
 
342
 
343
 
344
{
345
	if (!strcmp(get_URL_part(5),"http:")))
346
		file_size stdcall (#download_path);
347
	else
348
		file_size stdcall (#URL);
349
350
 
351
	if (!filesize) return;
352
353
 
354
	buf = mem_Alloc(filesize);
355
	if (!strcmp(get_URL_part(5),"http:")))
356
		ReadFile(0, filesize, buf, #download_path);
357
	else
358
		ReadFile(0, filesize, buf, #URL);
359
360
 
361
	if (encoding==_WIN) wintodos(buf);
362
	if (encoding==_UTF) utf8rutodos(buf);
363
	if (encoding==_KOI) koitodos(buf);
364
}
365
366
 
367
 
368
{
369
	if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
370
	KillProcess(downloader_id);
371
	strcpy(#editURL, #URL);
372
	BrowserHistory.AddUrl();
373
	strcpy(#header, #version);
374
	pre_text =0;
375
	if (!strcmp(get_URL_part(5),"http:")))
376
	{
377
		KillProcess(downloader_id); //убиваем старый процесс
378
		DeleteFile(#download_path);
379
		IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL;
380
		downloader_id = RunProgram("/sys/network/downloader", #URL);
381
		//Browser Hack v2.0
382
		/*
3649 leency 383
		pause(60);
3079 leency 384
		if (GetProcessSlot(downloader_id)<>0)
3067 leency 385
		{
386
			debug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
387
			KillProcess(downloader_id); //убиваем старый процесс
388
			downloader_id = RunProgram("/sys/network/downloader", #URL);
389
		}
390
		*/
3649 leency 391
		IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
3067 leency 392
		Draw_Window();
393
		return;
394
	}
395
	lines.first = lines.all =0;
396
	ReadHtml(_WIN);
397
	WB1.ShowPage();
398
}
399
400
 
401
 
402
{
403
	address_box.size = address_box.pos = strlen(#editURL);
3466 leency 404
	address_box.offset=0;
405
	edit_box_draw stdcall(#address_box);
406
3128 leency 407
 
3067 leency 408
	{
409
		DrawBar(left, top, width+scroll1.size_x+1, height, 0xFFFFFF); //fill all
3466 leency 410
		if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading...");
3107 leency 411
		else
3067 leency 412
		{
413
			WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.");
3107 leency 414
			if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration.");
415
		}
3067 leency 416
		//return;
417
	}
418
	else
419
		ParseHTML(buf);
420
421
 
422
	if (!strcmp(#version, #header)) DrawTitle(#header);
423
}
424
425
 
426
 
427
 
428
	word bukva[2];
429
	int j, perenos_num;
430
	byte ignor_param;
431
	char temp[768];
432
433
 
3468 leency 434
	b_text = i_text = u_text = s_text = blq_text =
3466 leency 435
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //обнуляем теги
3067 leency 436
	link_color = 0x0000FF;
437
	bg_color = 0xFFFFFF;
438
	DrawBufFill();
3468 leency 439
	line = NULL;
3067 leency 440
	strcpy(#page_links,"|");
441
	strcpy(#header, #version);
442
	stroka = -lines.first;
3468 leency 443
	stolbec = 0;
444
3067 leency 445
 
446
	{
447
		pre_text=0;
448
		if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
449
		if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
450
	}
451
452
 
453
	{
454
		bukva = ESBYTE[bword];
455
		if (ignor_text) && (bukva<>'<') continue;
456
		switch (bukva)
457
		{
458
		case 0x0a:
459
			if (pre_text)
460
			{
461
				bukva = temp = NULL;
462
				goto NEXT_MARK;
463
			}
464
		case '\9':
465
			if (pre_text) //иначе идём на 0x0d
466
			{
467
				tab_len=strlen(#line)/8;
468
				tab_len=tab_len*8;
469
				tab_len=8+tab_len-strlen(#line);
470
				for (j=0; j
3468 leency 471
				break;
3067 leency 472
			}
3468 leency 473
			goto DEFAULT_MARK;
474
		case '=': //quoted printable
475
			if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
3067 leency 476
477
 
3468 leency 478
			temp[1] = ESBYTE[bword+2];
479
			temp[2] = '\0';
480
			if (bukva = Hex2Symb(#temp))
481
			{
482
				bword+=2;
483
				goto DEFAULT_MARK;
484
			}
485
			break;
3067 leency 486
487
 
488
			bword++;
489
			tag=0;
490
			for (j=0; (ESBYTE[bword]<>';') && (j<7);   j++, bword++;)
491
			{
492
				bukva = ESBYTE[bword];
493
				chrcat(#tag, bukva);
3468 leency 494
			}
3067 leency 495
496
 
497
			if (bukva) goto DEFAULT_MARK;
498
			break;
499
		case '<':
500
			bword++; //промотаем символ <
501
			tag = parametr = tagparam = ignor_param = NULL;
502
			if (ESBYTE[bword] == '!') //фильтрация внутри , дерзко
503
			{
504
				bword++;
505
				if (ESBYTE[bword] == '-')
506
				{
507
				HH_:
508
					do
509
					{
510
						bword++;
511
						if (buf + filesize <= bword) break 2;
512
					}
513
					while (ESBYTE[bword] <>'-');
514
515
 
516
					if (ESBYTE[bword] <>'-') goto HH_;
517
				}
518
			}
519
			while (ESBYTE[bword] !='>') && (bword < buf + filesize) //получаем тег и его параметры
520
			{
521
				bukva = ESBYTE[bword];
522
				if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
523
				if (!ignor_param) && (bukva <>' ')
524
				{
525
					if (strlen(#tag)
526
				}
527
				else
528
				{
529
					ignor_param = true;
530
					if (!ignor_text) && (strlen(#tagparam)+1
531
				}
532
				bword++;
533
			}
534
			strlwr(#tag);
535
			strlwr(#tagparam);
536
537
 
538
			if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
539
540
 
3466 leency 541
			{
3067 leency 542
				perenos_num = strrchr(#line, ' ');
543
				if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max;
544
				strcpy(#temp, #line + perenos_num); //перенос по словам
545
				line[perenos_num] = 0x00;
546
				if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим...
3466 leency 547
				DrawPage();
3067 leency 548
				strcpy(#line, #temp);
3466 leency 549
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3067 leency 550
			}
551
			DrawPage();
552
			line=NULL;
553
554
 
555
556
 
557
			break;
558
		default:
559
			DEFAULT_MARK:
560
			if (bukva<=15) bukva=' ';
3468 leency 561
			if (!pre_text) && (bukva == ' ')
3067 leency 562
			{
563
				if (line[strlen(#line)-1]==' ') break; //убрать 2 пробела подряд
564
				if (!stolbec) && (!line) break; //строка не может начинаться с пробела
565
			}
566
			if (strlen(#line)
3363 leency 567
3067 leency 568
 
569
			{
570
			NEXT_MARK:
571
				perenos_num = strrchr(#line, ' ');
572
				if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max;
573
				strcpy(#temp, #line + perenos_num); //перенос по словам
574
				line[perenos_num] = 0x00;
575
				if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим...
3466 leency 576
				DrawPage();
3067 leency 577
				strcpy(#line, #temp);
3466 leency 578
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3067 leency 579
			}
580
		}
581
	}
582
583
 
584
	TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку
3466 leency 585
586
 
3067 leency 587
		DrawBar(left, lines.visible * 10 + top + 25, width, -lines.visible * 10 + height - 25, bg_color);
3466 leency 588
	if (stroka * 10 + 5 <= height)
589
		DrawBar(left, stroka * 10 + top + 5, width, -stroka * 10 + height - 5, bg_color); //закрашиваем всё до конца
590
	if (lines.first == 0) lines.all = stroka;
3067 leency 591
	if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл
592
	{
593
		anchor=NULL;
594
		lines.first=anchor_line_num;
595
		ParseHTML(buf);
596
	}
597
	DrawScroller();
598
}
599
600
 
3464 leency 601
 
602
 
3067 leency 603
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
604
	dword hr_color;
605
606
 
607
	if (tag[0] == '/')
608
	{
609
		 rez = 0;
610
		 strcpy(#tag, #tag+1);
611
	}
612
	else rez = 1;
613
614
 
615
	{
616
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
617
		return;
618
	}
619
620
 
621
622
 
623
	{
624
		if (rez) header=NULL;
625
		else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку
626
		return;
627
	}
628
629
 
630
631
 
632
 
633
 
634
635
 
636
	{
637
		if (!strcmp(#anchor, #options))	anchor_line_num=lines.first+stroka;
638
	}
639
640
 
641
	{
642
		do{
643
			if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
644
			if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
645
			if (!strcmp(#parametr, "bgcolor="))
3466 leency 646
			{
647
				bg_color=GetColor(#options);
648
				DrawBufFill();
649
			}
650
		} while(GetNextParam());
3067 leency 651
		return;
652
	}
653
654
 
655
	{
656
		if (rez)
657
		{
658
			if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт
659
660
 
661
				if (!strcmp(#parametr, "href="))
662
				{
663
					if (stroka - 1 > lines.visible) || (stroka < -2) return;
664
665
 
666
					text_colors[text_color_index] = text_colors[text_color_index-1];
667
668
 
669
					blink++;
670
					text_colors[text_color_index] = link_color;
671
					strcat(#page_links, #options);
672
					strcat(#page_links, "|");
673
				}
674
				if (anchor) && (!strcmp(#parametr, "name="))
675
				{
676
					if (!strcmp(#anchor, #options))
677
					{
678
						anchor_line_num=lines.first+stroka;
679
					}
680
				}
681
			} while(GetNextParam());
682
		}
683
		else {
684
			link = 0;
685
			IF(text_color_index > 0) text_color_index--;
686
		}
687
		return;
688
	}
689
690
 
691
	{
692
		if (rez)
693
		{
694
			text_color_index++;
695
			text_colors[text_color_index] = text_colors[text_color_index-1];
696
697
 
698
				if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
699
				{
700
					text_colors[text_color_index] = GetColor(#options);
701
				}
702
			} while(GetNextParam());
703
		}
704
		else
705
			if (text_color_index > 0) text_color_index--;
706
		return;
707
	}
708
	if(!chTag("tr")) || (!chTag("br")) {
709
		TextGoDown(left1, top1, width1);
710
		return;
711
	}
712
	if (!chTag("div")) {
713
		IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
714
		return;
715
	}
716
	if (!chTag("p")) {
717
		IF(oldtag[0] == 'h') return;
718
		TextGoDown(left1, top1, width1);
719
		IF(rez) TextGoDown(left1, top1 + 10, width1);
720
		return;
721
	}
722
	if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
723
		TextGoDown(left1, top1, width1);
724
		IF(rez) TextGoDown(left1, top1 + 10, width1);
725
		b_text = rez;
726
		strcpy(#oldtag, #tag);
727
		return;
728
	}
729
	else
730
		oldtag=NULL;
731
732
 
733
		b_text = rez;
734
		return;
735
	}
736
	if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) {
737
		i_text = rez;
738
		return;
739
	}
740
	if (!chTag("dt"))
741
	{
742
		li_text = rez;
743
		IF(rez == 0) return;
744
		TextGoDown(left1, top1, width1);
745
		return;
746
	}
747
	if(!chTag("li")) || (!chTag("dt")) //надо сделать вложенные списки
748
	{
749
		li_text = rez;
750
		if (rez)
3466 leency 751
		{
752
			TextGoDown(left1, top1, width1);
753
			if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, line_h/2-3, 2, 2, 0x555555);
754
		}
755
		return;
3067 leency 756
	}
757
	if (!chTag("u")) || (!chTag("ins")) u_text = rez;
758
	if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
759
	if (!chTag("ul")) || (!chTag("ol")) IF(!rez)
760
	{
761
		li_text = rez;
762
		li_tab--;
763
		TextGoDown(left1, top1, width1);
764
	} ELSE li_tab++;
765
	if (!chTag("dd")) stolbec += 5;
766
	if (!chTag("blockquote")) blq_text = rez;
767
	if (!chTag("pre")) pre_text = rez;
768
	if (!chTag("hr"))
769
	{
770
		if (anchor) || (stroka < -1)
3466 leency 771
		{
772
			stroka+=2;
773
			return;
774
		}
775
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
776
		TextGoDown(left1, top1, width1);
3067 leency 777
		DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color);
3466 leency 778
		TextGoDown(left1, top1+WB1.line_h, width1);
779
	}
3067 leency 780
	/*
3466 leency 781
	if (!chTag("input"))
3129 leency 782
	{
783
		do{
784
			if (!strcmp(#parametr, "type="))
3466 leency 785
			{
3129 leency 786
				if ((!strcmp(#options, "radio")) || (!strcmp(#options, "checkbox")))
3466 leency 787
				{
788
					if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,10,10, 0, "\0", 0x888888, text_colors[text_color_index], 0);
789
					stolbec+=2;
790
				}
791
				if ((!strcmp(#options, "text")) || (!strcmp(#options, "password")))
792
				{
793
					if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,90,10, 0, "\0", 0x555555, 0, 0);
794
					stolbec+=16;
795
				}
796
				if ((!strcmp(#options, "button")) || (!strcmp(#options, "file")) || (!strcmp(#options, "submit")))
797
				{
798
					if (!anchor) && (stroka > 0) DrawCaptButton(stolbec*6 + left1,top1-2,60,10, 0, 0xCCCccc, 0, "Button");
799
					stolbec+=21;
800
				}
801
			}
3129 leency 802
		} while(GetNextParam());
803
	}
804
	*/
3466 leency 805
	if (!chTag("img"))
3067 leency 806
	{
807
		Images( left1, top1, width1);
808
		return;
809
	}
810
	if (!chTag("meta")) || (!chTag("?xml"))
811
	{
812
		do{
813
			if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
814
			{
815
				strcpy(#options, #options[strrchr(#options, '=')]); //поиск в content=
816
				if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
817
				if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
818
				if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
819
			}
820
		} while(GetNextParam());
821
		return;
822
	}
823
}
824
825
 
826
 
827
 
828
{
829
	scroll1.max_area = lines.all;
830
	scroll1.cur_area = lines.visible;
831
	scroll1.position = lines.first;
832
833
 
834
	scroll1.start_x = WB1.left + WB1.width;
3466 leency 835
	scroll1.size_y=WB1.height;
3067 leency 836
837
 
838
}
839
>
3466 leency 840