Subversion Repositories Kolibri OS

Rev

Rev 8330 | Rev 8339 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8330 Rev 8336
Line 29... Line 29...
29
};
29
};
Line 30... Line 30...
30
 
30
 
31
struct TWebBrowser {
31
struct TWebBrowser {
32
	llist list;
32
	llist list;
33
	_style style;
33
	_style style;
34
	_img page_img;
34
	_img img;
35
	dword draw_y, stolbec;
35
	dword draw_y, stolbec;
36
	int zoom;
36
	int zoom;
37
	dword o_bufpointer;
37
	dword o_bufpointer;
38
	int cur_encoding, custom_encoding;
38
	int cur_encoding, custom_encoding;
Line 127... Line 127...
127
	page_bg = 0xFFFFFF;
127
	page_bg = 0xFFFFFF;
128
	style.bg_color = page_bg;
128
	style.bg_color = page_bg;
129
	DrawBuf.Fill(0, page_bg);
129
	DrawBuf.Fill(0, page_bg);
130
	links.clear();
130
	links.clear();
131
	anchors.clear();
131
	anchors.clear();
132
	page_img.clear();
132
	img.clear();
133
	text_colors.drop();
133
	text_colors.drop();
134
	text_colors.add(0);
134
	text_colors.add(0);
135
	header = NULL;
135
	header = NULL;
136
	cur_encoding = CH_CP866;
136
	cur_encoding = CH_CP866;
137
	draw_y = BODY_MARGIN;
137
	draw_y = BODY_MARGIN;
Line 252... Line 252...
252
				bufpos++;
252
				bufpos++;
253
			}
253
			}
Line 254... Line 254...
254
 
254
 
255
			ignor_param=false;
255
			ignor_param=false;
-
 
256
			while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
256
			while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
257
			//&& (!chrnum(#tag.params,'\"') % 2) //
257
			{
258
			{
258
				bukva = ESBYTE[bufpos];
259
				bukva = ESBYTE[bufpos];
259
				if (__isWhite(bukva)) bukva = ' ';
260
				if (__isWhite(bukva)) bukva = ' ';
260
				if (!ignor_param) && (bukva <>' ') {
261
				if (!ignor_param) && (bukva!=' ') {
261
					if (strlen(#tag.name)+1
262
					if (strlen(#tag.name)+1
262
				} else {
263
				} else {
263
					ignor_param = true;
264
					ignor_param = true;
264
					if (strlen(#tag.params)+1
265
					if (strlen(#tag.params)+1
Line 448... Line 449...
448
		if (tag.opened) style.bg_color = 0xe4ffcb; else style.bg_color = page_bg;
449
		if (tag.opened) style.bg_color = 0xe4ffcb; else style.bg_color = page_bg;
449
		style.pre = tag.opened; return; 
450
		style.pre = tag.opened; return; 
450
	}
451
	}
451
	if (tag.is("img")) {
452
	if (tag.is("img")) {
452
		value = tag.get_value_of("src=");
453
		value = tag.get_value_of("src=");
-
 
454
		if (!value) goto NOIMG;
Line 453... Line -...
453
 
-
 
454
		/*
-
 
455
		if (streqrp(value, "data:")) {
-
 
456
			EAX = strstr(value, "base64,");
-
 
457
			if (value == EAX) return;
-
 
458
			value = EAX;
-
 
459
			//cache.add(history.current(), http.content_pointer, http.content_received, PAGE);
-
 
460
			base64_decode stdcall (#pass_b64, value, strlen(value));
-
 
461
		} else 
-
 
462
		*/
455
 
-
 
456
		strlcpy(#img_path, value, sizeof(img_path)-1);
Line 463... Line 457...
463
		strlcpy(#img_path, value, sizeof(img_path)-1);
457
		get_absolute_url(#img_path, history.current());
-
 
458
 
-
 
459
		if (cache.has(#img_path)) 
-
 
460
		{
-
 
461
			img_decode stdcall (cache.current_buf, cache.current_size, 0);
-
 
462
			if (!EAX) goto NOIMG;
-
 
463
 
-
 
464
			EDI = EAX;
-
 
465
			img.w.add(ESDWORD[EDI+4]);
-
 
466
			img.h.add(ESDWORD[EDI+8]);
-
 
467
			free(EDI);
-
 
468
 
-
 
469
			img.url.add(#img_path);
-
 
470
 
-
 
471
			if (img.w.get_last() / 6 + 1 + stolbec > list.column_max) {
-
 
472
				NewLine();
-
 
473
			} 
Line 464... Line 474...
464
		
474
			img.x.add(stolbec*list.font_w+3);
Line 465... Line 475...
465
		if (!img_path) { line=0; return; }
475
			img.y.add(draw_y);
466
 
476
 
-
 
477
			stolbec += img.w.get_last() / 6 + 1;
-
 
478
 
Line 467... Line 479...
467
		value = page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y);
479
			if (img.h.get_last() > list.item_h) {
468
 
480
				draw_y += img.h.get_last() - list.item_h; 
469
		if (cache.has(value)) {
481
				NewLine();
470
			if (page_img.set_size(page_img.url.count-1, cache.current_buf, cache.current_size)) {
482
			}
471
 
483
 
472
				if (link) links.add_text(
484
			if (link) links.add_text(
Line 473... Line -...
473
					stolbec * list.font_w + BODY_MARGIN + list.x,
-
 
474
					draw_y + list.y, 
-
 
475
					page_img.xywh.get(page_img.url.count-1*4+2), 
485
				img.x.get_last() + list.x,
476
					page_img.xywh.get(page_img.url.count-1*4+3), 
-
 
Line 477... Line 486...
477
					0);
486
				img.y.get_last() + list.y, 
-
 
487
				img.w.get_last(), 
-
 
488
				img.h.get_last(), 
478
 
489
				0);
-
 
490
 
-
 
491
			//debugval(img.url.get_last(), img.y.get_last());
479
				stolbec += page_img.xywh.get(page_img.url.count-1*4+2) / 6 + 1;
492
 
-
 
493
			return;
-
 
494
		} else {
-
 
495
			img.url.add(#img_path);
-
 
496
		}
-
 
497
		NOIMG:
-
 
498
 
-
 
499
		/*
-
 
500
		if (streqrp(value, "data:")) {
Line 480... Line 501...
480
				//if (stolbec > list.column_max) NewLine();
501
			EAX = strstr(value, "base64,");
481
				value = page_img.xywh.get(page_img.url.count-1*4+3);
502
			if (value == EAX) return;
482
				if (value > list.item_h) {draw_y += value - list.item_h; NewLine();}
503
			value = EAX;
483
 
504
			//cache.add(history.current(), http.content_pointer, http.content_received, PAGE);
Line 585... Line 606...
585
		if (value = tag.get_value_of("charset=")) || (value = tag.get_value_of("content=")) || (value = tag.get_value_of("encoding="))
606
		if (value = tag.get_value_of("charset=")) || (value = tag.get_value_of("content=")) || (value = tag.get_value_of("encoding="))
586
		{
607
		{
587
			value += strrchr(value, '='); //search in content=
608
			value += strrchr(value, '='); //search in content=
588
			if (ESBYTE[value] == '"') value++;
609
			if (ESBYTE[value] == '"') value++;
589
			strlwr(value);
610
			strlwr(value);
590
			if      (streqrp(value,"utf-8"))        || (streqrp(value,"utf8"))        { ChangeEncoding(CH_UTF8); debugln("UTF"); }
611
			if      (streqrp(value,"utf-8"))        || (streqrp(value,"utf8"))        ChangeEncoding(CH_UTF8);
591
			else if (streqrp(value,"windows-1251")) || (streqrp(value,"windows1251")) ChangeEncoding(CH_CP1251);
612
			else if (streqrp(value,"windows-1251")) || (streqrp(value,"windows1251")) ChangeEncoding(CH_CP1251);
592
			else if (streqrp(value,"dos"))          || (streqrp(value,"cp-866"))      ChangeEncoding(CH_CP866);
613
			else if (streqrp(value,"dos"))          || (streqrp(value,"cp-866"))      ChangeEncoding(CH_CP866);
593
			else if (streqrp(value,"iso-8859-5"))   || (streqrp(value,"iso8859-5"))   ChangeEncoding(CH_ISO8859_5);
614
			else if (streqrp(value,"iso-8859-5"))   || (streqrp(value,"iso8859-5"))   ChangeEncoding(CH_ISO8859_5);
594
			else if (streqrp(value,"koi8-r"))       || (streqrp(value,"koi8-u"))      ChangeEncoding(CH_KOI8);
615
			else if (streqrp(value,"koi8-r"))       || (streqrp(value,"koi8-u"))      ChangeEncoding(CH_KOI8);
595
		}
616
		}
Line 646... Line 667...
646
	if (debug_mode) debugln(NULL);
667
	if (debug_mode) debugln(NULL);
647
}
668
}
648
//============================================================================================
669
//============================================================================================
649
void TWebBrowser::DrawPage()
670
void TWebBrowser::DrawPage()
650
{
671
{
-
 
672
	int i, img_y;
651
	PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
673
	PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
652
	page_img.draw_all(list.x, list.y, list.w, list.h, list.first);
-
 
653
	DrawScroller();
674
	DrawScroller();
-
 
675
	//img.draw_all(list.x, list.y, list.w, list.h, list.first);
-
 
676
 
-
 
677
	for (i=0; i
-
 
678
	{
-
 
679
		img_y = img.y.get(i);
-
 
680
 
-
 
681
		if (img_y + img.h.get(i) > list.first) && (img_y - list.h < list.first) 
-
 
682
		&& (cache.has(img.url.get(i))) img.draw(list.x, list.y, list.w, list.h, list.first, i);
-
 
683
	}
654
}
684
}
655
>
685
>