Subversion Repositories Kolibri OS

Rev

Rev 7244 | Rev 7266 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7244 Rev 7256
1
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
1
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
2
 
2
 
3
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
3
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
4
{
4
{
5
	char BYTE_HEAD_FILE[4];
5
	char BYTE_HEAD_FILE[4];
6
	char ext[512];
6
	char ext[512];
7
	int i;
7
	int i;
8
	dword icon_n;
8
	dword icon_n;
9
	dword selected_image;
9
	dword selected_image;
10
	dword default_image;
10
	dword default_image;
-
 
11
	dword default_icon;
11
 
12
 
12
	if (big_icons.checked) {
13
	if (big_icons.checked) {
13
		icons_ini.section = "icons32";
14
		icons_ini.section = "icons32";
14
		selected_image = icons32_selected.image;
15
		selected_image = icons32_selected.image;
15
		default_image = icons32_default.image;
16
		default_image = icons32_default.image;
-
 
17
		default_icon=95;
16
	}
18
	}
17
	else {
19
	else {
18
		icons_ini.section = "icons16";
20
		icons_ini.section = "icons16";
19
		selected_image = icons16_selected.image;
21
		selected_image = icons16_selected.image;
20
		default_image = icons16_default.image;
22
		default_image = icons16_default.image;
-
 
23
		default_icon=2;
21
	}
24
	}
22
 
25
 
23
	if (extension)
26
	if (extension)
24
	{
27
	{
25
		strcpy(#ext, extension);
28
		strcpy(#ext, extension);
26
		strlwr(#ext);
29
		strlwr(#ext);
27
		icon_n = icons_ini.GetInt(#ext, 2);
30
		icon_n = icons_ini.GetInt(#ext, default_icon);
28
	} 
31
	} 
29
	else if (file_path)
32
	else if (file_path)
30
	{
33
	{
31
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
34
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
32
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
35
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
33
				icon_n = icons_ini.GetInt("kex", 2);
36
				icon_n = icons_ini.GetInt("kex", 2);
34
	}
37
	}
35
	if (fairing_color==col_selec)
38
	if (fairing_color==col_selec)
36
	{
39
	{
37
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
40
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
38
		if (big_icons.checked==false) IconFairing(icon_n, xx, yy, fairing_color);
41
		if (big_icons.checked==false) IconFairing(icon_n, xx, yy, fairing_color);
39
	}
42
	}
40
	else 
43
	else 
41
	{
44
	{
42
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
45
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
43
	}
46
	}
44
}
47
}
45
 
48
 
46
 
49
 
47
void IconFairing(dword filenum, x,y, color)
50
void IconFairing(dword filenum, x,y, color)
48
{
51
{
49
	//0 = folder
52
	//0 = folder
50
	//22 = forder with up arrow
53
	//22 = forder with up arrow
51
	if (filenum == 0) || (filenum == 22)
54
	if (filenum == 0) || (filenum == 22)
52
	{
55
	{
53
		DrawBar(x+7,y+1,8,2,color);
56
		DrawBar(x+7,y+1,8,2,color);
54
		DrawBar(x,y+14,15,2,color);
57
		DrawBar(x,y+14,15,2,color);
55
		PutPixel(x,y+1,color);
58
		PutPixel(x,y+1,color);
56
		PutPixel(x+6,y+1,color);
59
		PutPixel(x+6,y+1,color);
57
		PutPixel(x+14,y+3,color);
60
		PutPixel(x+14,y+3,color);
58
		PutPixel(x,y+13,color);
61
		PutPixel(x,y+13,color);
59
		PutPixel(x+14,y+13,color);
62
		PutPixel(x+14,y+13,color);
60
	}
63
	}
61
	if (filenum == 22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
64
	if (filenum == 22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
62
}
65
}