Subversion Repositories Kolibri OS

Rev

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

Rev 4718 Rev 5718
Line 7... Line 7...
7
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
7
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
Line 8... Line 8...
8
 
8
 
9
struct ImageCache {
9
struct ImageCache {
10
	int pics_count;
10
	int pics_count;
11
	void Free();
11
	void Free();
12
	int GetImageNumber();
12
	int GetImage();
13
	void Images();
13
	void Images();
Line 14... Line 14...
14
};
14
};
15
 
15
 
Line 20... Line 20...
20
		if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image);
20
		if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image);
21
		pics[pics_count].path = NULL;
21
		pics[pics_count].path = NULL;
22
	}
22
	}
23
}
23
}
Line 24... Line 24...
24
 
24
 
25
int ImageCache::GetImageNumber(dword i_path)
25
int ImageCache::GetImage(dword i_path)
26
{
26
{
27
	int i;
27
	int i;
28
	for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists
28
	for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists
29
	// Load image and add it to Cache
29
	// Load image and add it to Cache
Line 41... Line 41...
41
    int imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
41
    int imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
Line 42... Line 42...
42
	
42
	
43
	do{
43
	do{
44
		if (!strcmp(#parametr,"src="))   //íàäî îáúåäèíèòü ñ GetNewUrl()
44
		if (!strcmp(#parametr,"src="))   //íàäî îáúåäèíèòü ñ GetNewUrl()
-
 
45
		{
45
		{
46
			if (http_transfer!=0) 
-
 
47
				strcpy(#img_path, #history_list[BrowserHistory.current-1].Item); 
-
 
48
			else
-
 
49
			{
46
			if (http_transfer<>0) strcpy(#img_path, #history_list[BrowserHistory.current-1].Item); else
50
				//if (strcmp(#options)) 
-
 
51
					strcpy(#img_path, #options);
47
			strcpy(#img_path, #options);
52
			}
48
			PageLinks.GetAbsoluteURL(#img_path);
53
			PageLinks.GetAbsoluteURL(#img_path);
49
			cur_pic = GetImageNumber(#img_path);
54
			cur_pic = GetImage(#img_path);
50
		}
55
		}
51
		if (!strcmp(#parametr,"alt="))
56
		if (!strcmp(#parametr,"alt="))
52
		{
57
		{
53
			strcpy(#alt, "[");
58
			strcpy(#alt, "[");
Line 65... Line 70...
65
	
70
	
66
	imgw = DSWORD[pics[cur_pic].image+4];
71
	imgw = DSWORD[pics[cur_pic].image+4];
67
	imgh = DSWORD[pics[cur_pic].image+8];
72
	imgh = DSWORD[pics[cur_pic].image+8];
Line 68... Line 73...
68
	if (imgw > width1) imgw = width1;
73
	if (imgw > width1) imgw = width1;
69
	
74
	
70
	if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
75
	if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //fill first line
71
	stroka += imgh / WB1.list.line_h;
76
	stroka += imgh / WB1.list.line_h;
72
	if (imgh % WB1.list.line_h) stroka++;
77
	if (imgh % WB1.list.line_h) stroka++;
73
	if (top1+imghWB1.list.y+WB1.list.h-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
78
	if (top1+imghWB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
74
	if (top1
79
	if (top1
75
	{
80
	{
76
		img_lines_first=WB1.list.y-top1;
81
		img_lines_first=WB1.list.y-top1;
77
		imgh=imgh-img_lines_first;
82
		imgh=imgh-img_lines_first;
78
		top1=WB1.list.y;
83
		top1=WB1.list.y;
79
	}
84
	}
80
	if (top1>WB1.list.y+WB1.list.h-imgh-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó
85
	if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom)
81
	{
86
	{
82
		imgh=WB1.list.y+WB1.list.h-top1-5;
87
		imgh=WB1.list.y+WB1.list.h-top1-5;
83
	}	
88
	}	
Line 84... Line 89...
84
	if (imgh<=0) return;
89
	if (imgh<=0) return;
85
	if (anchor) return;
90
	if (anchor) return;
86
	
91
	
87
	img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
92
	img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
88
	DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);
93
	DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);
89
	DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.line_h + WB1.list.line_h, bg_color);
94
	DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.line_h + WB1.list.line_h, bg_color);
90
	IF (link)
95
	if (link)
91
	{
96
	{
92
		UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
97
		UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);