Subversion Repositories Kolibri OS

Rev

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