Subversion Repositories Kolibri OS

Rev

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

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